提交 543b6b14 authored 作者: Matrix's avatar Matrix

feat(核查模块): 核查模块新功能的添加

- 手持终端的添加 - 将Task的标题更改为形如[萧山]核查标题 + 标签 - 区B/市 的 回退任务 更改为该单位所有人员均可以做 - 优化了发起检查,发起核查的性能(3.5s -> 500ms) - 添加了可以依据unitId查询到该单位下所有自查列表的接口 /detail/unitId/{id}
上级 1f65c5e9
...@@ -160,13 +160,26 @@ public class DeviceCheckController { ...@@ -160,13 +160,26 @@ public class DeviceCheckController {
return ResponseEntity.ok(new ResultObj<>(detailVoList)); return ResponseEntity.ok(new ResultObj<>(detailVoList));
} }
@ApiOperation(value = "根据id查询核查详情数据", notes = "可以通过这个接口查询核查详情数据")
@GetMapping("/detail/unit/{unitId}")
public ResponseEntity<ResultObj<List<CheckDetailVo>>> findDetailsByUnitId(@PathVariable Integer unitId) {
Units unit = unitsRepo.findById(unitId).get();
Specification<DeviceCheckDetail> pred = Specifications.<DeviceCheckDetail>and()
.eq("checkUnit", unit.getName())
.build();
List<CheckDetailVo> detailVoList = detailRepo.findAll(pred).stream()
.map(transUtil::CheckDetailDo2Vo)
.collect(toList());
return ResponseEntity.ok(new ResultObj<>(detailVoList));
}
@ApiOperation(value = "根据id 刷新 核查详情数据", notes = "可以通过这个接口 刷新 核查详情数据") @ApiOperation(value = "根据id 刷新 核查详情数据", notes = "可以通过这个接口 刷新 核查详情数据")
@GetMapping("/detail/refresh/{id}") @GetMapping("/detail/refresh/{id}")
public ResponseEntity<ResultObj<CheckDetailVo>> refreshDetail(@PathVariable Integer id) { public ResponseEntity<ResultObj<CheckDetailVo>> refreshDetail(@PathVariable Integer id) {
DeviceCheckDetail detail = detailRepo.findById(id).get(); DeviceCheckDetail detail = detailRepo.findById(id).get();
String checkUnit = detail.getCheckUnit(); String checkUnit = detail.getCheckUnit();
//查出所有装备 分为4类 A 所在是本单位 B 所属是本单位 其中 //查出所有装备 分为4类 A 所在是本单位 B 所属是本单位 其中
List<DeviceLibrary> allDevices = deviceRepo.findAll(); List<DeviceLibrary> allDevices = dcService.getAllDeviceLibraryList();
//在库 = A and B & not B 去除掉ls = 10 的装备 把ls = 11 的装备加入到非在库 //在库 = A and B & not B 去除掉ls = 10 的装备 把ls = 11 的装备加入到非在库
Map<Boolean, List<DeviceLibrary>> locationMap = allDevices.stream() Map<Boolean, List<DeviceLibrary>> locationMap = allDevices.stream()
.collect(partitioningBy(d -> d.getLocationUnit().equals(checkUnit))); .collect(partitioningBy(d -> d.getLocationUnit().equals(checkUnit)));
...@@ -273,8 +286,8 @@ public class DeviceCheckController { ...@@ -273,8 +286,8 @@ public class DeviceCheckController {
//todo 这里更改从detail中去查看并求和 //todo 这里更改从detail中去查看并求和
//找到chilid的子child detail 并求和 ccTask即为所有的自查任务集合 //找到chilid的子child detail 并求和 ccTask即为所有的自查任务集合
List<Task> cctask = parentTaskMap.get(child.getId()); List<Task> cctask = parentTaskMap.get(child.getId());
if (Objects.isNull(cctask)){ if (Objects.isNull(cctask)) {
cctask = new ArrayList<>(); cctask = new ArrayList<>();
} }
...@@ -348,7 +361,7 @@ public class DeviceCheckController { ...@@ -348,7 +361,7 @@ public class DeviceCheckController {
linkVo.setType(2); linkVo.setType(2);
//看到的都是自查 根据tpye和billId找到父级节点 这里的根节点只能是检查节点 //看到的都是自查 根据tpye和billId找到父级节点 这里的根节点只能是检查节点
Task rootTask = taskRepo.findAllByBillIdAndBusinessType(billId, type).stream() Task rootTask = taskRepo.findAllByBillIdAndBusinessType(billId, type).stream()
.filter(task -> task.getTitle().contains("检查")) .filter(task -> task.getCustomInfo().contains("exam"))
.findFirst() .findFirst()
.orElseThrow(() -> new ApiException("[核查模块]没有找到对应billId的检查任务,您给的billId = " + billId)); .orElseThrow(() -> new ApiException("[核查模块]没有找到对应billId的检查任务,您给的billId = " + billId));
// 找到所有的子节点 // 找到所有的子节点
...@@ -448,9 +461,9 @@ public class DeviceCheckController { ...@@ -448,9 +461,9 @@ public class DeviceCheckController {
.collect(toList()); .collect(toList());
// 如果 size = 0 或全都是 无 ,则无 // 如果 size = 0 或全都是 无 ,则无
if (situationList.size() == 0){ if (situationList.size() == 0) {
finalSituation = "无"; finalSituation = "无";
}else { } else {
boolean allIsNothing = situationList.stream().allMatch(s -> s.equals("无")); boolean allIsNothing = situationList.stream().allMatch(s -> s.equals("无"));
if (allIsNothing) { if (allIsNothing) {
finalSituation = "无"; finalSituation = "无";
...@@ -478,10 +491,10 @@ public class DeviceCheckController { ...@@ -478,10 +491,10 @@ public class DeviceCheckController {
// 核查情况 所有子任务都是初始状态 = 无 10=未 // 核查情况 所有子任务都是初始状态 = 无 10=未
String checkReuslt = ""; String checkReuslt = "";
boolean allIsInit = detailTasks.stream() boolean allIsNotInit = detailTasks.stream()
.allMatch(t -> t.getBillStatus().equals(CHECK_DETAIL_CITY_0.id) || t.getBillStatus().equals(CHECK_DETAIL_REGION_0.id)); .anyMatch(t -> t.getBillStatus().equals(END.id));
if (allIsInit) { if (!allIsNotInit) {
checkReuslt = "无"; checkReuslt = "无";
} else { } else {
// 任意一个是10则是待审核 // 任意一个是10则是待审核
...@@ -500,7 +513,7 @@ public class DeviceCheckController { ...@@ -500,7 +513,7 @@ public class DeviceCheckController {
for (List<CheckAreaStatVo> vos : map.values()) { for (List<CheckAreaStatVo> vos : map.values()) {
boolean containsOk = vos.stream() boolean containsOk = vos.stream()
.anyMatch(checkAreaStatVo -> checkAreaStatVo.getComSituation() == 12); .anyMatch(checkAreaStatVo -> checkAreaStatVo.getComSituation() == 12);
if (containsOk){ if (containsOk) {
okCount++; okCount++;
} }
} }
...@@ -577,16 +590,16 @@ public class DeviceCheckController { ...@@ -577,16 +590,16 @@ public class DeviceCheckController {
if (comSituation == 10) { if (comSituation == 10) {
// 再判断一下 是2级结构还是3级结构 // 再判断一下 是2级结构还是3级结构
Integer rootId = taskService.findByTaskId(task.getParentTaskId()).getParentTaskId(); Integer rootId = taskService.findByTaskId(task.getParentTaskId()).getParentTaskId();
boolean isTwoLevel = rootId == null || rootId ==0; boolean isTwoLevel = rootId == null || rootId == 0;
// 2级结构 - 发起人单位是省单位 则不变, 发起人市市单位则变为无 // 2级结构 - 发起人单位是省单位 则不变, 发起人市市单位则变为无
if (isTwoLevel){ if (isTwoLevel) {
Integer startUnitId = userService.findById(task.getCreateUserId()).getUnitsId(); Integer startUnitId = userService.findById(task.getCreateUserId()).getUnitsId();
if (startUnitId !=1){ if (startUnitId != 1) {
checkResult = "无"; checkResult = "无";
}else { } else {
checkResult = "等待省审核"; checkResult = "等待省审核";
} }
}else { } else {
checkResult = "等待省审核"; checkResult = "等待省审核";
} }
} else if (comSituation == 12) { } else if (comSituation == 12) {
...@@ -713,16 +726,8 @@ public class DeviceCheckController { ...@@ -713,16 +726,8 @@ public class DeviceCheckController {
return ResponseEntity.ok(ImmutableMap.of("empty", findEmpty, "msg", alertString)); return ResponseEntity.ok(ImmutableMap.of("empty", findEmpty, "msg", alertString));
} }
private String getUnitDateString(Units units){ private String getUnitDateString(Units units, String title) {
LocalDate now = LocalDate.now(); return "[" + units.getUnitDesc() + "]" + title;
int monthValue = now.getMonthValue();
String monthString = "";
if (monthValue < 10){
monthString = "0" + monthValue;
}else {
monthString = "" + monthValue;
}
return units.getUnitDesc() + monthString + now.getDayOfMonth();
} }
...@@ -748,7 +753,7 @@ public class DeviceCheckController { ...@@ -748,7 +753,7 @@ public class DeviceCheckController {
.collect(toList()); .collect(toList());
// 构建省的统计任务 // 构建省的统计任务
TaskBto provStatTask = new Task(CHECK_STAT_1.id, getUnitDateString(startUnit), 0, ".0.", CONFIRM_CHECK_STAT.id, statId, startUnitId) TaskBto provStatTask = new Task(CHECK_STAT_1.id, getUnitDateString(startUnit, ccVO.getTitle()), 0, ".0.", CONFIRM_CHECK_STAT.id, statId, startUnitId)
.parse2Bto(); .parse2Bto();
provStatTask.getInvolveUserIdList().add(authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId()); provStatTask.getInvolveUserIdList().add(authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId());
provStatTask.getInvolveUserIdList().add(-1); provStatTask.getInvolveUserIdList().add(-1);
...@@ -773,7 +778,7 @@ public class DeviceCheckController { ...@@ -773,7 +778,7 @@ public class DeviceCheckController {
log.info("[核查模块] {} 检查统计账单构建完毕,id 为 {}", unit.getName(), cityStatId); log.info("[核查模块] {} 检查统计账单构建完毕,id 为 {}", unit.getName(), cityStatId);
// 构建市的统计任务 // 构建市的统计任务
TaskBto cityStatTask = new TaskBto(CHECK_EXAM_STAT_0.id, getUnitDateString(unit), provStatTask.getId(), addNode(provStatTask.getNodeIdDetail(), provStatTask.getId()), CONFIRM_CHECK_STAT.id, cityStatId, unit.getUnitId(), 0); TaskBto cityStatTask = new TaskBto(CHECK_EXAM_STAT_0.id, getUnitDateString(unit, ccVO.getTitle()), provStatTask.getId(), addNode(provStatTask.getNodeIdDetail(), provStatTask.getId()), CONFIRM_CHECK_STAT.id, cityStatId, unit.getUnitId(), 0);
cityStatTask.getInvolveUserIdList().add(0); cityStatTask.getInvolveUserIdList().add(0);
cityStatTask.setCurrentPoint(1); cityStatTask.setCurrentPoint(1);
cityStatTask.setCustomInfo("exam"); cityStatTask.setCustomInfo("exam");
...@@ -789,13 +794,13 @@ public class DeviceCheckController { ...@@ -789,13 +794,13 @@ public class DeviceCheckController {
.collect(toList()); .collect(toList());
// 获取所有在库装备 lifeStatus ==2 or 14 // 获取所有在库装备 lifeStatus ==2 or 14
Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devInLib = dcService.getAllDeviceLibraryList().stream()
// .filter(device -> device.getOwnUnit().equals(device.getLocationUnit())) // .filter(device -> device.getOwnUnit().equals(device.getLocationUnit()))
.filter(d -> d.getLifeStatus() == 2 || d.getLifeStatus() == 14) .filter(d -> d.getLifeStatus() == 2 || d.getLifeStatus() == 14)
.collect(groupingBy(DeviceLibrary::getOwnUnit)); .collect(groupingBy(DeviceLibrary::getOwnUnit));
// 获取所有非在库装备 ls != 2 and != 14 // 获取所有非在库装备 ls != 2 and != 14
Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devNotInLib = dcService.getAllDeviceLibraryList().stream()
// .filter(device -> !device.getOwnUnit().equals(device.getLocationUnit())) // .filter(device -> !device.getOwnUnit().equals(device.getLocationUnit()))
.filter(d -> d.getLifeStatus() != 2 && d.getLifeStatus() != 14) .filter(d -> d.getLifeStatus() != 2 && d.getLifeStatus() != 14)
.collect(groupingBy(DeviceLibrary::getOwnUnit)); .collect(groupingBy(DeviceLibrary::getOwnUnit));
...@@ -845,7 +850,7 @@ public class DeviceCheckController { ...@@ -845,7 +850,7 @@ public class DeviceCheckController {
ownUnitId = unit.getUnitId(); ownUnitId = unit.getUnitId();
} }
TaskBto checkedTask = new TaskBto(initStatusId, getUnitDateString(unit), fatherId, addNode(provStatTask.getNodeIdDetail(), provStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), ownUnitId, 0); TaskBto checkedTask = new TaskBto(initStatusId, getUnitDateString(unit, ccVO.getTitle()), fatherId, addNode(provStatTask.getNodeIdDetail(), provStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), ownUnitId, 0);
checkedTask.setCustomInfo("manual"); checkedTask.setCustomInfo("manual");
taskService.start(checkedTask); taskService.start(checkedTask);
} }
...@@ -919,7 +924,7 @@ public class DeviceCheckController { ...@@ -919,7 +924,7 @@ public class DeviceCheckController {
Integer currentUserId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId(); Integer currentUserId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId();
TaskBto cityStatTask; TaskBto cityStatTask;
if (ceVo.getExamStatId() == 0) { if (ceVo.getExamStatId() == 0) {
cityStatTask = new Task(CHECK_EXAM_STAT_1.id, getUnitDateString(startUnit), 0, ".0.", CONFIRM_CHECK_STAT.id, statId, startUnitId) cityStatTask = new Task(CHECK_EXAM_STAT_1.id, getUnitDateString(startUnit, ceVo.getTitle()), 0, ".0.", CONFIRM_CHECK_STAT.id, statId, startUnitId)
.parse2Bto(); .parse2Bto();
// cityStatTask.setRemark(String.valueOf(CHECK_EXAM_STAT_1.id)); // cityStatTask.setRemark(String.valueOf(CHECK_EXAM_STAT_1.id));
cityStatTask.setCustomInfo("exam"); cityStatTask.setCustomInfo("exam");
...@@ -943,13 +948,13 @@ public class DeviceCheckController { ...@@ -943,13 +948,13 @@ public class DeviceCheckController {
// 3 构建被查单位的 自查账单 与 自查任务 // 3 构建被查单位的 自查账单 与 自查任务
// 获取所有在库装备 ls == 2 or ls == 14 // 获取所有在库装备 ls == 2 or ls == 14
Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devInLib = dcService.getAllDeviceLibraryList().stream()
.filter(d -> d.getLifeStatus() == 2 || d.getLifeStatus() == 14) .filter(d -> d.getLifeStatus() == 2 || d.getLifeStatus() == 14)
// .filter(device -> device.getOwnUnit().equals(device.getLocationUnit())) // .filter(device -> device.getOwnUnit().equals(device.getLocationUnit()))
.collect(groupingBy(DeviceLibrary::getOwnUnit)); .collect(groupingBy(DeviceLibrary::getOwnUnit));
// 非在库装备 ls !=2 and ls !=14 // 非在库装备 ls !=2 and ls !=14
Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devNotInLib = dcService.getAllDeviceLibraryList().stream()
.filter(d -> d.getLifeStatus() != 2 && d.getLifeStatus() != 14) .filter(d -> d.getLifeStatus() != 2 && d.getLifeStatus() != 14)
// .filter(device -> !device.getOwnUnit().equals(device.getLocationUnit())) // .filter(device -> !device.getOwnUnit().equals(device.getLocationUnit()))
.collect(groupingBy(DeviceLibrary::getOwnUnit)); .collect(groupingBy(DeviceLibrary::getOwnUnit));
...@@ -997,7 +1002,7 @@ public class DeviceCheckController { ...@@ -997,7 +1002,7 @@ public class DeviceCheckController {
// 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态) // 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态)
TaskBto checkedTask = new TaskBto(initTaskStatusId,getUnitDateString(unit), cityStatTask.getId(), addNode(cityStatTask.getNodeIdDetail(), cityStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0); TaskBto checkedTask = new TaskBto(initTaskStatusId, getUnitDateString(unit, ceVo.getTitle()), cityStatTask.getId(), addNode(cityStatTask.getNodeIdDetail(), cityStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0);
// checkedTask.setRemark(String.valueOf(CHECK_EXAM_DETAIL_0.id)); // checkedTask.setRemark(String.valueOf(CHECK_EXAM_DETAIL_0.id));
checkedTask.setCustomInfo("manual"); checkedTask.setCustomInfo("manual");
checkedTask = taskService.start(checkedTask); checkedTask = taskService.start(checkedTask);
...@@ -1210,8 +1215,9 @@ public class DeviceCheckController { ...@@ -1210,8 +1215,9 @@ public class DeviceCheckController {
} }
} else { } else {
//不通过则回到第一阶段 //不通过则回到第一阶段
log.info("[核查模块] 核查员B退回自查任务...");
StatusEnum firstStatus = getFirstStatus(currentTask.getBillStatus(), Integer.valueOf(currentDetail.getVar2())); StatusEnum firstStatus = getFirstStatus(currentTask.getBillStatus(), Integer.valueOf(currentDetail.getVar2()));
taskService.moveToSpecial(currentTask, firstStatus, currentTask.getFirstUserId()); taskService.moveToSpecial(currentTask, firstStatus, 0);
} }
log.info("[核查模块] 专管员B操作成功"); log.info("[核查模块] 专管员B操作成功");
//完结系统自查业务 //完结系统自查业务
...@@ -1246,7 +1252,7 @@ public class DeviceCheckController { ...@@ -1246,7 +1252,7 @@ public class DeviceCheckController {
// 重置Task任务本身的任务状态,使其回滚到等待专管员A处理时的状态,并在Task里添加特殊的回滚标记,用来鉴别这是一个回滚任务 // 重置Task任务本身的任务状态,使其回滚到等待专管员A处理时的状态,并在Task里添加特殊的回滚标记,用来鉴别这是一个回滚任务
StatusEnum firstStatus = getFirstStatus(currentTask.getBillStatus(), Integer.valueOf(currentDetail.getVar2())); StatusEnum firstStatus = getFirstStatus(currentTask.getBillStatus(), Integer.valueOf(currentDetail.getVar2()));
currentTask.setRemark("ROLLBACK-0"); currentTask.setRemark("ROLLBACK-0");
taskService.moveToSpecial(currentTask, firstStatus, currentTask.getFirstUserId()); taskService.moveToSpecial(currentTask, firstStatus, 0);
//重置该自查详情里的各个装备的自查详情 //重置该自查详情里的各个装备的自查详情
currentDetail = setDetailCheckNumber(currentDetail, 119); currentDetail = setDetailCheckNumber(currentDetail, 119);
currentDetail = detailRepo.save(currentDetail); currentDetail = detailRepo.save(currentDetail);
...@@ -1571,7 +1577,7 @@ public class DeviceCheckController { ...@@ -1571,7 +1577,7 @@ public class DeviceCheckController {
.orElse(null); .orElse(null);
if (Objects.nonNull(verifyTask)) { if (Objects.nonNull(verifyTask)) {
log.info("[核查模块] 发现了id = {}市的统计确认任务,将其完结并剔除整个树节点",verifyTask.getId()); log.info("[核查模块] 发现了id = {}市的统计确认任务,将其完结并剔除整个树节点", verifyTask.getId());
verifyTask.setParentTaskId(0); verifyTask.setParentTaskId(0);
taskService.moveToEnd(verifyTask.parse2Bto()); taskService.moveToEnd(verifyTask.parse2Bto());
} }
...@@ -1584,7 +1590,8 @@ public class DeviceCheckController { ...@@ -1584,7 +1590,8 @@ public class DeviceCheckController {
.min(Comparator.comparing(Area::getId)) .min(Comparator.comparing(Area::getId))
.get() .get()
.getId(); .getId();
TaskBto cityDoneTask = new TaskBto(CONFIRM_STAT_0.id, getUnitDateString(units) + "统计数据确认任务", parentTaskId, ".", CONFIRM_CHECK_STAT.id, statId, provId, 0); String provTitle = taskRepo.findById(parentTaskId).get().getTitle();
TaskBto cityDoneTask = new TaskBto(CONFIRM_STAT_0.id, provTitle + "统计数据确认任务", parentTaskId, ".", CONFIRM_CHECK_STAT.id, statId, provId, 0);
cityDoneTask.getInvolveUserIdList().add(0); cityDoneTask.getInvolveUserIdList().add(0);
cityDoneTask.setCurrentPoint(cityDoneTask.getCurrentPoint() + 1); cityDoneTask.setCurrentPoint(cityDoneTask.getCurrentPoint() + 1);
cityDoneTask = taskService.start(cityDoneTask); cityDoneTask = taskService.start(cityDoneTask);
...@@ -1780,7 +1787,7 @@ public class DeviceCheckController { ...@@ -1780,7 +1787,7 @@ public class DeviceCheckController {
.map(units -> auService.findOne(AuExample.UnitId, units.getUnitId())) .map(units -> auService.findOne(AuExample.UnitId, units.getUnitId()))
.collect(toList()); .collect(toList());
List<CheckDeviceStatVo> cdv = deviceRepo.findAll() List<CheckDeviceStatVo> cdv = dcService.getAllDeviceLibraryList()
.stream() .stream()
.filter(dev -> unitNameList.contains(dev.getOwnUnit())) .filter(dev -> unitNameList.contains(dev.getOwnUnit()))
.filter(dev -> initUnitNames.contains(dev.getOwnUnit())) .filter(dev -> initUnitNames.contains(dev.getOwnUnit()))
...@@ -1831,7 +1838,7 @@ public class DeviceCheckController { ...@@ -1831,7 +1838,7 @@ public class DeviceCheckController {
.collect(toList()); .collect(toList());
Collection<CheckDeviceStatVo> statVos; Collection<CheckDeviceStatVo> statVos;
List<CheckDeviceStatVo> cds = deviceRepo.findAll() List<CheckDeviceStatVo> cds = dcService.getAllDeviceLibraryList()
.stream() .stream()
.filter(dev -> unitNameList.contains(dev.getOwnUnit())) .filter(dev -> unitNameList.contains(dev.getOwnUnit()))
// .filter(d->d.getLifeStatus() != 2 & d.getLifeStatus() != 14) // .filter(d->d.getLifeStatus() != 2 & d.getLifeStatus() != 14)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论