diff --git a/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basediscountpackage/BaseDiscountpackageService.java b/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basediscountpackage/BaseDiscountpackageService.java index e5670d32cd..39f6f69d99 100644 --- a/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basediscountpackage/BaseDiscountpackageService.java +++ b/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basediscountpackage/BaseDiscountpackageService.java @@ -30,7 +30,6 @@ import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; import com.yxt.anrui.portal.api.sysuser.SysUserFeign; -import com.yxt.anrui.portal.api.sysuser.SysUserVo; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; import com.yxt.common.core.query.PagerQuery; @@ -395,6 +394,7 @@ public class BaseDiscountpackageService extends MybatisBaseService voList = baseMapper.getAppPackage(qw); if (voList.isEmpty()) { voList = new ArrayList<>(); diff --git a/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java b/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java index 4421ad1b31..ef278b91ea 100644 --- a/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java +++ b/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java @@ -74,6 +74,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.File; +import java.io.InputStream; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; @@ -750,24 +751,32 @@ public class CommonContractService extends MybatisBaseService map, AppOrderDetailsVo appOrderDetailsVo) { - File file = null; +// File file = null; + + String ftl = ""; if ("现车".equals(appOrderDetailsVo.getOrderType())) { //获取模板 - file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles.ftl").getFile()); +// file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles.ftl").getFile()); + ftl = "existingvehicles.ftl"; } else { //获取模板 - file = new File(getClass().getClassLoader().getResource("ftl/orderacar.ftl").getFile()); + ftl = "orderacar.ftl"; +// file = new File(getClass().getClassLoader().getResource("ftl/orderacar.ftl").getFile()); } - String dir = getClassLoader().getResource("ftl").getPath(); + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl); +// String dir = getClassLoader().getResource("ftl").getPath(); //生成word文件名 String targetPath = docPdfComponent.getUploadTemplateUrl(); String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); long seconds = System.currentTimeMillis(); String typeName = dateStr + seconds + ".doc"; - WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); + File file = new File(targetPath + ftl); + File dir = new File(targetPath); + WordConvertUtils.inputStreamToFile(inputStream, file); + WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); //新生成的word路径 String wordPath = targetPath + typeName; - //生成出门证文件名 + //生成文件名 String pdfName = dateStr + seconds + ".pdf"; WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); return pdfName; @@ -805,27 +814,34 @@ public class CommonContractService extends MybatisBaseService map, AppOrderDetailsVo appOrderDetailsVo) { String url = ""; - File file = null; +// File file = null; map.put("totalPrice", ""); map.put("priceRemarks", ""); map.put("depositTotal", ""); + String ftl = ""; // 涉及高低开票的,需要打印两套合同,一套按照成交价打印(记账用),一套为价格空白的合同(开票用) if ("1".equals(dto.getDiscountKey())) { // 现车 if ("现车".equals(appOrderDetailsVo.getOrderType())) { //获取模板 - file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles_black.ftl").getFile()); + ftl = "existingvehicles_black.ftl"; +// file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles_black.ftl").getFile()); } else { // 订车获取模板 - file = new File(getClass().getClassLoader().getResource("ftl/orderacar_black.ftl").getFile()); + ftl = "orderacar_black.ftl"; +// file = new File(getClass().getClassLoader().getResource("ftl/orderacar_black.ftl").getFile()); } - String dir = getClassLoader().getResource("ftl").getPath(); +// String dir = getClassLoader().getResource("ftl").getPath(); + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl); //生成word文件名 String targetPath = docPdfComponent.getUploadTemplateUrl(); String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); long seconds = System.currentTimeMillis(); String typeName = dateStr + seconds + ".doc"; - WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); + File file = new File(targetPath + ftl); + File dir = new File(targetPath); + WordConvertUtils.inputStreamToFile(inputStream, file); + WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); //新生成的word路径 String wordPath = targetPath + typeName; //生成合同文件名 @@ -1231,7 +1247,7 @@ public class CommonContractService extends MybatisBaseService voResultBean = flowableFeign.startProcess(bv); UpdateFlowFieldVo ufVo = voResultBean.getData(); updateFlowFiled(BeanUtil.beanToMap(ufVo)); - if(!voResultBean.getSuccess()){ + if (!voResultBean.getSuccess()) { return rb.setMsg(voResultBean.getMsg()); } baseMapper.updateBySidAndState(businessSid, "2"); diff --git a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bushandover/BusHandoverVo.java b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bushandover/BusHandoverVo.java index 7e71d4cb15..0d72d91f25 100644 --- a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bushandover/BusHandoverVo.java +++ b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bushandover/BusHandoverVo.java @@ -46,4 +46,6 @@ public class BusHandoverVo implements Vo { //下载路径 private List fileResps = new ArrayList<>(); + private String recipient; + } diff --git a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverMapper.xml b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverMapper.xml index 8654d90a9c..c75e7fa20d 100644 --- a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverMapper.xml +++ b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverMapper.xml @@ -39,7 +39,8 @@ bhi.modelName, bh.sid, (select count(*) from bus_handover_items bhi2 where bhi2.handoverSid = bh.sid) as number, - bh.handoverStateKey + bh.handoverStateKey, + bh.recipient from bus_handover bh left join bus_handover_items bhi on bh.sid = bhi.handoverSid diff --git a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverService.java b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverService.java index 99d46f0f8e..601977beaa 100644 --- a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverService.java +++ b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bushandover/BusHandoverService.java @@ -48,8 +48,6 @@ import java.util.*; import java.util.concurrent.*; import java.util.stream.Collectors; -import static cn.hutool.core.util.ClassLoaderUtil.getClassLoader; - /** * Project: anrui-buscenter(业务中心)
* File: BusHandoverService.java
@@ -185,7 +183,7 @@ public class BusHandoverService extends MybatisBaseService future2 = pool.submit(() -> { + Future future2 = pool.submit(() -> { return entrustConfirmImages(busHandover.getSid()); }); if (StringUtils.isNotBlank(future2.get())) { @@ -206,26 +204,28 @@ public class BusHandoverService extends MybatisBaseService future3 = pool.submit(() -> { - return entrustImages(busHandover.getSid()); - }); - if (StringUtils.isNotBlank(future3.get())) { - busHandoverListVo = new BusHandoverListVo(); - busHandoverListVo.setName(MessageFormat.format("《{0}》", BuscenterFileEnum.ENTRUST_IMAGES.getMark())); - busHandoverListVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future3.get()); - list.add(busHandoverListVo); - String str = future1.get(); - buscenterFile = new BuscenterFile(); - buscenterFile.setLinkSid(busHandover.getSid()); - buscenterFile.setFilePath(future3.get()); - buscenterFile.setAttachType(BuscenterFileEnum.ENTRUST.getAttachType()); - File file = new File(fileUploadComponent.getUploadPath() + str.replace("/", File.separator)); - if (file != null) { - buscenterFile.setFileSize(fileUploadComponent.getPrintSize(file.length())); + if (!busHandover.getCustomerName().equals(busHandover.getRecipient())) { + Future future3 = pool.submit(() -> { + return entrustImages(busHandover.getSid()); + }); + if (StringUtils.isNotBlank(future3.get())) { + busHandoverListVo = new BusHandoverListVo(); + busHandoverListVo.setName(MessageFormat.format("《{0}》", BuscenterFileEnum.ENTRUST_IMAGES.getMark())); + busHandoverListVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future3.get()); + list.add(busHandoverListVo); + String str = future1.get(); + buscenterFile = new BuscenterFile(); + buscenterFile.setLinkSid(busHandover.getSid()); + buscenterFile.setFilePath(future3.get()); + buscenterFile.setAttachType(BuscenterFileEnum.ENTRUST.getAttachType()); + File file = new File(fileUploadComponent.getUploadPath() + str.replace("/", File.separator)); + if (file != null) { + buscenterFile.setFileSize(fileUploadComponent.getPrintSize(file.length())); + } + buscenterFile.setFileName(BuscenterFileEnum.ENTRUST_IMAGES.getMark()); + buscenterFile.setFileType(str.substring(str.lastIndexOf(".") + 1)); + buscenterFileService.insert(buscenterFile); } - buscenterFile.setFileName(BuscenterFileEnum.ENTRUST_IMAGES.getMark()); - buscenterFile.setFileType(str.substring(str.lastIndexOf(".") + 1)); - buscenterFileService.insert(buscenterFile); } Future future4 = pool.submit(() -> { return outDoor(busHandover.getSid()); @@ -247,7 +247,7 @@ public class BusHandoverService extends MybatisBaseService list = busHandoverItemsService.getList(sid); List stringList = list.stream().map(v -> v.getVinNo()).collect(Collectors.toList()); map.put("vinNo", String.join(",", stringList)); - File file = new File(getClass().getClassLoader().getResource("ftl/entrust.ftl").getFile()); - String dir = getClassLoader().getResource("ftl").getPath(); +// File file = new File(getClass().getClassLoader().getResource("ftl/entrust.ftl").getFile()); + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/entrust.ftl"); +// String dir = getClassLoader().getResource("ftl").getPath(); //生成word文件名 String targetPath = docPdfComponent.getUploadTemplateUrl(); String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); long seconds = System.currentTimeMillis(); String typeName = dateStr + seconds + ".doc"; - WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); + File file = new File(targetPath + "entrust.ftl"); + File dir = new File(targetPath); + WordConvertUtils.inputStreamToFile(inputStream, file); + WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); //新生成的word路径 String wordPath = targetPath + typeName; //生成出门证文件名 @@ -366,14 +370,18 @@ public class BusHandoverService extends MybatisBaseService list = busHandoverItemsService.getList(sid); map.put("list", list); - File file = new File(getClass().getClassLoader().getResource("ftl/entrustConfirm.ftl").getFile()); - String dir = getClassLoader().getResource("ftl").getPath(); +// File file = new File(getClass().getClassLoader().getResource("ftl/entrustConfirm.ftl").getFile()); +// String dir = getClassLoader().getResource("ftl").getPath(); + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/entrustConfirm.ftl"); //生成word文件名 String targetPath = docPdfComponent.getUploadTemplateUrl(); String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); long seconds = System.currentTimeMillis(); String typeName = dateStr + seconds + ".doc"; - WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); + File file = new File(targetPath + "entrustConfirm.ftl"); + File dir = new File(targetPath); + WordConvertUtils.inputStreamToFile(inputStream, file); + WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); //新生成的word路径 String wordPath = targetPath + typeName; //生成出门证文件名 @@ -407,14 +415,18 @@ public class BusHandoverService extends MybatisBaseService * File: ScmVehicleGressionService.java
@@ -1373,14 +1372,18 @@ public class ScmVehicleGressionService extends MybatisBaseService