提交 82e0d0f1 authored 作者: ljj's avatar ljj

fix(check): 更新退回后统计状态显示问题

上级 53bbd1b0
package com.tykj.dev.device.confirmcheck.controller;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.misc.base.StatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
*
* 修复bug新涉及的一些方法
*
* @AUTHOR: cnljj1995@gmail.com
* @DATE: 2023/3/28
*/
@Component
@Slf4j
public class CheckFixUntil {
@Autowired
private TaskDao taskDao;
@Autowired
private DeviceCheckDetailDao detailDao;
@Autowired
private TaskService taskService;
/**
* 根据detail id自动结算上级detail的状态
* @param billId detail的id
*/
public void finishMinStatByChild(Integer billId) {
Task detailTask = taskDao.findByBillIdAndBusinessType(billId, 8).get();
List<Task> allTask = taskDao.findAllByParentTaskId(detailTask.getParentTaskId());
boolean tag = allTask.stream().parallel().allMatch(o -> o.getBillStatus().equals(StatusEnum.END.id));
if (tag) {
Task father = taskDao.findById(detailTask.getParentTaskId()).get();
father.setBillStatus(StatusEnum.END.id);
taskDao.save(father);
}
}
}
......@@ -92,6 +92,8 @@ import static java.util.stream.Collectors.*;
public class DeviceCheckController {
@Autowired
private CheckFixUntil checkFixUntil;
@Autowired
private ConfirmCheckTask confirmCheckTask;
......@@ -359,7 +361,7 @@ public class DeviceCheckController {
filter = 0;
}
CheckDetailVo detailVoList = transUtil.CheckDetailDo2Vo(byId);
CheckDetailVo detailVoList = transUtil.CheckDetailDo2Vo(byId);
// byId
// .map(transUtil::CheckDetailDo2Vo)
// .orElse(null);
......@@ -1070,8 +1072,12 @@ public class DeviceCheckController {
if (unitsService.isProvUnit(currentTask.getOwnUnit())) {
provAudit(currentDetail.getId(), true);
}
}
// todo
// statConfirm(taskRepo.findById(taskRepo.findByBillIdAndBusinessType(id, 8).get().getParentTaskId()).get().getBillId());
checkFixUntil.finishMinStatByChild(id);
} else {
//不通过则回到第一阶段
log.info("[核查模块] 核查员B退回自查任务...");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论