From 3db2210e09e92a507935af414c9c455b657f5254 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Wed, 8 Nov 2023 10:40:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8D=B0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=8C=89=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/auth/SysUserController.java | 2 +- .../basic/BasicOrderPrintController.java | 72 ++++++++++--------- src/main/java/com/glxp/api/util/IntUtil.java | 10 +++ 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/auth/SysUserController.java b/src/main/java/com/glxp/api/controller/auth/SysUserController.java index 00555858..4f5c979b 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysUserController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysUserController.java @@ -185,7 +185,7 @@ public class SysUserController extends BaseController { return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "当前管理员已存在"); } AuthAdmin authAdmin = new AuthAdmin(); - BeanUtil.copyProperties(authUserSaveRequest, authAdmin); + BeanUtils.copyProperties(authUserSaveRequest, authAdmin); if (authAdmin.getPassWord() != null) { authAdmin.setPassWord(PasswordUtils.authAdminPwd(authAdmin.getPassWord())); } diff --git a/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java b/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java index d14e8c78..7e400558 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java @@ -7,9 +7,11 @@ import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.basic.BasicBussinessTypeEntity; import com.glxp.api.entity.basic.UdiProductEntity; +import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.inout.IoCodeEntity; import com.glxp.api.entity.inout.IoOrderDetailBizEntity; import com.glxp.api.entity.system.*; +import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.req.basic.FilterOrderPrintRequest; import com.glxp.api.req.inout.FilterOrderRequest; import com.glxp.api.res.basic.UdiRelevanceResponse; @@ -20,11 +22,10 @@ import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.inout.IoOrderDetailBizService; import com.glxp.api.service.inout.IoOrderService; import com.glxp.api.service.inout.impl.IoCodeService; -import com.glxp.api.service.system.SystemPDFModuleService; -import com.glxp.api.service.system.SystemPDFTemplateRelevanceCodeService; -import com.glxp.api.service.system.SystemPDFTemplateRelevanceService; -import com.glxp.api.service.system.SystemPDFTemplateService; +import com.glxp.api.service.system.*; +import com.glxp.api.service.thrsys.ThrProductsService; import com.glxp.api.util.FileUtils; +import com.glxp.api.util.IntUtil; import com.glxp.api.util.JasperUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -69,6 +70,11 @@ public class BasicOrderPrintController { @Value("${file_path}") private String filePath; + @Resource + SystemParamConfigService systemParamConfigService; + @Resource + ThrProductsService thrProductsService; + //校验模板是否正确 @AuthRuleAnnotation("") @PostMapping("/udiwms/pdf/template/inspection/order/file") @@ -101,7 +107,7 @@ public class BasicOrderPrintController { Map data = new HashMap<>(1); List list = new ArrayList<>(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式 - + String printThird = systemParamConfigService.selectValueByParamKey("order_print_by_thrproduct"); //查询打印格式 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(filterOrderPrintRequest.getAction()); //根据批次号打印 @@ -117,7 +123,6 @@ public class BasicOrderPrintController { for (IoOrderDetailBizEntity obj : ioOrderDetailBizEntityList) { //查询产品表 UdiProductEntity udiProductEntity = udiProductService.findByUuid(obj.getUuidFk()); -// List ioOrderInvoiceResponses = ioOrderDetailBizService.selectByorderIdFk(obj.getOrderIdFk()); //组装数据 Map bizData = new HashMap<>(); bizData.put("index", i); @@ -140,19 +145,21 @@ public class BasicOrderPrintController { bizData.put("manufactor", obj.getManufacturer()); bizData.put("zczbhhzbapzbh", obj.getCertCode() == null ? ' ' : obj.getCertCode()); bizData.put("ylqxzcrbarmc", udiProductEntity.getYlqxzcrbarmc() == null ? ' ' : udiProductEntity.getYlqxzcrbarmc()); -// bizData.put("cplb", udiProductEntity.getCplb() == null ? ' ' : udiProductEntity.getCplb()); -// if(ioOrderInvoiceResponses != null && ioOrderInvoiceResponses.size()>0){ -// String encode=""; -// for (IoOrderInvoiceResponse respons : ioOrderInvoiceResponses) { -// encode+=respons.getInvoiceEncode()+","; -// } -// encode = encode.substring(0,encode.length()-1); -// bizData.put("invoiceEncode", encode == null ? ' ' : encode); -// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// String dateStr = sdf.format(ioOrderInvoiceResponses.get(0).getCreateTime()); -// bizData.put("createTime", dateStr == null ? ' ' : dateStr); -// -// } + + + if (IntUtil.value(printThird) == 1) { + UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(obj.getBindRlFk()); + ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(udiRelevanceEntity.getThirdId()); + bizData.put("productName", thrProductsEntity.getName() == null ? ' ' : thrProductsEntity.getName()); + bizData.put("spmc", thrProductsEntity.getName() == null ? ' ' : thrProductsEntity.getName()); + bizData.put("spec", thrProductsEntity.getSpec() == null ? ' ' : thrProductsEntity.getSpec()); + bizData.put("measname", thrProductsEntity.getMeasname() == null ? ' ' : thrProductsEntity.getMeasname()); + bizData.put("manufactor", thrProductsEntity.getManufactory()); + bizData.put("zczbhhzbapzbh", thrProductsEntity.getRegisterNo() == null ? ' ' : thrProductsEntity.getRegisterNo()); + bizData.put("ylqxzcrbarmc", thrProductsEntity.getYlqxzcrbarmc() == null ? ' ' : thrProductsEntity.getYlqxzcrbarmc()); + } + + list.add(bizData); i++; } @@ -198,7 +205,7 @@ public class BasicOrderPrintController { bizData.put("spmc", ioOrderDetailBizEntity.getCoName() == null ? ' ' : ioOrderDetailBizEntity.getCoName()); bizData.put("spec", ioOrderDetailBizEntity.getSpec() == null ? ' ' : ioOrderDetailBizEntity.getSpec()); - bizData.put("count", ioOrderDetailBizEntity.getCount()); + bizData.put("count", IntUtil.value(obj.getReCount())); bizData.put("measname", ioOrderDetailBizEntity.getMeasname() == null ? ' ' : ioOrderDetailBizEntity.getMeasname()); bizData.put("price", ioOrderDetailBizEntity.getPrice() == null ? '0' : ioOrderDetailBizEntity.getPrice()); bizData.put("batchNo", ioOrderDetailBizEntity.getBatchNo() == null ? ' ' : ioOrderDetailBizEntity.getBatchNo()); @@ -208,18 +215,19 @@ public class BasicOrderPrintController { bizData.put("manufactor", ioOrderDetailBizEntity.getManufacturer()); bizData.put("zczbhhzbapzbh", ioOrderDetailBizEntity.getCertCode() == null ? ' ' : ioOrderDetailBizEntity.getCertCode()); -// bizData.put("cplb", udiProductEntity.getCplb() == null ? ' ' : udiProductEntity.getCplb()); -// if(ioOrderInvoiceResponses != null && ioOrderInvoiceResponses.size()>0){ -// String encode=""; -// for (IoOrderInvoiceResponse respons : ioOrderInvoiceResponses) { -// encode+=respons.getInvoiceEncode()+","; -// } -// encode = encode.substring(0,encode.length()-1); -// bizData.put("invoiceEncode", encode == null ? ' ' : encode); -// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// String dateStr = sdf.format(ioOrderInvoiceResponses.get(0).getCreateTime()); -// bizData.put("createTime", dateStr == null ? ' ' : dateStr); -// } + if (IntUtil.value(printThird) == 1) { + UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(obj.getRelId()); + ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(udiRelevanceEntity.getThirdId()); + bizData.put("productName", thrProductsEntity.getName() == null ? ' ' : thrProductsEntity.getName()); + bizData.put("spmc", thrProductsEntity.getName() == null ? ' ' : thrProductsEntity.getName()); + bizData.put("spec", thrProductsEntity.getSpec() == null ? ' ' : thrProductsEntity.getSpec()); + bizData.put("measname", thrProductsEntity.getMeasname() == null ? ' ' : thrProductsEntity.getMeasname()); + bizData.put("manufactor", thrProductsEntity.getManufactory()); + bizData.put("zczbhhzbapzbh", thrProductsEntity.getRegisterNo() == null ? ' ' : thrProductsEntity.getRegisterNo()); + bizData.put("ylqxzcrbarmc", thrProductsEntity.getYlqxzcrbarmc() == null ? ' ' : thrProductsEntity.getYlqxzcrbarmc()); + } + + list.add(bizData); i++; } diff --git a/src/main/java/com/glxp/api/util/IntUtil.java b/src/main/java/com/glxp/api/util/IntUtil.java index aa0be398..5fc53533 100644 --- a/src/main/java/com/glxp/api/util/IntUtil.java +++ b/src/main/java/com/glxp/api/util/IntUtil.java @@ -1,5 +1,7 @@ package com.glxp.api.util; +import cn.hutool.core.util.StrUtil; + public class IntUtil { public static int value(Integer value) { @@ -22,4 +24,12 @@ public class IntUtil { return false; else return value; } + + + public static int value(String value) { + if (StrUtil.isEmpty(value)) + return 0; + else return Integer.parseInt(value); + + } }