|
|
|
@ -310,7 +310,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
if ( |
|
|
|
|
StringUtils.isBlank(list.get(i).getRuleNo()) || |
|
|
|
|
StringUtils.isBlank(list.get(i).getProjectId()) || |
|
|
|
|
StringUtils.isBlank(list.get(i).getRuleCode()) || |
|
|
|
|
// StringUtils.isBlank(list.get(i).getRuleCode()) ||
|
|
|
|
|
// StringUtils.isBlank() list.get(i).getPmDescribe() == null &&
|
|
|
|
|
StringUtils.isBlank(list.get(i).getModuleId()) || |
|
|
|
|
StringUtils.isBlank(list.get(i).getFunctionId()) || |
|
|
|
@ -501,23 +501,27 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
rulex.setFieldId(fieldx.getId()); |
|
|
|
|
} |
|
|
|
|
Double duration = null; |
|
|
|
|
try { |
|
|
|
|
if (duration < 0){ |
|
|
|
|
String duration1 = ruleVo.getDuration(); |
|
|
|
|
if(!StringUtils.isBlank(duration1)) { |
|
|
|
|
try { |
|
|
|
|
duration = Double.valueOf(duration1); |
|
|
|
|
if (duration < 0) { |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,任务时长输入错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,任务时长输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
rulex.setDuration(duration); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,任务时长输入错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,任务时长输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
duration = Double.valueOf(ruleVo.getDuration()); |
|
|
|
|
rulex.setDuration(duration); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,任务时长输入错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,任务时长输入错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Double d; |
|
|
|
@ -645,48 +649,57 @@ String workLevel = ruleVo.getWorkLevel(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//规则编码
|
|
|
|
|
String ruleCode = ruleVo.getRuleCode(); |
|
|
|
|
String functionCode1 = functionx.getFunctionCode(); |
|
|
|
|
if (ruleCode == null) { |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
} |
|
|
|
|
//截取到功能编码校验(去除后三位)
|
|
|
|
|
if (!ruleCode.substring(0, ruleCode.length() - 3).equals(functionCode1)) { |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//后三位
|
|
|
|
|
String substring = ruleCode.substring(ruleCode.length() - 3); |
|
|
|
|
try { |
|
|
|
|
Integer integer1 = Integer.valueOf(substring); |
|
|
|
|
if (integer1 < 0) { |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
} |
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setRuleCode(ruleCode); |
|
|
|
|
// String ruleCode = ruleVo.getRuleCode();
|
|
|
|
|
// String functionCode1 = functionx.getFunctionCode();
|
|
|
|
|
// if (ruleCode == null) {
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
// message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
// return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// }
|
|
|
|
|
// //截取到功能编码校验(去除后三位)
|
|
|
|
|
// if (!ruleCode.substring(0, ruleCode.length() - 3).equals(functionCode1)) {
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
// message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
// return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //后三位
|
|
|
|
|
// String substring = ruleCode.substring(ruleCode.length() - 3);
|
|
|
|
|
// try {
|
|
|
|
|
// Integer integer1 = Integer.valueOf(substring);
|
|
|
|
|
// if (integer1 < 0) {
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
// message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
// return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// }
|
|
|
|
|
// } catch (NumberFormatException e) {
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
// message.put("status", "第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
// return Result.error("第" + (i + 1) + "条数据,规则编码错误,请核对");
|
|
|
|
|
// }
|
|
|
|
|
// rulex.setRuleCode(ruleCode);
|
|
|
|
|
//规则序号
|
|
|
|
|
// String ruleNo = ruleVo.getRuleNo();
|
|
|
|
|
// String c = ruleCode.substring(ruleCode.length() - ruleNo.length());
|
|
|
|
|
////三位数整数且与编码后三位相同
|
|
|
|
|
// if (!(c.equals(ruleNo) && ruleNo.matches("^[0-9]*[1-9][0-9]*$") && (Integer.valueOf(ruleNo) < 1000))) {
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
// message.put("status", "第" + (i + 1) + "条数据,规则序号错误,请核对");
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
// return Result.error("第" + (i + 1) + "条数据,规则序号错误,请核对");
|
|
|
|
|
// }
|
|
|
|
|
// rulex.setRuleNo(ruleNo);
|
|
|
|
|
String ruleNo = ruleVo.getRuleNo(); |
|
|
|
|
String c = ruleCode.substring(ruleCode.length() - ruleNo.length()); |
|
|
|
|
//三位数整数且与编码后三位相同
|
|
|
|
|
if (!(c.equals(ruleNo) && ruleNo.matches("^[0-9]*[1-9][0-9]*$") && (Integer.valueOf(ruleNo) < 1000))) { |
|
|
|
|
if(!ruleNo.matches("^[0-9]*[1-9][0-9]*$") && (Integer.valueOf(ruleNo) < 1000)){ |
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
message.put("status", "第" + (i + 1) + "条数据,规则序号错误,请核对"); |
|
|
|
@ -694,7 +707,17 @@ String workLevel = ruleVo.getWorkLevel(); |
|
|
|
|
return Result.error("第" + (i + 1) + "条数据,规则序号错误,请核对"); |
|
|
|
|
} |
|
|
|
|
rulex.setRuleNo(ruleNo); |
|
|
|
|
{ |
|
|
|
|
String functionCode1 = functionx.getFunctionCode(); |
|
|
|
|
if (ruleNo.length()==1){ |
|
|
|
|
ruleNo="00"+ruleNo; |
|
|
|
|
}else if (ruleNo.length()==2){ |
|
|
|
|
ruleNo="0"+ruleNo; |
|
|
|
|
} |
|
|
|
|
String ruleCode =functionCode1+ruleNo; |
|
|
|
|
rulex.setRuleCode(ruleCode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//规则描述
|
|
|
|
|
String pmDescribe = ruleVo.getPmDescribe(); |
|
|
|
@ -765,7 +788,7 @@ String workLevel = ruleVo.getWorkLevel(); |
|
|
|
|
rulexList.add(rulex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} finally{ |
|
|
|
|
finally{ |
|
|
|
|
//清理预存表
|
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
} |
|
|
|
|