diff --git a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdiscountpackagehandover/BusDiscountpackageHandoverService.java b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdiscountpackagehandover/BusDiscountpackageHandoverService.java index 867a00f6c1..a0eba23dc7 100644 --- a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdiscountpackagehandover/BusDiscountpackageHandoverService.java +++ b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdiscountpackagehandover/BusDiscountpackageHandoverService.java @@ -449,12 +449,11 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService 0 && !busFiles.isEmpty()) { this.uploadPicture(dto); } -// BusDiscountpackageHandoverDetailsVo detailsVo = this.handoverDetails(sid); -// String s = commonCreatePdf(detailsVo); -// String targetPath = docPdfComponent.getUploadTemplateUrl(); -// String filePath = s.substring(targetPath.length()); -// BusDiscountpackageHandover entity = fetchBySid(sid); -// entity.setFilePath(filePath); -// baseMapper.updateById(entity); + BusDiscountpackageHandoverDetailsVo detailsVo = this.handoverDetails(sid); + String s = commonCreatePdf(detailsVo); + String targetPath = docPdfComponent.getUploadTemplateUrl(); + String filePath = s.substring(targetPath.length()); + BusDiscountpackageHandover entity = fetchBySid(sid); + entity.setFilePath(filePath); + baseMapper.updateById(entity); return rb.success(); } @@ -1022,11 +1021,11 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService> pdf = createPdf(busHandover.getSid()); -// String path = ""; -// if (pdf.getSuccess()) { -// //打印pdf -// List filePaths = pdf.getData(); -// List fileList = new ArrayList<>(); -// if (!filePaths.isEmpty()) { -// for (String filePath : filePaths) { -// File file = new File(filePath); -// fileList.add(file); -// } -// } -// String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); -// long seconds = System.currentTimeMillis(); -// String targetPath = docPdfComponent.getUploadTemplateUrl(); -// File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "交车确认.pdf"); -// if (fileList.size() <= 0) { -// path = null; -// } else { -// for (File fileDelete : fileList) { -// fileDelete.delete(); -// } -// path = dateStr + seconds + "交车确认.pdf"; -// } -// } - String path = "temp"; + ResultBean> pdf = createPdf(busHandover.getSid()); + String path = ""; + if (pdf.getSuccess()) { + //打印pdf + List filePaths = pdf.getData(); + List fileList = new ArrayList<>(); + if (!filePaths.isEmpty()) { + for (String filePath : filePaths) { + File file = new File(filePath); + fileList.add(file); + } + } + String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); + long seconds = System.currentTimeMillis(); + String targetPath = docPdfComponent.getUploadTemplateUrl(); + File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "交车确认.pdf"); + if (fileList.size() <= 0) { + path = null; + } else { + for (File fileDelete : fileList) { + fileDelete.delete(); + } + path = dateStr + seconds + "交车确认.pdf"; + } + } BusHandover entity = fetchBySid(busHandover.getSid()); entity.setFilePath(path); baseMapper.updateById(entity); @@ -1776,32 +1775,31 @@ public class BusHandoverService extends MybatisBaseService> pdf = createPdf(busHandover.getSid()); -// String path = ""; -// if (pdf.getSuccess()) { -// //打印pdf -// List filePaths = pdf.getData(); -// List fileList = new ArrayList<>(); -// if (!filePaths.isEmpty()) { -// for (String filePath : filePaths) { -// File file = new File(filePath); -// fileList.add(file); -// } -// } -// String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); -// long seconds = System.currentTimeMillis(); -// String targetPath = docPdfComponent.getUploadTemplateUrl(); -// File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "交车确认.pdf"); -// if (fileList.size() <= 0) { -// path = null; -// } else { -// for (File fileDelete : fileList) { -// fileDelete.delete(); -// } -// path = dateStr + seconds + "交车确认.pdf"; -// } -// } - String path = "temp"; + ResultBean> pdf = createPdf(busHandover.getSid()); + String path = ""; + if (pdf.getSuccess()) { + //打印pdf + List filePaths = pdf.getData(); + List fileList = new ArrayList<>(); + if (!filePaths.isEmpty()) { + for (String filePath : filePaths) { + File file = new File(filePath); + fileList.add(file); + } + } + String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); + long seconds = System.currentTimeMillis(); + String targetPath = docPdfComponent.getUploadTemplateUrl(); + File file = WordConvertUtils.mulFile2One(fileList, targetPath + dateStr + seconds + "交车确认.pdf"); + if (fileList.size() <= 0) { + path = null; + } else { + for (File fileDelete : fileList) { + fileDelete.delete(); + } + path = dateStr + seconds + "交车确认.pdf"; + } + } BusHandover entity = fetchBySid(busHandover.getSid()); entity.setFilePath(path); baseMapper.updateById(entity); @@ -2604,11 +2602,10 @@ public class BusHandoverService extends MybatisBaseService