|
|
@ -244,6 +244,8 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
message.put("isVisible", "true"); |
|
|
|
message.put("isVisible", "true"); |
|
|
|
message.put("uploaded", "0"); |
|
|
|
message.put("uploaded", "0"); |
|
|
|
message.put("status", "判断文件结构"); |
|
|
|
message.put("status", "判断文件结构"); |
|
|
|
|
|
|
|
message.put("isError", "false"); |
|
|
|
|
|
|
|
message.put("closeable","false"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -252,13 +254,20 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
if (StringUtils.isBlank(originalFilename) || |
|
|
|
if (StringUtils.isBlank(originalFilename) || |
|
|
|
(!originalFilename.endsWith("xls") && |
|
|
|
(!originalFilename.endsWith("xls") && |
|
|
|
!originalFilename.endsWith("xlsx"))) { |
|
|
|
!originalFilename.endsWith("xlsx"))) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","文件格式不正确"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("文件格式不正确"); |
|
|
|
return Result.error("文件格式不正确"); |
|
|
|
} |
|
|
|
} |
|
|
|
//校验时间
|
|
|
|
//校验时间
|
|
|
|
final DateValidator validator = new DateValidatorUsingDateFormat("yyyy-MM-dd hh:mm:ss"); |
|
|
|
final DateValidator validator = new DateValidatorUsingDateFormat("yyyy-MM-dd hh:mm:ss"); |
|
|
|
|
|
|
|
|
|
|
|
if (file == null) { |
|
|
|
if (file == null) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","文件上传失败,请重新上传"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("文件上传失败,请重新上传"); |
|
|
|
return Result.error("文件上传失败,请重新上传"); |
|
|
|
} |
|
|
|
} |
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
ImportParams params = new ImportParams(); |
|
|
@ -270,7 +279,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
List<RuleVo> list = ExcelImportUtil.importExcel(file.getInputStream(), RuleVo.class, params); |
|
|
|
List<RuleVo> list = ExcelImportUtil.importExcel(file.getInputStream(), RuleVo.class, params); |
|
|
|
if (list == null || list.size() <= 0) { |
|
|
|
if (list == null || list.size() <= 0) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","文件导入失败:模板中暂无数据"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("文件导入失败:模板中暂无数据"); |
|
|
|
return Result.error("文件导入失败:模板中暂无数据"); |
|
|
|
} |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
int num = 0; |
|
|
@ -300,7 +312,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
} |
|
|
|
} |
|
|
|
num++; |
|
|
|
num++; |
|
|
|
if (num == 0) { |
|
|
|
if (num == 0) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","文件导入失败:导入模板不匹配"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("文件导入失败:导入模板不匹配"); |
|
|
|
return Result.error("文件导入失败:导入模板不匹配"); |
|
|
|
// } else if (num!=list.size()) {
|
|
|
|
// } else if (num!=list.size()) {
|
|
|
|
// return Result.error("文件导入失败:请检查填写文字");
|
|
|
|
// return Result.error("文件导入失败:请检查填写文字");
|
|
|
@ -313,7 +328,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
log.error(msg, e); |
|
|
|
log.error(msg, e); |
|
|
|
//if(msg!=null && msg.contains("Duplicate entry"))
|
|
|
|
//if(msg!=null && msg.contains("Duplicate entry"))
|
|
|
|
if (msg != null && msg.indexOf("Duplicate entry") >= 0) { |
|
|
|
if (msg != null && msg.indexOf("Duplicate entry") >= 0) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","文件导入失败:有重复数据"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("文件导入失败:有重复数据!"); |
|
|
|
return Result.error("文件导入失败:有重复数据!"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
@ -330,7 +348,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
|
|
|
|
|
|
|
|
List<RuleVo> ruleVoList = iRuleVoService.list(); |
|
|
|
List<RuleVo> ruleVoList = iRuleVoService.list(); |
|
|
|
if (ruleVoList.size() <= 0 || ruleVoList == null) { |
|
|
|
if (ruleVoList.size() <= 0 || ruleVoList == null) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","文件导入失败,模板不匹配有空值"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("文件导入失败,模板不匹配有空值"); |
|
|
|
return Result.error("文件导入失败,模板不匹配有空值"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 将总的记录数传递给前端
|
|
|
|
// 将总的记录数传递给前端
|
|
|
@ -347,7 +368,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
Fieldx byId = iFieldxService.getOne(rulexLambdaQueryWrapper); |
|
|
|
Fieldx byId = iFieldxService.getOne(rulexLambdaQueryWrapper); |
|
|
|
if (byId == null) { |
|
|
|
if (byId == null) { |
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","字段输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("字段输入错误,请核对"); |
|
|
|
return Result.error("字段输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setFieldId(byId.getId()); |
|
|
|
rulex.setFieldId(byId.getId()); |
|
|
@ -358,7 +382,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
Functionx byId1 = functionxService.getOne(functionxLambdaQueryWrapper); |
|
|
|
Functionx byId1 = functionxService.getOne(functionxLambdaQueryWrapper); |
|
|
|
if (byId1 == null) { |
|
|
|
if (byId1 == null) { |
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","功能输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("功能输入错误,请核对"); |
|
|
|
return Result.error("功能输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setFunctionId(byId1.getId()); |
|
|
|
rulex.setFunctionId(byId1.getId()); |
|
|
@ -370,7 +397,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
if (byId2 == null) { |
|
|
|
if (byId2 == null) { |
|
|
|
|
|
|
|
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","模块输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("模块输入错误,请核对"); |
|
|
|
return Result.error("模块输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setModuleId(byId2.getId()); |
|
|
|
rulex.setModuleId(byId2.getId()); |
|
|
@ -382,7 +412,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
if (byId3 == null) { |
|
|
|
if (byId3 == null) { |
|
|
|
|
|
|
|
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","实体输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("实体输入错误,请核对"); |
|
|
|
return Result.error("实体输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setTableId(byId3.getId()); |
|
|
|
rulex.setTableId(byId3.getId()); |
|
|
@ -393,7 +426,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
rulex.setDuration(aDouble); |
|
|
|
rulex.setDuration(aDouble); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","任务时长输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("任务时长输入错误,请核对"); |
|
|
|
return Result.error("任务时长输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -402,7 +438,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
d = Double.valueOf(ruleVo.getRealDuration()); |
|
|
|
d = Double.valueOf(ruleVo.getRealDuration()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","实际时长输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("实际时长输入错误,请核对"); |
|
|
|
return Result.error("实际时长输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setRealDuration(d); |
|
|
|
rulex.setRealDuration(d); |
|
|
@ -411,7 +450,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
integer = Integer.valueOf(ruleVo.getWorkLevel()); |
|
|
|
integer = Integer.valueOf(ruleVo.getWorkLevel()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","任务等级输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("任务等级输入错误,请核对"); |
|
|
|
return Result.error("任务等级输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setWorkLevel(integer); |
|
|
|
rulex.setWorkLevel(integer); |
|
|
@ -434,7 +476,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
rulex.setWorkStatus(9); |
|
|
|
rulex.setWorkStatus(9); |
|
|
|
else { |
|
|
|
else { |
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","任务状态输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("任务状态输入错误,请核对"); |
|
|
|
return Result.error("任务状态输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
String status = ruleVo.getStatus(); |
|
|
|
String status = ruleVo.getStatus(); |
|
|
@ -449,7 +494,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
rulex.setStatus(9); |
|
|
|
rulex.setStatus(9); |
|
|
|
else { |
|
|
|
else { |
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","规则状态输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("规则状态输入错误,请核对"); |
|
|
|
return Result.error("规则状态输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
String verisonStatus = ruleVo.getVerisonStatus(); |
|
|
|
String verisonStatus = ruleVo.getVerisonStatus(); |
|
|
@ -458,7 +506,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
SysDictItem sysDictItem3 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper3); |
|
|
|
SysDictItem sysDictItem3 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper3); |
|
|
|
if (sysDictItem3 == null) { |
|
|
|
if (sysDictItem3 == null) { |
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","版本状态输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("版本状态输入错误,请核对"); |
|
|
|
return Result.error("版本状态输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -472,7 +523,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
if (startTime != null) |
|
|
|
if (startTime != null) |
|
|
|
if (!validator.isValid(startTime)) { |
|
|
|
if (!validator.isValid(startTime)) { |
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","开始时间输入错误"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("开始时间输入错误"); |
|
|
|
return Result.error("开始时间输入错误"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Date date = simpleDateFormat.parse(startTime); |
|
|
|
Date date = simpleDateFormat.parse(startTime); |
|
|
@ -482,7 +536,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
if (submitTime != null) |
|
|
|
if (submitTime != null) |
|
|
|
if (!validator.isValid(submitTime)) { |
|
|
|
if (!validator.isValid(submitTime)) { |
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","提交时间输入错误"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("提交时间输入错误"); |
|
|
|
return Result.error("提交时间输入错误"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Date date1 = simpleDateFormat.parse(submitTime); |
|
|
|
Date date1 = simpleDateFormat.parse(submitTime); |
|
|
@ -497,7 +554,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
List<String> list = rulexMapper.checkRuleNo(byId1.getId()); |
|
|
|
List<String> list = rulexMapper.checkRuleNo(byId1.getId()); |
|
|
|
if (list.contains(ruleNo)) { |
|
|
|
if (list.contains(ruleNo)) { |
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","规则序号已存在"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("规则序号已存在"); |
|
|
|
return Result.error("规则序号已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setRuleNo(ruleNo); |
|
|
|
rulex.setRuleNo(ruleNo); |
|
|
@ -522,7 +582,10 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
integer1 = Integer.valueOf(ruleVo.getVerison()); |
|
|
|
integer1 = Integer.valueOf(ruleVo.getVerison()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
|
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
message.put("status","版本号输入错误,请核对"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("版本号输入错误,请核对"); |
|
|
|
return Result.error("版本号输入错误,请核对"); |
|
|
|
} |
|
|
|
} |
|
|
|
rulex.setVerison(String.valueOf(integer1)); |
|
|
|
rulex.setVerison(String.valueOf(integer1)); |
|
|
@ -534,11 +597,11 @@ public class RulexController extends JeecgController<Rulex, IRulexService> { |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
//存入真实表
|
|
|
|
//存入真实表
|
|
|
|
rulexService.saveRule(rulex, loginUser, message, i + 1); |
|
|
|
rulexService.saveRule(rulex, loginUser, message, i + 1); |
|
|
|
message.put("status", "导入成功"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
iRuleVoService.remove(null); |
|
|
|
iRuleVoService.remove(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
message.put("status", "导入成功"); |
|
|
|
|
|
|
|
message.put("closeable","true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|