定时刷新状态
Former-commit-id: 61f896fb4d14527222b16ef36fb968ceaf4e3bff
This commit is contained in:
parent
753e740cc8
commit
c44efd4574
|
|
@ -3,9 +3,11 @@ package com.xjy.ai.api;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@ComponentScan("com.xjy.*")
|
||||
@EnableScheduling
|
||||
public class ApiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ public enum StatusEnum {
|
|||
REJECT("3", "审核未通过"),
|
||||
FINISH("4", "完成"),
|
||||
DELAY("5", "延期"),
|
||||
OTHER("6", "其他");
|
||||
OTHER("6", "其他"),
|
||||
NOT_PASS("7", "验收未通过");
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.xjy.ai.model.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.xjy.ai.common.enums.StatusEnum;
|
||||
import com.xjy.ai.model.dao.requirement.entity.Requirement;
|
||||
import com.xjy.ai.model.service.requirement.RequirementService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class RequirTask {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private RequirementService requirementService;
|
||||
@Scheduled(cron = "0 0/3 * * * *")
|
||||
public void work() {
|
||||
QueryWrapper<Requirement> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("status", StatusEnum.ING.getKey());
|
||||
List<Requirement> list = requirementService.list(wrapper);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
for(Requirement requirement : list){
|
||||
long diff = new Date().getTime() - requirement.getEndTime().getTime();
|
||||
if(diff > 0){
|
||||
requirement.setStatus(StatusEnum.DELAY.getKey());
|
||||
requirementService.updateByPrimaryKey(requirement);
|
||||
logger.info("update status:{}",requirement.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -281,6 +281,7 @@
|
|||
dic_item
|
||||
where
|
||||
dic_type_code = #{dicTypeCode,jdbcType=VARCHAR}
|
||||
order by dic_item_order
|
||||
</select>
|
||||
|
||||
<select id="getDicList" resultMap="BaseResultMap"
|
||||
|
|
|
|||
Loading…
Reference in New Issue