|
@@ -28,30 +28,31 @@ public class PayControlRuleController {
|
|
|
@Autowired
|
|
|
PayControlRuleService payControlRuleService;
|
|
|
|
|
|
- @PostMapping("/add")
|
|
|
+ @PostMapping("/adds")
|
|
|
@ApiModelProperty(value = "添加阀控规则",notes = "添加阀控规则")
|
|
|
- public AjaxMessage add(
|
|
|
- @ApiParam(value = "阀控规则",required = true) @RequestBody(required = true) @Validated PayControlRule payControlRule
|
|
|
+ public AjaxMessage adds(
|
|
|
+ @ApiParam(value = "阀控规则",required = true) @RequestBody(required = true) @Validated List<PayControlRule> payControlRules
|
|
|
){
|
|
|
try {
|
|
|
- if(StringUtils.isBlank(payControlRule.getName()))
|
|
|
- throw new Exception("阀控规则名称不能为空");
|
|
|
- if(StringUtils.isBlank(payControlRule.getCondition()))
|
|
|
- throw new Exception("阀控规则判断条件不能为空");
|
|
|
- if(StringUtils.isBlank(payControlRule.getOperator()))
|
|
|
- throw new Exception("阀控规则运算符不能为空");
|
|
|
- if(StringUtils.isBlank(payControlRule.getValue()))
|
|
|
- throw new Exception("阀控规则条件值不能为空");
|
|
|
- if(StringUtils.isBlank(payControlRule.getAction()))
|
|
|
- throw new Exception("阀控规则执行操作不能为空");
|
|
|
+ for (PayControlRule payControlRule:payControlRules){
|
|
|
+ if(StringUtils.isBlank(payControlRule.getName()))
|
|
|
+ throw new Exception("阀控规则名称不能为空");
|
|
|
+ if(StringUtils.isBlank(payControlRule.getCondition()))
|
|
|
+ throw new Exception("阀控规则判断条件不能为空");
|
|
|
+ if(StringUtils.isBlank(payControlRule.getOperator()))
|
|
|
+ throw new Exception("阀控规则运算符不能为空");
|
|
|
+ if(StringUtils.isBlank(payControlRule.getValue()))
|
|
|
+ throw new Exception("阀控规则条件值不能为空");
|
|
|
+ if(StringUtils.isBlank(payControlRule.getAction()))
|
|
|
+ throw new Exception("阀控规则执行操作不能为空");
|
|
|
+ }
|
|
|
|
|
|
- Integer result = payControlRuleService.add(payControlRule);
|
|
|
+ Integer result = payControlRuleService.adds(payControlRules);
|
|
|
if(result != null){
|
|
|
if(result == 1){
|
|
|
return new AjaxMessage(ResultStatus.OK);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return new AjaxMessage(ResultStatus.ERROR);
|
|
|
}
|
|
|
catch (Exception ex){
|