diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/sync/SyncVlwkhclXztb.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/sync/SyncVlwkhclXztb.java new file mode 100644 index 0000000..58a431f --- /dev/null +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/sync/SyncVlwkhclXztb.java @@ -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 param){ + List 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); + } +}