|
|
@@ -1,10 +1,14 @@
|
|
|
package com.mokamrp.privates.tast.pangu;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.mokamrp.privates.constant.RedisKey;
|
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
+import com.mokamrp.privates.entity.ResHandle;
|
|
|
import com.mokamrp.privates.mapper.data.pojo.PanCSLTRecord;
|
|
|
import com.mokamrp.privates.mapper.data.pojo.PanCSTQRecord;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskSchedule;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.PromoteQrcodePoolRecord;
|
|
|
import com.mokamrp.privates.service.data.PanCSLTRecordService;
|
|
|
import com.mokamrp.privates.service.data.PanCSTQRecordService;
|
|
|
@@ -12,9 +16,13 @@ import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
|
|
|
import com.mokamrp.privates.service.pangu.PromoteQrcodePoolRecordService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Component
|
|
|
@@ -26,15 +34,30 @@ public class SyncFosterwxTask {
|
|
|
@Autowired
|
|
|
public FosterwxStationService fosterwxStationService;
|
|
|
|
|
|
- @Scheduled(cron = "0 */30 * * * ?")
|
|
|
+ @Autowired
|
|
|
+ public StringRedisTemplate stringRedisTemplate;
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 */1 * * * ?")
|
|
|
public void execute() {
|
|
|
System.out.println("[cronjob]:同步微信养号任务到REDIS");
|
|
|
+ Integer taskCnt = 60;
|
|
|
+ Date nowDate = new Date();
|
|
|
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
PostBasePageHandle postBasePageHandle = new PostBasePageHandle();
|
|
|
postBasePageHandle.setPage(1);
|
|
|
postBasePageHandle.setPagesize(9999999);
|
|
|
List<FosterwxStation> fosterwxStationList = fosterwxStationService.list();
|
|
|
for (FosterwxStation fosterwxStation : fosterwxStationList){
|
|
|
- fosterwxTaskScheduleService.getList(postBasePageHandle,"",fosterwxStation.getId(),"2021-07-24");
|
|
|
+ for (Integer i =0;i<=60;i++){
|
|
|
+ String nextDate = df.format(nowDate);
|
|
|
+ if (!i.equals(0)){
|
|
|
+ nextDate = df.format(new Date(nowDate.getTime() + 1000 * 60 * 60 * 24 * i));
|
|
|
+ }
|
|
|
+ Integer stationId = fosterwxStation.getId();
|
|
|
+ ResHandle<List<FosterwxTaskSchedule>> resHandle = fosterwxTaskScheduleService.getList(postBasePageHandle,"",fosterwxStation.getId(),nextDate);
|
|
|
+ List<FosterwxTaskSchedule> fosterwxTaskScheduleList = resHandle.getList();
|
|
|
+ stringRedisTemplate.opsForHash().put(RedisKey.PanWxfosterTask+stationId,nextDate, JSON.toJSONString(fosterwxTaskScheduleList));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|