修补学生作业pdf丢失脚本

This commit is contained in:
yangjun 2025-01-17 10:22:45 +08:00
parent 5279a97eab
commit c0bc0f4084
3 changed files with 28 additions and 27 deletions

View File

@ -5,9 +5,6 @@ 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;
@ -47,27 +44,6 @@ public class SyncZyStudentPdf extends BaseSync {
*/
public void run(Map<String, Object> param){
List<ZyInfoStudent> 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 pdfUtil = SpringContextHolder.getBean(PDFUtil.class);
pdfUtil.office2PDF(docPath,pdfPath);
zyInfoStudent.setPdfPath("contract/"+namePath);
zyInfoStudent.setPublishTime(new Date());
zyInfoStudentService.updateById(zyInfoStudent);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
/**

View File

@ -790,8 +790,8 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
System.out.println("filPath:"+zyInfoStudent.getFilePath());
System.out.println("docPath:"+docPath);
System.out.println("pdfPath:"+pdfPath);
// PDFUtil.office2PDF(docPath,pdfPath);
// zyInfoStudent.setPdfPath("contract/"+namePath);
PDFUtil.office2PDF(docPath,pdfPath);
zyInfoStudent.setPdfPath("contract/"+namePath);
}else{
ZykInfo zykInfo = new ZykInfo();
zykInfo.setBizId(zyInfoStudent.getId());

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.kc.zyInfoStudent.service.impl;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -15,6 +16,7 @@ import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.SFTPUtil;
import org.jeecg.common.util.SftpConfig;
import org.jeecg.common.util.SpringContextHolder;
import org.jeecg.modules.kc.kcWechatSendLog.entity.KcWechatSendLog;
import org.jeecg.modules.kc.ktgl.entity.KcKechengbiao;
import org.jeecg.modules.kc.ktgl.service.IKcKechengbiaoService;
@ -31,7 +33,9 @@ import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudentSys;
import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudentXbkhcl;
import org.jeecg.modules.kc.zyInfoStudent.mapper.ZyInfoStudentMapper;
import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService;
import org.jeecg.modules.tools.Global;
import org.jeecg.modules.tools.dbsdkfzpt.RestTemplateUtils;
import org.jeecg.modules.tools.office.pdf.PDFUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
@ -253,7 +257,28 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
@Override
public List<ZyInfoStudent> getDocNoPdfList() {
return baseMapper.getDocNoPdfList();
List<ZyInfoStudent> ybtkblist = baseMapper.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());
baseMapper.updateById(zyInfoStudent);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return ybtkblist;
}
//校内查重批量提交