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

[核查模块] bug fix

上级 ab845849
......@@ -150,6 +150,35 @@ public class DeviceCheckController {
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 = "可以通过这个接口进行跳转")
@GetMapping("/link")
public ResponseEntity unionLink(@RequestParam Integer type, @RequestParam Integer billId) {
......@@ -343,10 +372,9 @@ public class DeviceCheckController {
private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, RevAreaStat revAreaStat) {
LinkCheckDetail lcd = new LinkCheckDetail();
lcd.setId(task.getBillId());
//核查情况 无误/有误/逾期
if (endTime.isBefore(LocalDateTime.now()) && task.getBillStatus() != 9999 && revAreaStat.getComProgress() != 2) {
lcd.setCheckSituation("逾期");
} else if (revAreaStat.getComSituation() == 1) {
if (revAreaStat.getComSituation() == 1) {
lcd.setCheckSituation("有误");
} else if (revAreaStat.getComSituation() == 0) {
if (revAreaStat.getComProgress() == 0) {
......@@ -357,19 +385,28 @@ public class DeviceCheckController {
} else {
lcd.setCheckSituation("异常");
}
//核查结果
if (task.getBillStatus() == 9999) {
lcd.setCheckResult("完成");
} else if (revAreaStat.getComProgress() == 0) {
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("完成");
if (endTime.isBefore(LocalDateTime.now())) {
if (task.getBillStatus() != 9999 || revAreaStat.getComProgress() != 2) {
lcd.setCheckResult("逾期");
} else {
lcd.setCheckResult("逾期完成");
}
} else {
if (task.getBillStatus() == 9999) {
lcd.setCheckResult("完成");
} else if (revAreaStat.getComProgress() == 0) {
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 {
private LinkExamDetail rev2led(Task task, LocalDateTime endTime, RevAreaStat revAreaStat) {
LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId());
//核查情况 无误/有误/逾期
if (endTime.isBefore(LocalDateTime.now()) && task.getBillStatus() != 9999 && revAreaStat.getComProgress() != 2) {
led.setCheckSituation("逾期");
} else if (revAreaStat.getComSituation() == 1) {
if (revAreaStat.getComSituation() == 1) {
led.setCheckSituation("有误");
} else if (revAreaStat.getComSituation() == 0) {
if (revAreaStat.getComProgress() == 0) {
......@@ -398,20 +434,28 @@ public class DeviceCheckController {
} else {
led.setCheckSituation("异常");
}
//核查结果 还需要检查任务的当前情况,以防止AB岗中途访问数据导致进度异常
if (task.getBillStatus() == 9999) {
led.setCheckResult("完成");
} else if (revAreaStat.getComProgress() == 0) {
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("完成");
//核查结果
if (endTime.isBefore(LocalDateTime.now())) {
if (task.getBillStatus() != 9999 || revAreaStat.getComProgress() != 2) {
led.setCheckResult("逾期");
} else {
led.setCheckResult("逾期完成");
}
} else {
if (task.getBillStatus() == 9999) {
led.setCheckResult("完成");
} else if (revAreaStat.getComProgress() == 0) {
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 {
.filter(units -> Arrays.asList(0, 1).contains(units.getLevel()) || units.getType() == 2)
.collect(toList());
// 获取所有在库装备与不在库装备
// 获取所有在库装备 lifeStatus ==2 or 14
Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().stream()
.filter(device -> device.getOwnUnit().equals(device.getLocationUnit()))
// .filter(d->d.getLifeStatus() != 2 & d.getLifeStatus() != 14)
// .filter(device -> device.getOwnUnit().equals(device.getLocationUnit()))
.filter(d -> d.getLifeStatus() == 2 || d.getLifeStatus() == 14)
.collect(groupingBy(DeviceLibrary::getOwnUnit));
// 获取所有非在库装备 ls != 2 and != 14
Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().stream()
.filter(device -> !device.getOwnUnit().equals(device.getLocationUnit()))
// .filter(d->d.getLifeStatus() != 2 & d.getLifeStatus() != 14)
// .filter(device -> !device.getOwnUnit().equals(device.getLocationUnit()))
.filter(d -> d.getLifeStatus() != 2 && d.getLifeStatus() != 14)
.collect(groupingBy(DeviceLibrary::getOwnUnit));
......@@ -721,15 +766,16 @@ public class DeviceCheckController {
}
// 3 构建被查单位的 自查账单 与 自查任务
// 获取所有在库装备与不在库装备
// 获取所有在库装备 ls == 2 or ls == 14
Map<String, List<DeviceLibrary>> devInLib = deviceRepo.findAll().stream()
// .filter(d->d.getLifeStatus() != 2 & d.getLifeStatus() != 14)
.filter(device -> device.getOwnUnit().equals(device.getLocationUnit()))
.filter(d -> d.getLifeStatus() == 2 || d.getLifeStatus() == 14)
// .filter(device -> device.getOwnUnit().equals(device.getLocationUnit()))
.collect(groupingBy(DeviceLibrary::getOwnUnit));
// 非在库装备 ls !=2 and ls !=14
Map<String, List<DeviceLibrary>> devNotInLib = deviceRepo.findAll().stream()
// .filter(d->d.getLifeStatus() != 2 & d.getLifeStatus() != 14)
.filter(device -> !device.getOwnUnit().equals(device.getLocationUnit()))
.filter(d -> d.getLifeStatus() != 2 && d.getLifeStatus() != 14)
// .filter(device -> !device.getOwnUnit().equals(device.getLocationUnit()))
.collect(groupingBy(DeviceLibrary::getOwnUnit));
// 3. 构建被核查单位的详情账单与Task
......@@ -1067,7 +1113,7 @@ public class DeviceCheckController {
//3.如果所有省级的子任务都完成了
boolean over = taskService.TaskTreeIsOver(cityTask.getParentTaskId());
if (over){
if (over) {
log.info("[核查模块] 所有的省级子任务都完成了,将省统计任务变为待办");
TaskBto provTask = taskService.get(cityTask.getParentTaskId());
provTask.getInvolveUserIdList().add(0);
......
......@@ -186,6 +186,29 @@ public class DeviceCheckDetail extends BaseEntity {
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 devInLib 所属与所在均在本单位的装备集合
......
......@@ -46,4 +46,7 @@ public class DeviceInLibVo {
private String typeName;
private String secretLevelName;
private String lifeStatusName;
}
......@@ -324,7 +324,7 @@ public class ObjTransUtil {
String[] array = detail.split("-");
Integer deviceId = Integer.valueOf(array[0]);
int proofResult = Integer.parseInt(array[1]);
// DeviceLibrary device = deviceRepo.findById(deviceId).get().setConfigName();
// 搜索装备
DeviceLibrary device = deviceRepo.findById(deviceId).orElseThrow(
() -> new ApiException(ResponseEntity.badRequest().body(String.format("检查到装备序号为%d的装备不在资料库中,请先执行入库操作!", deviceId)))).setConfigName();
//依据proofResult的个位数 判断是否是在库装备
......@@ -377,7 +377,8 @@ public class ObjTransUtil {
device.getSecretLevel(),
device.getInvisibleRangeName(),
device.getTypeName(),
device.getSecretLevelName()
device.getSecretLevelName(),
device.getLifeStatusName()
);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论