提交 f79dca3b authored 作者: Matrix's avatar Matrix

fix(核查模块): 修复省统计中核查结果没有正确显示为无的问题

修复省统计中核查结果没有正确显示为无的问题
上级 ddec201f
...@@ -324,6 +324,7 @@ public class DeviceCheckController { ...@@ -324,6 +324,7 @@ public class DeviceCheckController {
List<CheckAreaStatVo> totalList = new ArrayList<>(); List<CheckAreaStatVo> totalList = new ArrayList<>();
for (Task cct : cctask) { for (Task cct : cctask) {
long start1 = System.currentTimeMillis();
Integer detailId = cct.getBillId(); Integer detailId = cct.getBillId();
DeviceCheckDetail childDetail = detailRepo.findById(detailId).get(); DeviceCheckDetail childDetail = detailRepo.findById(detailId).get();
...@@ -332,6 +333,8 @@ public class DeviceCheckController { ...@@ -332,6 +333,8 @@ public class DeviceCheckController {
.flatMap(checkAreaStatVos -> checkAreaStatVos.stream()) .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
.collect(toList()); .collect(toList());
totalList.addAll(casList); totalList.addAll(casList);
long end1 = System.currentTimeMillis();
log.info("[性能分析] task id = {} cost {} ms",cct.getId(),end1-start1);
} }
// //
String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName(); String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
...@@ -521,10 +524,18 @@ public class DeviceCheckController { ...@@ -521,10 +524,18 @@ public class DeviceCheckController {
// 核查情况 所有子任务都是初始状态 = 无 10=未 // 核查情况 所有子任务都是初始状态 = 无 10=未
String checkReuslt = ""; String checkReuslt = "";
boolean allIsNotInit = detailTasks.stream() // Task 先将历史数据给过滤掉 - 方法是按照billId分组排序,跳出主键id最大的即最新的一条
.anyMatch(t -> t.getBillStatus().equals(END.id)); detailTasks = detailTasks.stream()
.collect(groupingBy(Task::getBillId,
collectingAndThen(maxBy(Comparator.comparing(Task::getId)), Optional::get)))
.values().stream()
.collect(toList());
// 不能存在有9999的任务
boolean notExistsEnd = detailTasks.stream()
.allMatch(t -> !t.getBillStatus().equals(END.id));
if (!allIsNotInit) { if (notExistsEnd) {
checkReuslt = "无"; checkReuslt = "无";
} else { } else {
// 任意一个是10则是待审核 // 任意一个是10则是待审核
...@@ -853,7 +864,7 @@ public class DeviceCheckController { ...@@ -853,7 +864,7 @@ public class DeviceCheckController {
if (unit.getLevel() == 1 || unit.getLevel() == 2) { if (unit.getLevel() == 1 || unit.getLevel() == 2) {
fatherId = cityExamIdMap.get(unit.getUnitId()); fatherId = cityExamIdMap.get(unit.getUnitId());
initStatusId = CHECK_DETAIL_CITY_0.id; initStatusId = CHECK_DETAIL_CITY_0.id;
if (fatherId == null){ if (fatherId == null) {
fatherId = provStatTask.getId(); fatherId = provStatTask.getId();
} }
} else { } else {
...@@ -1120,7 +1131,7 @@ public class DeviceCheckController { ...@@ -1120,7 +1131,7 @@ public class DeviceCheckController {
long count = devLibVo.getDevInLibrary().stream() long count = devLibVo.getDevInLibrary().stream()
.filter(deviceInLibVo -> deviceInLibVo.getProofResult() % 10 != 9) .filter(deviceInLibVo -> deviceInLibVo.getProofResult() % 10 != 9)
.count(); .count();
detailRepo.updateCheckDetailWithT(id, detailString, checkResult, currentUser.getUserId(), assignUserId, (int) count,terminalInfo); detailRepo.updateCheckDetailWithT(id, detailString, checkResult, currentUser.getUserId(), assignUserId, (int) count, terminalInfo);
//2. 推进TASK 状态 //2. 推进TASK 状态
TaskBto currentTask = taskService.get(id, CONFIRM_CHECK_DETAIL.id); TaskBto currentTask = taskService.get(id, CONFIRM_CHECK_DETAIL.id);
currentTask.getInvolveUserIdList().set(0, authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId()); currentTask.getInvolveUserIdList().set(0, authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId());
...@@ -1734,6 +1745,8 @@ public class DeviceCheckController { ...@@ -1734,6 +1745,8 @@ public class DeviceCheckController {
String[] statArray = statString.split(","); String[] statArray = statString.split(",");
//将 id - status 转化为 model - count - status(只统计新增和无误的作为数量) //将 id - status 转化为 model - count - status(只统计新增和无误的作为数量)
long start1 = System.currentTimeMillis();
// 根这里unid可以从detail里拿,根据unitId 查到 areaId 根据 areaId 查询到 areaName // 根这里unid可以从detail里拿,根据unitId 查到 areaId 根据 areaId 查询到 areaName
String areaName = auService.findOne(AuExample.UnitName, detail.getCheckUnit()).getName(); String areaName = auService.findOne(AuExample.UnitName, detail.getCheckUnit()).getName();
...@@ -1743,22 +1756,29 @@ public class DeviceCheckController { ...@@ -1743,22 +1756,29 @@ public class DeviceCheckController {
int statId = Optional.ofNullable(taskRepo.findBillId(task.getParentTaskId(), CONFIRM_CHECK_STAT.id)) int statId = Optional.ofNullable(taskRepo.findBillId(task.getParentTaskId(), CONFIRM_CHECK_STAT.id))
.orElse(0); .orElse(0);
long end1 = System.currentTimeMillis();
log.info("[核查TEST] 基础数据查询消耗 {} ms ", end1 - start1);
// checkDevice 批量查询做一个MAP缓存 // checkDevice 批量查询做一个MAP缓存
long start = System.currentTimeMillis();
List<Integer> idList = Arrays.stream(statArray) List<Integer> idList = Arrays.stream(statArray)
.filter(StringUtils::isNotEmpty) .filter(StringUtils::isNotEmpty)
.map(s -> s.split("-")[0]) .map(s -> s.split("-")[0])
.map(Integer::parseInt) .map(Integer::parseInt)
.collect(toList()); .collect(toList());
long start = System.currentTimeMillis();
List<DeviceLibrary> allDevice = dcService.getAllDeviceLibraryList(); List<DeviceLibrary> allDevice = dcService.getAllDeviceLibraryList();
Map<Integer, DeviceLibrary> deviceMap = allDevice.stream() Map<Integer, DeviceLibrary> deviceMap = allDevice.stream()
.filter(d -> idList.contains(d.getId())) .filter(d -> idList.contains(d.getId()))
.collect(toMap(DeviceLibrary::getId, Function.identity())); .collect(toMap(DeviceLibrary::getId, Function.identity()));
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
log.info("[核查TEST] 批量查询id集合耗时 {} ms ", end - start); log.info("[核查TEST] 批量查询id集合耗时 {} ms ", end - start);
long start2 = System.currentTimeMillis();
for (String s : statArray) { for (String s : statArray) {
if (StringUtils.isEmpty(s)) { if (StringUtils.isEmpty(s)) {
continue; continue;
...@@ -1768,6 +1788,9 @@ public class DeviceCheckController { ...@@ -1768,6 +1788,9 @@ public class DeviceCheckController {
int proofResult = Integer.parseInt(device[1]); int proofResult = Integer.parseInt(device[1]);
DeviceLibrary checkDevice = deviceMap.get(deviceId); DeviceLibrary checkDevice = deviceMap.get(deviceId);
if (Objects.isNull(checkDevice)){
continue;
}
CheckAreaStatVo checkAreaStatVo; CheckAreaStatVo checkAreaStatVo;
// 百位数 0/1 待审核 2 无误 3未通过 // 百位数 0/1 待审核 2 无误 3未通过
...@@ -1805,6 +1828,8 @@ public class DeviceCheckController { ...@@ -1805,6 +1828,8 @@ public class DeviceCheckController {
statVoList.add(new CheckDeviceStatVo(checkDevice.getModel(), checkDevice.getName(), 1, areaStatVoList)); statVoList.add(new CheckDeviceStatVo(checkDevice.getModel(), checkDevice.getName(), 1, areaStatVoList));
} }
long end2 = System.currentTimeMillis();
log.info("[核查TEST] 拼装deviceStat数据消耗了 {} ms ", end2 - start2);
return statVoList; return statVoList;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论