提交 f1ba3b61 authored 作者: zhoushaopan's avatar zhoushaopan

fix(自查模块): 自查完成终止系统发起的自查

自查完成终止系统发起的自查
上级 fca1c484
...@@ -27,6 +27,7 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao; ...@@ -27,6 +27,7 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService; 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.selfcheck.service.SelfCheckBillService;
import com.tykj.dev.device.task.repository.TaskDao; import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.repository.TaskLogDao; import com.tykj.dev.device.task.repository.TaskLogDao;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
...@@ -69,6 +70,7 @@ import org.springframework.http.ResponseEntity; ...@@ -69,6 +70,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.*; import java.util.*;
...@@ -158,6 +160,9 @@ public class DeviceCheckController { ...@@ -158,6 +160,9 @@ public class DeviceCheckController {
@Autowired @Autowired
private HistoryCheckDeviceService historyCheckDeviceService; private HistoryCheckDeviceService historyCheckDeviceService;
@Resource
private SelfCheckBillService selfCheckBillService;
@GetMapping("/escow/taskLog") @GetMapping("/escow/taskLog")
@ApiOperation(value = "添加阅知信息:终止检查/核查任务") @ApiOperation(value = "添加阅知信息:终止检查/核查任务")
public ResponseEntity fixEscowTaskLog(@RequestParam Integer detailId) { public ResponseEntity fixEscowTaskLog(@RequestParam Integer detailId) {
...@@ -1084,6 +1089,8 @@ public class DeviceCheckController { ...@@ -1084,6 +1089,8 @@ public class DeviceCheckController {
// todo // todo
// statConfirm(taskRepo.findById(taskRepo.findByBillIdAndBusinessType(id, 8).get().getParentTaskId()).get().getBillId()); // statConfirm(taskRepo.findById(taskRepo.findByBillIdAndBusinessType(id, 8).get().getParentTaskId()).get().getBillId());
checkFixUntil.finishMinStatByChild(id); checkFixUntil.finishMinStatByChild(id);
//终止系统发起的自查
findBySystemStop();
} else { } else {
//不通过则回到第一阶段 //不通过则回到第一阶段
...@@ -1096,7 +1103,7 @@ public class DeviceCheckController { ...@@ -1096,7 +1103,7 @@ public class DeviceCheckController {
} }
log.info("[核查模块] 专管员B操作成功"); log.info("[核查模块] 专管员B操作成功");
//完结系统自查业务 //完结系统自查业务
findBySystem(); // findBySystem();
return ResponseEntity.ok(new ResultObj<>("专管B操作成功")); return ResponseEntity.ok(new ResultObj<>("专管B操作成功"));
} }
...@@ -2436,6 +2443,10 @@ public class DeviceCheckController { ...@@ -2436,6 +2443,10 @@ public class DeviceCheckController {
selfCheckController.findBySystem1(); selfCheckController.findBySystem1();
} }
private void findBySystemStop() {
selfCheckBillService.findBySystemStop();
}
/** /**
* find unit's name by detail's unitId * find unit's name by detail's unitId
* *
......
...@@ -262,6 +262,8 @@ public enum StatusEnum { ...@@ -262,6 +262,8 @@ public enum StatusEnum {
WAITAPPLYTASKTOEND(512,"申请任务待办结"), WAITAPPLYTASKTOEND(512,"申请任务待办结"),
SELF_CHECK_STOP(513,"自查终止"),
// /** // /**
// * 等待上传申请回执单 // * 等待上传申请回执单
// */ // */
......
...@@ -85,4 +85,16 @@ public interface SelfCheckBillService { ...@@ -85,4 +85,16 @@ public interface SelfCheckBillService {
void historyUpperChain(); void historyUpperChain();
boolean checkTrueData(Integer billId); boolean checkTrueData(Integer billId);
/**
* 查询未完成的系统发起自查任务 并进行自动完结
* @return
*/
void getNoFinShBySystem();
/**
* 查询未完成的系统发起自查任务 并进行终止
*/
void findBySystemStop();
} }
...@@ -32,6 +32,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo; ...@@ -32,6 +32,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo; import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo; import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.user.cache.UserCache; import com.tykj.dev.device.user.cache.UserCache;
...@@ -57,6 +58,7 @@ import org.springframework.data.jpa.domain.Specification; ...@@ -57,6 +58,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.Transient; import javax.persistence.Transient;
...@@ -116,7 +118,7 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService { ...@@ -116,7 +118,7 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Override @Override
public SelfCheckBill addEntity(SelfCheckBill selfExaminationBillEntity) { public SelfCheckBill addEntity(SelfCheckBill selfExaminationBillEntity) {
SelfCheckBill selfCheckBill = selfExaminationBillDao.save(selfExaminationBillEntity); SelfCheckBill selfCheckBill = selfExaminationBillDao.save(selfExaminationBillEntity);
sendText(selfCheckBill.getId()); // sendText(selfCheckBill.getId());
return selfCheckBill; return selfCheckBill;
} }
...@@ -416,6 +418,54 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService { ...@@ -416,6 +418,54 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
return blockDataService.contrast(blockTraceabilityParsing); return blockDataService.contrast(blockTraceabilityParsing);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void getNoFinShBySystem() {
// LocalDate now = LocalDate.now();
LocalDate now = LocalDate.parse("2023-10-07");
List<SelfCheckBill> billList = selfExaminationBillDao.findAll()
.stream()
.filter(selfCheckBill -> selfCheckBill.getCycle() == 2 && selfCheckBill.getCheckStatus() == 3 &&
selfCheckBill.getTitle().contains("系统发起") &&
DateUtil.getLocalDate(selfCheckBill.getCreateTime()).plusMonths(1).equals(now))
.collect(Collectors.toList());
if (billList.size() > 0) {
log.info("[自查模块]:自动完结自查定时任务开始执行");
billList.forEach(selfCheckBill -> selfCheckBill.setCheckStatus(4));
List<Integer> billIdList = billList.stream()
.map(SelfCheckBill::getId)
.distinct()
.collect(Collectors.toList());
List<TaskBto> taskBtoList = taskService.findBillIdAndBillType(billIdList, 4);
taskBtoList.forEach(taskBto -> {
taskService.moveToStop(taskBto);
});
selfExaminationBillDao.saveAll(billList);
log.info("[自查模块]:自动完结自查定时任务执行完成");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void findBySystemStop() {
//通过billId和businessType 和 ownUnit
List<Task> allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(4, userUtils.getCurrentUnitId());
if (allByBillAndBusinessTypeAndOwnUnit.size()>0){
for (Task task : allByBillAndBusinessTypeAndOwnUnit) {
taskService.moveToArchive(task.parse2Bto());
SelfCheckBill selfCheckBill = getOne(task.getBillId());
if (selfCheckBill !=null){
//业务设置为终止
selfCheckBill.setCheckStatus(4);
selfExaminationBillDao.save(selfCheckBill);
}
}
}
}
@Override @Override
public BlockTraceabilityParsing traceabilityParsing(Integer billId) { public BlockTraceabilityParsing traceabilityParsing(Integer billId) {
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.SELF_CHECK.id, billId); BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.SELF_CHECK.id, billId);
......
...@@ -97,7 +97,7 @@ public class SelfCheckBill { ...@@ -97,7 +97,7 @@ public class SelfCheckBill {
@ApiModelProperty(value = "非在库装备转JSon") @ApiModelProperty(value = "非在库装备转JSon")
private String unStockDetail; private String unStockDetail;
/** /**
* 自查状态(0:待审核,1:审核失败,2:自查完成,3:未检) * 自查状态(0:待审核,1:审核失败,2:自查完成,3:未检 4:终止)
*/ */
@ApiModelProperty(value = "自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)") @ApiModelProperty(value = "自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)")
private Integer checkStatus; private Integer checkStatus;
......
...@@ -276,4 +276,9 @@ public interface TaskService { ...@@ -276,4 +276,9 @@ public interface TaskService {
*/ */
Task findByParentId(Integer parentTaskId); Task findByParentId(Integer parentTaskId);
/**
* 业务终止封存
*/
void moveToStop(TaskBto taskBto);
} }
...@@ -42,6 +42,7 @@ import org.springframework.data.jpa.domain.Specification; ...@@ -42,6 +42,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
...@@ -654,11 +655,13 @@ public class TaskServiceImpl implements TaskService { ...@@ -654,11 +655,13 @@ public class TaskServiceImpl implements TaskService {
if (taskSelectVo.getAreaId()!=null){ if (taskSelectVo.getAreaId()!=null){
List<Integer> unitIds= userPublicService.findByAreaExhibitionIdSubordinateAll(taskSelectVo.getAreaId()).stream().map(Units::getUnitId).collect(Collectors.toList()); List<Integer> unitIds= userPublicService.findByAreaExhibitionIdSubordinateAll(taskSelectVo.getAreaId()).stream().map(Units::getUnitId).collect(Collectors.toList());
List<Integer> userIDs= userCache.findAllByUnitsIdIn(unitIds).stream().map(User::getUserId).collect(Collectors.toList()); List<Integer> userIDs= userCache.findAllByUnitsIdIn(unitIds).stream().map(User::getUserId).collect(Collectors.toList());
taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId())).collect(Collectors.toList()); // taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId())).collect(Collectors.toList());
taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId()) || taskUserVo.getCreateUserId() == null).collect(Collectors.toList());
} }
if (taskSelectVo.getUnitId()!=null){ if (taskSelectVo.getUnitId()!=null){
List<Integer> userIDs= userService.findAllByUnitId(taskSelectVo.getUnitId()).stream().map(User::getUserId).collect(Collectors.toList()); List<Integer> userIDs= userService.findAllByUnitId(taskSelectVo.getUnitId()).stream().map(User::getUserId).collect(Collectors.toList());
taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId())).collect(Collectors.toList()); // taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId())).collect(Collectors.toList());
taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId()) || taskUserVo.getCreateUserId() == null).collect(Collectors.toList());
} }
taskUserVos = taskUserVos.stream() taskUserVos = taskUserVos.stream()
...@@ -1244,6 +1247,13 @@ public class TaskServiceImpl implements TaskService { ...@@ -1244,6 +1247,13 @@ public class TaskServiceImpl implements TaskService {
return taskDao.findByParentTaskId(parentTaskId); return taskDao.findByParentTaskId(parentTaskId);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void moveToStop(TaskBto taskBto) {
taskBto.setBillStatus(StatusEnum.SELF_CHECK_STOP.id);
update(taskBto);
}
@Override @Override
public void moveAllSonNodeToEnd(Integer taskId) { public void moveAllSonNodeToEnd(Integer taskId) {
List<Task> tasks = taskDao.findAllByParentTaskId(taskId); List<Task> tasks = taskDao.findAllByParentTaskId(taskId);
...@@ -1273,7 +1283,8 @@ public class TaskServiceImpl implements TaskService { ...@@ -1273,7 +1283,8 @@ public class TaskServiceImpl implements TaskService {
.filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id)) .filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id))
&& (!task.getBillStatus().equals(StatusEnum.ARCHIVE.id)) && (!task.getBillStatus().equals(StatusEnum.ARCHIVE.id))
&& (!task.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id)) && (!task.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id))
&& (!task.getBillStatus().equals(StatusEnum.CHECK_SHUT_DOWN.id))) && (!task.getBillStatus().equals(StatusEnum.CHECK_SHUT_DOWN.id))
&& (!task.getBillStatus().equals(StatusEnum.SELF_CHECK_STOP.id)))
.filter(o -> { .filter(o -> {
if (o.getExhibit() == null) { if (o.getExhibit() == null) {
return true; return true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论