添加定时发布作业逻辑

This commit is contained in:
yangjun 2024-10-17 19:57:05 +08:00
parent ccb77dc17d
commit fae2fc8673
3 changed files with 28 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.kc.grab.SynchronizationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync; import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
import org.jeecg.modules.kc.zyCcjg.service.IZyCcjgService; import org.jeecg.modules.kc.zyCcjg.service.IZyCcjgService;
import org.jeecg.modules.kc.zyInfo.service.IZyInfoService;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +18,8 @@ public class SyncZyCcjg extends BaseSync {
@Autowired @Autowired
private IZyCcjgService zyCcjgService; private IZyCcjgService zyCcjgService;
@Autowired
private IZyInfoService zyInfoService;
/** /**
* 若参数变量名修改 QuartzJobController中也需对应修改 * 若参数变量名修改 QuartzJobController中也需对应修改
@ -35,7 +38,16 @@ public class SyncZyCcjg extends BaseSync {
* @param param * @param param
*/ */
public void run(Map<String, Object> param){ public void run(Map<String, Object> param){
zyCcjgService.getCcjg(); try {
zyCcjgService.getCcjg();
} catch (Exception e) {
e.printStackTrace();
}
try {
zyInfoService.updateInfoZyStatus();
} catch (Exception e) {
e.printStackTrace();
}
} }
/** /**

View File

@ -27,4 +27,5 @@ public interface IZyInfoService extends IService<ZyInfo> {
List<ZyInfo> zyzb(String rwbh, String xqxn, String teano, String zyLeixing); List<ZyInfo> zyzb(String rwbh, String xqxn, String teano, String zyLeixing);
void updateInfoZyStatus();
} }

View File

@ -7,10 +7,12 @@ import org.jeecg.modules.kc.zyInfo.entity.ZyInfo;
import org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys; import org.jeecg.modules.kc.zyInfo.entity.ZyInfoSys;
import org.jeecg.modules.kc.zyInfo.mapper.ZyInfoMapper; import org.jeecg.modules.kc.zyInfo.mapper.ZyInfoMapper;
import org.jeecg.modules.kc.zyInfo.service.IZyInfoService; import org.jeecg.modules.kc.zyInfo.service.IZyInfoService;
import org.jeecg.modules.tools.DateUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -47,4 +49,16 @@ public class ZyInfoServiceImpl extends ServiceImpl<ZyInfoMapper, ZyInfo> impleme
return baseMapper.zyzb(rwbh,xqxn,teano,zyLeixing); return baseMapper.zyzb(rwbh,xqxn,teano,zyLeixing);
} }
@Override
public void updateInfoZyStatus() {
QueryWrapper<ZyInfo> zyInfoQueryWrapper = new QueryWrapper<>();
zyInfoQueryWrapper.le("start_time", DateUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
zyInfoQueryWrapper.eq("zy_status","0");
List<ZyInfo> list = baseMapper.selectList(zyInfoQueryWrapper);
for(ZyInfo par : list){
par.setZyStatus("1");
baseMapper.updateById(par);
}
}
} }