qa-prevention-gwj/src/main/java/com/zcloud/util/CleanUpHotNumber.java

38 lines
1.5 KiB
Java

package com.zcloud.util;
import com.zcloud.entity.PageData;
import com.zcloud.service.bus.CheckRecordService;
import com.zcloud.service.bus.ListManagerService;
import com.zcloud.service.highriskwork.HotWorkApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Component
public class CleanUpHotNumber {
@Autowired
private HotWorkApplicationService hotWorkApplicationService;
@Scheduled(cron ="0 30 0 * * ?")//每天12点30
// @Scheduled(cron ="*/20 * * * * ?")//测试
public void scheduled(){
try {
// 2022-11-22 13:45:40.059 [scheduling-1] DEBUG c.z.m.d.h.H.cleanUpJobNumber - ==> Preparing: DELETE from bus_hotworkapplicationnumber where JOB_NUMBER LIKE CONCAT(CONCAT('%', ?),'%')
// 2022-11-22 13:45:40.077 [scheduling-1] DEBUG c.z.m.d.h.H.cleanUpJobNumber - ==> Parameters: 20221122(String)
// 2022-11-22 13:45:40.119 [scheduling-1] DEBUG c.z.m.d.h.H.cleanUpJobNumber - <== Updates: 3
System.out.println("============清除动火申请的编码==========开始");
String dataStr = DateUtil.getAfterDayDate("-1").replaceAll("-",""); // 获取昨天的信息
hotWorkApplicationService.cleanUpJobNumber(dataStr.substring(0,8));
System.out.println("============清除动火申请的编码==========结束");
} catch (Exception e) {
e.printStackTrace();
}
}
}