fix:暂时取消定时任务,手动查询需要更新的阿里数据进行写死时间的过滤

v3
chenhc 3 months ago
parent d1751384b1
commit a758dca19b

@ -19,6 +19,8 @@ public interface ThirdAliDrugMapper extends BaseMapper<ThirdAliDrug> {
List<ThirdAliDrug> filterList(ThirdAliDrugRequest thirdAliDrug);
@Select("SELECT cpmctymc FROM third_ali_drug GROUP BY cpmctymc")
// @Select("SELECT cpmctymc FROM third_ali_drug GROUP BY cpmctymc")
// List<ThirdAliDrug> groupByCpmctymc();
@Select("SELECT a.cpmctymc FROM ( SELECT cpmctymc,max(createTime) as createTime FROM third_ali_drug GROUP BY cpmctymc) a WHERE a.createTime < '2025-01-06 09:00:00'")
List<ThirdAliDrug> groupByCpmctymc();
}

@ -1,49 +1,49 @@
package com.glxp.udidl.admin.thread;
import com.glxp.udidl.admin.dao.info.ScheduledMapper;
import com.glxp.udidl.admin.entity.info.ScheduledEntity;
import com.glxp.udidl.admin.req.info.ScheduledRequest;
import com.glxp.udidl.admin.service.chsapi.ChsYbHcxxService;
import com.glxp.udidl.admin.service.collect.ThirdAliDrugService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@EnableScheduling
public class ThirdAliDrugTask implements SchedulingConfigurer {
@Resource
private ScheduledMapper scheduledDao;
@Resource
private ThirdAliDrugService thirdAliDrugService;
final Logger logger = LoggerFactory.getLogger(ThirdAliDrugTask.class);
@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
scheduledTaskRegistrar.addTriggerTask(() -> process(),
triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("thirdAliDrugTask");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity.getCron();
if (cron.isEmpty()) {
logger.error("cron is null");
}
return new CronTrigger(cron).nextExecutionTime(triggerContext);
});
}
private void process() {
System.out.println("开始执行更新阿里健康数据");
thirdAliDrugService.updateThirdAliDrugTask();
}
}
//package com.glxp.udidl.admin.thread;
//
//import com.glxp.udidl.admin.dao.info.ScheduledMapper;
//import com.glxp.udidl.admin.entity.info.ScheduledEntity;
//import com.glxp.udidl.admin.req.info.ScheduledRequest;
//import com.glxp.udidl.admin.service.chsapi.ChsYbHcxxService;
//import com.glxp.udidl.admin.service.collect.ThirdAliDrugService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.SchedulingConfigurer;
//import org.springframework.scheduling.config.ScheduledTaskRegistrar;
//import org.springframework.scheduling.support.CronTrigger;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//
//@Component
//@EnableScheduling
//public class ThirdAliDrugTask implements SchedulingConfigurer {
//
// @Resource
// private ScheduledMapper scheduledDao;
//
// @Resource
// private ThirdAliDrugService thirdAliDrugService;
//
// final Logger logger = LoggerFactory.getLogger(ThirdAliDrugTask.class);
//
// @Override
// public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
// scheduledTaskRegistrar.addTriggerTask(() -> process(),
// triggerContext -> {
// ScheduledRequest scheduledRequest = new ScheduledRequest();
// scheduledRequest.setCronName("thirdAliDrugTask");
// ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
// String cron = scheduledEntity.getCron();
// if (cron.isEmpty()) {
// logger.error("cron is null");
// }
// return new CronTrigger(cron).nextExecutionTime(triggerContext);
// });
// }
//
// private void process() {
// System.out.println("开始执行更新阿里健康数据");
// thirdAliDrugService.updateThirdAliDrugTask();
// }
//}

Loading…
Cancel
Save