From dba352b2f2967ddd906f0785ee2f0d23c9ca8480 Mon Sep 17 00:00:00 2001 From: zhaoqing <1670883518@qq.com> Date: Fri, 15 May 2026 10:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E6=96=87=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2bug=20=E4=BF=AE=E6=94=B9=E8=BF=9B=E5=87=BA=E5=8F=A3?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gwLog/GwLogApplicationService.java | 3 + .../oms/interfaces/facade/gwLog/GwLogApi.java | 4 + .../OriginalImportExportDocumentApi.java | 116 +----------------- 3 files changed, 11 insertions(+), 112 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java index cea349b41..e6f558de1 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java @@ -50,6 +50,9 @@ public class GwLogApplicationService { GwLog gwLog =new GwLog(); BeanUtils.copyProperties(gwLogDTO,gwLog); List po1 = gwLogMapper.selectByTypeAndId(gwLog); + if(po1.isEmpty()){ + return null; + } GwLogPO po = po1.get(0); return po; } diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/gwLog/GwLogApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/gwLog/GwLogApi.java index 99f03999d..7e3893ffe 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/gwLog/GwLogApi.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/gwLog/GwLogApi.java @@ -37,6 +37,10 @@ public class GwLogApi extends BaseController { @PostMapping("/selectByTypeAndId") public AjaxResult selectByTypeAndId(@RequestBody GwLogDTO gwLogDTO){ GwLogPO po = gwLogApplicationService.selectByTypeAndId(gwLogDTO); + if (po == null) + { + return AjaxResult.error(500,"该项数据未推送过/数据错误"); + } AjaxResult ajaxResult = new AjaxResult(); ajaxResult.put("code",200); ajaxResult.put("data",po); diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/originalImportExportDocument/OriginalImportExportDocumentApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/originalImportExportDocument/OriginalImportExportDocumentApi.java index d87976e65..251d65f39 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/originalImportExportDocument/OriginalImportExportDocumentApi.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/originalImportExportDocument/OriginalImportExportDocumentApi.java @@ -47,8 +47,8 @@ public class OriginalImportExportDocumentApi extends BaseController { private WmsServiceFeign wmsServiceFeign; @ApiOperation("进出口原始单证查询列表") - @GetMapping("/list") - public TableDataInfo list(BusinessDocumentOrderDTO businessDocumentOrderDTO, + @GetMapping("/list1") + public TableDataInfo list1(BusinessDocumentOrderDTO businessDocumentOrderDTO, @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { BusinessDocumentOrderDO businessDocumentOrderDO = businessDocumentOrderAssembler.toDO(businessDocumentOrderDTO); @@ -58,8 +58,6 @@ public class OriginalImportExportDocumentApi extends BaseController { Page page = (Page) orderList; List resultList = convertToOrderWithMaterialList(orderList); - fillMaterialInfo(resultList); - TableDataInfo tableDataInfo = new TableDataInfo(); tableDataInfo.setData(resultList); tableDataInfo.setTotal(page.getTotal()); @@ -88,118 +86,12 @@ public class OriginalImportExportDocumentApi extends BaseController { } -// private List convertToOrderWithMaterialList(List orderList) { -// List resultList = new ArrayList<>(); -// for (BusinessDocumentOrderPO order : orderList) { -// OrderWithMaterialDTO orderWithMaterialDTO = new OrderWithMaterialDTO(); -// orderWithMaterialDTO.setMaterialCode(order.getMaterialCode()); -// orderWithMaterialDTO.setIeType(order.getIeType()); -// BeanUtils.copyProperties(order, orderWithMaterialDTO); -// resultList.add(orderWithMaterialDTO); -// } -// -// return resultList; -// } - - /** - * 调用WMS接口获取物料详细信息 - * 根据materialCode查询,获取goodsType、grossWeight等字段 - */ - private void fillMaterialInfo(List resultList) { - - List materialCodeList = resultList.stream() - .map(OrderWithMaterialDTO::getMaterialCode) - .filter(StringUtils::hasText) - .distinct() - .collect(Collectors.toList()); - - if (materialCodeList.isEmpty()) { - return; - } - - // 2. 批量查询物料信息(一次查询所有物料) - try { - MaterialInfoDTO queryDTO = new MaterialInfoDTO(); - // 传入物料编码列表(逗号分隔或用其他方式) - queryDTO.setMaterialCode(String.join(",", materialCodeList)); - - TableDataInfo tableDataInfo = wmsServiceFeign.getMaterialBaseInfoList(queryDTO); - - if (tableDataInfo != null && tableDataInfo.getCode() == 200) { - List materialList = tableDataInfo.getData(); - - // 3. 把物料列表转成 Map(key = materialCode) - Map> materialMap = new HashMap<>(); - for (Object material : materialList) { - Map m = (Map) material; - String code = (String) m.get("materialCode"); - materialMap.put(code, m); - } - - // 4. 遍历订单,匹配物料信息 - for (OrderWithMaterialDTO dto : resultList) { - if (StringUtils.hasText(dto.getMaterialCode())) { - Map material = materialMap.get(dto.getMaterialCode()); - if (material != null) { - dto.setMaterialName((String) material.get("materialName")); - dto.setGoodsType((Integer) material.get("goodsType")); - dto.setGrossWeight((BigDecimal) material.get("grossWeight")); - dto.setDeclarationUnit((String) material.get("declarationUnit")); - dto.setOriginCountry((String) material.get("originCountry")); - dto.setUnitPrice((BigDecimal) material.get("unitPrice")); - dto.setWeightLimit((BigDecimal) material.get("weightLimit")); - } - } - } - } - } catch (Exception e) { - // 查询失败不影响主流程 - e.printStackTrace(); - } - } - -// for (OrderWithMaterialDTO dto : resultList) { -// // 只查询有物料编码的订单 -// if (StringUtils.hasText(dto.getMaterialCode())) { -// try { -// // 构建查询参数 -// MaterialInfoDTO queryDTO = new MaterialInfoDTO(); -// queryDTO.setMaterialCode(dto.getMaterialCode()); -// -// // 调用WMS接口查询物料详情 -// AjaxResult ajaxResult = wmsServiceFeign.getMaterialBaseInfoList(queryDTO); -// -// // 判断返回是否成功 -// if ("200".equals(String.valueOf(ajaxResult.get("code")))) { -// List materialList = (List) ajaxResult.get("data"); -// if (materialList != null && !materialList.isEmpty()) { -// // 取第一条物料记录 -// Map materialMap = (Map) materialList.get(0); -// -// // 从WMS返回的Map中取值,填充到DTO -// dto.setMaterialName((String) materialMap.get("materialName")); // 物料名称 -// dto.setGoodsType((Integer) materialMap.get("goodsType")); // 货物类型 -// dto.setGrossWeight((java.math.BigDecimal) materialMap.get("grossWeight")); // 毛重 -// dto.setDeclarationUnit((String) materialMap.get("declarationUnit")); // 申报单位 -// dto.setOriginCountry((String) materialMap.get("originCountry")); // 原产国 -// dto.setUnitPrice((BigDecimal) materialMap.get("unitPrice")); //单价 -// dto.setWeightLimit((BigDecimal) materialMap.get("weightLimit")); //净重 -// } -// } -// } catch (Exception e) { -// // 查询失败不影响主流程,打印日志 -// e.printStackTrace(); -// } -// } -// -// } - //} @ApiOperation("进出口原始单证查询列表") - @GetMapping("/list1") - public TableDataInfo list1(BusinessDocumentOrderDTO businessDocumentOrderDTO, + @GetMapping("/list") + public TableDataInfo list(BusinessDocumentOrderDTO businessDocumentOrderDTO, @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { BusinessDocumentOrderDO businessDocumentOrderDO = businessDocumentOrderAssembler.toDO(businessDocumentOrderDTO);