添加脚本

This commit is contained in:
yangjun 2024-11-29 14:02:57 +08:00
parent c6358646f7
commit ef4757cb68
1 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,77 @@
package org.jeecg.modules.demo.sync;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.jeecg.modules.demo.lwKhcl.entity.LwKhcl;
import org.jeecg.modules.demo.lwKhcl.service.ILwKhclService;
import org.jeecg.modules.demo.lwKhclXz.entity.LwKhclXz;
import org.jeecg.modules.demo.lwKhclXz.service.ILwKhclXzService;
import org.jeecg.modules.demo.vLwKhcl.entity.VLwKhcl;
import org.jeecg.modules.demo.vLwKhcl.service.IVLwKhclService;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
/**
* 同步选择的考核材料
*/
@Slf4j
public class SyncVlwkhclXztb extends BaseSync {
@Autowired
private ILwKhclService lwKhclService;
@Autowired
private ILwKhclXzService lwKhclXzService;
/**
* 若参数变量名修改 QuartzJobController中也需对应修改
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) {
start();
run(getParamMap());
end();
}
/**
* 有参定时任务实现
* @param param
*/
public void run(Map<String, Object> param){
List<LwKhclXz> list = lwKhclXzService.list();
for(LwKhclXz x : list){
LwKhcl lwKhcl = lwKhclService.getById(x.getMainId());
if(lwKhcl != null){
x.setCcjg(lwKhcl.getCcjg());
x.setKtbg(lwKhcl.getKtbg());
x.setKtbgshyj(lwKhcl.getKtbgshyj());
x.setLwzg(lwKhcl.getLwzg());
x.setLwzgPdf(lwKhcl.getLwzgPdf());
x.setZdjld(lwKhcl.getZdjld());
x.setJcbgdcl(lwKhcl.getJcbgdcl());
lwKhclXzService.updateById(x);
}
}
}
/**
* 无参定时任务实现
*/
public void run(){
run(null);
}
public static void main(String[] args) {
LocalDate today = LocalDate.now(); // 获取今天的日期
LocalDate yesterday = today.minusDays(1); // 减去一天得到昨天的日期
System.out.println("昨天的日期是: " + yesterday);
}
}