| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- package com.mokamrp;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.mokamrp.privates.PrivateServerStart;
- import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobilePool;
- import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileTaskTimeList;
- import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskSchedule;
- import com.mokamrp.privates.service.CoralApiService;
- import com.mokamrp.privates.service.CorpService;
- import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
- import com.mokamrp.privates.service.pangu.FosterwxMobileService;
- import com.mokamrp.privates.service.pangu.FosterwxMobileTaskTimeListService;
- import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
- import com.mokamrp.privates.task.pangu.SyncCreateCashTask;
- import com.mokamrp.privates.task.pangu.SyncFosterwxMobilePool;
- import com.mokamrp.privates.task.pangu.SyncMobilePoolFans;
- import lombok.extern.slf4j.Slf4j;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.test.context.junit4.SpringRunner;
- import java.time.LocalDateTime;
- @Slf4j
- @SpringBootTest(classes = PrivateServerStart.class)
- @RunWith(SpringRunner.class)
- public class WebTest {
- @Autowired
- private FosterwxMobileService fosterwxMobileService;
- @Autowired
- private CorpService corpService;
- @Autowired
- private FosterwxMobilePoolService fosterwxMobilePoolService;
- @Autowired
- private SyncFosterwxMobilePool syncFosterwxMobilePool;
- @Autowired
- private FosterwxMobileTaskTimeListService fosterwxMobileTaskTimeListService;
- @Autowired
- private FosterwxTaskScheduleService fosterwxTaskScheduleService;
- @Autowired
- private SyncMobilePoolFans syncMobilePoolFans;
- @Autowired
- private SyncCreateCashTask syncCreateCashTask;
- @Autowired
- private CoralApiService coralApiService;
- @Test
- public void test1() {
- // 清洗数据
- fosterwxMobileService.list().forEach(fosterwxMobile -> {
- // if (corpService.count(new LambdaQueryWrapper<Corp>().eq(Corp::getName, fosterwxMobile.getWorkWxCorp())) > 1) {
- // log.warn("{}名字有两个主体", fosterwxMobile.getWorkWxCorp());
- // }
- // Corp corp = corpService.getOne(new LambdaQueryWrapper<Corp>().eq(Corp::getName, fosterwxMobile.getWorkWxCorp()).last("Limit 1"));
- // if (null != corp) {
- // fosterwxMobile.setWorkWxCorpId(corp.getId());
- // fosterwxMobile.setWxAppid(corp.getWxCorpid());
- // fosterwxMobileService.updateById(fosterwxMobile);
- // } else {
- // fosterwxMobile.setWorkWxCorpId(0);
- // fosterwxMobile.setWxAppid(null);
- // fosterwxMobileService.updateById(fosterwxMobile);
- // }
- fosterwxMobilePoolService.update(new FosterwxMobilePool() {{
- setWxAppid(fosterwxMobile.getWxAppid());
- }}, new LambdaQueryWrapper<FosterwxMobilePool>().eq(FosterwxMobilePool::getPoolIndex, fosterwxMobile.getMobileUnioCode()));
- });
- }
- @Test
- public void test2() {
- // syncFosterwxMobilePool.execute();
- syncMobilePoolFans.syncTotalFans();
- syncMobilePoolFans.syncDayFans();
- }
- /**
- * 清洗任务开始时间到新的数据表中
- */
- @Test
- public void test3() {
- fosterwxMobileService.list().forEach(fosterwxMobile -> {
- if (null != fosterwxMobile.getTaskStartAt()) {
- FosterwxMobileTaskTimeList fosterwxMobileTaskTimeList = new FosterwxMobileTaskTimeList();
- fosterwxMobileTaskTimeList.setStationId(fosterwxMobile.getStationId());
- fosterwxMobileTaskTimeList.setMobileCode(fosterwxMobile.getMobileCode());
- fosterwxMobileTaskTimeList.setMobileUnioCode(fosterwxMobile.getMobileUnioCode());
- FosterwxTaskSchedule fosterwxTaskSchedule = fosterwxTaskScheduleService.getOne(new LambdaQueryWrapper<FosterwxTaskSchedule>().eq(FosterwxTaskSchedule::getStationId, fosterwxMobile.getStationId()).eq(FosterwxTaskSchedule::getMobileCode, fosterwxMobile.getMobileCode()).last("limit 1"));
- if (null != fosterwxTaskSchedule)
- fosterwxMobileTaskTimeList.setTemplateId(fosterwxTaskSchedule.getTemplateId());
- fosterwxMobileTaskTimeList.setTaskStartAt(fosterwxMobile.getTaskStartAt());
- fosterwxMobileTaskTimeList.setTaskEndAt(null);
- fosterwxMobileTaskTimeList.setCreateAt(LocalDateTime.now());
- fosterwxMobileTaskTimeList.setUpdateAt(LocalDateTime.now());
- fosterwxMobileTaskTimeListService.save(fosterwxMobileTaskTimeList);
- }
- });
- }
- @Test
- public void test4() {
- syncCreateCashTask.syncCreateCashTask();
- }
- }
|