From 7c6b5b1da37154768ff9b5b99bef2612b8e971c3 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Mon, 22 May 2023 20:52:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E9=83=A8=E7=A0=81=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inv/InvInnerOrderPrintController.java | 18 +++++++++--------- .../service/inout/impl/IoOrderServiceImpl.java | 1 + src/main/java/com/glxp/api/util/FileUtils.java | 13 +++++++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inv/InvInnerOrderPrintController.java b/src/main/java/com/glxp/api/controller/inv/InvInnerOrderPrintController.java index b64f4696..7aabbf42 100644 --- a/src/main/java/com/glxp/api/controller/inv/InvInnerOrderPrintController.java +++ b/src/main/java/com/glxp/api/controller/inv/InvInnerOrderPrintController.java @@ -186,34 +186,34 @@ public class InvInnerOrderPrintController { } else { Map data = new HashMap(); data.put("data", printEntities); - JasperUtils.jasperReport(request, response, data, filePath + "/pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf"); + JasperUtils.jasperReport(request, response, data, filePath + "/pdf/template/" + FileUtils.getLastFileName(systemPDFTemplateEntity.getPath()), "pdf"); } - String orderId=""; + String orderId = ""; for (InnerOrderPrintResponse InnerOrderPrintResponse : mStockPrintEntities) { InvInnerOrderPrintEntity innerOrderPrintEntity = new InvInnerOrderPrintEntity(); innerOrderPrintEntity.setStatus(1); innerOrderPrintEntity.setId(InnerOrderPrintResponse.getId()); invInnerOrderPrintService.updateOrder(innerOrderPrintEntity); - orderId=InnerOrderPrintResponse.getId()+""; + orderId = InnerOrderPrintResponse.getId() + ""; } //查询订单id - InvInnerOrderPrintEntity innerOrderPrintEntity=invInnerOrderPrintService.selectById(orderId); + InvInnerOrderPrintEntity innerOrderPrintEntity = invInnerOrderPrintService.selectById(orderId); //更新内部码状态 - InnerOrderEntity innerOrderEntity=innerOrderService.findByRecordKey(innerOrderPrintEntity.getOrderIdFk()); - if(innerOrderEntity!=null){ + InnerOrderEntity innerOrderEntity = innerOrderService.findByRecordKey(innerOrderPrintEntity.getOrderIdFk()); + if (innerOrderEntity != null) { innerOrderEntity.setGenStatus(2); innerOrderEntity.setId(innerOrderEntity.getId()); innerOrderService.update(innerOrderEntity); } - IoOrderEntity ioOrderEntity=new IoOrderEntity(); + IoOrderEntity ioOrderEntity = new IoOrderEntity(); ioOrderEntity.setInCodeStatus(1); ioOrderEntity.setBillNo(innerOrderPrintEntity.getOrderIdFk()); ioOrderService.updateByBillNo(ioOrderEntity); @@ -229,7 +229,7 @@ public class InvInnerOrderPrintController { @RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) throws Exception { //查询模板文件是否存在 - SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(inspectionPDFTemplateRequest.getLabelId()+""); + SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(inspectionPDFTemplateRequest.getLabelId() + ""); if (null == sysPdfTemplateRelevanceStatemenEntity) { return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误"); } @@ -247,7 +247,7 @@ public class InvInnerOrderPrintController { @RequestBody InnerOrderQRCodeTextPDFTemplateRequest stockQRCodeTextPDFTemplateRequest, HttpServletRequest request, HttpServletResponse response) throws Exception { - SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(stockQRCodeTextPDFTemplateRequest.getLabelId()+""); + SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(stockQRCodeTextPDFTemplateRequest.getLabelId() + ""); if (sysPdfTemplateRelevanceStatemenEntity == null) return ResultVOUtils.error(500, "未找到单据模板模块设置,请检查"); SystemPDFTemplateEntity systemPDFTemplateEntity = diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java index 856f4813..b426efe3 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java @@ -153,6 +153,7 @@ public class IoOrderServiceImpl implements IoOrderService { orderEntity.setRelKey(UUID.fastUUID().toString(true)); } orderEntity.setExportStatus(0); //上传状态:未上传 + orderEntity.setInCodeStatus(0); return orderDao.insert(orderEntity); } diff --git a/src/main/java/com/glxp/api/util/FileUtils.java b/src/main/java/com/glxp/api/util/FileUtils.java index f9cdcf09..42a57a17 100644 --- a/src/main/java/com/glxp/api/util/FileUtils.java +++ b/src/main/java/com/glxp/api/util/FileUtils.java @@ -1,5 +1,7 @@ package com.glxp.api.util; +import cn.hutool.core.util.StrUtil; + import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -529,6 +531,16 @@ public class FileUtils { } } + public static String getLastFileName(String fileName) { + String fileNameNow = fileName.substring(fileName.lastIndexOf("/") + 1); + if (StrUtil.isEmpty(fileNameNow)) + return fileName; + else + return fileNameNow; + + } + + /** * 得到相对路径。 * 文件名不是目录名的子节点时返回文件名。 @@ -538,6 +550,7 @@ public class FileUtils { * @return 得到文件名相对于目录名的相对路径,目录下不存在该文件时返回文件名 * @since 1.0 */ + public static String getSubpath(String pathName, String fileName) { int index = fileName.indexOf(pathName); if (index != -1) {