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

[核查模块] bug fix

上级 ab845849
...@@ -150,6 +150,35 @@ public class DeviceCheckController { ...@@ -150,6 +150,35 @@ public class DeviceCheckController {
return ResponseEntity.ok(new ResultObj<>(detailVoList)); return ResponseEntity.ok(new ResultObj<>(detailVoList));
} }
@ApiOperation(value = "根据id 刷新 核查详情数据", notes = "可以通过这个接口 刷新 核查详情数据")
@GetMapping("/detail/refresh/{id}")
public ResponseEntity<ResultObj<CheckDetailVo>> refreshDetail(@PathVariable Integer id) {
DeviceCheckDetail detail = detailRepo.findById(id).get();
String checkUnit = detail.getCheckUnit();
//查出所有装备 分为4类 A 所在是本单位 B 所属是本单位 其中
List<DeviceLibrary> allDevices = deviceRepo.findAll();
//在库 = A and B & not B
Map<Boolean, List<DeviceLibrary>> locationMap = allDevices.stream()
.collect(partitioningBy(d -> d.getLocationUnit().equals(checkUnit)));
List<DeviceLibrary> devInLib = locationMap.get(true);
// 非在库 = not A and in B
List<DeviceLibrary> devNotInLib = locationMap.get(false)
.stream().filter(d -> d.getOwnUnit().equals(checkUnit))
.collect(toList());
// 更新detail
detail.updateDevice(devInLib, devNotInLib);
detail = detailRepo.save(detail);
CheckDetailVo cdVo = transUtil.CheckDetailDo2Vo(detail);
return ResponseEntity.ok(new ResultObj<>(cdVo));
}
@ApiOperation(value = "统一跳转接口", notes = "可以通过这个接口进行跳转") @ApiOperation(value = "统一跳转接口", notes = "可以通过这个接口进行跳转")
@GetMapping("/link") @GetMapping("/link")
public ResponseEntity unionLink(@RequestParam Integer type, @RequestParam Integer billId) { public ResponseEntity unionLink(@RequestParam Integer type, @RequestParam Integer billId) {
...@@ -343,10 +372,9 @@ public class DeviceCheckController { ...@@ -343,10 +372,9 @@ public class DeviceCheckController {
private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, RevAreaStat revAreaStat) { private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, RevAreaStat revAreaStat) {
LinkCheckDetail lcd = new LinkCheckDetail(); LinkCheckDetail lcd = new LinkCheckDetail();
lcd.setId(task.getBillId()); lcd.setId(task.getBillId());
//核查情况 无误/有误/逾期 //核查情况 无误/有误/逾期
if (endTime.isBefore(LocalDateTime.now()) && task.getBillStatus() != 9999 && revAreaStat.getComProgress() != 2) { if (revAreaStat.getComSituation() == 1) {
lcd.setCheckSituation("逾期");
} else if (revAreaStat.getComSituation() == 1) {
lcd.setCheckSituation("有误"); lcd.setCheckSituation("有误");
} else if (revAreaStat.getComSituation() == 0) { } else if (revAreaStat.getComSituation() == 0) {
if (revAreaStat.getComProgress() == 0) { if (revAreaStat.getComProgress() == 0) {
...@@ -357,19 +385,28 @@ public class DeviceCheckController { ...@@ -357,19 +385,28 @@ public class DeviceCheckController {
} else { } else {
lcd.setCheckSituation("异常"); lcd.setCheckSituation("异常");
} }
//核查结果 //核查结果
if (task.getBillStatus() == 9999) { if (endTime.isBefore(LocalDateTime.now())) {
lcd.setCheckResult("完成"); if (task.getBillStatus() != 9999 || revAreaStat.getComProgress() != 2) {
} else if (revAreaStat.getComProgress() == 0) { lcd.setCheckResult("逾期");
lcd.setCheckResult("未开始"); } else {
} else if (revAreaStat.getComProgress() == 1) { lcd.setCheckResult("逾期完成");
lcd.setCheckResult("进行中"); }
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 0) { } else {
lcd.setCheckResult("进行中"); if (task.getBillStatus() == 9999) {
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 1) { lcd.setCheckResult("完成");
lcd.setCheckResult("进行中"); } else if (revAreaStat.getComProgress() == 0) {
} else if (revAreaStat.getComProgress() == 2) { lcd.setCheckResult("未开始");
lcd.setCheckResult("完成"); } else if (revAreaStat.getComProgress() == 1) {
lcd.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 0) {
lcd.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 1) {
lcd.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2) {
lcd.setCheckResult("完成");
}
} }
//核查单位名 //核查单位名
...@@ -384,10 +421,9 @@ public class DeviceCheckController { ...@@ -384,10 +421,9 @@ public class DeviceCheckController {
private LinkExamDetail rev2led(Task task, LocalDateTime endTime, RevAreaStat revAreaStat) { private LinkExamDetail rev2led(Task task, LocalDateTime endTime, RevAreaStat revAreaStat) {
LinkExamDetail led = new LinkExamDetail(); LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId()); led.setId(task.getBillId());
//核查情况 无误/有误/逾期 //核查情况 无误/有误/逾期
if (endTime.isBefore(LocalDateTime.now()) && task.getBillStatus() != 9999 && revAreaStat.getComProgress() != 2) { if (revAreaStat.getComSituation() == 1) {
led.setCheckSituation("逾期");
} else if (revAreaStat.getComSituation() == 1) {
led.setCheckSituation("有误"); led.setCheckSituation("有误");
} else if (revAreaStat.getComSituation() == 0) { } else if (revAreaStat.getComSituation() == 0) {
if (revAreaStat.getComProgress() == 0) { if (revAreaStat.getComProgress() == 0) {
...@@ -398,20 +434,28 @@ public class DeviceCheckController { ...@@ -398,20 +434,28 @@ public class DeviceCheckController {
} else { } else {
led.setCheckSituation("异常"); led.setCheckSituation("异常");
} }
//核查结果 还需要检查任务的当前情况,以防止AB岗中途访问数据导致进度异常
//核查结果
if (task.getBillStatus() == 9999) { if (endTime.isBefore(LocalDateTime.now())) {
led.setCheckResult("完成"); if (task.getBillStatus() != 9999 || revAreaStat.getComProgress() != 2) {
} else if (revAreaStat.getComProgress() == 0) { led.setCheckResult("逾期");
led.setCheckResult("未开始"); } else {
} else if (revAreaStat.getComProgress() == 1) { led.setCheckResult("逾期完成");
led.setCheckResult("进行中"); }
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 0) { } else {
led.setCheckResult("进行中"); if (task.getBillStatus() == 9999) {
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 1) { led.setCheckResult("完成");
led.setCheckResult("进行中"); } else if (revAreaStat.getComProgress() == 0) {
} else if (revAreaStat.getComProgress() == 2) { led.setCheckResult("未开始");
led.setCheckResult("完成"); } else if (revAreaStat.getComProgress() == 1) {
led.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 0) {
led.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 1) {
led.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2) {
led.setCheckResult("完成");
}
} }
//核查单位名 //核查单位名
...@@ -586,15 +630,16 @@ public class DeviceCheckController { ...@@ -586,15 +630,16 @@ public class DeviceCheckController {
.filter(units -> Arrays.asList(0, 1).contains(units.getLevel()) || units.getType() == 2) .filter(units -> Arrays.asList(0, 1).contains(units.getLevel()) || units.getType() == 2)
.collect(toList()); .collect(toList());
// 获取所有在库装备与不在库装备 // 获取所有在库装备 lifeStatus ==2 or 14
Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().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
Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().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));
...@@ -721,15 +766,16 @@ public class DeviceCheckController { ...@@ -721,15 +766,16 @@ public class DeviceCheckController {
} }
// 3 构建被查单位的 自查账单 与 自查任务 // 3 构建被查单位的 自查账单 与 自查任务
// 获取所有在库装备与不在库装备 // 获取所有在库装备 ls == 2 or ls == 14
Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().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
Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().stream() Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().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));
// 3. 构建被核查单位的详情账单与Task // 3. 构建被核查单位的详情账单与Task
...@@ -1067,7 +1113,7 @@ public class DeviceCheckController { ...@@ -1067,7 +1113,7 @@ public class DeviceCheckController {
//3.如果所有省级的子任务都完成了 //3.如果所有省级的子任务都完成了
boolean over = taskService.TaskTreeIsOver(cityTask.getParentTaskId()); boolean over = taskService.TaskTreeIsOver(cityTask.getParentTaskId());
if (over){ if (over) {
log.info("[核查模块] 所有的省级子任务都完成了,将省统计任务变为待办"); log.info("[核查模块] 所有的省级子任务都完成了,将省统计任务变为待办");
TaskBto provTask = taskService.get(cityTask.getParentTaskId()); TaskBto provTask = taskService.get(cityTask.getParentTaskId());
provTask.getInvolveUserIdList().add(0); provTask.getInvolveUserIdList().add(0);
......
...@@ -186,6 +186,29 @@ public class DeviceCheckDetail extends BaseEntity { ...@@ -186,6 +186,29 @@ public class DeviceCheckDetail extends BaseEntity {
this.remark = remark; this.remark = remark;
} }
public void updateDevice(List<DeviceLibrary> devInLib,List<DeviceLibrary> devNotInLib){
//构造checkDetail 分当前在库与不在库的 赋予不同状态
String goodCheckDetail = "";
if (!CollectionUtils.isEmpty(devInLib)) {
goodCheckDetail = devInLib.stream()
.map(device -> device.getId() + "-9")
.collect(Collectors.joining(","));
}
String badCheckDetail = "";
if (!CollectionUtils.isEmpty(devNotInLib)) {
badCheckDetail = devNotInLib.stream()
.map(device -> device.getId() + "-3")
.collect(Collectors.joining(","));
}
//如果不在库的不为空,则拼接,否则没必要
String checkDetail = StringUtils.isEmpty(badCheckDetail) ? goodCheckDetail : goodCheckDetail + "," + badCheckDetail;
this.checkDetail = checkDetail;
}
/** /**
* @param checkUnit 要核查的单位 * @param checkUnit 要核查的单位
* @param devInLib 所属与所在均在本单位的装备集合 * @param devInLib 所属与所在均在本单位的装备集合
......
...@@ -46,4 +46,7 @@ public class DeviceInLibVo { ...@@ -46,4 +46,7 @@ public class DeviceInLibVo {
private String typeName; private String typeName;
private String secretLevelName; private String secretLevelName;
private String lifeStatusName;
} }
...@@ -324,7 +324,7 @@ public class ObjTransUtil { ...@@ -324,7 +324,7 @@ public class ObjTransUtil {
String[] array = detail.split("-"); String[] array = detail.split("-");
Integer deviceId = Integer.valueOf(array[0]); Integer deviceId = Integer.valueOf(array[0]);
int proofResult = Integer.parseInt(array[1]); int proofResult = Integer.parseInt(array[1]);
// DeviceLibrary device = deviceRepo.findById(deviceId).get().setConfigName(); // 搜索装备
DeviceLibrary device = deviceRepo.findById(deviceId).orElseThrow( DeviceLibrary device = deviceRepo.findById(deviceId).orElseThrow(
() -> new ApiException(ResponseEntity.badRequest().body(String.format("检查到装备序号为%d的装备不在资料库中,请先执行入库操作!", deviceId)))).setConfigName(); () -> new ApiException(ResponseEntity.badRequest().body(String.format("检查到装备序号为%d的装备不在资料库中,请先执行入库操作!", deviceId)))).setConfigName();
//依据proofResult的个位数 判断是否是在库装备 //依据proofResult的个位数 判断是否是在库装备
...@@ -377,7 +377,8 @@ public class ObjTransUtil { ...@@ -377,7 +377,8 @@ public class ObjTransUtil {
device.getSecretLevel(), device.getSecretLevel(),
device.getInvisibleRangeName(), device.getInvisibleRangeName(),
device.getTypeName(), device.getTypeName(),
device.getSecretLevelName() device.getSecretLevelName(),
device.getLifeStatusName()
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论