导入规则修改

dev^2
zjh 1 year ago
parent 5126e009a2
commit 9759640383
  1. 3
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  2. 111
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java

@ -609,8 +609,7 @@ export default {
'对应功能(必填):填写正确的功能名称',
'对应实体(非必填):填写正确的实体名称',
'对应字段(非必填):填写正确的字段名称',
'顺序号(必填):同功能下不重复,为正整数且与规则编码顺序号相等',
'规则编码(必填):功能编码+顺序号(格式001)',
'顺序号(必填):同功能下不重复,为三位数正整数',
'规则描述(非必填)',
'责任人(非必填):如果有多个值请使用逗号分割',
'任务等级(必填):值:1、2、3、4、5个等级',

@ -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,7 +501,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
rulex.setFieldId(fieldx.getId());
}
Double duration = null;
String duration1 = ruleVo.getDuration();
if(!StringUtils.isBlank(duration1)) {
try {
duration = Double.valueOf(duration1);
if (duration < 0) {
message.put("isError", "true");
message.put("closeable", "true");
@ -509,7 +512,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (i + 1) + "条数据,任务时长输入错误,请核对");
}
duration = Double.valueOf(ruleVo.getDuration());
rulex.setDuration(duration);
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
@ -519,6 +522,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (i + 1) + "条数据,任务时长输入错误,请核对");
}
}
Double d;
String realDuration = ruleVo.getRealDuration();
@ -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);
}

Loading…
Cancel
Save