企业微信登录

master
yechenhao 6 years ago
parent 2f6c59e0ad
commit 25e79cd9c3

@ -6,7 +6,9 @@ import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.handler.annotation.JobHandler;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -18,10 +20,9 @@ import java.util.List;
* @company kiisoo * @company kiisoo
* @details job 0 0 1 * * ? * @details job 0 0 1 * * ?
*/ */
@JobHandler(value="storePromotionData") @Service
@Component
@Slf4j @Slf4j
public class StorePromotionDataJob extends IJobHandler { public class StorePromotionDataJob {
/** /**
* service * service
@ -29,12 +30,12 @@ public class StorePromotionDataJob extends IJobHandler {
@Autowired @Autowired
private StorePromotionDataService storePromotionDataService; private StorePromotionDataService storePromotionDataService;
@Override @Scheduled(cron = "0 0 1 * * ?")
public ReturnT<String> execute(String s) throws Exception { public void syncData(){
try { try {
log.info("<--获取联系客户统计数据定时任务执行-->"); log.info("<--获取联系客户统计数据定时任务执行-->");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<Date> getdays = DateUtils.getdays(DateUtils.addDay(new Date(),-7), DateUtils.addDay(new Date(),-1)); List<Date> getdays = DateUtils.getdays(DateUtils.addDay(new Date(),-3), DateUtils.addDay(new Date(),-1));
for (Date date:getdays){ for (Date date:getdays){
storePromotionDataService.syncCustomerBlackListByDate(date,date); storePromotionDataService.syncCustomerBlackListByDate(date,date);
} }
@ -42,7 +43,6 @@ public class StorePromotionDataJob extends IJobHandler {
} catch (Exception e) { } catch (Exception e) {
log.error("获取联系客户统计数据任务出错", e); log.error("获取联系客户统计数据任务出错", e);
} }
return SUCCESS;
} }

Loading…
Cancel
Save