(OA 初稿30天则发送oa提醒 三天后则发送取消提醒,标准发布时间三天则发送提醒)
This commit is contained in:
@@ -213,4 +213,7 @@ public interface LawsUserInfoService {
|
||||
|
||||
@GetMapping("/esRevisePlan/es-revise-plan/getAllPlansByWk")
|
||||
public List<EsRevisePlanDTO> getAllPlansByWk(@RequestParam("esName") String esName);
|
||||
|
||||
@GetMapping("/esRevisePlan/es-revise-plan/oaUpdatePlans")
|
||||
void updateEsRevisePlan(@RequestParam("esId")String esId, @RequestParam("date")Date date,@RequestParam("s") String s);
|
||||
}
|
||||
|
||||
@@ -113,4 +113,13 @@ public class EsRevisePlanDTO {
|
||||
@ApiModelProperty(value = "立项单")
|
||||
@TableField("LXD")
|
||||
private String lxd;
|
||||
|
||||
@ApiModelProperty(value = "OA发送时间记录")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private Date oaDateIime;
|
||||
|
||||
@ApiModelProperty(value = "OA是否已经发送")
|
||||
@TableField("OA_IS_SEND")
|
||||
private String oaIsSend;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessNew;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.EsPrcRelation;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.EsRevisePlanDTO;
|
||||
import com.ydw.bat.wkflow.business_main.datas.mapper.BusProcessNameMapper;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNewService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IEsPrcRelationService;
|
||||
import com.ydw.bat.wkflow.business_mq.service.CreateMQService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.impl.WebServiceOAServiceImpl;
|
||||
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.TaskService;
|
||||
@@ -15,6 +17,7 @@ import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@@ -23,6 +26,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -35,6 +39,9 @@ public class ScheduledJobEsPlan {
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
@Autowired
|
||||
WebServiceOAServiceImpl webServiceOAService;
|
||||
|
||||
@Scheduled(cron = "0 0 2 * * ?") //每天的凌晨2点执行
|
||||
@Async
|
||||
public void SchedulingTask() {
|
||||
@@ -83,6 +90,117 @@ public class ScheduledJobEsPlan {
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 2 * * ?") //每天的凌晨2点执行
|
||||
@Async
|
||||
public void SchedulingTaskInfo() {
|
||||
if(isNotScheduled) {
|
||||
logger.info("============企标计划定时任务开始===========");
|
||||
{
|
||||
LawsUserInfoService lawsUserInfoService = SpringContextUtil.getBean(LawsUserInfoService.class);
|
||||
IEsPrcRelationService esPrcRelationService = SpringContextUtil.getBean(IEsPrcRelationService.class);
|
||||
TaskService taskService = SpringContextUtil.getBean(TaskService.class);
|
||||
|
||||
List<EsRevisePlanDTO> esRevisePlanDTOList = lawsUserInfoService.getAllPlansByWk(null); // 查询 制定中,修订中的企标计划
|
||||
//esRevisePlanDTOList 如果 计划标准初稿时间前一个月的企标计划 以前发送过,
|
||||
if(!esRevisePlanDTOList.isEmpty()){
|
||||
for (EsRevisePlanDTO data : esRevisePlanDTOList) {
|
||||
if(StringUtils.isNotBlank(data.getOaIsSend()) && data.getOaIsSend().equals("1")){
|
||||
//等于1 则证明已经发送了 三十天的OA信息 判断是否是已经发送三天 如果是 则撤回发送
|
||||
if(data.getOaDateIime()!=null){
|
||||
// 三天时间的时间戳 86400000 * 3
|
||||
long threeDay = 259200000;
|
||||
long time1 = new Date().getTime();
|
||||
long oaTime = data.getOaDateIime().getTime();
|
||||
//long l = threeDay;
|
||||
long l = time1 - oaTime;
|
||||
if( l > threeDay || l == threeDay){
|
||||
//证明已经过了三天 则发送撤回信息
|
||||
List<EsPrcRelation> esPrcRelationList = esPrcRelationService.list(data.getId());
|
||||
if (!esPrcRelationList.isEmpty()) {
|
||||
String esId = esPrcRelationList.get(0).getEsId();
|
||||
lawsUserInfoService.updateEsRevisePlan(esId,new Date(),"0");
|
||||
if(esPrcRelationList.get(0) != null && StringUtils.isNotBlank(esPrcRelationList.get(0).getPrcId())) {
|
||||
webServiceOAService.deleteOAByPid(esPrcRelationList.get(0).getPrcId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 计划标准初稿时间前一个月的企标计划
|
||||
SimpleDateFormat sdfQuery = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
String endDate = sdfQuery.format(calendar.getTime());
|
||||
List<EsRevisePlanDTO> esRevisePlanDTOList2 = esRevisePlanDTOList.stream()
|
||||
.filter(e -> endDate.equals(sdfQuery.format(e.getDraftTime())))
|
||||
.collect(Collectors.toList());
|
||||
if (!esRevisePlanDTOList2.isEmpty()) {
|
||||
for (EsRevisePlanDTO esRevisePlanDTO : esRevisePlanDTOList2) {
|
||||
List<EsPrcRelation> esPrcRelationList = esPrcRelationService.list(esRevisePlanDTO.getId());
|
||||
if (esPrcRelationList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String esId = esPrcRelationList.get(0).getEsId();
|
||||
String prcIdGk = esPrcRelationList.get(0).getPrcIdGk();
|
||||
String oaFlag = esPrcRelationList.get(0).getOaFlag();
|
||||
// 判断对应 管控流程是否还在 技术标准起草节点, 且之前点过接受任务
|
||||
if (StringUtils.isNotBlank(prcIdGk)) {
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(prcIdGk).active().list();
|
||||
if (!list2.isEmpty()) {
|
||||
String nowTaskInfo = list2.get(0).getName();
|
||||
if ("技术标准起草".equals(nowTaskInfo) && "0".equals(oaFlag)) {
|
||||
// 再次发送待办
|
||||
logger.info("============再次发送待办的企标计划" + esRevisePlanDTO.getEsName() +"===========");
|
||||
sendOATodo(list2.get(0));
|
||||
// 更新 状态为待办
|
||||
esPrcRelationService.modifyEsPrcRelation(esId, null, "1", null);
|
||||
//存储 OA发的时间 和 修改是否发送过
|
||||
lawsUserInfoService.updateEsRevisePlan(esId,new Date(),"1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 计划标准发布时间 前三天
|
||||
Calendar calendarTrid = Calendar.getInstance();
|
||||
calendarTrid.add(Calendar.DATE, 3);
|
||||
String endDateTrid = sdfQuery.format(calendarTrid.getTime());
|
||||
List<EsRevisePlanDTO> esRevisePlanDTOList3 = esRevisePlanDTOList.stream()
|
||||
.filter(e -> endDateTrid.equals(sdfQuery.format(e.getReleaseTime())))
|
||||
.collect(Collectors.toList());
|
||||
if (!esRevisePlanDTOList3.isEmpty()) {
|
||||
for (EsRevisePlanDTO esRevisePlanDTO : esRevisePlanDTOList3) {
|
||||
List<EsPrcRelation> esPrcRelationList = esPrcRelationService.list(esRevisePlanDTO.getId());
|
||||
if (esPrcRelationList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String esId = esPrcRelationList.get(0).getEsId();
|
||||
String prcIdGk = esPrcRelationList.get(0).getPrcIdGk();
|
||||
String oaFlag = esPrcRelationList.get(0).getOaFlag();
|
||||
// 判断对应 管控流程是否还在 技术标准起草节点, 且之前点过接受任务
|
||||
if (StringUtils.isNotBlank(prcIdGk)) {
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(prcIdGk).active().list();
|
||||
if (!list2.isEmpty()) {
|
||||
String nowTaskInfo = list2.get(0).getName();
|
||||
if ("技术标准起草".equals(nowTaskInfo) && "0".equals(oaFlag)) {
|
||||
// 再次发送待办
|
||||
logger.info("============再次发送待办的企标计划" + esRevisePlanDTO.getEsName() +"===========");
|
||||
sendOATodo(list2.get(0));
|
||||
// 更新 状态为待办
|
||||
esPrcRelationService.modifyEsPrcRelation(esId, null, "1", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//logger.info("============企标计划定时任务结束===========");
|
||||
}
|
||||
logger.info("============企标计划定时任务结束===========");
|
||||
}
|
||||
}
|
||||
|
||||
public void sendOATodo(Task delegateTask) {
|
||||
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
|
||||
QueryWrapper queryWrapper1 = new QueryWrapper();
|
||||
|
||||
Reference in New Issue
Block a user