修改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.Global;
|
||||||
import org.jeecg.modules.tools.pdf.PDFUtil;
|
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.ExcelImportUtil;
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
|
@ -76,6 +79,9 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
|
||||||
@Autowired
|
@Autowired
|
||||||
private IZyDbtxService zyDbtxService;
|
private IZyDbtxService zyDbtxService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IZykService zykService;
|
||||||
|
|
||||||
@Value("${jeecg.path.upload}")
|
@Value("${jeecg.path.upload}")
|
||||||
private String upLoadPath;
|
private String upLoadPath;
|
||||||
/**
|
/**
|
||||||
|
@ -249,29 +255,44 @@ public class ZyInfoStudentController extends JeecgController<ZyInfoStudent, IZyI
|
||||||
@RequestMapping(value = "/zyscStu", method = {RequestMethod.PUT,RequestMethod.POST})
|
@RequestMapping(value = "/zyscStu", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
public Result<String> zyscStu(@RequestBody ZyInfoStudent zyInfoStudent) {
|
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);
|
String nameLast = zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf(".")+1);
|
||||||
if(StringUtils.equals("pdf",nameLast)){
|
if(StringUtils.equals("pdf",nameLast)){
|
||||||
zyInfoStudent.setPdfPath(zyInfoStudent.getFilePath());
|
zyInfoStudent.setPdfPath(zyInfoStudent.getFilePath());
|
||||||
}else{
|
}else{
|
||||||
Global global = SpringContextHolder.getBean(Global.class);
|
// Global global = SpringContextHolder.getBean(Global.class);
|
||||||
FileUtil.mkdir(global.getContractDickPath());
|
// FileUtil.mkdir(global.getContractDickPath());
|
||||||
String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
|
// String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
|
||||||
String docPath = upLoadPath+ File.separator+ zyInfoStudent.getFilePath();
|
// String docPath = upLoadPath+ File.separator+ zyInfoStudent.getFilePath();
|
||||||
String namePath = dd + ".pdf";
|
// String namePath = dd + ".pdf";
|
||||||
String pdfPath = global.getContractDickPath() + namePath;
|
// String pdfPath = global.getContractDickPath() + namePath;
|
||||||
System.out.println("filPath:"+zyInfoStudent.getFilePath());
|
// System.out.println("filPath:"+zyInfoStudent.getFilePath());
|
||||||
System.out.println("docPath:"+docPath);
|
// System.out.println("docPath:"+docPath);
|
||||||
System.out.println("pdfPath:"+pdfPath);
|
// System.out.println("pdfPath:"+pdfPath);
|
||||||
PDFUtil.office2PDF(docPath,pdfPath);
|
// PDFUtil.office2PDF(docPath,pdfPath);
|
||||||
zyInfoStudent.setPdfPath("contract/"+namePath);
|
// 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);
|
zyInfoStudentService.updateById(zyInfoStudent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ZyInfoStudent stuPar = zyInfoStudentService.getById(zyInfoStudent.getId());
|
|
||||||
ZyInfo zyInfo = zyInfoService.getById(stuPar.getMainId());
|
|
||||||
//作业代办提醒
|
//作业代办提醒
|
||||||
ZyDbtx zyDbtx = new ZyDbtx();
|
ZyDbtx zyDbtx = new ZyDbtx();
|
||||||
zyDbtx.setCreateBy(zyInfo.getCreateBy());
|
zyDbtx.setCreateBy(zyInfo.getCreateBy());
|
||||||
|
|
|
@ -390,18 +390,37 @@ public class ZyJxdgController extends JeecgController<ZyJxdg, IZyJxdgService> {
|
||||||
if(StringUtils.equals("pdf",nameLast)){
|
if(StringUtils.equals("pdf",nameLast)){
|
||||||
zyJxdg.setJxrlPdfPath(zyJxdg.getJxrlFilePath());
|
zyJxdg.setJxrlPdfPath(zyJxdg.getJxrlFilePath());
|
||||||
}else{
|
}else{
|
||||||
Global global = SpringContextHolder.getBean(Global.class);
|
// Global global = SpringContextHolder.getBean(Global.class);
|
||||||
FileUtil.mkdir(global.getContractDickPath());
|
// FileUtil.mkdir(global.getContractDickPath());
|
||||||
String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
|
// String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
|
||||||
String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath();
|
// String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath();
|
||||||
String namePath = dd + ".pdf";
|
// String namePath = dd + ".pdf";
|
||||||
String pdfPath = global.getContractDickPath() + namePath;
|
// String pdfPath = global.getContractDickPath() + namePath;
|
||||||
PDFUtil.office2PDF(docPath,pdfPath);
|
// PDFUtil.office2PDF(docPath,pdfPath);
|
||||||
zyJxdg.setJxrlPdfPath("contract/"+namePath);
|
// 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{
|
}else{
|
||||||
zyJxdg.setJxrlPdfPath(null);
|
zyJxdg.setJxrlPdfPath(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(StringUtils.isEmpty(zyJxdg.getId())){
|
if(StringUtils.isEmpty(zyJxdg.getId())){
|
||||||
zyJxdgService.save(zyJxdg);
|
zyJxdgService.save(zyJxdg);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -311,9 +311,9 @@ public class FileHandleUtil {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
map.put("filePath",uploadFileName);
|
map.put("filePath",uploadFileName);
|
||||||
String fileName = uploadFileName.substring(uploadFileName.lastIndexOf('/')+1, uploadFileName.indexOf("_"));
|
String fileName = uploadFileName.substring(uploadFileName.lastIndexOf('/')+1, uploadFileName.length());
|
||||||
String suffix = uploadFileName.substring(uploadFileName.lastIndexOf("."));
|
// String suffix = uploadFileName.substring(uploadFileName.lastIndexOf("."));
|
||||||
fileName = fileName + suffix;
|
// fileName = fileName + suffix;
|
||||||
map.put("fileName",fileName);
|
map.put("fileName",fileName);
|
||||||
return map;
|
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
|
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
|
#local、minio、alioss
|
||||||
uploadType: local
|
# uploadType: local
|
||||||
# uploadType: sftp
|
uploadType: sftp
|
||||||
# 前端访问地址
|
# 前端访问地址
|
||||||
domainUrl:
|
domainUrl:
|
||||||
pc: http://localhost:3100
|
pc: http://localhost:3100
|
||||||
|
|
Loading…
Reference in New Issue