| | |
| | | package com.highdatas.srs.task;
|
| | |
|
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
| | | import com.highdatas.srs.entity.Scheme;
|
| | | import com.highdatas.srs.entity.SchemeDetail;
|
| | | import com.highdatas.srs.service.ISchemeDetailService;
|
| | | import com.highdatas.srs.service.ISchemeService;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.scheduling.annotation.EnableScheduling;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @date 2020-02-12 10:40
|
| | | */
|
| | |
|
| | |
|
| | | @EnableScheduling
|
| | | public class DelayTimeTask {
|
| | | }
|
| | | @Autowired
|
| | | ISchemeService schemeService;
|
| | | @Autowired
|
| | | ISchemeDetailService schemeDetailService;
|
| | |
|
| | | @Scheduled(cron = "0 0 0 1/1 * ?")
|
| | | private void delayTask(){
|
| | | Date date = new Date();
|
| | | List<SchemeDetail> schemeDetailList = schemeDetailService.selectList(new EntityWrapper<SchemeDetail>().lt("end_time", date).eq("edit", false));
|
| | | HashSet<String> parentIdSet = new HashSet<>();
|
| | | for (SchemeDetail detail : schemeDetailList) {
|
| | | parentIdSet.add(detail.getParentId());
|
| | | detail.setDelay(true);
|
| | | detail.updateById();
|
| | | }
|
| | | //项目中某个节点发生延期则项目延期 后期根据业务修改
|
| | | List<Scheme> schemes = schemeService.selectBatchIds(parentIdSet);
|
| | | for (Scheme scheme : schemes) {
|
| | | scheme.setStatus("delay").updateById();
|
| | | }
|
| | | }
|
| | | }
|