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

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

自查完成终止系统发起的自查
上级 fca1c484
......@@ -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.subject.domin.DeviceLibrary;
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.TaskLogDao;
import com.tykj.dev.device.task.service.TaskLogService;
......@@ -69,6 +70,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
......@@ -158,6 +160,9 @@ public class DeviceCheckController {
@Autowired
private HistoryCheckDeviceService historyCheckDeviceService;
@Resource
private SelfCheckBillService selfCheckBillService;
@GetMapping("/escow/taskLog")
@ApiOperation(value = "添加阅知信息:终止检查/核查任务")
public ResponseEntity fixEscowTaskLog(@RequestParam Integer detailId) {
......@@ -1084,6 +1089,8 @@ public class DeviceCheckController {
// todo
// statConfirm(taskRepo.findById(taskRepo.findByBillIdAndBusinessType(id, 8).get().getParentTaskId()).get().getBillId());
checkFixUntil.finishMinStatByChild(id);
//终止系统发起的自查
findBySystemStop();
} else {
//不通过则回到第一阶段
......@@ -1096,7 +1103,7 @@ public class DeviceCheckController {
}
log.info("[核查模块] 专管员B操作成功");
//完结系统自查业务
findBySystem();
// findBySystem();
return ResponseEntity.ok(new ResultObj<>("专管B操作成功"));
}
......@@ -2436,6 +2443,10 @@ public class DeviceCheckController {
selfCheckController.findBySystem1();
}
private void findBySystemStop() {
selfCheckBillService.findBySystemStop();
}
/**
* find unit's name by detail's unitId
*
......
......@@ -262,6 +262,8 @@ public enum StatusEnum {
WAITAPPLYTASKTOEND(512,"申请任务待办结"),
SELF_CHECK_STOP(513,"自查终止"),
// /**
// * 等待上传申请回执单
// */
......
......@@ -13,6 +13,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
......@@ -29,23 +30,23 @@ import java.util.concurrent.ScheduledFuture;
@Data
public class SelfCheckSchedulerTask {
private String cron = "0 0 0 1 1/3 ? ";
/**
* 月度
*/
private String cron1 = "0 0 0 1 1/1 ? ";
/**
* 季度
*/
private String cron2 = "0 0 0 1 1,4,7,10 ? ";
/**
* 年度
*/
private String cron3 = "0 0 0 1 1 ? ";
private String cron4 = "0 0/1 * * * ? ";
// private String cron = "0 0 0 1 1/3 ? ";
//
// /**
// * 月度
// */
// private String cron1 = "0 0 0 1 1/1 ? ";
// /**
// * 季度
// */
// private String cron2 = "0 0 0 1 1,4,7,10 ? ";
// /**
// * 年度
// */
// private String cron3 = "0 0 0 1 1 ? ";
//
// private String cron4 = "0 0/1 * * * ? ";
//
final UnitsDao unitsDao;
final TaskService taskService;
......@@ -57,44 +58,126 @@ public class SelfCheckSchedulerTask {
final SelfCheckBillService selfCheckBillService;
private ScheduledFuture scheduledFuture;
public SelfCheckSchedulerTask(UnitsDao unitsDao,TaskService taskService,SystemVariableService systemVariableService,SystemVariableDao systemVariableDao,SelfCheckBillService selfCheckBillService) {
this.unitsDao = unitsDao;
this.taskService = taskService;
this.systemVariableService = systemVariableService;
this.systemVariableDao = systemVariableDao;
this.selfCheckBillService = selfCheckBillService;
String value;
if (systemVariableDao.findAll().size()==0){
value = this.cron;
}
else {
value = Objects.requireNonNull(systemVariableService).getVaule("selfCheckCycle");
if (value.length()!=14){
value = cron;
}
}
// if ("month".equals(value)){
// setCron(cron1);
//
// //最终需求是改成每个季度的最后一个月的第一天开始执行
// private String corner = "0 0 0 1 3,9 ? *";
//
// public SelfCheckSchedulerTask(UnitsDao unitsDao,TaskService taskService,SystemVariableService systemVariableService,SystemVariableDao systemVariableDao,SelfCheckBillService selfCheckBillService) {
// this.unitsDao = unitsDao;
// this.taskService = taskService;
// this.systemVariableService = systemVariableService;
// this.systemVariableDao = systemVariableDao;
// this.selfCheckBillService = selfCheckBillService;
//// String value;
//// if (systemVariableDao.findAll().size()==0){
//// value = this.cron;
//// }
//// else {
//// value = Objects.requireNonNull(systemVariableService).getVaule("selfCheckCycle");
//// if (value.length()!=14){
//// value = cron;
//// }
//// }
//
//
//// if ("month".equals(value)){
//// setCron(cron1);
//// }
//// if ("quarter".equals(value)){
//// setCron(cron2);
//// }
//// if ("year".equals(value)){
//// setCron(cron3);
//// }
//// if ("minute".equals(value)){
//// setCron(cron4);
//// }
//// setCron(value);
// setCron(corner);
//// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(cron).nextExecutionTime(triggerContext));
// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(corner).nextExecutionTime(triggerContext));
// }
//
// public class SelfCheckTask implements Runnable{
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void run() {
// if (unitsDao != null && taskService!=null && selfCheckBillService!=null) {
// List<Units> unitsList = unitsDao.findAll();
// unitsList.forEach(units -> {
// //添加账单
// SelfCheckBill selfCheckBill = new SelfCheckBill();
// selfCheckBill.setCheckStatus(3);
// selfCheckBill.setCheckUnit(units.getName());
// selfCheckBill.setCheckUnitId(units.getUnitId());
// //add zsp
// selfCheckBill.setStorageLocationId(0);
// StringBuffer title = new StringBuffer();
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(new Date());
// int year = calendar.get(Calendar.YEAR);
// int month = calendar.get(Calendar.MONTH)+1;
// title.append("系统发起定时"+units.getName());
// title.append(year).append("年");
// title.append(month).append("月自查任务");
// //修改为永远是季度发起
// selfCheckBill.setCycle(2);
//// int type;
//// if (' '==cron.charAt(11)) {
//// type = Integer.parseInt(cron.substring(10,11));
//// }
//// else {
//// type = Integer.parseInt(cron.substring(10,12));
//// }
//// if (type==1) {
//// selfCheckBill.setCycle(1);
//// }
//// else if (type==3){
//// selfCheckBill.setCycle(2);
//// }
//// else if (type==12){
//// selfCheckBill.setCycle(3);
//// }
//// else {
//// selfCheckBill.setCycle(type+2);
//// }
//// if (cron.equals(cron1)){
//// title.append(month).append("月自查任务");
//// selfCheckBill.setCycle(1);
//// }
//// else if (cron.equals(cron2)){
//// title.append(getQuarter(month)).append("自查任务");
//// selfCheckBill.setCycle(2);
//// }
//// else if (cron.equals(cron3)){
//// title.append("自查任务");
//// selfCheckBill.setCycle(3);
//// }
//// else {
//// title.append("自查任务");
//// selfCheckBill.setCycle(0);
//// }
// selfCheckBill.setTitle(title.toString());
// SelfCheckBill selfCheckBill1 = selfCheckBillService.addEntity(selfCheckBill);
// //发起待自查任务
// List<Integer> userIds = new ArrayList<>();
// userIds.add(0);
// TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,title.toString(),null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds);
// taskService.start(taskBto);
// });
// }
// if ("quarter".equals(value)){
// setCron(cron2);
// log.info("[自查模块]:自查定时任务执行了");
// }
// if ("year".equals(value)){
// setCron(cron3);
// }
// if ("minute".equals(value)){
// setCron(cron4);
//
// public void startTask(){
//// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(cron).nextExecutionTime(triggerContext));
// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(corner).nextExecutionTime(triggerContext));
// }
setCron(value);
scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(cron).nextExecutionTime(triggerContext));
}
public class SelfCheckTask implements Runnable{
@Override
@Transactional(rollbackFor = Exception.class)
public void run() {
if (unitsDao != null && taskService!=null && selfCheckBillService!=null) {
@Scheduled(cron = "0 0 0 1 3,9 ?")
public void selfCheckStart() {
if (unitsDao != null && taskService != null && selfCheckBillService != null) {
List<Units> unitsList = unitsDao.findAll();
unitsList.forEach(units -> {
//添加账单
......@@ -104,64 +187,34 @@ public class SelfCheckSchedulerTask {
selfCheckBill.setCheckUnitId(units.getUnitId());
//add zsp
selfCheckBill.setStorageLocationId(0);
StringBuffer title = new StringBuffer();
StringBuilder title = new StringBuilder();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
title.append("系统发起定时"+units.getName());
title.append(year).append("年");
title.append(month).append("月自查任务");
int type;
if (' '==cron.charAt(11)) {
type = Integer.parseInt(cron.substring(10,11));
}
else {
type = Integer.parseInt(cron.substring(10,12));
}
if (type==1) {
selfCheckBill.setCycle(1);
}
else if (type==3){
int month = calendar.get(Calendar.MONTH) + 1;
title.append("系统发起定时")
.append(units.getName())
.append(units.getName())
.append(year).append("年")
.append(month).append("月自查任务");
//修改为永远是季度发起
selfCheckBill.setCycle(2);
}
else if (type==12){
selfCheckBill.setCycle(3);
}
else {
selfCheckBill.setCycle(type+2);
}
// if (cron.equals(cron1)){
// title.append(month).append("月自查任务");
// selfCheckBill.setCycle(1);
// }
// else if (cron.equals(cron2)){
// title.append(getQuarter(month)).append("自查任务");
// selfCheckBill.setCycle(2);
// }
// else if (cron.equals(cron3)){
// title.append("自查任务");
// selfCheckBill.setCycle(3);
// }
// else {
// title.append("自查任务");
// selfCheckBill.setCycle(0);
// }
selfCheckBill.setTitle(title.toString());
SelfCheckBill selfCheckBill1 = selfCheckBillService.addEntity(selfCheckBill);
//发起待自查任务
List<Integer> userIds = new ArrayList<>();
userIds.add(0);
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,title.toString(),null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds);
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id, title.toString(), null, ".", selfCheckBill1.getId(), 4, units.getUnitId(), 0, null, userIds);
taskService.start(taskBto);
});
}
log.info("[自查模块]:自查定时任务执行了");
}
}
public void startTask(){
scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(cron).nextExecutionTime(triggerContext));
@Scheduled(cron = "0 0 0 1 4,10 ?")
public void selfCheckEnd() {
log.info("[自查模块]:自动完结自查定时任务准备执行");
selfCheckBillService.getNoFinShBySystem();
}
/**
......
......@@ -163,60 +163,60 @@ public class SelfCheckController {
return ResponseEntity.ok(type);
}
@ApiOperation(value = "设置自查周期", notes = "可以通过这个接口设置自查周期")
@PostMapping(value = "/set/cycle/{type}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity setCycle(@PathVariable("type") int type){
if (selfCheckSchedulerTask!=null) {
String corn = "0 0 0 1 1/"+type+" ? ";
ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
scheduledFuture.cancel(true);
selfCheckSchedulerTask.setCron(corn);
selfCheckSchedulerTask.startTask();
systemVariableService.setVaule("selfCheckCycle",corn);
log.info("[自查模块]:自查周期更改为"+type+"个月");
return ResponseEntity.ok("自查周期更改为"+type+"个月");
// switch (type) {
// case 1:
// selfCheckSchedulerTask.setCron(cron1);
// @ApiOperation(value = "设置自查周期", notes = "可以通过这个接口设置自查周期")
// @PostMapping(value = "/set/cycle/{type}")
// @Transactional(rollbackFor = Exception.class)
// public ResponseEntity setCycle(@PathVariable("type") int type){
// if (selfCheckSchedulerTask!=null) {
// String corn = "0 0 0 1 1/"+type+" ? ";
// ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
// scheduledFuture.cancel(true);
// selfCheckSchedulerTask.setCron(corn);
// selfCheckSchedulerTask.startTask();
// systemVariableService.setVaule("selfCheckCycle","month");
// log.info("[自查模块]:自查周期更改为月度");
// return ResponseEntity.ok("自查周期更改为月度");
// case 2:
// selfCheckSchedulerTask.setCron(cron2);
// ScheduledFuture scheduledFuture2 = selfCheckSchedulerTask.getScheduledFuture();
// scheduledFuture2.cancel(true);
// selfCheckSchedulerTask.startTask();
// systemVariableService.setVaule("selfCheckCycle","quarter");
// log.info("[自查模块]:自查周期更改为季度");
// return ResponseEntity.ok("自查周期更改为季度");
// case 3:
// selfCheckSchedulerTask.setCron(cron3);
// ScheduledFuture scheduledFuture3 = selfCheckSchedulerTask.getScheduledFuture();
// scheduledFuture3.cancel(true);
// selfCheckSchedulerTask.startTask();
// systemVariableService.setVaule("selfCheckCycle","year");
// log.info("[自查模块]:自查周期更改为年度");
// return ResponseEntity.ok("自查周期更改为年度");
// case 4:
// selfCheckSchedulerTask.setCron(cron4);
// ScheduledFuture scheduledFuture4 = selfCheckSchedulerTask.getScheduledFuture();
// scheduledFuture4.cancel(true);
// selfCheckSchedulerTask.startTask();
// systemVariableService.setVaule("selfCheckCycle","minute");
// log.info("[自查模块]:自查周期更改为每分钟");
// return ResponseEntity.ok("自查周期更改为每分钟");
// default:
// return ResponseEntity.ok(ResultUtil.failed("设置失败:type只能为1,2,3"));
// systemVariableService.setVaule("selfCheckCycle",corn);
// log.info("[自查模块]:自查周期更改为"+type+"个月");
// return ResponseEntity.ok("自查周期更改为"+type+"个月");
//// switch (type) {
//// case 1:
//// selfCheckSchedulerTask.setCron(cron1);
//// ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
//// scheduledFuture.cancel(true);
//// selfCheckSchedulerTask.startTask();
//// systemVariableService.setVaule("selfCheckCycle","month");
//// log.info("[自查模块]:自查周期更改为月度");
//// return ResponseEntity.ok("自查周期更改为月度");
//// case 2:
//// selfCheckSchedulerTask.setCron(cron2);
//// ScheduledFuture scheduledFuture2 = selfCheckSchedulerTask.getScheduledFuture();
//// scheduledFuture2.cancel(true);
//// selfCheckSchedulerTask.startTask();
//// systemVariableService.setVaule("selfCheckCycle","quarter");
//// log.info("[自查模块]:自查周期更改为季度");
//// return ResponseEntity.ok("自查周期更改为季度");
//// case 3:
//// selfCheckSchedulerTask.setCron(cron3);
//// ScheduledFuture scheduledFuture3 = selfCheckSchedulerTask.getScheduledFuture();
//// scheduledFuture3.cancel(true);
//// selfCheckSchedulerTask.startTask();
//// systemVariableService.setVaule("selfCheckCycle","year");
//// log.info("[自查模块]:自查周期更改为年度");
//// return ResponseEntity.ok("自查周期更改为年度");
//// case 4:
//// selfCheckSchedulerTask.setCron(cron4);
//// ScheduledFuture scheduledFuture4 = selfCheckSchedulerTask.getScheduledFuture();
//// scheduledFuture4.cancel(true);
//// selfCheckSchedulerTask.startTask();
//// systemVariableService.setVaule("selfCheckCycle","minute");
//// log.info("[自查模块]:自查周期更改为每分钟");
//// return ResponseEntity.ok("自查周期更改为每分钟");
//// default:
//// return ResponseEntity.ok(ResultUtil.failed("设置失败:type只能为1,2,3"));
//// }
// }
// else {
// throw new ApiException(ResultUtil.failed("selfCheckSchedulerTask为null"));
// }
// }
}
else {
throw new ApiException(ResultUtil.failed("selfCheckSchedulerTask为null"));
}
}
@ApiOperation(value = "装备比较", notes = "可以通过这个接口发起比较装备")
@PostMapping(value = "/compare")
......@@ -683,6 +683,8 @@ public class SelfCheckController {
});
log.info("[自查模块]:审核通过自查完成");
myWebSocket.sendMessage1();
//审核通过 系统发起的自查进行终止
selfCheckBillService.findBySystemStop();
return ResultUtil.success("审核通过自查完成");
}
//审核不通过,改变账单和任务状态
......@@ -883,41 +885,7 @@ public class SelfCheckController {
title.append("系统发起定时"+units.getName());
title.append(year).append("年");
title.append(month).append("月自查任务");
int type=1;
// if (' '==cron.charAt(11)) {
// type = Integer.parseInt(cron.substring(10,11));
// }
// else {
// type = Integer.parseInt(cron.substring(10,12));
// }
if (type==1) {
selfCheckBill.setCycle(1);
}
else if (type==3){
selfCheckBill.setCycle(2);
}
else if (type==12){
selfCheckBill.setCycle(3);
}
else {
selfCheckBill.setCycle(type+2);
}
// if (cron.equals(cron1)){
// title.append(month).append("月自查任务");
// selfCheckBill.setCycle(1);
// }
// else if (cron.equals(cron2)){
// title.append(getQuarter(month)).append("自查任务");
// selfCheckBill.setCycle(2);
// }
// else if (cron.equals(cron3)){
// title.append("自查任务");
// selfCheckBill.setCycle(3);
// }
// else {
// title.append("自查任务");
// selfCheckBill.setCycle(0);
// }
selfCheckBill.setTitle(title.toString());
SelfCheckBill selfCheckBill1 = selfCheckBillService.addEntity(selfCheckBill);
//发起待自查任务
......@@ -948,6 +916,12 @@ public class SelfCheckController {
}
}
@ApiOperation(value = "查询时间段系统发其自查任务并进行终止", notes = "查询时间段系统发其自查任务并进行终止")
@GetMapping(value = "/findBySystemStop")
public void findBySystemStop() {
selfCheckBillService.findBySystemStop();
}
@ApiOperation(value = "自查任务撤回", notes = "根据任务id撤回自查任务")
@GetMapping("/revokeTask/taskId")
@Transactional(rollbackFor = Exception.class)
......@@ -1297,4 +1271,11 @@ public class SelfCheckController {
return ResponseEntity.ok(selfCheckBillService.traceabilityParsing(billId));
}
@GetMapping(value ="finishTest")
@ApiOperation(value = "测试完结系统发起自查", notes = "测试完结系统发起自查")
public ResponseEntity finishTest(){
selfCheckBillService.getNoFinShBySystem();
return ResponseEntity.ok("完成");
}
}
......@@ -85,4 +85,16 @@ public interface SelfCheckBillService {
void historyUpperChain();
boolean checkTrueData(Integer billId);
/**
* 查询未完成的系统发起自查任务 并进行自动完结
* @return
*/
void getNoFinShBySystem();
/**
* 查询未完成的系统发起自查任务 并进行终止
*/
void findBySystemStop();
}
......@@ -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.TaskService;
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.TaskUserVo;
import com.tykj.dev.device.user.cache.UserCache;
......@@ -57,6 +58,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.persistence.Transient;
......@@ -116,7 +118,7 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Override
public SelfCheckBill addEntity(SelfCheckBill selfExaminationBillEntity) {
SelfCheckBill selfCheckBill = selfExaminationBillDao.save(selfExaminationBillEntity);
sendText(selfCheckBill.getId());
// sendText(selfCheckBill.getId());
return selfCheckBill;
}
......@@ -416,6 +418,54 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
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
public BlockTraceabilityParsing traceabilityParsing(Integer billId) {
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.SELF_CHECK.id, billId);
......
......@@ -97,7 +97,7 @@ public class SelfCheckBill {
@ApiModelProperty(value = "非在库装备转JSon")
private String unStockDetail;
/**
* 自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)
* 自查状态(0:待审核,1:审核失败,2:自查完成,3:未检 4:终止)
*/
@ApiModelProperty(value = "自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)")
private Integer checkStatus;
......
......@@ -276,4 +276,9 @@ public interface TaskService {
*/
Task findByParentId(Integer parentTaskId);
/**
* 业务终止封存
*/
void moveToStop(TaskBto taskBto);
}
......@@ -42,6 +42,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
......@@ -654,11 +655,13 @@ public class TaskServiceImpl implements TaskService {
if (taskSelectVo.getAreaId()!=null){
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());
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){
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()
......@@ -1244,6 +1247,13 @@ public class TaskServiceImpl implements TaskService {
return taskDao.findByParentTaskId(parentTaskId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void moveToStop(TaskBto taskBto) {
taskBto.setBillStatus(StatusEnum.SELF_CHECK_STOP.id);
update(taskBto);
}
@Override
public void moveAllSonNodeToEnd(Integer taskId) {
List<Task> tasks = taskDao.findAllByParentTaskId(taskId);
......@@ -1273,7 +1283,8 @@ public class TaskServiceImpl implements TaskService {
.filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id))
&& (!task.getBillStatus().equals(StatusEnum.ARCHIVE.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 -> {
if (o.getExhibit() == null) {
return true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论