You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
Java
42 lines
1.5 KiB
Java
|
8 months ago
|
package com.docus.demo.job;
|
||
|
|
|
||
|
|
import com.docus.demo.dto.SyncBasicDataDto;
|
||
|
|
import com.docus.demo.facade.ISyncBasicDataService;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
|
||
|
|
import java.time.LocalDate;
|
||
|
|
import java.time.temporal.TemporalAdjusters;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author YongBin Wen
|
||
|
|
* @date 2025/4/23 0023 17:13
|
||
|
|
*/
|
||
|
|
@Component
|
||
|
|
@Slf4j
|
||
|
|
public class GzFirstHospBasicSyncJob {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private ISyncBasicDataService syncBasicDataService;
|
||
|
|
|
||
|
|
@Scheduled(cron = "0 0 0/12 * * ?")
|
||
|
|
public void syncOneMonthData() {
|
||
|
|
LocalDate today = LocalDate.now();
|
||
|
|
LocalDate firstDayOfLastMonth = today.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
|
||
|
|
SyncBasicDataDto dto = new SyncBasicDataDto();
|
||
|
|
dto.setStartDate(firstDayOfLastMonth.toString());
|
||
|
|
dto.setEndDate(today.toString());
|
||
|
|
dto.setLimit(1000);
|
||
|
|
log.info("广州市第一人民医院,同步省厅基础数据,日期:{} —— {}", firstDayOfLastMonth, today);
|
||
|
|
try {
|
||
|
|
syncBasicDataService.syncBasicData(dto);
|
||
|
|
log.info("广州市第一人民医院,同步省厅基础数据,日期:" + firstDayOfLastMonth + "—— " + today + ",同步完成!");
|
||
|
|
} catch (Exception ex) {
|
||
|
|
log.info("广州市第一人民医院,同步省厅基础数据,日期:" + firstDayOfLastMonth + "—— " + today + ",出现异常:" + ex.getMessage(), ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|