diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncZyStudentPdf.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncZyStudentPdf.java new file mode 100644 index 00000000..2ef08070 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncZyStudentPdf.java @@ -0,0 +1,78 @@ +package org.jeecg.modules.kc.grab.SynchronizationService; + +import cn.hutool.core.io.FileUtil; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.DateUtils; +import org.jeecg.common.util.SpringContextHolder; +import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync; +import org.jeecg.modules.kc.kcEvaluationsStat.entity.KcEvaluationsStat; +import org.jeecg.modules.kc.kcEvaluationsStat.service.IKcEvaluationsStatService; +import org.jeecg.modules.kc.zyInfoScjl.entity.ZyInfoScjl; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService; +import org.jeecg.modules.tools.Global; +import org.jeecg.modules.tools.pdf.PDFUtil; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.io.File; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Slf4j +public class SyncZyStudentPdf extends BaseSync { + + @Autowired + private IZyInfoStudentService zyInfoStudentService; + + @Value("${jeecg.path.upload}") + private String upLoadPath; + /** + * 若参数变量名修改 QuartzJobController中也需对应修改 + */ + + @Override + public void execute(JobExecutionContext jobExecutionContext) { + start(); + run(getParamMap()); + end(); + } + + + /** + * 有参定时任务实现 + * @param param + */ + public void run(Map param){ + List ybtkblist = zyInfoStudentService.getDocNoPdfList(); + for(ZyInfoStudent zyInfoStudent:ybtkblist){ + try { + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); + String docPath = upLoadPath+ File.separator+ zyInfoStudent.getFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + System.out.println("filPath:"+zyInfoStudent.getFilePath()); + System.out.println("docPath:"+docPath); + System.out.println("pdfPath:"+pdfPath); + PDFUtil.office2PDF(docPath,pdfPath); + zyInfoStudent.setPdfPath("contract/"+namePath); + zyInfoStudent.setPublishTime(new Date()); + zyInfoStudentService.updateById(zyInfoStudent); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + /** + * 无参定时任务实现 + */ + public void run(){ + run(null); + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java index 3a76b1e8..8665b9c9 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java @@ -44,4 +44,6 @@ public interface ZyInfoStudentMapper extends BaseMapper { void updateJxfs2(ZyInfo jspc); IPage getList2(Page page,@Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + List getDocNoPdfList(); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml index d3ad859b..5829f39b 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml @@ -163,5 +163,8 @@ update zy_info_student set jxfs2 = '0' where main_id=#{id} + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java index 25834917..3f019369 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java @@ -44,4 +44,6 @@ public interface IZyInfoStudentService extends IService { void batchKhcl(List list); IPage getList2(Page page, QueryWrapper queryWrapper); + + List getDocNoPdfList(); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java index 62af3b49..2bacbb1a 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java @@ -145,8 +145,11 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl getDocNoPdfList() { + return baseMapper.getDocNoPdfList(); + } + private void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response) { zyInfoStudent.setQueryType("0");//外网查重数据 String paperids = baseMapper.getWpFile(zyInfoStudent);