提交 b2db9c1c authored 作者: ljj's avatar ljj

bug 核查模块:修正发起单位均无装备创建任务的问题

上级 8e091950
...@@ -125,13 +125,19 @@ public class ExamController { ...@@ -125,13 +125,19 @@ public class ExamController {
@PostMapping("/confirm/checkPossible") @PostMapping("/confirm/checkPossible")
public ResponseEntity checkPossible(@RequestBody UnitIds unitIds, @RequestParam(defaultValue = "false") boolean isExam) { public ResponseEntity checkPossible(@RequestBody UnitIds unitIds, @RequestParam(defaultValue = "false") boolean isExam) {
boolean tag = false;
if (!isExam) { if (!isExam) {
// 核查 // 核查
List<Units> rs = new ArrayList<>(); List<Units> rs = new ArrayList<>();
rs.addAll(unitsRepo.findAllById(checkUnitService.findUnExistDevice(unitIds.getIds()))); List<Integer> unExistDevice1 = checkUnitService.findUnExistDevice(unitIds.getIds());
rs.addAll(unitsRepo.findAllById(unExistDevice1));
List<Integer> collect = unitsRepo.findAllById(unitIds.getIds()).stream().filter(o -> o.getLevel() == 2).map(Units::getUnitId).collect(toList()); List<Integer> collect = unitsRepo.findAllById(unitIds.getIds()).stream().filter(o -> o.getLevel() == 2).map(Units::getUnitId).collect(toList());
log.info("[check] 获取核查单位,{}", collect); log.info("[check] 获取核查单位,{}", collect);
if (unExistDevice1.size() < unitIds.getIds().size()) {
tag = true;
}
if (!collect.isEmpty()) { if (!collect.isEmpty()) {
for (Integer integer : collect) { for (Integer integer : collect) {
List<Units> bySubordinateAll = unitsService.findBySubordinateAll(integer); List<Units> bySubordinateAll = unitsService.findBySubordinateAll(integer);
...@@ -139,13 +145,27 @@ public class ExamController { ...@@ -139,13 +145,27 @@ public class ExamController {
List<Integer> unExistDevice = checkUnitService.findUnExistDevice(bySubordinateAll.stream().map(Units::getUnitId).collect(toList())); List<Integer> unExistDevice = checkUnitService.findUnExistDevice(bySubordinateAll.stream().map(Units::getUnitId).collect(toList()));
log.info("[check] 市级无装备的单位:{}", unExistDevice); log.info("[check] 市级无装备的单位:{}", unExistDevice);
rs.addAll(unitsRepo.findAllById(unExistDevice)); rs.addAll(unitsRepo.findAllById(unExistDevice));
if (unExistDevice.size() < bySubordinateAll.size()) {
tag = true;
} }
} }
return ResponseEntity.ok(rs.stream().distinct().collect(toList())); }
return ResponseEntity.ok(CheckPossibleVO.builder()
.tag(tag)
.untis(rs.stream().distinct().collect(toList()))
.build());
} else { } else {
// 检查 // 检查
List<Units> units = unitsRepo.findAllById(checkUnitService.findUnExistDevice(unitIds.getIds())); List<Units> units = unitsRepo.findAllById(checkUnitService.findUnExistDevice(unitIds.getIds()));
return ResponseEntity.ok(units);
if (units.size() < unitIds.getIds().size()) {
tag = true;
}
return ResponseEntity.ok(CheckPossibleVO.builder()
.tag(tag)
.untis(units)
.build());
} }
} }
......
package com.tykj.dev.device.confirmcheck.entity.vo;
import com.tykj.dev.device.user.subject.entity.Units;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/3/2
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CheckPossibleVO {
private boolean tag;
private List<Units> untis;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论