修改pdf上传
This commit is contained in:
parent
cd31ff7833
commit
f28653e020
|
@ -35,6 +35,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import org.jeecg.modules.tools.Global;
|
||||
import org.jeecg.modules.tools.pdf.PDFUtil;
|
||||
import org.jeecg.modules.zyk.entity.ZykInfo;
|
||||
import org.jeecg.modules.zyk.service.IZykService;
|
||||
import org.jeecg.modules.zyk.utils.WjlxEnum;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
|
@ -76,6 +79,9 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
|
|||
@Autowired
|
||||
private IZyDbtxService zyDbtxService;
|
||||
|
||||
@Autowired
|
||||
private IZykService zykService;
|
||||
|
||||
@Value("${jeecg.path.upload}")
|
||||
private String upLoadPath;
|
||||
/**
|
||||
|
@ -249,29 +255,44 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
|
|||
@RequestMapping(value = "/zyscStu", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> zyscStu(@RequestBody ZyInfoStudent zyInfoStudent) {
|
||||
|
||||
ZyInfoStudent stuPar = zyInfoStudentService.getById(zyInfoStudent.getId());
|
||||
ZyInfo zyInfo = zyInfoService.getById(stuPar.getMainId());
|
||||
|
||||
String nameLast = zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf(".")+1);
|
||||
if(StringUtils.equals("pdf",nameLast)){
|
||||
zyInfoStudent.setPdfPath(zyInfoStudent.getFilePath());
|
||||
}else{
|
||||
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);
|
||||
// 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);
|
||||
|
||||
|
||||
ZykInfo zykInfo = new ZykInfo();
|
||||
zykInfo.setBizId(zyInfoStudent.getId());
|
||||
zykInfo.setBizTable("zy_jxdg");
|
||||
zykInfo.setWjlx(WjlxEnum.JXDG.getType());
|
||||
zykInfo.setRwbh(zyInfo.getRwbh());
|
||||
zykInfo.setFileName(zyInfoStudent.getFilePath());
|
||||
Map<String,String> map = zykService.saveToZykJxdg(zykInfo);
|
||||
String fileName = map.get("data");
|
||||
String pdfName = map.get("pdfData");
|
||||
zyInfoStudent.setFilePath(fileName);
|
||||
zyInfoStudent.setPdfPath(pdfName);
|
||||
|
||||
}
|
||||
zyInfoStudentService.updateById(zyInfoStudent);
|
||||
|
||||
|
||||
|
||||
|
||||
ZyInfoStudent stuPar = zyInfoStudentService.getById(zyInfoStudent.getId());
|
||||
ZyInfo zyInfo = zyInfoService.getById(stuPar.getMainId());
|
||||
//作业代办提醒
|
||||
ZyDbtx zyDbtx = new ZyDbtx();
|
||||
zyDbtx.setCreateBy(zyInfo.getCreateBy());
|
||||
|
|
|
@ -390,18 +390,37 @@ public class ZyJxdgController extends JeecgController<ZyJxdg, IZyJxdgService> {
|
|||
if(StringUtils.equals("pdf",nameLast)){
|
||||
zyJxdg.setJxrlPdfPath(zyJxdg.getJxrlFilePath());
|
||||
}else{
|
||||
Global global = SpringContextHolder.getBean(Global.class);
|
||||
FileUtil.mkdir(global.getContractDickPath());
|
||||
String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
|
||||
String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath();
|
||||
String namePath = dd + ".pdf";
|
||||
String pdfPath = global.getContractDickPath() + namePath;
|
||||
PDFUtil.office2PDF(docPath,pdfPath);
|
||||
zyJxdg.setJxrlPdfPath("contract/"+namePath);
|
||||
// Global global = SpringContextHolder.getBean(Global.class);
|
||||
// FileUtil.mkdir(global.getContractDickPath());
|
||||
// String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
|
||||
// String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath();
|
||||
// String namePath = dd + ".pdf";
|
||||
// String pdfPath = global.getContractDickPath() + namePath;
|
||||
// PDFUtil.office2PDF(docPath,pdfPath);
|
||||
// zyJxdg.setJxrlPdfPath("contract/"+namePath);
|
||||
|
||||
|
||||
|
||||
ZykInfo zykInfo = new ZykInfo();
|
||||
zykInfo.setBizId(zyJxdg.getId());
|
||||
zykInfo.setBizTable("zy_jxdg");
|
||||
zykInfo.setWjlx(WjlxEnum.JXRL.getType());
|
||||
zykInfo.setRwbh(zyJxdg.getRwbh());
|
||||
zykInfo.setFileName(zyJxdg.getJxrlFilePath());
|
||||
Map<String,String> map = zykService.saveToZykJxdg(zykInfo);
|
||||
String fileName = map.get("data");
|
||||
String pdfName = map.get("pdfData");
|
||||
zyJxdg.setJxrlFilePath(fileName);
|
||||
zyJxdg.setJxrlPdfPath(pdfName);
|
||||
|
||||
}
|
||||
}else{
|
||||
zyJxdg.setJxrlPdfPath(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(StringUtils.isEmpty(zyJxdg.getId())){
|
||||
zyJxdgService.save(zyJxdg);
|
||||
}else{
|
||||
|
|
|
@ -311,9 +311,9 @@ public class FileHandleUtil {
|
|||
return map;
|
||||
}
|
||||
map.put("filePath",uploadFileName);
|
||||
String fileName = uploadFileName.substring(uploadFileName.lastIndexOf('/')+1, uploadFileName.indexOf("_"));
|
||||
String suffix = uploadFileName.substring(uploadFileName.lastIndexOf("."));
|
||||
fileName = fileName + suffix;
|
||||
String fileName = uploadFileName.substring(uploadFileName.lastIndexOf('/')+1, uploadFileName.length());
|
||||
// String suffix = uploadFileName.substring(uploadFileName.lastIndexOf("."));
|
||||
// fileName = fileName + suffix;
|
||||
map.put("fileName",fileName);
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -176,8 +176,8 @@ jeecg:
|
|||
# 签名拦截接口
|
||||
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys
|
||||
#local、minio、alioss
|
||||
uploadType: local
|
||||
# uploadType: sftp
|
||||
# uploadType: local
|
||||
uploadType: sftp
|
||||
# 前端访问地址
|
||||
domainUrl:
|
||||
pc: http://localhost:3100
|
||||
|
|
Loading…
Reference in New Issue