提交 f6f27e46 authored 作者: 133's avatar 133

[自查任务] 代码t提交

上级 77529b0b
package com.tykj.dev.device.selfcheck.controller; package com.tykj.dev.device.selfcheck.controller;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.repository.SystemVariableDao;
import com.tykj.dev.config.service.SystemVariableService; import com.tykj.dev.config.service.SystemVariableService;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
...@@ -19,6 +20,8 @@ import com.tykj.dev.device.task.service.TaskService; ...@@ -19,6 +20,8 @@ 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.user.read.service.MessageService; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto; import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
...@@ -580,5 +583,78 @@ public class SelfCheckController { ...@@ -580,5 +583,78 @@ public class SelfCheckController {
return ResponseEntity.ok("不保存"); return ResponseEntity.ok("不保存");
} }
} }
@Autowired
private UnitsDao unitsDao;
@Autowired
private SystemVariableDao systemVariableDao;
@Autowired
private SelfCheckBillService selfCheckBillService;
@ApiOperation(value = "是否保存自查任务", notes = "可以通过这个接口查询是否保存自查任务")
@GetMapping(value = "/isSaveSelfTask")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity toSave(){
List<Units> unitsList = unitsDao.findAll();
unitsList.forEach(units -> {
//添加账单
SelfCheckBill selfCheckBill = new SelfCheckBill();
selfCheckBill.setCheckStatus(3);
selfCheckBill.setCheckUnit(units.getName());
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("月自查任务");
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);
//发起待自查任务
List<Integer> userIds = new ArrayList<>();
userIds.add(0);
// selfCheckBill.setTitle("系统发起"+units.getName()+"自查任务");
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,title.toString(),null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds);
taskService.start(taskBto);
});
return ResponseEntity.ok("ok");
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论