From 9efab16a9848702f8271bf425b3208944123fb8a Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Mon, 24 Feb 2025 18:06:08 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E9=9B=B6=E6=8B=85=E8=BF=90?= =?UTF-8?q?=E5=8D=95=E6=A0=87=E7=AD=BE=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PrintTemplateStatusConstant.java | 1 + .../controller/OpenOrderController.java | 27 ++++++++ .../trunkline/service/IOpenOrderService.java | 3 + .../service/impl/OpenOrderServiceImpl.java | 63 +++++++++++++++++++ 4 files changed, 94 insertions(+) diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java index 9a50966bb..88dcdf270 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java @@ -24,6 +24,7 @@ public enum PrintTemplateStatusConstant { daiqueren_14("订单模版","15"), wallbill_1("运单打印模板","16"), stock_import_1("库存品入库模块","17"), + zero_label_18("零担标签模版","18"), daiqueren_1("配送任务打印模板-市配","1"); /** diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java index e9e0414c9..07e129b92 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java @@ -1966,4 +1966,31 @@ public class OpenOrderController { } + @ResponseBody + @PostMapping("/findZeroWaybillLabelInfo") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询零担运单标签信息", notes = "传入openOrderDTO") + public R findZeroWaybillLabelInfo(@RequestBody OpenOrderDTO openOrderDTO) { + String method = "############findZeroWaybillLabelInfo: "; + log.info(method + "请求参数{}", openOrderDTO); + String waybillNo = openOrderDTO.getWaybillNo(); + + try { + + if (StringUtil.isBlank(waybillNo)) { + log.warn(method + "运单号不能为空 waybillNo={}", waybillNo); + return R.fail(405, "运单号不能为空"); + } + + return openOrderService.findZeroWaybillLabelInfo(openOrderDTO); + } catch (CustomerException e) { + log.error(e.message, e); + return R.fail(e.code, e.message); + } catch (Exception e) { + log.error(method + "系统异常", e); + return R.fail(500, "系统异常"); + } + } + + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java index 4cb168b4c..00cc19c9d 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java @@ -113,5 +113,8 @@ public interface IOpenOrderService { void patchCheckWaybill(String waybillNo); + R findZeroWaybillLabelInfo(OpenOrderDTO openOrderDTO) throws Exception; + + // R findWaybillInfo(String waybillNo); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index f15a017b2..1270cbb63 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -12,7 +12,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.basic.entity.BasicMaterialEntity; +import com.logpm.basic.entity.BasicPrintTemplateEntity; import com.logpm.basic.feign.IBasicMaterialClient; +import com.logpm.basic.feign.IBasicPrintTemplateClient; import com.logpm.basicdata.entity.*; import com.logpm.basicdata.feign.*; import com.logpm.basicdata.vo.BasicdataClientVO; @@ -54,6 +56,7 @@ import org.springblade.common.constant.IncomingTypeEnum; import org.springblade.common.constant.WorkNodeEnums; import org.springblade.common.constant.broadcast.FanoutConstants; import org.springblade.common.constant.order.*; +import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; import org.springblade.common.enums.BizOperationEnums; import org.springblade.common.enums.PackageTypeEnums; import org.springblade.common.exception.CustomerException; @@ -61,6 +64,8 @@ import org.springblade.common.model.FanoutMsg; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; import org.springblade.common.utils.CommonUtil; +import org.springblade.common.utils.QRCodeUtil; +import org.springblade.common.utils.TemplateUtil; import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; @@ -128,6 +133,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { private final IWarehouseWaybillAbolishClient waybillAbolishClient; private final IWarehouseWaybillDetailAbolishClient waybillDetailAbolishClient; private final IPackageTrackLogAsyncService packageTrackLogAsyncService; + private final IBasicPrintTemplateClient basicPrintTemplateClient; @Override @@ -228,6 +234,63 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } + @Override + public R findZeroWaybillLabelInfo(OpenOrderDTO openOrderDTO) throws Exception { + String waybillNo = openOrderDTO.getWaybillNo(); + + WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo); + if(Objects.isNull(waybillEntity)){ + log.warn("################findZeroWaybillLabelInfo: 运单信息不存在 waybillNo={}",waybillNo); + return R.fail(405,"运单信息不存在"); + } + + List wayBillDetailList = warehouseWaybillDetailClient.findListByWaybillNo(waybillNo); + + BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.zero_label_18 .getValue()); + if (org.springblade.core.tool.utils.ObjectUtil.isEmpty(template)) { + log.warn("################findZeroWaybillLabelInfo: 未找到模版 waybillNo={}",waybillNo); + return R.fail(405,"未找到模版"); + } + String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); + + Map map = new HashMap<>(); + + map.put("waybillNo",waybillNo); + map.put("orderNo",waybillEntity.getOrderNo()); + map.put("departureWarehouseName",waybillEntity.getDepartureWarehouseName()); + map.put("destinationWarehouseName",waybillEntity.getDestinationWarehouseName()); + map.put("destination",waybillEntity.getDestination()); + map.put("departure",waybillEntity.getDeparture()); + map.put("totalCount",waybillEntity.getTotalCount()); + map.put("totalWeight",waybillEntity.getTotalWeight()); + map.put("total_volume",waybillEntity.getTotalVolume()); + map.put("shipper",waybillEntity.getShipper()); + map.put("shipperName",waybillEntity.getShipperName()); + map.put("shipperMobile",waybillEntity.getShipperName()); + map.put("shipperAddress",waybillEntity.getShipperAddress()); + map.put("consignee",waybillEntity.getConsignee()); + map.put("consigneeName",waybillEntity.getConsigneeName()); + map.put("consigneeMobile",waybillEntity.getConsigneeMobile()); + map.put("consigneeAddress",waybillEntity.getConsigneeAddress()); + String fileTypeName = QRCodeUtil.createCodeToFile(waybillNo); + String image = QRCodeUtil.getEmpAutograph(fileTypeName); + map.put("waybillNoCode",image); + map.put("delivery_way",DictBizCache.getValue(DictBizConstant.OPEN_ORDER_DELIVERY_WAY,waybillEntity.getDeliveryWay())); + map.put("waybillNoCode",image); + + List> detailList = new ArrayList<>(); + wayBillDetailList.forEach(item->{ + Map m = new HashMap<>(); + m.put("productName",item.getProductName()); + m.put("num",item.getNum()); + detailList.add(m); + }); + map.put("detailList",detailList); + map.put("template",html); + + return R.data(map); + } + @Override public List findAdvanceDetailList(Long advanceId) { return advanceDetailService.findList(advanceId);