Compare commits

...

2 Commits

  1. 170
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java
  2. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java
  3. 32
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java

@ -247,8 +247,14 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
message.put("isError", "false"); message.put("isError", "false");
message.put("closeable","false"); message.put("closeable","false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
//判断文件是否为空
if (file == null) {
message.put("isError", "true");
message.put("closeable","true");
message.put("status","文件上传失败,请重新上传");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件上传失败,请重新上传");
}
// 判断文件是否是表格 // 判断文件是否是表格
String originalFilename = file.getOriginalFilename(); String originalFilename = file.getOriginalFilename();
if (StringUtils.isBlank(originalFilename) || if (StringUtils.isBlank(originalFilename) ||
@ -262,22 +268,19 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
} }
//校验时间 //校验时间
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) {
message.put("isError", "true");
message.put("closeable","true");
message.put("status","文件上传失败,请重新上传");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件上传失败,请重新上传");
}
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(2);//表格标题行数,默认0 params.setTitleRows(2);//表格标题行数,默认0
params.setHeadRows(1);//表头行数,默认1 params.setHeadRows(1);//表头行数,默认1
params.setNeedSave(true);//是否需要保存上传的Excel,默认为false params.setNeedSave(true);//是否需要保存上传的Excel,默认为false
try {
message.put("status", "数据预读入"); message.put("status", "数据预读入");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
List<RuleVo> list = ExcelImportUtil.importExcel(file.getInputStream(), RuleVo.class, params); List<RuleVo> list = null;
try {
list = ExcelImportUtil.importExcel(file.getInputStream(), RuleVo.class, params);
} catch (Exception e) {
e.printStackTrace();
}
if (list == null || list.size() <= 0) { if (list == null || list.size() <= 0) {
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
@ -285,10 +288,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件导入失败:模板中暂无数据"); return Result.error("文件导入失败:模板中暂无数据");
} }
int num = 0; //必要字段判断空值
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if ( if (
//excel出现必要值未填该行直接跳过
list.get(i).getRuleNo() == null || list.get(i).getRuleNo() == null ||
list.get(i).getRuleCode() == null || list.get(i).getRuleCode() == null ||
// list.get(i).getPmDescribe() == null && // list.get(i).getPmDescribe() == null &&
@ -308,45 +310,21 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
list.get(i).getStatus() == null || list.get(i).getStatus() == null ||
list.get(i).getVerisonStatus() == null || list.get(i).getVerisonStatus() == null ||
list.get(i).getVerison() == null) { list.get(i).getVerison() == null) {
continue;
}
num++;
if (num == 0) {
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","文件导入失败:导入模板不匹配"); message.put("status","文件导入失败:"+"第"+(i + 1) + "条存在必填数据为空,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件导入失败:导入模板不匹配"); return Result.error("文件导入失败:"+"第"+(i + 1) + "条不能为空,请核对");
// } else if (num!=list.size()) {
// return Result.error("文件导入失败:请检查填写文字");
} }
//存入预存表
iRuleVoService.save(list.get(i)); iRuleVoService.save(list.get(i));
} }
} catch (Exception e) { List<Rulex> rulexList;
//update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
String msg = e.getMessage();
log.error(msg, e);
//if(msg!=null && msg.contains("Duplicate entry"))
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("文件导入失败:有重复数据!");
} else {
return Result.error("文件导入失败:" + e.getMessage());
}
//update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
} finally {
try { try {
file.getInputStream().close(); //取出预存表校验字段
} catch (IOException e) {
e.printStackTrace();
}
}
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("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
@ -357,6 +335,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
// 将总的记录数传递给前端 // 将总的记录数传递给前端
message.put("records", String.valueOf(ruleVoList.size())); message.put("records", String.valueOf(ruleVoList.size()));
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
rulexList = new ArrayList<>();
for (int i = 0; i < ruleVoList.size(); i++) { for (int i = 0; i < ruleVoList.size(); i++) {
Rulex rulex = new Rulex(); Rulex rulex = new Rulex();
@ -370,9 +349,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","字段输入错误,请核对"); message.put("status","第"+(i + 1) + "条数据,对应字段输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("字段输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,对应字段输入错误,请核对");
} }
rulex.setFieldId(byId.getId()); rulex.setFieldId(byId.getId());
//对应功能 //对应功能
@ -384,9 +363,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","功能输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,对应功能输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("功能输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,对应功能输入错误,请核对");
} }
rulex.setFunctionId(byId1.getId()); rulex.setFunctionId(byId1.getId());
//对应模块 //对应模块
@ -399,9 +378,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","模块输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,对应模块输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("模块输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,对应模块输入错误,请核对");
} }
rulex.setModuleId(byId2.getId()); rulex.setModuleId(byId2.getId());
//对应实体 //对应实体
@ -414,9 +393,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","实体输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,对应实体输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("实体输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,对应实体输入错误,请核对");
} }
rulex.setTableId(byId3.getId()); rulex.setTableId(byId3.getId());
Double aDouble = null; Double aDouble = null;
@ -428,9 +407,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","任务时长输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,任务时长输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("任务时长输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,任务时长输入错误,请核对");
} }
Double d; Double d;
@ -440,9 +419,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","实际时长输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,实际时长输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("实际时长输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,实际时长输入错误,请核对");
} }
rulex.setRealDuration(d); rulex.setRealDuration(d);
Integer integer; Integer integer;
@ -452,15 +431,15 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","任务等级输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,任务等级输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("任务等级输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,任务等级输入错误,请核对");
} }
rulex.setWorkLevel(integer); rulex.setWorkLevel(integer);
String workStatus = ruleVo.getWorkStatus(); String workStatus = ruleVo.getWorkStatus();
// LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
// sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762"); // sysDictItemLambdaQueryWrapper.eq(SysDictItem::getItemText, workStatus).eq(SysDictItem::getDictId, "1645268542514421762");
// SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper); // SysDictItem sysDictItem = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper);
if (workStatus.equals("未发布")) if (workStatus.equals("未发布"))
rulex.setWorkStatus(0); rulex.setWorkStatus(0);
@ -478,14 +457,14 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","任务状态输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,任务状态输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("任务状态输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,任务状态输入错误,请核对");
} }
String status = ruleVo.getStatus(); String status = ruleVo.getStatus();
// LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper2 = new LambdaQueryWrapper<>();
// sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713"); // sysDictItemLambdaQueryWrapper2.eq(SysDictItem::getItemText, status).eq(SysDictItem::getDictId, "1645264493205491713");
// SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2); // SysDictItem sysDictItem2 = sysDictItemMapper.selectOne(sysDictItemLambdaQueryWrapper2);
if (status.equals("正常")) if (status.equals("正常"))
rulex.setStatus(1); rulex.setStatus(1);
else if (status.equals("停用")) else if (status.equals("停用"))
@ -496,9 +475,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","规则状态输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,规则状态输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("规则状态输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,规则状态输入错误,请核对");
} }
String verisonStatus = ruleVo.getVerisonStatus(); String verisonStatus = ruleVo.getVerisonStatus();
LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper3 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper3 = new LambdaQueryWrapper<>();
@ -508,9 +487,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
iRuleVoService.remove(null); iRuleVoService.remove(null);
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","版本状态输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,版本状态输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("版本状态输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,版本状态输入错误,请核对");
} }
rulex.setVerisonStatus(Integer.valueOf(sysDictItem3.getItemValue())); rulex.setVerisonStatus(Integer.valueOf(sysDictItem3.getItemValue()));
@ -525,9 +504,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","开始时间输入错误"); message.put("status","第"+(i + 1) +"条数据,开始时间输入错误");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("开始时间输入错误"); return Result.error("第"+(i + 1) +"条数据,开始时间输入错误");
} else { } else {
Date date = simpleDateFormat.parse(startTime); Date date = simpleDateFormat.parse(startTime);
rulex.setStartTime(date); rulex.setStartTime(date);
@ -538,9 +517,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","提交时间输入错误"); message.put("status","第"+(i + 1) +"条数据,提交时间输入错误");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("提交时间输入错误"); return Result.error("第"+(i + 1) +"条数据,提交时间输入错误");
} else { } else {
Date date1 = simpleDateFormat.parse(submitTime); Date date1 = simpleDateFormat.parse(submitTime);
rulex.setSubmitTime(date1); rulex.setSubmitTime(date1);
@ -548,25 +527,13 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
rulex.setRuleNo(ruleVo.getRuleNo());
//规则序号
String ruleNo = ruleVo.getRuleNo();
List<String> list = rulexMapper.checkRuleNo(byId1.getId());
if (list.contains(ruleNo)) {
iRuleVoService.remove(null);
message.put("isError", "true");
message.put("closeable","true");
message.put("status","规则序号已存在");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("规则序号已存在");
}
rulex.setRuleNo(ruleNo);
//规则编码 //规则编码
String ruleCode = ruleVo.getRuleCode(); String ruleCode = ruleVo.getRuleCode();
Functionx functionxServiceById = functionxService.getById(byId1.getId()); Functionx functionxServiceById = functionxService.getById(byId1.getId());
String functionCode = functionxServiceById.getFunctionCode(); String functionCode = functionxServiceById.getFunctionCode();
// if (!ruleCode.matches(functionCode)) // if (!ruleCode.matches(functionCode))
// return Result.error("规则编码错误"); // return Result.error("规则编码错误");
rulex.setRuleCode(functionCode); rulex.setRuleCode(functionCode);
//规则描述 //规则描述
String pmDescribe = ruleVo.getPmDescribe(); String pmDescribe = ruleVo.getPmDescribe();
@ -584,25 +551,36 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","版本号输入错误,请核对"); message.put("status","第"+(i + 1) +"条数据,版本号输入错误,请核对");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("版本号输入错误,请核对"); return Result.error("第"+(i + 1) +"条数据,版本号输入错误,请核对");
} }
rulex.setVerison(String.valueOf(integer1)); rulex.setVerison(String.valueOf(integer1));
//责任人 //责任人
String managerUsers = ruleVo.getManagerUsers(); String managerUsers = ruleVo.getManagerUsers();
if (managerUsers != null) if (managerUsers != null)
rulex.setManagerUsers(managerUsers); rulex.setManagerUsers(managerUsers);
message.put("status", "正在读取数据"); message.put("status", "正在读取数据");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
//存入真实表 //存入集合待存真实表
rulexService.saveRule(rulex, loginUser, message, i + 1); rulexList.add(rulex);
}
} finally {
//清理预存表
iRuleVoService.remove(null); iRuleVoService.remove(null);
} }
//存入真实表
Boolean aBoolean = rulexService.saveRule(rulexList, loginUser, message);
if (aBoolean) {
message.put("status", "导入成功"); message.put("status", "导入成功");
message.put("closeable","true"); message.put("closeable", "true");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.ok("文件导入成功!"); return Result.ok("文件导入成功!");
}else {
return Result.error("文件导入失败!");
}
} }
@GetMapping(value = "/sort") @GetMapping(value = "/sort")

