71 lines
2.2 KiB
Java
71 lines
2.2 KiB
Java
package com.zcloud.util;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import com.zcloud.entity.PageData;
|
|
import com.zcloud.service.bus.CheckRecordService;
|
|
import com.zcloud.service.bus.ListManagerService;
|
|
import com.zcloud.service.bus.ListStatisticsService;
|
|
import com.zcloud.service.bus.SysDateService;
|
|
|
|
@Component
|
|
public class OverTimeScheduled {
|
|
@Autowired
|
|
private ListManagerService listManagerService;
|
|
@Autowired
|
|
private CheckRecordService checkrecordService;
|
|
|
|
|
|
//@Scheduled(cron ="0 5 0 * * ?")//每天12点05
|
|
@Scheduled(cron ="0 30 0 * * ?")//每天12点30
|
|
|
|
//@Scheduled(cron ="*/20 * * * * ?")//测试 每20S
|
|
//@Scheduled(cron ="0 0/2 * * * ?")//测试 每2分钟
|
|
public void scheduled(){
|
|
try {
|
|
System.out.println("============查询清单超期未检查数==========");
|
|
PageData pd = new PageData();
|
|
List<PageData> allList = listManagerService.getAllList(pd);
|
|
if(allList != null && allList.size() > 0) {
|
|
for(PageData l: allList) {
|
|
if(l.get("TYPE") != null && Tools.notEmpty(l.getString("TYPE")) && "listType0005".equals(l.getString("TYPE"))) {
|
|
if(l.get("END_DATE") != null
|
|
&& Tools.notEmpty(l.getString("END_DATE"))
|
|
&& DateUtil.timeCompare(DateUtil.fomatDateTime(l.getString("END_DATE")+" 23:59:59"),new Date())
|
|
&& Integer.valueOf(l.get("checkCount").toString()) <2) {
|
|
l.put("OVERTIMENUM", 2-Integer.valueOf(l.get("checkCount").toString()));
|
|
} else {
|
|
l.put("OVERTIMENUM", 0);
|
|
}
|
|
} else {
|
|
PageData overTime = new PageData();
|
|
overTime.put("LISTTYPE", l.get("PERIOD"));
|
|
overTime.put("LISTMANAGER_ID", l.get("LISTMANAGER_ID"));
|
|
overTime.put("CORPINFO_ID", l.get("CORPINFO_ID"));
|
|
overTime.put("LISTDATE", l.get("CREATTIME"));
|
|
overTime.put("STATUS", "0");
|
|
int count = checkrecordService.countOverTime(overTime);
|
|
l.put("OVERTIMENUM", count);
|
|
}
|
|
|
|
listManagerService.edit(l);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
/**得到32位的uuid
|
|
* @return
|
|
*/
|
|
public String get32UUID(){
|
|
return UuidUtil.get32UUID();
|
|
}
|
|
}
|