1.委托单列表去掉待编制,并把待生成报告和已完成数据结合

2.解决打印报告仪器和操作程序换行问题
3.解决驳回功能问题
dev
litao 3 years ago
parent 81423b98ff
commit fccf211c4c
  1. 38
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java
  2. 14
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  3. 161
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  4. 178
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java

@ -473,12 +473,11 @@ public class EntrustController extends BladeController {
} }
return R.data(page); return R.data(page);
} }
// 待编制报告状态 // 已完成状态
if (entry != null && entry.getEntrustStatus() != null && "5".equals(entry.getEntrustStatus())) { if (entry != null && entry.getEntrustStatus() != null && "8".equals(entry.getEntrustStatus())) {
QueryWrapper<Entrust> queryWrapper = new QueryWrapper<>(); QueryWrapper<Entrust> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_status", "4").or(); queryWrapper.eq("entrust_status", "7").or()
queryWrapper.eq("entrust_status", "5").or(); .eq("entrust_status", "8");
queryWrapper.eq("entrust_status", "6");
query.setDescs("create_time"); query.setDescs("create_time");
IPage<Entrust> page = service.page(Condition.getPage(query), queryWrapper); IPage<Entrust> page = service.page(Condition.getPage(query), queryWrapper);
return R.data(page); return R.data(page);
@ -855,19 +854,8 @@ public class EntrustController extends BladeController {
map.put("jcz", service.count(queryWrapper)); map.put("jcz", service.count(queryWrapper));
queryWrapper.clear(); queryWrapper.clear();
// queryWrapper.eq("entrust_status", "3"); queryWrapper.eq("entrust_status", "7").or()
// map.put("jcwc", service.count(queryWrapper)); .eq("entrust_status", "8");
// queryWrapper.clear();
queryWrapper.eq("entrust_status", "4");
map.put("shtg", service.count(queryWrapper));
queryWrapper.clear();
// queryWrapper.eq("entrust_status", "5");
// map.put("shbh", service.count(queryWrapper));
// queryWrapper.clear();
queryWrapper.eq("entrust_status", "8");
map.put("ywc", service.count(queryWrapper)); map.put("ywc", service.count(queryWrapper));
queryWrapper.clear(); queryWrapper.clear();
@ -875,12 +863,16 @@ public class EntrustController extends BladeController {
map.put("yzf", service.count(queryWrapper)); map.put("yzf", service.count(queryWrapper));
queryWrapper.clear(); queryWrapper.clear();
queryWrapper.eq("entrust_status", "4").or(); queryWrapper.eq("entrust_status", "-0.5");
queryWrapper.eq("entrust_status", "5").or(); map.put("djc", service.count(queryWrapper));
queryWrapper.eq("entrust_status", "6");
map.put("dbz", service.count(queryWrapper));
queryWrapper.clear(); queryWrapper.clear();
// queryWrapper.eq("entrust_status", "4").or();
// queryWrapper.eq("entrust_status", "5").or();
// queryWrapper.eq("entrust_status", "6");
// map.put("dbz", service.count(queryWrapper));
// queryWrapper.clear();
// queryWrapper.eq("entrust_status", "-1"); // queryWrapper.eq("entrust_status", "-1");
// map.put("sb", service.count(queryWrapper)); // map.put("sb", service.count(queryWrapper));
// } // }
@ -1224,7 +1216,7 @@ public class EntrustController extends BladeController {
if ("0".equals(entrust.getIsGenreport())) { if ("0".equals(entrust.getIsGenreport())) {
entrust.setEntrustStatus("8"); entrust.setEntrustStatus("8");
} else { } else {
entrust.setEntrustStatus("4"); entrust.setEntrustStatus("7");
} }
service.updateById(entrust); service.updateById(entrust);

@ -790,10 +790,7 @@ public class ExamineResultController extends BladeController {
List<ExamineExcel> excels = map.get(i + 1 + ""); List<ExamineExcel> excels = map.get(i + 1 + "");
double code1 = Double.parseDouble(excels.get(0).getCode1()); double code1 = Double.parseDouble(excels.get(0).getCode1());
double code2 = Double.parseDouble(excels.get(1).getCode1()); double code2 = Double.parseDouble(excels.get(1).getCode1());
double code3 = Double.parseDouble(excels.get(2).getCode1());
double code4 = Double.parseDouble(excels.get(3).getCode1());
double v1 = (code1 + code2) / 2; double v1 = (code1 + code2) / 2;
double v2 = (code3 + code4) / 2;
DecimalFormat df = new DecimalFormat("#0.000"); DecimalFormat df = new DecimalFormat("#0.000");
for (int j = 0; j < excels.size(); j++) { for (int j = 0; j < excels.size(); j++) {
// 行标头:前端渲染需要A、B、C.... // 行标头:前端渲染需要A、B、C....
@ -853,7 +850,7 @@ public class ExamineResultController extends BladeController {
if (StringUtil.isNoneBlank(code)) { if (StringUtil.isNoneBlank(code)) {
if (j > 5 || n > 1) { if (j > 5 || n > 1) {
if (v1 != 0) { if (v1 != 0) {
SP = df.format((v2 - Double.parseDouble(code)) / v1); SP = df.format((v1 - Double.parseDouble(code)) / v1);
} }
mapResult.put("originResult", code); mapResult.put("originResult", code);
mapResult.put("value", SP); mapResult.put("value", SP);
@ -1278,6 +1275,8 @@ public class ExamineResultController extends BladeController {
numIndex++; numIndex++;
} }
} }
System.out.println("split.length: " + split.length);
System.out.println("numIndex: " + numIndex);
// 判断分配样品数量与检测样品数量是否一致 // 判断分配样品数量与检测样品数量是否一致
if (split.length != numIndex) { if (split.length != numIndex) {
throw new Exception("分配样品数量与检测样品数量不一致!"); throw new Exception("分配样品数量与检测样品数量不一致!");
@ -3015,7 +3014,7 @@ public class ExamineResultController extends BladeController {
String ctValue = read.get(i).getCtValue(); String ctValue = read.get(i).getCtValue();
String length = ""; String length = "";
if (ctValue != null && !"".equals(ctValue)) { if (ctValue != null && !"".equals(ctValue)) {
int length1 = 15 - ctValue.length(); int length1 = 10 - ctValue.length();
for (int i1 = 0; i1 < length1; i1++) { for (int i1 = 0; i1 < length1; i1++) {
length += " "; length += " ";
} }
@ -3023,7 +3022,10 @@ public class ExamineResultController extends BladeController {
if (i == (read.size() - 1)) { if (i == (read.size() - 1)) {
read.get(i).setCtValue(length + ctValue); read.get(i).setCtValue(length + ctValue);
read.get(i).setResult(" 阳性"); read.get(i).setResult(" 阳 性");
} else if (i == (read.size() - 2)) {
read.get(i).setCtValue("/");
read.get(i).setResult("阴 性");
} else { } else {
if ("".equals(read.get(i).getCtValue()) || read.get(i).getCtValue() == null) { if ("".equals(read.get(i).getCtValue()) || read.get(i).getCtValue() == null) {
read.get(i).setCtValue("/"); read.get(i).setCtValue("/");

@ -1007,11 +1007,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 获取该仪器对象 // 获取该仪器对象
Instrument instrument = instrumentService.getById(s); Instrument instrument = instrumentService.getById(s);
// 拼接仪器编号及名称 // 拼接仪器编号及名称
instrumentName += instrument.getName() + " " + instrument.getCode() + ","; instrumentName += instrument.getName() + "" + instrument.getCode() + ",";
} }
result1.put("code", instrumentName.replace(",", "\r\n"));
String replace = instrumentName.replace(",", "\r");
result1.put("code", instrumentName);
result1.put("experieDate", format3.format(taskBlueprint.getCreateTime())); result1.put("experieDate", format3.format(taskBlueprint.getCreateTime()));
result1.put("remark", entrust.getRemark()); result1.put("remark", entrust.getRemark());
result1.put("resultList1", ItemAndAllList); result1.put("resultList1", ItemAndAllList);
@ -1191,76 +1189,86 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 诊断试剂 // 诊断试剂
String[] split1 = examineResult.getReagentId().split(","); String[] split1 = examineResult.getReagentId().split(",");
String regentName = ""; String regentName = "";
Set<String> set = new HashSet();
for (int i = 0; i < split1.length; i++) { for (int i = 0; i < split1.length; i++) {
Reagent reagent = reagentService.getById(split1[i]); Reagent reagent = reagentService.getById(split1[i]);
if (i == (split1.length - 1)) { if (i == (split1.length - 1)) {
regentName += reagent.getName(); regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer();
} else { } else {
regentName += reagent.getName() + ","; regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer() + "\r\n";
} }
set.add(reagent.getManufacturer());
} }
result.put("7", regentName); result.put("7", regentName);
// 生产厂家及批号 // Set<String> set = new HashSet();
String manufacturer = ""; // for (int i = 0; i < split1.length; i++) {
List<String> strList = new ArrayList<>(); // Reagent reagent = reagentService.getById(split1[i]);
for (String m : set) { // if (i == (split1.length - 1)) {
strList.add(m); // regentName += reagent.getName();
} // } else {
for (int i = 0; i < strList.size(); i++) { // regentName += reagent.getName() + ",";
if (i == (strList.size() - 1)) { // }
manufacturer += strList.get(i); // set.add(reagent.getManufacturer());
} else { // }
manufacturer += strList.get(i) + ","; // result.put("7", regentName);
} //
} // // 生产厂家及批号
// String manufacturer = "";
// 1.先拿到批次号 // List<String> strList = new ArrayList<>();
String batchNos = examineResult.getBatchNos(); // for (String m : set) {
String[] split3 = batchNos.split(","); // strList.add(m);
Map<String, List<String>> tempListMap = new HashMap(); // }
for (String batch : split3) { // for (int i = 0; i < strList.size(); i++) {
String[] reagentIdAndBatchArr = batch.split("-"); // if (i == (strList.size() - 1)) {
String reagentId = reagentIdAndBatchArr[0]; // manufacturer += strList.get(i);
// 试剂中会有中线的情况,如:1101-3,-3也要带着;原以为只有1101 // } else {
String realBatch = ""; // manufacturer += strList.get(i) + ",";
if (reagentIdAndBatchArr.length > 2) { // }
for (int i = 1; i < reagentIdAndBatchArr.length; i++) { // }
realBatch += reagentIdAndBatchArr[i] + "-"; //
} // // 1.先拿到批次号
} else { // String batchNos = examineResult.getBatchNos();
realBatch = reagentIdAndBatchArr[1]; // String[] split3 = batchNos.split(",");
} // Map<String, List<String>> tempListMap = new HashMap();
List<String> list = tempListMap.get(reagentId); // for (String batch : split3) {
if (CollectionUtils.isNotEmpty(list)) { // String[] reagentIdAndBatchArr = batch.split("-");
list.add(realBatch); // String reagentId = reagentIdAndBatchArr[0];
} else { // // 试剂中会有中线的情况,如:1101-3,-3也要带着;原以为只有1101
List<String> temp = new ArrayList<>(); // String realBatch = "";
temp.add(realBatch); // if (reagentIdAndBatchArr.length > 2) {
tempListMap.put(reagentId, temp); // for (int i = 1; i < reagentIdAndBatchArr.length; i++) {
} // realBatch += reagentIdAndBatchArr[i] + "-";
} // }
String resultBatchStr = ""; // } else {
// 遍历处理批号 // realBatch = reagentIdAndBatchArr[1];
Set<String> strings = tempListMap.keySet(); // }
for (String reagentId : strings) { // List<String> list = tempListMap.get(reagentId);
// 根据试剂名称查询厂家名称 // if (CollectionUtils.isNotEmpty(list)) {
Reagent reagent = reagentService.getById(reagentId); // list.add(realBatch);
String manufacturerName = reagent.getManufacturer(); // } else {
List<String> list = tempListMap.get(reagentId); // List<String> temp = new ArrayList<>();
resultBatchStr += manufacturerName + ":批号("; // temp.add(realBatch);
for (int i = 0; i < list.size(); i++) { // tempListMap.put(reagentId, temp);
String realBatch = list.get(i); // }
resultBatchStr += realBatch; // }
if (i != list.size() - 1) { // String resultBatchStr = "";
resultBatchStr += "、"; // // 遍历处理批号
} // Set<String> strings = tempListMap.keySet();
} // for (String reagentId : strings) {
resultBatchStr += ")"; // // 根据试剂名称查询厂家名称
} // Reagent reagent = reagentService.getById(reagentId);
result.put("8", resultBatchStr); // String manufacturerName = reagent.getManufacturer();
// List<String> list = tempListMap.get(reagentId);
// resultBatchStr += manufacturerName + ":批号(";
// for (int i = 0; i < list.size(); i++) {
// String realBatch = list.get(i);
// resultBatchStr += realBatch;
// if (i != list.size() - 1) {
// resultBatchStr += "、";
// }
// }
// resultBatchStr += ")";
// }
// result.put("8", resultBatchStr);
// 使用仪器名称及编号 // 使用仪器名称及编号
String[] split2 = examineResult.getInstrumentId().split(","); String[] split2 = examineResult.getInstrumentId().split(",");
@ -1274,17 +1282,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
instrumentName += s2 + ","; instrumentName += s2 + ",";
} }
} }
result.put("9", instrumentName.replace(",", "\r")); result.put("9", instrumentName.replace(",", "\r\n"));
// String value = DictBizCache.getValue(DictBizEnum.SIMPLE_STATUS, examineResult.getSimpleStatus()); // String value = DictBizCache.getValue(DictBizEnum.SIMPLE_STATUS, examineResult.getSimpleStatus());
result.put("10", examineResult.getSimpleStatus()); result.put("10", examineResult.getSimpleStatus());
result.put("11", "温度" + examineResult.getTemperature() + "℃; " + "湿度" + examineResult.getHumidity() + "%RH"); result.put("11", "温度" + examineResult.getTemperature() + "℃; " + "湿度" + examineResult.getHumidity() + "%RH");
// 操作程序内容 // 操作程序内容
result.put("12", examineResult.getOperateContent().replace("#", "\r")); result.put("12", examineResult.getOperateContent().replace("\n", "\r\n"));
// if (examineBasis != null) {
// result.put("13", examineBasis.getContent().replace("$", "(char)11"));
// }
// 结果判定方法和依据 // 结果判定方法和依据
result.put("13", examineResult.getExamineBasisContent().replace("#", "\r")); result.put("13", examineResult.getExamineBasisContent().replace("\n", "\r\n"));
String path = sysClient.getParamValue("electronic_signature_real_path").getData(); String path = sysClient.getParamValue("electronic_signature_real_path").getData();
// 检测人 // 检测人
if (!"".equals(examine.getExamineBy()) && examine.getExamineBy() != null) { if (!"".equals(examine.getExamineBy()) && examine.getExamineBy() != null) {
@ -3347,10 +3352,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
result.put("flowTime", "/"); result.put("flowTime", "/");
} }
//检测任务书交回日期 //检测任务书交回日期
result.put("backCrossTime", format.format(eTask.getBackCrossTime())); if (eTask.getBackCrossTime() != null) {
String name1 = userClient.userInfoById(Long.parseLong(eTask.getBackCrossRecipientBy())).getData().getName(); result.put("backCrossTime", format.format(eTask.getBackCrossTime()));
//接收人 }
result.put("backCrossRecipient", name1); if (eTask.getBackCrossRecipientBy() != null) {
String name1 = userClient.userInfoById(Long.parseLong(eTask.getBackCrossRecipientBy())).getData().getName();
//接收人
result.put("backCrossRecipient", name1);
}
} }
} }

@ -70,9 +70,29 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
List<Simple> simples = simpleService.list(wrapper1); List<Simple> simples = simpleService.list(wrapper1);
// 如果是追加检验计划提交 // 如果是追加检验计划提交
Random random = new Random();
if (taskBlueprint.getIsContinue() != null && taskBlueprint.getIsContinue() == 1) { if (taskBlueprint.getIsContinue() != null && taskBlueprint.getIsContinue() == 1) {
List<ETask> eTasks = taskBlueprint.getTasks(); List<ETask> eTasks = taskBlueprint.getTasks();
for (ETask eTask : eTasks) { for (ETask eTask : eTasks) {
// 如果是新分配的子任务
if (eTask.getId() == null) {
eTask.setId(random.nextLong());
LambdaQueryWrapper<TaskBlueprint> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TaskBlueprint::getEntrustId, taskBlueprint.getEntrustId());
TaskBlueprint one = this.getOne(wrapper);
eTask.setTaskBlueprintId(one.getId());
taskBlueprint.setId(one.getId());
if (eTask.getDeptId() != null) {
Integer sort = sysClient.getDept(eTask.getDeptId()).getData().getSort();
eTask.setWeight(sort);
}
eTask.setDemandCompletionTime(taskBlueprint.getDemandCompletionTime());
eTask.setStatus(0);
eTask.setIsDeleted(0);
eTask.setCreateTime(new Date());
eTask.setUpdateTime(new Date());
ieTaskService.save(eTask);
}
// 发送提示消息 // 发送提示消息
sendMessage(String.valueOf(eTask.getDeptId())); sendMessage(String.valueOf(eTask.getDeptId()));
@ -80,71 +100,71 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
List<Examine> examines = eTask.getExamines(); List<Examine> examines = eTask.getExamines();
// 库里的检验 // 库里的检验
QueryWrapper<Examine> queryWrapper = new QueryWrapper<>(); // QueryWrapper<Examine> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("dept_id", eTask.getDeptId()); // queryWrapper.eq("dept_id", eTask.getDeptId());
queryWrapper.eq("entrust_id", taskBlueprint.getEntrustId()); // queryWrapper.eq("entrust_id", taskBlueprint.getEntrustId());
List<Examine> examinesInDB = examineService.list(queryWrapper); // List<Examine> examinesInDB = examineService.list(queryWrapper);
//
// 要加的检验 // // 要加的检验
List<Examine> examinesWillAdd = new ArrayList<>(); // List<Examine> examinesWillAdd = new ArrayList<>();
// 要去掉的检验 // // 要去掉的检验
List<Examine> examinesWillSub = new ArrayList<>(); // List<Examine> examinesWillSub = new ArrayList<>();
// 不变的检验 // // 不变的检验
List<Examine> examinesWillKeep = new ArrayList<>(); // List<Examine> examinesWillKeep = new ArrayList<>();
//
// 计算出要保持的 // // 计算出要保持的
for (Examine dbExamine : examinesInDB) { // for (Examine dbExamine : examinesInDB) {
// 判断对象是都在该集合中包含 // // 判断对象是都在该集合中包含
if (isContain(examines, dbExamine)) { // if (isContain(examines, dbExamine)) {
// 如果在,添加到不变的检验接集合中 // // 如果在,添加到不变的检验接集合中
examinesWillKeep.add(dbExamine); // examinesWillKeep.add(dbExamine);
// 最新检验集合中删除包含的 // // 最新检验集合中删除包含的
for (Examine examine : examines) { // for (Examine examine : examines) {
if (examine.getId().equals(dbExamine.getId())) { // if (examine.getId().equals(dbExamine.getId())) {
examine.setIsDeleted(1); // examine.setIsDeleted(1);
} // }
} // }
// examines.remove(dbExamine); //// examines.remove(dbExamine);
// 之前检验集合中删除包含的 // // 之前检验集合中删除包含的
dbExamine.setIsDeleted(1); // dbExamine.setIsDeleted(1);
// examinesInDB.remove(dbExamine); //// examinesInDB.remove(dbExamine);
} // }
} // }
// 要加的 // // 要加的
for (Examine examine : examines) { // for (Examine examine : examines) {
if (examine.getIsDeleted() == null || examine.getIsDeleted() == 0) { // if (examine.getIsDeleted() == null || examine.getIsDeleted() == 0) {
examinesWillAdd.add(examine); // examinesWillAdd.add(examine);
} // }
} // }
// 要去掉的 // // 要去掉的
for (Examine examine : examinesInDB) { // for (Examine examine : examinesInDB) {
if (examine.getIsDeleted() == 0) { // if (examine.getIsDeleted() == 0) {
examinesWillSub.add(examine); // examinesWillSub.add(examine);
} // }
} // }
//
// 找样品当前位置? // // 找样品当前位置?
String simpleCurrPlace = ""; // String simpleCurrPlace = "";
for (Examine examine : examines) { // for (Examine examine : examines) {
if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) { // if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) {
simpleCurrPlace = examine.getSimpleCurrPlace(); // simpleCurrPlace = examine.getSimpleCurrPlace();
break; // break;
} // }
} // }
//
// 获取委托单所有样品 // // 获取委托单所有样品
LambdaQueryWrapper<Simple> wrapperTemp = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<Simple> wrapperTemp = new LambdaQueryWrapper<>();
wrapperTemp.eq(Simple::getEntrustId, taskBlueprint.getEntrustId()); // wrapperTemp.eq(Simple::getEntrustId, taskBlueprint.getEntrustId());
wrapperTemp.orderByAsc(Simple::getSort); // wrapperTemp.orderByAsc(Simple::getSort);
List<Simple> simplesTemp = simpleService.list(wrapperTemp); // List<Simple> simplesTemp = simpleService.list(wrapperTemp);
for (int i = 0; i < simplesTemp.size(); i++) { // for (int i = 0; i < simplesTemp.size(); i++) {
simplesTemp.get(i).setIsDistribution(0); // simplesTemp.get(i).setIsDistribution(0);
} // }
simpleService.updateBatchById(simplesTemp); // simpleService.updateBatchById(simplesTemp);
// 遍历检验 // 遍历检验
List<Examine> examinesWillAddTemp = new ArrayList<>(); List<Examine> examinesWillAddTemp = new ArrayList<>();
for (Examine examine : examinesWillAdd) { for (Examine examine : examines) {
if (!"".equals(examine.getExperieNum())) { if (!"".equals(examine.getExperieNum())) {
continue; continue;
} }
@ -171,7 +191,7 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
StringBuilder experieNum = new StringBuilder(); StringBuilder experieNum = new StringBuilder();
for (int i = min - 1; i < max; i++) { for (int i = min - 1; i < max; i++) {
simples.get(i).setIsDistribution(1); simples.get(i).setIsDistribution(1);
experieNum.append(simples.get(i).getExperieNum()); experieNum.append(simples.get(i).getExperieNum()).append(",");
} }
// simpleService.updateBatchById(simples); // simpleService.updateBatchById(simples);
@ -190,13 +210,39 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
} }
examineService.saveOrUpdateBatch(examinesWillAddTemp); examineService.saveOrUpdateBatch(examinesWillAddTemp);
// 删掉要去掉的 // 删掉要去掉的
List<Long> collect = examinesWillSub.stream().map(Examine::getId).collect(Collectors.toList()); // List<Long> collect = examinesWillSub.stream().map(Examine::getId).collect(Collectors.toList());
examineService.removeByIds(collect); // examineService.removeByIds(collect);
}
// 筛选出驳回的检测数据
LambdaQueryWrapper<Examine> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Examine::getEntrustId, taskBlueprint.getEntrustId());
wrapper.eq(Examine::getStatus, -1);
List<Examine> examines = examineService.list(wrapper);
// 拿到需要删除的检测id集合,批量删除
List<Long> collect = examines.stream().map(Examine::getId).collect(Collectors.toList());
examineService.removeByIds(collect);
// 删除没有对应检测的子任务
LambdaQueryWrapper<ETask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ETask::getTaskBlueprintId, taskBlueprint.getId());
// 查询任务书下所有子任务
List<ETask> eTaskList = ieTaskService.list(queryWrapper);
// 如果不为空
if (CollectionUtils.isNotEmpty(eTaskList)) {
// 循环
for (ETask eTask : eTaskList) {
// 查询该子任务下所有的检测
LambdaQueryWrapper<Examine> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(Examine::getETaskId, eTask.getId());
List<Examine> examineList = examineService.list(wrapper2);
// 如果没有数据,删除该子任务
if (examineList == null || examineList.size() == 0) {
ieTaskService.removeById(eTask.getId());
}
}
} }
} }
// 第一次计划提交 // 第一次计划提交
else { else {
Random random = new Random();
long taskBlueprintId = random.nextLong(); long taskBlueprintId = random.nextLong();
taskBlueprint.setId(taskBlueprintId); taskBlueprint.setId(taskBlueprintId);
List<ETask> eTasks = taskBlueprint.getTasks(); List<ETask> eTasks = taskBlueprint.getTasks();

Loading…
Cancel
Save