@ -22,7 +22,7 @@ public interface IRulexService extends IService<Rulex> {
List<Rulex> queryRuleListByFunctionId(Functionx functionx); List<Rulex> queryRuleListByFunctionId(Functionx functionx);
void saveRule(Rulex rulex, LoginUser loginUser, Map<String, String> message,int i); Boolean saveRule(List<Rulex> rulexList, LoginUser loginUser, Map<String, String> message);
void saveRulex(Functionx functionx); void saveRulex(Functionx functionx);
} }

@ -18,6 +18,7 @@ import org.jeecg.modules.tablex.service.ITablexService;
import org.jeecg.modules.tablex.ws.WebSocketUtils; import org.jeecg.modules.tablex.ws.WebSocketUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
@ -78,24 +79,39 @@ public class RulexServiceImpl extends ServiceImpl<RulexMapper, Rulex> implements
} }
@Override @Override
public void saveRule(Rulex rulex, LoginUser loginUser, Map<String, String> message,int i) { public Boolean saveRule(List<Rulex> rulexList, LoginUser loginUser, Map<String, String> message) {
try { for (int i = 0; i < rulexList.size(); i++) {
Thread.sleep(1000L); //规则序号
this.save(rulex); String ruleNo = rulexList.get(i).getRuleNo();
message.put("uploaded", String.valueOf(i )); List<String> checkRuleNo = rulexMapper.checkRuleNo(rulexList.get(i).getFunctionId());
if (checkRuleNo.contains(ruleNo)) {
webSocketUtils.sendMessage(loginUser.getId(), message);
} catch (InterruptedException e) {
message.put("isError", "true"); message.put("isError", "true");
message.put("closeable","true"); message.put("closeable","true");
message.put("status","导入失败"); message.put("status","第"+(i + 1) +"条数据,规则序号已存在");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); //手动回滚,这样上层就无需去处理异常了
return false;
}else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
} }
boolean save = this.save(rulexList.get(i));
message.put("uploaded", String.valueOf(i+1));
webSocketUtils.sendMessage(loginUser.getId(), message);
}
} }
return true;
}
/** /**

Loading…
Cancel
Save