提交 d991f2cf authored 作者: ljj234's avatar ljj234

refactor: 修改核查模块(重构)

上级 dab1be1f
......@@ -36,6 +36,7 @@ import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.base.enums.AuExample;
import com.tykj.dev.device.user.base.ret.UserShenRe;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.user.cache.AreaExhibitionCache;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
......@@ -97,6 +98,8 @@ public class DeviceCheckController {
private int specialDetailId = 0;
private List<String> specialUnits = new ArrayList<>();
@Autowired
AreaExhibitionCache areaExhibitionCache;
@Autowired
private UnitsCache unitsCache;
......@@ -147,13 +150,13 @@ public class DeviceCheckController {
@GetMapping("/msg")
@ApiOperation(value = "添加阅知信息:终止检查/核查任务")
public ResponseEntity sendMsg(@RequestParam Integer billId,@RequestParam Integer type) {
public ResponseEntity sendMsg(@RequestParam Integer billId, @RequestParam Integer type) {
Optional<Task> taskOpt = taskRepo.findByBillIdAndBusinessType(billId, type);
Task node = taskOpt.orElseThrow(() -> new ApiException("查询的任务不存在"));
// 生成终止任务的信息
String billCunstom = "check".equals(node.getCustomInfo())? "核查" : "检查";
String billCunstom = "check".equals(node.getCustomInfo()) ? "核查" : "检查";
String title = node.getTitle().split("]")[1];
String adminUser = authenticationUtils.getAuthentication().getCurrentUserInfo().getName();
String shutDownMsg = adminUser + "终止" + billCunstom + "任务:【" + title + "】";
......@@ -165,7 +168,7 @@ public class DeviceCheckController {
List<Task> secondNode = taskRepo.findAllByParentTaskId(node.getId());
// 三级任务对象
if (secondNode!= null && !secondNode.isEmpty()) {
if (secondNode != null && !secondNode.isEmpty()) {
List<Task> thridNode = taskRepo.findAllByParentTaskIdIn(secondNode.stream().map(Task::getId).collect(toList()));
if (thridNode != null && !thridNode.isEmpty()) {
// 这里处理市终止区检查任务的情况
......@@ -194,7 +197,7 @@ public class DeviceCheckController {
}
// 发送阅知
MessageBto msgBto = new MessageBto(node.getId(), node.getBusinessType(), shutDownMsg, rsUserIds.stream().distinct().collect(toList()));
MessageBto msgBto = new MessageBto(-1, node.getBusinessType(), shutDownMsg, rsUserIds.stream().distinct().collect(toList()));
messageService.add(msgBto);
return ResponseEntity.ok("ok");
......@@ -435,7 +438,7 @@ public class DeviceCheckController {
* 1 - 统计跳转
* 1-1 省核查页面 - 市的检查以及省直属的自查任务
* 2 - 详情跳转
*
* <p>
* type: 1_省核查 2_两级的省检查 3_核查下面的市检查 4_市检查
*
* @param type 7 统计
......@@ -486,7 +489,7 @@ public class DeviceCheckController {
// checkType = 0 核查,checkType = 1 检查
if (ctVo.getCheckType() == 0 || (ctVo.getCheckType() == 1 && unitsService.isProvUnit(rootTask.getOwnUnit()))) {
if (ctVo.getCheckType() == 0 ) {
if (ctVo.getCheckType() == 0) {
linkVo.setType(1);
}
// 根据tpye和billId找到父级节点 - 默认了最顶级的省核查节点应当为一个
......@@ -636,7 +639,7 @@ public class DeviceCheckController {
Integer createUserId = ctVo.getCreateUserId();
Integer ownUnit = rootTask.getOwnUnit();
linkVo.setType(4);
linkVo.setType(4);
// 找到所有的子节点
List<Task> childTask = taskRepo.findAllByParentTaskId(rootTask.getId());
......@@ -654,7 +657,7 @@ public class DeviceCheckController {
.examName("")
.examUser("")
.checkResult("无误")
.checkUnit(split[0].replace("[",""))
.checkUnit(split[0].replace("[", ""))
.checkSituation("211")
.id(child.getBillId())
.remark(1)
......@@ -675,6 +678,9 @@ public class DeviceCheckController {
}
}
List<LinkExamDetail> ledVo = linkVo.getLeDetail().stream().sorted(Comparator.comparing(LinkExamDetail::getId)).collect(toList());
linkVo.setLeDetail(ledVo);
//将此次使用的linkVo更新
DeviceCheckLink updateLink = linkRepo.findByStatId(billId).orElse(new DeviceCheckLink());
updateLink.setLinkText(JSON.toJSONStringWithDateFormat(linkVo, "yyyy-MM-dd"));
......@@ -862,13 +868,15 @@ public class DeviceCheckController {
@RequestParam int checkStatus,
@RequestParam(required = false, defaultValue = "0") int checkUserAId,
@RequestParam(required = false, defaultValue = "0") int checkUserBId,
@RequestParam(required = false, defaultValue = "") String checkUserCName,
@RequestParam(required = false, defaultValue = "") String checkUserDName,
@RequestParam(required = false, defaultValue = "") String checkUserEName,
@RequestParam(required = false, defaultValue = "0") int isUpdate,
@RequestParam String checkResult,
@RequestBody DetailVo detailVo
) {
String checkUserCName = detailVo.getCheckUserCName();
String checkUserDName = detailVo.getCheckUserDName();
String checkUserEName = detailVo.getCheckUserEName();
// 0:待核查,1:审核失败,2:核查完成
List<FileRet> checkFiles = detailVo.getCheckFiles();
......@@ -878,11 +886,11 @@ public class DeviceCheckController {
return ResponseEntity.status(400).body(new ResultObj<>("checkStatus不应该为0!"));
}
detailRepo.updateCheckUserCDE(id,checkUserCName,checkUserDName,checkUserEName);
detailRepo.updateCheckUserCDE(id, checkUserCName, checkUserDName, checkUserEName);
//先更新checkUser
if (checkUserAId > 0 && checkUserBId > 0) {
detailRepo.updateCheckUserAbc(id, checkUserAId, checkUserBId, checkUserCName,checkUserDName,checkUserEName);
detailRepo.updateCheckUserAbc(id, checkUserAId, checkUserBId, checkUserCName, checkUserDName, checkUserEName);
}
// 审核通过与不通过的逻辑不同
......@@ -950,7 +958,7 @@ public class DeviceCheckController {
/**
* 市人员审核区自查数据的接口
*
* <p>
* 市 审核 区
*
* @param detailId
......@@ -969,7 +977,7 @@ public class DeviceCheckController {
if (pass) {
// 通过的话就推进任务进度,合并数据
log.info("[核查模块] 市专管员审核通过,结束 {} 区的自查任务并汇总数据", unitsRepo.findById(currentDetail.getCheckUnitId()).get().getName());
taskService.moveToSpecial(currentTask,END);
taskService.moveToSpecial(currentTask, END);
Integer userId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId();
currentDetail.setUserCId(userId);
currentDetail = detailRepo.save(currentDetail);
......@@ -1086,7 +1094,7 @@ public class DeviceCheckController {
// 1级节点分为两类 自查类节点&统计数据确认节点 以及 检查类节点
List<Task> l1Childs = taskRepo.findAllByParentTaskId(checkTask.getId());
for (Task c1 : l1Childs) {
if (predNodeType(c1).equals(CcNodeType.EXAM)) {
if (predNodeType(c1).equals(CcNodeType.EXAM) || predNodeType(c1).equals(CcNodeType.CHECK)) {
// c1里的检查节点也shutDown掉 并保存掉
unionLink(7, c1.getBillId());//save
taskService.moveToSpecial(c1.parse2Bto(), CHECK_SHUT_DOWN);
......@@ -1496,6 +1504,7 @@ public class DeviceCheckController {
/**
* 拼接待办,如[unit]title
*
* @param units unit
* @param title title
* @return [unit]title
......
......@@ -26,6 +26,7 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.base.enums.AuExample;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.user.cache.AreaExhibitionCache;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
......@@ -124,6 +125,9 @@ public class ExamController {
private TaskLogService taskLogService;
@Autowired
private UnitsService unitsService;
@Autowired
AreaExhibitionCache areaExhibitionCache;
@GetMapping("/check/confirm/escrow")
@ApiOperation(value = "判断task是否为代管单位的详情任务")
......@@ -131,7 +135,7 @@ public class ExamController {
Task task = taskRepo.findByBillIdAndBusinessType(billId, type).get();
if (task.getTitle().contains("[省直属单位]")) {
if (task.getTitle().contains("["+areaExhibitionCache.checkSpecial().get(2)+"]")) {
return ResponseEntity.ok(ImmutableMap.of("msg", true));
}
......@@ -312,7 +316,7 @@ public class ExamController {
// 3-1-2 构建省局单位的任务
TaskBto taskBtoPro = new Task(CHECK_EXAM_STAT_1.id,
"[省局单位]" + ceVo.getTitle(),
"["+areaExhibitionCache.checkSpecial().get(1)+"]" + ceVo.getTitle(),
cityStatTask.getId(), ".0.", CONFIRM_CHECK_STAT.id, proStatSave.getId(), startUnitId)
.parse2Bto();
taskBtoPro.setCustomInfo(isExam ? "exam" : "check");
......@@ -382,7 +386,7 @@ public class ExamController {
// 3-2-2 构建省直单位的任务
TaskBto taskBtoEs = new Task(CHECK_EXAM_STAT_1.id,
"[省直属单位]" + ceVo.getTitle(),
"["+ areaExhibitionCache.checkSpecial().get(2) +"]" + ceVo.getTitle(),
cityStatTask.getId(), ".0.", CONFIRM_CHECK_STAT.id, esStatSave.getId(),
// 省直单位的检查任务应该给省里
unitsRepo.findAllByTypeAndLevel(1, 1).get(0).getUnitId()).parse2Bto();
......@@ -500,7 +504,8 @@ public class ExamController {
// 3-4 核查,对市县进行核查的逻辑,需判断是否勾选了市级单位
if (!isExam && (checkedUnits.stream().anyMatch(o -> o.getLevel() == 2))) {
// 找到市相关的单位,包括市本级以及下级单位
List<Units> units = checkedUnits.stream().filter(o -> o.getLevel() == 2).collect(toList());
List<Units> units = checkedUnits.stream().filter(o -> o.getLevel() == 2)
.sorted(Comparator.comparing(Units::getShowOrder)).collect(toList());
log.info("[核查] 核查,生成市的统计及详情:{}", units.toString());
......@@ -536,7 +541,8 @@ public class ExamController {
// 2.创建单位的详情及任务
// 3-1-3 构建市单位的自查账单及任务
List<Units> unitsQu = unitsRepo.findAllById(existUnits);
List<Units> unitsQu = unitsRepo.findAllById(existUnits).stream()
.sorted(Comparator.comparing(Units::getShowOrder)).collect(toList());
for (Units qu : unitsQu) {
......
......@@ -20,4 +20,10 @@ public class DetailVo {
List<FileRet> checkFiles;
DevLibVo devLibVo;
private String checkUserCName;
private String checkUserDName;
private String checkUserEName;
}
......@@ -69,10 +69,12 @@ public class CheckUnitServiceImpl implements CheckUnitService {
}
);
}
log.info("[核查] 查询市单位:{}", checkCityUnits);
return ImmutableMap.of(1, provinceUnits, 2, esAUnits, 3, isExam ? cityUnits : checkCityUnits);
return ImmutableMap.of(1, provinceUnits.stream().sorted(Comparator.comparing(Units::getShowOrder)).collect(toList()),
2, esAUnits.stream().sorted(Comparator.comparing(Units::getShowOrder)).collect(toList()),
3, isExam ? cityUnits.stream().sorted(Comparator.comparing(Units::getShowOrder)).collect(toList())
: checkCityUnits.stream().sorted(Comparator.comparing(Units::getShowOrder)).collect(toList()));
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论