mirror of
https://gitee.com/freshday/radar.git
synced 2025-12-26 07:16:26 +08:00
feats:策略拷贝
feihu.wang
This commit is contained in:
parent
e37b69b05f
commit
a7eef7c187
@ -195,4 +195,10 @@ public class ActivationApiController {
|
||||
public CommonResult enable(@PathVariable Long activationId) {
|
||||
return activationService.updateStatus(activationId, 1);
|
||||
}
|
||||
|
||||
@PostMapping("/copy")
|
||||
public CommonResult copy(@RequestBody Long id) {
|
||||
CommonResult result = activationService.copy(id);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@
|
||||
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>风控引擎管理平台</title> <link rel="shortcut icon" href="/images/anquan.png"> <!--[if lt IE 10]>
|
||||
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>
|
||||
<![endif]--> <link href="./index.da6b2009-1.css" rel="stylesheet"><link href="./index.da6b2009-2.css" rel="stylesheet"><link href="./index.da6b2009-3.css" rel="stylesheet"></head> <body> <div id="react-content"></div> <script type="text/javascript" src="./main.da6b2009.js"></script></body> </html>
|
||||
<![endif]--> <link href="./index.ba8e3789-1.css" rel="stylesheet"><link href="./index.ba8e3789-2.css" rel="stylesheet"><link href="./index.ba8e3789-3.css" rel="stylesheet"></head> <body> <div id="react-content"></div> <script type="text/javascript" src="./main.ba8e3789.js"></script></body> </html>
|
||||
File diff suppressed because one or more lines are too long
@ -7,6 +7,8 @@ import com.pgmmers.radar.dal.bean.RuleQuery;
|
||||
import com.pgmmers.radar.vo.model.RuleHistoryVO;
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface RuleDal {
|
||||
|
||||
@ -22,4 +24,5 @@ public interface RuleDal {
|
||||
|
||||
int saveHistory(RuleHistoryVO model);
|
||||
|
||||
List<RuleVO> listByActId(Long actId);
|
||||
}
|
||||
|
||||
@ -146,4 +146,13 @@ public class RuleDalImpl implements RuleDal {
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RuleVO> listByActId(Long actId) {
|
||||
Example example = new Example(RulePO.class);
|
||||
Example.Criteria ruleCriteria = example.createCriteria();
|
||||
ruleCriteria.andEqualTo("activationId", actId);
|
||||
List<RulePO> ruleList = ruleMapper.selectByExample(example);
|
||||
return ruleMapping.sourceToTarget(ruleList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,13 +4,18 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.pgmmers.radar.dal.bean.ActivationQuery;
|
||||
import com.pgmmers.radar.dal.model.ActivationDal;
|
||||
import com.pgmmers.radar.dal.model.ModelDal;
|
||||
import com.pgmmers.radar.dal.model.RuleDal;
|
||||
import com.pgmmers.radar.service.cache.CacheService;
|
||||
import com.pgmmers.radar.service.cache.SubscribeHandle;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.ActivationService;
|
||||
import com.pgmmers.radar.vo.model.ActivationVO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -33,6 +38,9 @@ public class ActivationServiceImpl extends BaseLocalCacheService implements Acti
|
||||
@Autowired
|
||||
private ActivationDal activationDal;
|
||||
|
||||
@Autowired
|
||||
private RuleDal ruleDal;
|
||||
|
||||
@Autowired
|
||||
private CacheService cacheService;
|
||||
|
||||
@ -108,6 +116,28 @@ public class ActivationServiceImpl extends BaseLocalCacheService implements Acti
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult copy(Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
ActivationVO origVO = activationDal.get(id);
|
||||
if (origVO == null) {
|
||||
return result;
|
||||
}
|
||||
List<RuleVO> ruleList = ruleDal.listByActId(id);
|
||||
origVO.setId(null);
|
||||
origVO.setLabel(origVO.getLabel() + "_copy");
|
||||
origVO.setCreateTime(new Date());
|
||||
activationDal.save(origVO);
|
||||
for (RuleVO ruleVO : ruleList) {
|
||||
ruleVO.setId(null);
|
||||
ruleVO.setActivationId(origVO.getId());
|
||||
ruleVO.setCreateTime(new Date());
|
||||
ruleDal.save(ruleVO);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult updateStatus(Long activationId, Integer status) {
|
||||
CommonResult result = new CommonResult();
|
||||
|
||||
@ -21,6 +21,8 @@ public interface ActivationService {
|
||||
|
||||
CommonResult updateOrder(Long activationId, String ruleOrder);
|
||||
|
||||
CommonResult copy(Long id);
|
||||
|
||||
/**
|
||||
* update status of activation.
|
||||
* @param activationId
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user