Browse Source

交车资料捕获异常

master
fanzongzhe 2 years ago
parent
commit
440ed50956
  1. 48
      anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busvehicledatahandover/BusVehicleDataHandoverService.java

48
anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busvehicledatahandover/BusVehicleDataHandoverService.java

@ -234,23 +234,29 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
}
}
dataMap.put("newList", newList);
//获取模板
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/vinHandoverData.ftl");
//生成word文件名
String path = "";
String targetPath = docPdfComponent.getUploadTemplateUrl();
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
long seconds = System.currentTimeMillis();
String typeName = dateStr + seconds + ".doc";
File file = new File(targetPath + "vehicledatahandover" + seconds + ".ftl");
File dir = new File(targetPath);
WordConvertUtils.inputStreamToFile(inputStream, file);
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir);
//新生成的word路径
String wordPath = targetPath + typeName;
//生成出门证文件名
String pdfName = "交车资料确认单" + dateStr + seconds + ".pdf";
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName);
String path = targetPath + pdfName;
try {
//获取模板
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/vinHandoverData.ftl");
//生成word文件名
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
long seconds = System.currentTimeMillis();
String typeName = dateStr + seconds + ".doc";
File file = new File(targetPath + "vehicledatahandover" + seconds + ".ftl");
File dir = new File(targetPath);
WordConvertUtils.inputStreamToFile(inputStream, file);
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir);
//新生成的word路径
String wordPath = targetPath + typeName;
//生成出门证文件名
String pdfName = "交车资料确认单" + dateStr + seconds + ".pdf";
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName);
path = targetPath + pdfName;
} catch (Exception e) {
e.printStackTrace();
path = targetPath + "temp";
}
return path;
}
@ -394,15 +400,9 @@ public class BusVehicleDataHandoverService extends MybatisBaseService<BusVehicle
}
pdfVo.setPdfVos(pdfVos);
//--------------生成pdf抛出异常----------------
String filePath = "";
String template = "/template/";
try {
String s = commonCreatePdf(pdfVo);
filePath = s.substring(docPdfComponent.getUploadTemplateUrl().length());
} catch (Exception e) {
e.printStackTrace();
filePath = "tempForTest";
}
String s = commonCreatePdf(pdfVo);
String filePath = s.substring(docPdfComponent.getUploadTemplateUrl().length());
if (!newSids.isEmpty()) {
for (String newSid : newSids) {
BusVehicleDataHandover handover = fetchBySid(newSid);

Loading…
Cancel
Save