提交 46692d0d authored 作者: Matrix's avatar Matrix

[核查模块] 增加了退回功能,优化了核查情况与核查结果的说明

上级 7a35e0a5
...@@ -18,6 +18,7 @@ import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil; ...@@ -18,6 +18,7 @@ import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.controller.SelfCheckController; import com.tykj.dev.device.selfcheck.controller.SelfCheckController;
import com.tykj.dev.device.task.repository.TaskDao; import com.tykj.dev.device.task.repository.TaskDao;
...@@ -57,7 +58,6 @@ import java.time.LocalTime; ...@@ -57,7 +58,6 @@ import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate;
import static com.tykj.dev.misc.base.BusinessEnum.CONFIRM_CHECK_DETAIL; import static com.tykj.dev.misc.base.BusinessEnum.CONFIRM_CHECK_DETAIL;
import static com.tykj.dev.misc.base.BusinessEnum.CONFIRM_CHECK_STAT; import static com.tykj.dev.misc.base.BusinessEnum.CONFIRM_CHECK_STAT;
...@@ -93,6 +93,8 @@ public class DeviceCheckController { ...@@ -93,6 +93,8 @@ public class DeviceCheckController {
@Autowired @Autowired
private DeviceCheckDetailDao detailRepo; private DeviceCheckDetailDao detailRepo;
@Autowired @Autowired
private DeviceLibraryCacheService dcService;
@Autowired
private ObjTransUtil transUtil; private ObjTransUtil transUtil;
@Autowired @Autowired
private TaskDao taskRepo; private TaskDao taskRepo;
...@@ -108,6 +110,8 @@ public class DeviceCheckController { ...@@ -108,6 +110,8 @@ public class DeviceCheckController {
private ConfirmCheckService ccService; private ConfirmCheckService ccService;
@Autowired @Autowired
private MyWebSocket myWebSocket; private MyWebSocket myWebSocket;
@Autowired
private SelfCheckController selfCheckController;
@GetMapping("/area/{fatherId}") @GetMapping("/area/{fatherId}")
@ApiOperation(value = "查询指定区域下的所有区域信息") @ApiOperation(value = "查询指定区域下的所有区域信息")
...@@ -135,7 +139,6 @@ public class DeviceCheckController { ...@@ -135,7 +139,6 @@ public class DeviceCheckController {
return statVoList; return statVoList;
} }
@ApiOperation(value = "根据关键字分页查询核查统计数据") @ApiOperation(value = "根据关键字分页查询核查统计数据")
@PostMapping("/stat") @PostMapping("/stat")
public Page<CheckStatTableVo> findStatByKeyword( public Page<CheckStatTableVo> findStatByKeyword(
...@@ -191,7 +194,6 @@ public class DeviceCheckController { ...@@ -191,7 +194,6 @@ public class DeviceCheckController {
return ResponseEntity.ok(new ResultObj<>(cdVo)); return ResponseEntity.ok(new ResultObj<>(cdVo));
} }
/** /**
* 该接口负责处理以下跳转情况 * 该接口负责处理以下跳转情况
* 1 - 统计跳转 * 1 - 统计跳转
...@@ -266,11 +268,13 @@ public class DeviceCheckController { ...@@ -266,11 +268,13 @@ public class DeviceCheckController {
.collect(toList()); .collect(toList());
totalList.addAll(casList); totalList.addAll(casList);
} }
//
String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName(); String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
CheckAreaStatVo cas = combineCaList(totalList, areaName); // CheckAreaStatVo cas = combineCaList(totalList, areaName);
//
// LinkCheckDetail lcd = rev2lcd(child, endTime, updateTime, cas.reverse());
LinkCheckDetail lcd = cas2lcd(totalList, child, areaName);
LinkCheckDetail lcd = rev2lcd(child, endTime, updateTime,cas.reverse());
lcd.setCheckUnit(unitName); lcd.setCheckUnit(unitName);
if (child.getTitle().contains("统计确认待办任务")) { if (child.getTitle().contains("统计确认待办任务")) {
lcd.setCheckSituation("统计确认待办任务"); lcd.setCheckSituation("统计确认待办任务");
...@@ -300,16 +304,13 @@ public class DeviceCheckController { ...@@ -300,16 +304,13 @@ public class DeviceCheckController {
if (casList.isEmpty()) { if (casList.isEmpty()) {
cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0); cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0);
} else { } else {
cas = combineCaList(casList, unitName); // cas = combineCaList(casList, unitName);
cas = casList.get(0);
} }
// CheckAreaStatVo cas = parseStatString2Vo(child.parse2Bto(), childDetail).stream() // LinkExamDetail led = rev2led(child, endTime, updateTime, cas.reverse());
// .map(CheckDeviceStatVo::getAreaStatList) LinkExamDetail led = cas2led(cas, child, endTime, updateTime);
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .reduce(CheckAreaStatVo::combine)
// .orElse(new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0));
LinkExamDetail led = rev2led(child, endTime, updateTime,cas.reverse());
led.setCheckUnit(unitName); led.setCheckUnit(unitName);
ledList.add(led); ledList.add(led);
...@@ -369,10 +370,16 @@ public class DeviceCheckController { ...@@ -369,10 +370,16 @@ public class DeviceCheckController {
//自查的areaName要从detail里找 //自查的areaName要从detail里找
String areaName = childDetail.getCheckUnit(); String areaName = childDetail.getCheckUnit();
CheckAreaStatVo cas; CheckAreaStatVo cas;
// if (casList.isEmpty()) {
// cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0);
// } else {
// cas = combineCaList(casList, areaName);
// }
if (casList.isEmpty()) { if (casList.isEmpty()) {
cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0); cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0);
} else { } else {
cas = combineCaList(casList, areaName); cas = casList.get(0);
} }
// //
...@@ -382,7 +389,11 @@ public class DeviceCheckController { ...@@ -382,7 +389,11 @@ public class DeviceCheckController {
// .reduce(CheckAreaStatVo::combine) // .reduce(CheckAreaStatVo::combine)
// .get(); // .get();
LinkExamDetail led = rev2led(child, endTime, updateTime,cas.reverse()); // LinkExamDetail led = rev2led(child, endTime, updateTime, cas.reverse());
LinkExamDetail led = cas2led(cas, child, endTime, updateTime);
led.setCheckUnit(unitName); led.setCheckUnit(unitName);
//设置名称 //设置名称
...@@ -410,7 +421,7 @@ public class DeviceCheckController { ...@@ -410,7 +421,7 @@ public class DeviceCheckController {
} }
//进行了更新 使用修改时间去做是否逾期判断 //进行了更新 使用修改时间去做是否逾期判断
private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, LocalDateTime updateTime,RevAreaStat revAreaStat) { private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, LocalDateTime updateTime, RevAreaStat revAreaStat) {
LinkCheckDetail lcd = new LinkCheckDetail(); LinkCheckDetail lcd = new LinkCheckDetail();
lcd.setId(task.getBillId()); lcd.setId(task.getBillId());
...@@ -477,8 +488,100 @@ public class DeviceCheckController { ...@@ -477,8 +488,100 @@ public class DeviceCheckController {
return lcd; return lcd;
} }
/**
* lcd 里的列表都为检查,因此是集合对
*
* @return
*/
private LinkCheckDetail cas2lcd(List<CheckAreaStatVo> casList, Task task, String finalCityName) {
LinkCheckDetail lcd = new LinkCheckDetail();
lcd.setId(task.getBillId());
//全部为0->0,全部为2->2,否则1
boolean waitStart = casList.stream()
.allMatch(cas -> cas.getComProgress() == 0);
boolean isFinished = casList.stream()
.allMatch(cas -> cas.getComProgress() == 2);
if (waitStart) {
lcd.setCheckSituation("等待核查");
} else if (isFinished) {
lcd.setCheckSituation("已完成");
} else {
lcd.setCheckSituation("核查中");
}
boolean waitAudit = casList.stream()
.allMatch(cas -> cas.getComSituation() == 10);
// 需要每一个城市都有无误(即12) 才算无误
long cityCount = casList.stream().count();
long okCount = casList.stream()
.filter(cas -> cas.getComSituation() == 12)
.count();
boolean allOk = okCount >= cityCount;
if (isFinished) {
if (waitAudit) {
lcd.setCheckResult("待审核");
} else if (allOk) {
lcd.setCheckResult("无误");
} else {
lcd.setCheckResult("审核中");
}
}
lcd.setCheckUnit(finalCityName + "局");
return lcd;
}
/**
* led 里的列表都为自查,因此都是单个对象
*
* @return
*/
private LinkExamDetail cas2led(CheckAreaStatVo cas, Task task, LocalDateTime endTime, LocalDateTime updateTime) {
LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId());
int comProgress = cas.getComProgress();
int comSituation = cas.getComSituation();
if (comProgress == 0) {
led.setCheckSituation("准备核查");
} else if (comProgress == 1) {
led.setCheckSituation("核查中");
} else if (comProgress == 2) {
if (endTime.isBefore(updateTime)) {
led.setCheckSituation("逾期完成");
} else {
led.setCheckSituation("完成");
}
}
if (comProgress == 0 || comProgress == 1) {
led.setCheckResult("无");
} else {
if (comSituation == 10) {
led.setCheckResult("待审核");
} else if (comSituation == 12) {
led.setCheckResult("无误");
} else if (comSituation == 13) {
led.setCheckResult("未通过");
} else {
led.setCheckResult("缺省");
}
}
led.setCheckUnit(cas.getAreaName() + "局");
return led;
}
//修改 //修改
private LinkExamDetail rev2led(Task task, LocalDateTime endTime, LocalDateTime updateTime,RevAreaStat revAreaStat) { private LinkExamDetail rev2led(Task task, LocalDateTime endTime, LocalDateTime updateTime, RevAreaStat revAreaStat) {
LinkExamDetail led = new LinkExamDetail(); LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId()); led.setId(task.getBillId());
...@@ -917,7 +1020,6 @@ public class DeviceCheckController { ...@@ -917,7 +1020,6 @@ public class DeviceCheckController {
} }
/** /**
* 根据taskId查询Remark * 根据taskId查询Remark
*/ */
...@@ -928,7 +1030,6 @@ public class DeviceCheckController { ...@@ -928,7 +1030,6 @@ public class DeviceCheckController {
return ResponseEntity.ok(desBillMap.get(billId)); return ResponseEntity.ok(desBillMap.get(billId));
} }
private TaskBto selectProvTask(Integer taskId) { private TaskBto selectProvTask(Integer taskId) {
TaskBto taskBto = taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
if (taskBto.getParentTaskId() == 0) { if (taskBto.getParentTaskId() == 0) {
...@@ -937,7 +1038,6 @@ public class DeviceCheckController { ...@@ -937,7 +1038,6 @@ public class DeviceCheckController {
return selectProvTask(taskBto.getParentTaskId()); return selectProvTask(taskBto.getParentTaskId());
} }
/** /**
* 对于专员A来说的逻辑 * 对于专员A来说的逻辑
* 1. 修改detailString * 1. 修改detailString
...@@ -1100,6 +1200,51 @@ public class DeviceCheckController { ...@@ -1100,6 +1200,51 @@ public class DeviceCheckController {
return ResponseEntity.ok(new ResultObj<>("专管B操作成功")); return ResponseEntity.ok(new ResultObj<>("专管B操作成功"));
} }
@ApiOperation(value = "新的回退接口,目前用于测试")
@PutMapping("/test/rollback/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity rollBac(@PathVariable Integer id){
//1. bill单的自查将百位数变为3
DeviceCheckDetail detail = detailRepo.getOne(id);
String detailString = detail.getCheckDetail();
String initalDetail = Arrays.stream(detailString.split(","))
.map(s -> s.split("-")[0] + "-" + 119)
.collect(joining(","));
String updateDetail = Arrays.stream(detailString.split(","))
.map(s -> {
Integer number = Integer.valueOf(s.split("-")[1]);
int digit= number % 10;
int tens = number / 10 % 10;
number = 300 + tens * 10 + digit;
return s.split("-")[0] + "-" + number;
} )
.collect(joining(","));
detailRepo.updateCheckDetail(id, updateDetail, "", 0, 0, 0);
//2.当前任务结束,开启一个新的 退回任务(连带一个新的detail)
TaskBto currentTask = taskService.get(id, CONFIRM_CHECK_DETAIL.id);
taskService.moveToEnd(currentTask);
// 创建新的detail
DeviceCheckDetail cDetail = detail.copyWithoutId();
cDetail.setId(null);
cDetail.setCheckDetail(initalDetail);
cDetail = detailRepo.save(cDetail);
// 创建新的任务
TaskBto newTask = currentTask.toDo().copy().parse2Bto();
newTask.setBillStatus(CHECK_EXAM_DETAIL_0.id);
newTask.setBillId(cDetail.getId());
taskService.start(newTask);
//3.父级任务变为进行中
TaskBto fatherTask = taskService.get(currentTask.getParentTaskId());
fatherTask.setBillStatus(CHECK_EXAM_STAT_0.id);
return ResponseEntity.ok(new ResultObj<>("回退操作成功!"));
}
/** /**
* 用于核查的回退接口 * 用于核查的回退接口
* *
...@@ -1304,8 +1449,7 @@ public class DeviceCheckController { ...@@ -1304,8 +1449,7 @@ public class DeviceCheckController {
log.info("[核查模块] 办结统计待办操作成功"); log.info("[核查模块] 办结统计待办操作成功");
return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕")); return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕"));
} }
@Autowired
private SelfCheckController selfCheckController;
/** /**
* @param statId 统计账单主键id * @param statId 统计账单主键id
*/ */
...@@ -1441,8 +1585,10 @@ private SelfCheckController selfCheckController; ...@@ -1441,8 +1585,10 @@ private SelfCheckController selfCheckController;
.collect(toList()); .collect(toList());
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Map<Integer, DeviceLibrary> deviceMap = deviceRepo.findAllByIdIn(idList)
.stream() List<DeviceLibrary> allDevice = dcService.getAllDeviceLibraryList();
Map<Integer, DeviceLibrary> deviceMap = allDevice.stream()
.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);
...@@ -1458,23 +1604,34 @@ private SelfCheckController selfCheckController; ...@@ -1458,23 +1604,34 @@ private SelfCheckController selfCheckController;
DeviceLibrary checkDevice = deviceMap.get(deviceId); DeviceLibrary checkDevice = deviceMap.get(deviceId);
CheckAreaStatVo checkAreaStatVo; CheckAreaStatVo checkAreaStatVo;
// 百位数 0/1 待审核 2 无误 3未通过
// 十位数 1 人工 2 自动 // 十位数 1 人工 2 自动
// 0缺失1无误2新增3不在库 8已退回 9未检查 // 0缺失1无误2新增3不在库 8已退回 9未检查
int digits = proofResult % 10; int digits = proofResult % 10;
int tens = proofResult / 10 % 10;
int huns = proofResult / 100 % 10;
if (digits == 8) { // 个位数判断自查结果
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 3, -1, statId, detailId); if (digits == 9) {
} else if (digits == 9) { checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 0, 10, statId, detailId);
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 0, 0, statId, detailId);
} else if (digits == 3) { } else if (digits == 3) {
//跳过非在库的统计 //跳过非在库的统计
continue; continue;
} else if (digits == 1) { } else if (digits == 1) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 0, statId, detailId); checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 10, statId, detailId);
} else if (digits == 0) { } else if (digits == 0) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 0, 1, 2, 1, statId, detailId); checkAreaStatVo = new CheckAreaStatVo(areaName, 0, 1, 2, 10, statId, detailId);
} else { } else {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 1, statId, detailId); checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 10, statId, detailId);
}
// 百位数判断审核情况
if (huns == 0 || huns ==1){
checkAreaStatVo.setComSituation(10);
}else if (huns == 2){
checkAreaStatVo.setComSituation(12);
}else if (huns ==3){
checkAreaStatVo.setComSituation(13);
} }
List<CheckAreaStatVo> areaStatVoList = new ArrayList<>(); List<CheckAreaStatVo> areaStatVoList = new ArrayList<>();
...@@ -1657,7 +1814,7 @@ private SelfCheckController selfCheckController; ...@@ -1657,7 +1814,7 @@ private SelfCheckController selfCheckController;
return new CheckAreaStatVo(finalCityName, actualCount, supposeCount, finalProgress, finalSituation, 0, 0); return new CheckAreaStatVo(finalCityName, actualCount, supposeCount, finalProgress, finalSituation, 0, 0);
} }
private void findBySystem(){ private void findBySystem() {
selfCheckController.findBySystem1(); selfCheckController.findBySystem1();
} }
......
...@@ -2,13 +2,16 @@ package com.tykj.dev.device.confirmcheck.entity.domain; ...@@ -2,13 +2,16 @@ package com.tykj.dev.device.confirmcheck.entity.domain;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.misc.base.BaseEntity; import com.tykj.dev.misc.base.BaseEntity;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.TimestampUtil; import com.tykj.dev.misc.utils.TimestampUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.modelmapper.ModelMapper;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -16,6 +19,7 @@ import javax.persistence.Column; ...@@ -16,6 +19,7 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -261,4 +265,15 @@ public class DeviceCheckDetail extends BaseEntity { ...@@ -261,4 +265,15 @@ public class DeviceCheckDetail extends BaseEntity {
remark remark
); );
} }
public DeviceCheckDetail copyWithoutId(){
ModelMapper mapper = BeanHelper.getUserMapper();
DeviceCheckDetail detail = mapper.map(this, DeviceCheckDetail.class);
this.setCreateTime(LocalDateTime.now());
this.setUpdateTime(LocalDateTime.now());
this.userAId = 0;
this.userBId = 0;
return detail;
}
} }
...@@ -138,4 +138,13 @@ public class Task { ...@@ -138,4 +138,13 @@ public class Task {
taskBto.setUserReadDetailList(StringSplitUtil.userIdSplit(this.userReadDetail)); taskBto.setUserReadDetailList(StringSplitUtil.userIdSplit(this.userReadDetail));
return taskBto; return taskBto;
} }
public Task copy(){
//modelMap复制
ModelMapper mapper = BeanHelper.getUserMapper();
Task task = mapper.map(this, Task.class);
this.createTime = new Date();
this.updateTime = new Date();
return task;
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论