提交 52ea93f0 authored 作者: Matrix's avatar Matrix

[核查模块] 增加了统计任务正确变为待办的feature

上级 0f0780e4
...@@ -73,9 +73,9 @@ import static java.util.stream.Collectors.*; ...@@ -73,9 +73,9 @@ import static java.util.stream.Collectors.*;
@Api(tags = "核查模块", description = "核查模块", position = 1) @Api(tags = "核查模块", description = "核查模块", position = 1)
public class DeviceCheckController { public class DeviceCheckController {
Map<Integer,String> desMap=new HashMap<>(); Map<Integer, String> desMap = new HashMap<>();
Map<Integer,String> desBillMap=new HashMap<>(); Map<Integer, String> desBillMap = new HashMap<>();
@Autowired @Autowired
private DeviceCheckStatDao statRepo; private DeviceCheckStatDao statRepo;
...@@ -119,7 +119,7 @@ public class DeviceCheckController { ...@@ -119,7 +119,7 @@ public class DeviceCheckController {
@ApiOperation(value = "查询默认的可以被核查单位的清单(省本直,省直属,市局)") @ApiOperation(value = "查询默认的可以被核查单位的清单(省本直,省直属,市局)")
public ResponseEntity findDefaultUnits() { public ResponseEntity findDefaultUnits() {
return ResponseEntity.ok(new ResultObj<>(unitsRepo.findAllByTypeNotInAndLevelIn(Lists.newArrayList(3),Lists.newArrayList(0,1,2)))); return ResponseEntity.ok(new ResultObj<>(unitsRepo.findAllByTypeNotInAndLevelIn(Lists.newArrayList(3), Lists.newArrayList(0, 1, 2))));
} }
@ApiOperation(value = "根据id查询核查统计数据", notes = "可以通过这个接口查询核查统计数据") @ApiOperation(value = "根据id查询核查统计数据", notes = "可以通过这个接口查询核查统计数据")
...@@ -209,7 +209,7 @@ public class DeviceCheckController { ...@@ -209,7 +209,7 @@ public class DeviceCheckController {
LinkCheckDetail lcd = rev2lcd(child, endTime, cas.reverse()); LinkCheckDetail lcd = rev2lcd(child, endTime, cas.reverse());
lcd.setCheckUnit(unitName); lcd.setCheckUnit(unitName);
if (child.getTitle().contains("统计确认待办任务")){ if (child.getTitle().contains("统计确认待办任务")) {
lcd.setCheckSituation("统计确认待办任务"); lcd.setCheckSituation("统计确认待办任务");
} }
...@@ -349,9 +349,9 @@ public class DeviceCheckController { ...@@ -349,9 +349,9 @@ public class DeviceCheckController {
} else if (revAreaStat.getComSituation() == 1) { } 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) {
lcd.setCheckSituation("无"); lcd.setCheckSituation("无");
}else { } else {
lcd.setCheckSituation("无误"); lcd.setCheckSituation("无误");
} }
} else { } else {
...@@ -390,9 +390,9 @@ public class DeviceCheckController { ...@@ -390,9 +390,9 @@ public class DeviceCheckController {
} else if (revAreaStat.getComSituation() == 1) { } 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) {
led.setCheckSituation("无"); led.setCheckSituation("无");
}else { } else {
led.setCheckSituation("无误"); led.setCheckSituation("无误");
} }
} else { } else {
...@@ -473,7 +473,7 @@ public class DeviceCheckController { ...@@ -473,7 +473,7 @@ public class DeviceCheckController {
DeviceCheckStat deviceCheckStat = statRepo.getOne(statId); DeviceCheckStat deviceCheckStat = statRepo.getOne(statId);
String title = deviceCheckStat.getTitle(); String title = deviceCheckStat.getTitle();
String remark = deviceCheckStat.getRemark(); String remark = deviceCheckStat.getRemark();
return ResponseEntity.ok(new CheckTitleAndTimeVo(title, deviceCheckStat.getEndTime(),remark)); return ResponseEntity.ok(new CheckTitleAndTimeVo(title, deviceCheckStat.getEndTime(), remark));
} }
@ApiOperation(value = "发起自动核查", notes = "发起自动核查") @ApiOperation(value = "发起自动核查", notes = "发起自动核查")
...@@ -485,7 +485,7 @@ public class DeviceCheckController { ...@@ -485,7 +485,7 @@ public class DeviceCheckController {
@ApiOperation(value = "根据地区ID获取下级的单位", notes = "根据地区ID获取下级的单位") @ApiOperation(value = "根据地区ID获取下级的单位", notes = "根据地区ID获取下级的单位")
@GetMapping("/under/{areaId}") @GetMapping("/under/{areaId}")
public ResponseEntity getUnitsUnderAreaId(@PathVariable Integer areaId){ public ResponseEntity getUnitsUnderAreaId(@PathVariable Integer areaId) {
//1.获取child AreaId List //1.获取child AreaId List
List<Integer> areaIds = areaRepo.findAllByFatherId(areaId).stream() List<Integer> areaIds = areaRepo.findAllByFatherId(areaId).stream()
.map(Area::getId) .map(Area::getId)
...@@ -500,7 +500,7 @@ public class DeviceCheckController { ...@@ -500,7 +500,7 @@ public class DeviceCheckController {
@ApiOperation(value = "检查地区是否发起核查", notes = "检查地区是否发起核查") @ApiOperation(value = "检查地区是否发起核查", notes = "检查地区是否发起核查")
@PostMapping("/checkPossible") @PostMapping("/checkPossible")
public ResponseEntity checkPossible(@RequestBody UnitIds uuid){ public ResponseEntity checkPossible(@RequestBody UnitIds uuid) {
List<String> unitNames = uuid.getIds().stream() List<String> unitNames = uuid.getIds().stream()
.map(id -> auService.findOne(AuExample.UnitId, id)) .map(id -> auService.findOne(AuExample.UnitId, id))
.map(AreaUnit::getUnitName) .map(AreaUnit::getUnitName)
...@@ -511,7 +511,7 @@ public class DeviceCheckController { ...@@ -511,7 +511,7 @@ public class DeviceCheckController {
for (String unitName : unitNames) { for (String unitName : unitNames) {
List<DeviceLibrary> devices = deviceRepo.findAllByOwnUnit(unitName); List<DeviceLibrary> devices = deviceRepo.findAllByOwnUnit(unitName);
if (devices.size() == 0){ if (devices.size() == 0) {
findEmpty = true; findEmpty = true;
alertString += unitName + " "; alertString += unitName + " ";
} }
...@@ -554,7 +554,7 @@ public class DeviceCheckController { ...@@ -554,7 +554,7 @@ public class DeviceCheckController {
provStatTask.setCustomInfo("check"); provStatTask.setCustomInfo("check");
provStatTask = taskService.start(provStatTask); provStatTask = taskService.start(provStatTask);
desMap.put(provStatTask.getId(),ccVO.getRemark()); desMap.put(provStatTask.getId(), ccVO.getRemark());
//构建市的检查任务(level=2) //构建市的检查任务(level=2)
List<Units> examCheckUnits = checkedUnits.stream() List<Units> examCheckUnits = checkedUnits.stream()
.filter(units -> Arrays.asList(2).contains(units.getLevel())) .filter(units -> Arrays.asList(2).contains(units.getLevel()))
...@@ -735,7 +735,7 @@ public class DeviceCheckController { ...@@ -735,7 +735,7 @@ public class DeviceCheckController {
Units unit = unitsRepo.findById(ed.getUnitId()).get(); Units unit = unitsRepo.findById(ed.getUnitId()).get();
String names = ed.getUserNames().stream().collect(joining(",")); String names = ed.getUserNames().stream().collect(joining(","));
// 3-1 构建被查单位的 自查账单 // 3-1 构建被查单位的 自查账单
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + ed.getRemark(), ceVo.getTitle()+"%^&"+ed.getRemark(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>())); DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + ed.getRemark(), ceVo.getTitle() + "%^&" + ed.getRemark(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail detail = detailRepo.save(unitDetailDoc); DeviceCheckDetail detail = detailRepo.save(unitDetailDoc);
detailIds.add(detail.getId()); detailIds.add(detail.getId());
// 将id放入统计中去 model -> areaName -> detailId // 将id放入统计中去 model -> areaName -> detailId
...@@ -752,9 +752,9 @@ public class DeviceCheckController { ...@@ -752,9 +752,9 @@ public class DeviceCheckController {
// 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态) // 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态)
TaskBto checkedTask = new TaskBto(CHECK_EXAM_DETAIL_0.id, "自核查任务", cityStatTask.getId(), addNode(cityStatTask.getNodeIdDetail(), cityStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0); TaskBto checkedTask = new TaskBto(CHECK_EXAM_DETAIL_0.id, "自核查任务", cityStatTask.getId(), addNode(cityStatTask.getNodeIdDetail(), cityStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0);
checkedTask.setCustomInfo("manual"); checkedTask.setCustomInfo("manual");
checkedTask=taskService.start(checkedTask); checkedTask = taskService.start(checkedTask);
desBillMap.put(detail.getId(),ed.getRemark()); desBillMap.put(detail.getId(), ed.getRemark());
desMap.put(checkedTask.getId(),ed.getRemark()); desMap.put(checkedTask.getId(), ed.getRemark());
} }
// 4. 重新设置并保存统计账单 // 4. 重新设置并保存统计账单
...@@ -772,17 +772,17 @@ public class DeviceCheckController { ...@@ -772,17 +772,17 @@ public class DeviceCheckController {
*/ */
@ApiOperation(value = "根据taskId查询Remark", notes = "根据taskId查询Remark") @ApiOperation(value = "根据taskId查询Remark", notes = "根据taskId查询Remark")
@GetMapping("/selectRemark/{taskId}") @GetMapping("/selectRemark/{taskId}")
public ResponseEntity selectRemark(@PathVariable Integer taskId){ public ResponseEntity selectRemark(@PathVariable Integer taskId) {
TaskBto taskBto=selectProvTask(taskId); TaskBto taskBto = selectProvTask(taskId);
Optional<DeviceCheckStat> optional= statRepo.findById(taskBto.getBillId()); Optional<DeviceCheckStat> optional = statRepo.findById(taskBto.getBillId());
if (optional.isPresent()){ if (optional.isPresent()) {
DeviceCheckStat deviceCheckStat=optional.get(); DeviceCheckStat deviceCheckStat = optional.get();
if (deviceCheckStat.getCheckType().getId()==0){ if (deviceCheckStat.getCheckType().getId() == 0) {
return ResponseEntity.ok(desMap.get(taskBto.getId())); return ResponseEntity.ok(desMap.get(taskBto.getId()));
}else { } else {
return ResponseEntity.ok(desMap.get(taskId)); return ResponseEntity.ok(desMap.get(taskId));
} }
}else { } else {
throw new ApiException(ResponseEntity.status(500).body("没有找到id")); throw new ApiException(ResponseEntity.status(500).body("没有找到id"));
} }
...@@ -794,22 +794,21 @@ public class DeviceCheckController { ...@@ -794,22 +794,21 @@ public class DeviceCheckController {
*/ */
@ApiOperation(value = "根据BillId查询Remark", notes = "根据taskId查询Remark") @ApiOperation(value = "根据BillId查询Remark", notes = "根据taskId查询Remark")
@GetMapping("/selectRemarkBill/{billId}") @GetMapping("/selectRemarkBill/{billId}")
public ResponseEntity selectRemarkBill(@PathVariable Integer billId){ public ResponseEntity selectRemarkBill(@PathVariable Integer billId) {
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) {
return taskBto; return taskBto;
} }
return selectProvTask(taskBto.getParentTaskId()); return selectProvTask(taskBto.getParentTaskId());
} }
/** /**
* 对于专员A来说的逻辑 * 对于专员A来说的逻辑
* 1. 修改detailString * 1. 修改detailString
...@@ -829,7 +828,7 @@ public class DeviceCheckController { ...@@ -829,7 +828,7 @@ public class DeviceCheckController {
String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary()); String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary());
User currentUser = Objects.requireNonNull(authenticationUtils.getAuthentication()).getCurrentUserInfo(); User currentUser = Objects.requireNonNull(authenticationUtils.getAuthentication()).getCurrentUserInfo();
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.updateCheckDetail(id, detailString, checkResult, currentUser.getUserId(), assignUserId, (int) count); detailRepo.updateCheckDetail(id, detailString, checkResult, currentUser.getUserId(), assignUserId, (int) count);
//2. 推进TASK 状态 //2. 推进TASK 状态
...@@ -905,10 +904,10 @@ public class DeviceCheckController { ...@@ -905,10 +904,10 @@ public class DeviceCheckController {
@RequestParam(required = false, defaultValue = "0") int isUpdate, @RequestParam(required = false, defaultValue = "0") int isUpdate,
@RequestParam String checkResult, @RequestParam String checkResult,
@RequestBody DetailVo detailVo @RequestBody DetailVo detailVo
) { ) {
List<FileRet> checkFiles = detailVo.getCheckFiles(); List<FileRet> checkFiles = detailVo.getCheckFiles();
DevLibVo devLibVo = detailVo.getDevLibVo(); DevLibVo devLibVo = detailVo.getDevLibVo();
log.info("[核查模块] 专管员B正在进行核查操作,核查账单id为 {} ,且审核状态为 : {}", id, checkStatus == 1 ? "通过" : "不通过"); log.info("[核查模块] 专管员B正在进行核查操作,核查账单id为 {} ,且审核状态为 : {}", id, checkStatus == 1 ? "通过" : "不通过");
if (checkStatus == 0) { if (checkStatus == 0) {
return ResponseEntity.status(400).body(new ResultObj<>("checkStatus不应该为0!")); return ResponseEntity.status(400).body(new ResultObj<>("checkStatus不应该为0!"));
...@@ -932,10 +931,10 @@ public class DeviceCheckController { ...@@ -932,10 +931,10 @@ public class DeviceCheckController {
String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary()); String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary());
User currentUser = Objects.requireNonNull(authenticationUtils.getAuthentication()).getCurrentUserInfo(); User currentUser = Objects.requireNonNull(authenticationUtils.getAuthentication()).getCurrentUserInfo();
long count = devLibVo.getDevInLibrary().stream() long count = devLibVo.getDevInLibrary().stream()
.filter(deviceInLibVo -> deviceInLibVo.getProofResult() %10 !=9) .filter(deviceInLibVo -> deviceInLibVo.getProofResult() % 10 != 9)
.count(); .count();
log.info("[核查模块] 检测到专管员B人工核查修改了核查结果,实查装备数量为 : {}",count); log.info("[核查模块] 检测到专管员B人工核查修改了核查结果,实查装备数量为 : {}", count);
detailRepo.updateCheckDetail4Check(id, detailString, checkResult, (int) count); detailRepo.updateCheckDetail4Check(id, detailString, checkResult, (int) count);
} }
...@@ -958,8 +957,8 @@ public class DeviceCheckController { ...@@ -958,8 +957,8 @@ public class DeviceCheckController {
} else { } else {
// 如果是2流程的,则直接结束该任务 // 如果是2流程的,则直接结束该任务
log.info("[核查模块] 该详情任务是一个2流程任务,结束任务并统计数据..."); log.info("[核查模块] 该详情任务是一个2流程任务,结束任务并统计数据...");
summaryDetail(currentTask, currentDetail);
taskService.moveToEnd(currentTask); taskService.moveToEnd(currentTask);
summaryDetail(currentTask, currentDetail);
} }
} else { } else {
//不通过则回到第一阶段 //不通过则回到第一阶段
...@@ -1063,6 +1062,16 @@ public class DeviceCheckController { ...@@ -1063,6 +1062,16 @@ public class DeviceCheckController {
//2.办结待办 //2.办结待办
taskService.moveToEnd(cityDoneTask); taskService.moveToEnd(cityDoneTask);
//3.如果所有省级的子任务都完成了
boolean over = taskService.TaskTreeIsOver(cityTask.getParentTaskId());
if (over){
log.info("[核查模块] 所有的省级子任务都完成了,将省统计任务变为待办");
TaskBto provTask = taskService.get(cityTask.getParentTaskId());
provTask.getInvolveUserIdList().add(0);
provTask.setCurrentPoint(provTask.getCurrentPoint() + 1);
taskService.update(provTask);
}
log.info("[核查模块] 办结统计待办操作成功"); log.info("[核查模块] 办结统计待办操作成功");
return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕")); return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕"));
} }
...@@ -1155,9 +1164,10 @@ public class DeviceCheckController { ...@@ -1155,9 +1164,10 @@ public class DeviceCheckController {
//如果上一个id是-1 则证明是所有人的跟踪统计,即自动核查,那么下一步推进到所有人的跟踪,否则设置为-2,即维持跟踪者id //如果上一个id是-1 则证明是所有人的跟踪统计,即自动核查,那么下一步推进到所有人的跟踪,否则设置为-2,即维持跟踪者id
Integer lastUserId = fatherTask.getLastUserId() == -1 ? -1 : -2; Integer lastUserId = fatherTask.getLastUserId() == -1 ? -1 : -2;
TaskBto newFatherTask = taskService.moveToNext(fatherTask, lastUserId); TaskBto newFatherTask = taskService.moveToNext(fatherTask, lastUserId);
// newFatherTask.getInvolveUserIdList().add(0); // 将父级的统计任务变为待办
// newFatherTask.setCurrentPoint(newFatherTask.getCurrentPoint() + 1); newFatherTask.getInvolveUserIdList().add(0);
// taskService.update(newFatherTask); newFatherTask.setCurrentPoint(newFatherTask.getCurrentPoint() + 1);
taskService.update(newFatherTask);
} }
log.info("[核查模块] 数据汇总完毕"); log.info("[核查模块] 数据汇总完毕");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论