添加修复doc转pdf不好使的问题
This commit is contained in:
parent
899298d0fe
commit
ac9d8c1e36
|
@ -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<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.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -44,4 +44,6 @@ public interface ZyInfoStudentMapper extends BaseMapper<ZyInfoStudent> {
|
||||||
void updateJxfs2(ZyInfo jspc);
|
void updateJxfs2(ZyInfo jspc);
|
||||||
|
|
||||||
IPage<ZyInfoStudent> getList2(Page<ZyInfoStudent> page,@Param(Constants.WRAPPER) QueryWrapper<ZyInfoStudent> queryWrapper);
|
IPage<ZyInfoStudent> getList2(Page<ZyInfoStudent> page,@Param(Constants.WRAPPER) QueryWrapper<ZyInfoStudent> queryWrapper);
|
||||||
|
|
||||||
|
List<ZyInfoStudent> getDocNoPdfList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,5 +163,8 @@
|
||||||
<update id="updateJxfs2">
|
<update id="updateJxfs2">
|
||||||
update zy_info_student set jxfs2 = '0' where main_id=#{id}
|
update zy_info_student set jxfs2 = '0' where main_id=#{id}
|
||||||
</update>
|
</update>
|
||||||
|
<select id="getDocNoPdfList" resultType="org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent">
|
||||||
|
select * from zy_info_student where file_path like '%.doc%' and pdf_path is null
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -44,4 +44,6 @@ public interface IZyInfoStudentService extends IService<ZyInfoStudent> {
|
||||||
void batchKhcl(List<String> list);
|
void batchKhcl(List<String> list);
|
||||||
|
|
||||||
IPage<ZyInfoStudent> getList2(Page<ZyInfoStudent> page, QueryWrapper<ZyInfoStudent> queryWrapper);
|
IPage<ZyInfoStudent> getList2(Page<ZyInfoStudent> page, QueryWrapper<ZyInfoStudent> queryWrapper);
|
||||||
|
|
||||||
|
List<ZyInfoStudent> getDocNoPdfList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,8 +145,11 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
|
||||||
public boolean stuWpKsjc(ZyInfoStudent zyInfoStudent, HttpServletResponse response) {
|
public boolean stuWpKsjc(ZyInfoStudent zyInfoStudent, HttpServletResponse response) {
|
||||||
String fileName = getFileName(zyInfoStudent.getFilePath(),response);
|
String fileName = getFileName(zyInfoStudent.getFilePath(),response);
|
||||||
zyInfoStudent.setFilePath(fileName);
|
zyInfoStudent.setFilePath(fileName);
|
||||||
zyInfoStudent = baseMapper.selectById(zyInfoStudent.getId());
|
System.out.println("----------------1---------------------"+zyInfoStudent.getStuId());
|
||||||
|
zyInfoStudent = baseMapper.selectById(zyInfoStudent.getStuId());
|
||||||
|
System.out.println("----------------2---------------------"+zyInfoStudent);
|
||||||
ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId());
|
ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId());
|
||||||
|
System.out.println("----------------3---------------------"+zyInfo);
|
||||||
|
|
||||||
|
|
||||||
// String rwbh = zyInfo.getRwbh();
|
// String rwbh = zyInfo.getRwbh();
|
||||||
|
@ -160,9 +163,11 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
|
||||||
zyInfoStudent.setCateid(cateid);
|
zyInfoStudent.setCateid(cateid);
|
||||||
zyInfoStudent.setCatename(catename);
|
zyInfoStudent.setCatename(catename);
|
||||||
|
|
||||||
|
System.out.println("----------------4---------------------");
|
||||||
//删除维普已经提交的文档
|
//删除维普已经提交的文档
|
||||||
delweipulunwen(zyInfoStudent, response);
|
delweipulunwen(zyInfoStudent, response);
|
||||||
|
|
||||||
|
System.out.println("----------------5---------------------");
|
||||||
|
|
||||||
//外网查重及提交检测
|
//外网查重及提交检测
|
||||||
if(StringUtils.equals(zyInfo.getWwcc(),"true")){
|
if(StringUtils.equals(zyInfo.getWwcc(),"true")){
|
||||||
|
@ -186,6 +191,7 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
|
||||||
// zyInfoStudent.setCatename("东北师大全校作业比对库");
|
// zyInfoStudent.setCatename("东北师大全校作业比对库");
|
||||||
// xnccSave(zyInfoStudent,"0",response);//不提交比对
|
// xnccSave(zyInfoStudent,"0",response);//不提交比对
|
||||||
}
|
}
|
||||||
|
System.out.println("----------------6---------------------");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +215,11 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl<ZyInfoStudentMapper, Z
|
||||||
return baseMapper.getList2(page,queryWrapper);
|
return baseMapper.getList2(page,queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ZyInfoStudent> getDocNoPdfList() {
|
||||||
|
return baseMapper.getDocNoPdfList();
|
||||||
|
}
|
||||||
|
|
||||||
private void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response) {
|
private void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response) {
|
||||||
zyInfoStudent.setQueryType("0");//外网查重数据
|
zyInfoStudent.setQueryType("0");//外网查重数据
|
||||||
String paperids = baseMapper.getWpFile(zyInfoStudent);
|
String paperids = baseMapper.getWpFile(zyInfoStudent);
|
||||||
|
|
Loading…
Reference in New Issue