From 82909efe6b2ba1f9588dbee568ba7f6164befb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 24 Jul 2026 18:49:14 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 2 +- .../com/mhd/system/api/OmsServiceFeign.java | 2 +- .../com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../com/mhd/system/api/WmsServiceFeign.java | 2 +- .../com/mhd/system/api/YmsServiceFeign.java | 2 +- .../MaterialBaseInfoApplicationService.java | 241 +++++++++++++++++- .../materialBaseInfo/MaterialBaseInfoApi.java | 10 +- mhd_wms/src/main/resources/bootstrap.yml | 8 +- 8 files changed, 250 insertions(+), 19 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java index 401e4e028..7dc41f623 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java @@ -49,12 +49,15 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.File; +import java.io.FileOutputStream; import java.io.InputStream; import java.util.*; import java.util.stream.Collectors; @@ -436,8 +439,237 @@ public class MaterialBaseInfoApplicationService { return materialBaseInfoDomainService.getInfoByNoOrderReceipt(materialBaseInfoDO); } + /** - * 导入物料主数据(仅导入主表字段) + * 导入物料主数据(异步入口) + * + *

接口层调用此方法,将文件保存到临时目录后立即返回"异步处理中", + * 实际导入由 {@link #doImportData(File, String, LoginUser)} 异步执行, + * 避免大数据量时接口超时。

+ */ + public AjaxResult importDataAsync(MultipartFile file) { + if (file == null || file.isEmpty()) { + throw new ServiceException("上传文件不能为空"); + } + String fileName = file.getOriginalFilename(); + if (org.apache.commons.lang3.StringUtils.isBlank(fileName) + || (!fileName.endsWith(".xls") && !fileName.endsWith(".xlsx"))) { + throw new ServiceException("请上传xls或xlsx格式文件"); + } + + // 保存文件到临时目录 + String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "material_import"; + File dir = new File(tmpDir); + if (!dir.exists()) { + dir.mkdirs(); + } + String tmpFileName = System.currentTimeMillis() + "_" + fileName; + File tmpFile = new File(dir, tmpFileName); + try (FileOutputStream fos = new FileOutputStream(tmpFile)) { + fos.write(file.getBytes()); + } catch (Exception e) { + throw new ServiceException("文件保存失败:" + e.getMessage()); + } + + LoginUser loginUser = SecurityUtils.getLoginUser(); + // 异步执行导入 + doImportData(tmpFile, fileName, loginUser); + + return AjaxResult.success("导入任务已提交,正在后台异步处理,请稍后查看导入结果日志"); + } + + /** + * 异步执行物料主数据导入 + * + *

@Async 确保在独立线程中执行,不阻塞接口响应。 + * 每行独立事务,避免大事务锁表导致性能问题。

+ */ + @Async + public void doImportData(File tmpFile, String fileName, LoginUser loginUser) { + long startTime = System.currentTimeMillis(); + log.info("=== 物料主数据异步导入开始,文件:{},大小:{}KB ===", fileName, tmpFile.length() / 1024); + try { + List rows; + try (InputStream is = new java.io.FileInputStream(tmpFile)) { + rows = MaterialBaseInfoImportExcelUtil.importRows(is); + } catch (Exception e) { + log.error("物料主数据异步导入失败 - 文件解析异常:{}", e.getMessage(), e); + return; + } + + if (CollectionUtils.isEmpty(rows)) { + log.warn("物料主数据异步导入结束 - 导入数据为空"); + return; + } + + Long loginOrgId = null; + Long loginTopOrgId = null; + if (loginUser != null && loginUser.getUserPo() != null) { + loginOrgId = loginUser.getUserPo().getOrganizationId(); + loginTopOrgId = loginUser.getUserPo().getTopOrganizationId(); + } + + StringBuilder errors = new StringBuilder(); + Set duplicateInFile = new HashSet<>(); + int successCount = 0; + int totalCount = rows.size(); + + // 包装规格缓存:避免 5000 行数据对 system 服务发起 5000 次重复远程调用 + Map> packCache = new HashMap<>(); + + for (int i = 0; i < rows.size(); i++) { + MaterialBaseInfoDTO row = rows.get(i); + int rowNum = i + 2; + if (row == null) { + continue; + } + try { + if (StringUtils.isBlank(row.getMaterialCode())) { + errors.append("第").append(rowNum).append("行:物料编码不能为空;"); + continue; + } + if (StringUtils.isBlank(row.getMaterialName())) { + errors.append("第").append(rowNum).append("行:物料名称不能为空;"); + continue; + } + if (row.getNullify() == null) { + row.setNullify(2); + } + if (row.getCommon() == null) { + row.setCommon(2); + } + if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) { + row.setHsCode(row.getHsCodeImport().trim()); + } + normalizeImportBarCodeWhenDuplicateOfHs(row); + fillIdsFromExistingMasterData(row); + fillOrganizationFromShipperIfNeeded(row); + if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { + row.setOrganizationId(loginOrgId); + } + if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { + row.setTopOrganizationId(loginTopOrgId); + } + fillOrganizationName(row, loginUser); + + String shipperCode = StringUtils.defaultString(row.getShipperCode(), ""); + String duplicateKey = row.getOrganizationId() + "|" + shipperCode + "|" + row.getMaterialCode(); + if (!duplicateInFile.add(duplicateKey)) { + errors.append("第").append(rowNum).append("行:文件内存在重复物料(组织+货主编码+物料编码);"); + continue; + } + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialBaseInfo::getDelFlag, 1) + .eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId()) + .eq(MaterialBaseInfo::getMaterialCode, row.getMaterialCode()); + if (StringUtils.isBlank(row.getShipperCode())) { + wrapper.and(w -> w.isNull(MaterialBaseInfo::getShipperCode).or().eq(MaterialBaseInfo::getShipperCode, "")); + } else { + wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode()); + } + if (materialBaseInfoService.count(wrapper) > 0) { + errors.append("第").append(rowNum).append("行:物料已存在(组织+货主编码+物料编码);"); + continue; + } + fillClassifyTypeAndUnit(row); + + // 包装规格查询(带本地缓存,避免 5000 行对 system 服务发起 5000 次远程调用) + String packCacheKey = row.getOrganizationId() + "|" + StringUtils.defaultString(row.getPackName()); + Map cachedPack = packCache.get(packCacheKey); + if (cachedPack == null) { + Object result = systemServiceFeign.getPackList(null, row.getPackName(), row.getOrganizationId()); + if (result == null) { + // 缓存空结果,避免重复查询不存在的包装规格 + packCache.put(packCacheKey, Collections.emptyMap()); + errors.append("第").append(rowNum).append("行:包装规格查询无返回,请稍后重试或检查系统服务;"); + continue; + } + Map resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference>() {}); + List> rowsPack = extractTableDataRows(resultMap); + if (CollectionUtils.isEmpty(rowsPack)) { + packCache.put(packCacheKey, Collections.emptyMap()); + if (StringUtils.isNotBlank(row.getPackName())) { + errors.append("第").append(rowNum).append("行:包装规格「").append(row.getPackName()).append("」不存在或未在系统中维护;"); + } else { + errors.append("第").append(rowNum).append("行:包装规格未填写,或系统中无匹配的包装数据;"); + } + continue; + } + cachedPack = rowsPack.get(0); + packCache.put(packCacheKey, cachedPack); + } + if (cachedPack.isEmpty()) { + errors.append("第").append(rowNum).append("行:包装规格不存在(来自缓存);"); + continue; + } + if (cachedPack == null) { + errors.append("第").append(rowNum).append("行:包装规格查询结果为空;"); + continue; + } + String packCode = cachedPack.get("packCode") == null ? "" : String.valueOf(cachedPack.get("packCode")); + row.setPackCode(packCode); + String packId = cachedPack.get("packId") == null ? "" : String.valueOf(cachedPack.get("packId")); + if (StringUtils.isBlank(packId) || !StringUtils.isNumeric(packId)) { + errors.append("第").append(rowNum).append("行:包装规格数据异常(缺少包装ID);"); + continue; + } + row.setPackId(Long.valueOf(packId)); + String unitName = cachedPack.get("unitName") == null ? "" : String.valueOf(cachedPack.get("unitName")); + row.setUnitCode("EA"); + row.setUnitName(unitName); + + // 每行独立事务写入 + MaterialBaseInfoDO materialBaseInfoDO = new MaterialBaseInfoDO(); + BeanUtils.copyProperties(row, materialBaseInfoDO); + materialBaseInfoDO.setMaterialGoodsRule(buildImportMaterialGoodsRule(row)); + materialBaseInfoDO.setMaterialCommon(null); + materialBaseInfoDO.setMaterialWarehouseControl(null); + materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row)); + insert(materialBaseInfoDO); + Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId(); + + MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); + if (materialCommonDO != null) { + materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId); + materialCommonDomainService.insert(materialCommonDO); + } + MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl(); + if (materialWarehouseControlDO != null) { + materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId); + materialWarehouseControlDomainService.insert(materialWarehouseControlDO); + } + materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO); + materialBarCodeDomainService.batchInsertOrUpdate(materialBaseInfoDO); + successCount++; + } catch (Exception e) { + log.error("物料主数据异步导入 - 第{}行处理异常", rowNum, e); + errors.append("第").append(rowNum).append("行:处理异常-").append(e.getMessage()).append(";"); + } + } + + long costTime = System.currentTimeMillis() - startTime; + if (errors.length() > 0) { + log.warn("=== 物料主数据异步导入完成,文件:{},总数:{},成功:{},失败:{},耗时:{}ms,失败原因:{} ===", + fileName, totalCount, successCount, totalCount - successCount, costTime, errors); + } else { + log.info("=== 物料主数据异步导入完成,文件:{},总数:{},成功:{},耗时:{}ms ===", + fileName, totalCount, successCount, costTime); + } + } finally { + // 清理临时文件 + try { + if (tmpFile.exists()) { + tmpFile.delete(); + } + } catch (Exception e) { + log.warn("物料主数据异步导入 - 临时文件清理失败:{}", e.getMessage()); + } + } + } + + /** + * 导入物料主数据(仅导入主表字段)- 原同步方法保留,供其他场景调用 */ @Transactional(rollbackFor = Exception.class) public AjaxResult importData(MultipartFile file) { @@ -496,7 +728,6 @@ public class MaterialBaseInfoApplicationService { row.setHsCode(row.getHsCodeImport().trim()); } normalizeImportBarCodeWhenDuplicateOfHs(row); - // 客户模板通常只有「货主名称」无「货主id」:须先按名称解析货主,再回填组织;勿提前写入登录组织以免组织校验拦截货主匹配 fillIdsFromExistingMasterData(row); fillOrganizationFromShipperIfNeeded(row); if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { @@ -567,25 +798,20 @@ public class MaterialBaseInfoApplicationService { materialBaseInfoDO.setMaterialCommon(null); materialBaseInfoDO.setMaterialWarehouseControl(null); materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row)); - // 商品规则由 buildImportMaterialGoodsRule + insert() 统一写入,勿再单独 insert,避免 MATERIAL_GOODS_RULE 重复 insert(materialBaseInfoDO); Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId(); - //公共信息 MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); if (materialCommonDO != null) { materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId); materialCommonDomainService.insert(materialCommonDO); } - //仓库控制信息 MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl(); if (materialWarehouseControlDO != null) { materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId); materialWarehouseControlDomainService.insert(materialWarehouseControlDO); } - //库存预警 materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO); - //条码信息 materialBarCodeDomainService.batchInsertOrUpdate(materialBaseInfoDO); successCount++; } @@ -596,6 +822,7 @@ public class MaterialBaseInfoApplicationService { return AjaxResult.success("导入成功,共" + successCount + "条"); } + /** * 使用已存在主数据按名称/编码反查并回填ID */ diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialBaseInfo/MaterialBaseInfoApi.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialBaseInfo/MaterialBaseInfoApi.java index c780d3ea3..252bb8088 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialBaseInfo/MaterialBaseInfoApi.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialBaseInfo/MaterialBaseInfoApi.java @@ -106,12 +106,16 @@ public class MaterialBaseInfoApi extends BaseController { } /** - * 导入物料主数据 + * 导入物料主数据(异步执行) + * + *

数据量大时同步导入会导致接口超时,改为异步模式: + * 接口立即返回"已提交异步处理",后台线程执行实际导入, + * 导入结果通过日志输出。

*/ - @ApiOperation("导入物料主数据") + @ApiOperation("导入物料主数据(异步)") @PostMapping("/importData") public AjaxResult importData(@RequestParam("file") MultipartFile file) { - return materialBaseInfoApplicationService.importData(file); + return materialBaseInfoApplicationService.importDataAsync(file); } @ApiOperation("物料管理更新推送信息") diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..39eb710cb 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 5b98ae94350c48c3e70689d879911735ad27d5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 24 Jul 2026 19:42:40 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialBaseInfoApplicationService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java index 7dc41f623..b78ffebcd 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java @@ -457,7 +457,7 @@ public class MaterialBaseInfoApplicationService { throw new ServiceException("请上传xls或xlsx格式文件"); } - // 保存文件到临时目录 + // 流式写入临时文件,避免大文件 getBytes() 导致内存溢出和接口超时 String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "material_import"; File dir = new File(tmpDir); if (!dir.exists()) { @@ -465,8 +465,8 @@ public class MaterialBaseInfoApplicationService { } String tmpFileName = System.currentTimeMillis() + "_" + fileName; File tmpFile = new File(dir, tmpFileName); - try (FileOutputStream fos = new FileOutputStream(tmpFile)) { - fos.write(file.getBytes()); + try { + file.transferTo(tmpFile); } catch (Exception e) { throw new ServiceException("文件保存失败:" + e.getMessage()); } From 4f727fadc10f36c9dd634c67270b65061362ab6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 24 Jul 2026 20:01:18 +0800 Subject: [PATCH 03/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java b/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java index 678a72e6d..a986614ff 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java +++ b/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java @@ -36,6 +36,9 @@ public final class MaterialBaseInfoImportExcelUtil { HEADER_ALIASES.put("淨重(kg)", "净重 单位:千克"); HEADER_ALIASES.put("体积(m³)", "体积 单位:立方米"); HEADER_ALIASES.put("體積(m³)", "体积 单位:立方米"); + HEADER_ALIASES.put("长", "物料大小-长 单位:米"); + HEADER_ALIASES.put("宽", "物料大小-宽 单位:米"); + HEADER_ALIASES.put("高", "物料大小-高 单位:米"); } public static List importRows(InputStream is) throws Exception { From e544b76db633b0d56deb2b9270b680286cc3e038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 10:05:12 +0800 Subject: [PATCH 04/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialBaseInfoApplicationService.java | 214 ++---------------- 1 file changed, 14 insertions(+), 200 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java index b78ffebcd..56f2c7319 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java @@ -103,6 +103,10 @@ public class MaterialBaseInfoApplicationService { @Resource private MaterialBaseInfoMapper materialBaseInfoMapper; + + @Autowired + private MaterialBaseInfoAsyncService materialBaseInfoAsyncService; + /** * 分页查询物料基础信息列表 */ @@ -472,202 +476,12 @@ public class MaterialBaseInfoApplicationService { } LoginUser loginUser = SecurityUtils.getLoginUser(); - // 异步执行导入 - doImportData(tmpFile, fileName, loginUser); + // 通过独立的异步 Service 执行导入(避免类内部 self-invocation 导致 @Async 失效) + materialBaseInfoAsyncService.doImportData(tmpFile, fileName, loginUser); return AjaxResult.success("导入任务已提交,正在后台异步处理,请稍后查看导入结果日志"); } - /** - * 异步执行物料主数据导入 - * - *

@Async 确保在独立线程中执行,不阻塞接口响应。 - * 每行独立事务,避免大事务锁表导致性能问题。

- */ - @Async - public void doImportData(File tmpFile, String fileName, LoginUser loginUser) { - long startTime = System.currentTimeMillis(); - log.info("=== 物料主数据异步导入开始,文件:{},大小:{}KB ===", fileName, tmpFile.length() / 1024); - try { - List rows; - try (InputStream is = new java.io.FileInputStream(tmpFile)) { - rows = MaterialBaseInfoImportExcelUtil.importRows(is); - } catch (Exception e) { - log.error("物料主数据异步导入失败 - 文件解析异常:{}", e.getMessage(), e); - return; - } - - if (CollectionUtils.isEmpty(rows)) { - log.warn("物料主数据异步导入结束 - 导入数据为空"); - return; - } - - Long loginOrgId = null; - Long loginTopOrgId = null; - if (loginUser != null && loginUser.getUserPo() != null) { - loginOrgId = loginUser.getUserPo().getOrganizationId(); - loginTopOrgId = loginUser.getUserPo().getTopOrganizationId(); - } - - StringBuilder errors = new StringBuilder(); - Set duplicateInFile = new HashSet<>(); - int successCount = 0; - int totalCount = rows.size(); - - // 包装规格缓存:避免 5000 行数据对 system 服务发起 5000 次重复远程调用 - Map> packCache = new HashMap<>(); - - for (int i = 0; i < rows.size(); i++) { - MaterialBaseInfoDTO row = rows.get(i); - int rowNum = i + 2; - if (row == null) { - continue; - } - try { - if (StringUtils.isBlank(row.getMaterialCode())) { - errors.append("第").append(rowNum).append("行:物料编码不能为空;"); - continue; - } - if (StringUtils.isBlank(row.getMaterialName())) { - errors.append("第").append(rowNum).append("行:物料名称不能为空;"); - continue; - } - if (row.getNullify() == null) { - row.setNullify(2); - } - if (row.getCommon() == null) { - row.setCommon(2); - } - if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) { - row.setHsCode(row.getHsCodeImport().trim()); - } - normalizeImportBarCodeWhenDuplicateOfHs(row); - fillIdsFromExistingMasterData(row); - fillOrganizationFromShipperIfNeeded(row); - if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { - row.setOrganizationId(loginOrgId); - } - if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { - row.setTopOrganizationId(loginTopOrgId); - } - fillOrganizationName(row, loginUser); - - String shipperCode = StringUtils.defaultString(row.getShipperCode(), ""); - String duplicateKey = row.getOrganizationId() + "|" + shipperCode + "|" + row.getMaterialCode(); - if (!duplicateInFile.add(duplicateKey)) { - errors.append("第").append(rowNum).append("行:文件内存在重复物料(组织+货主编码+物料编码);"); - continue; - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(MaterialBaseInfo::getDelFlag, 1) - .eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId()) - .eq(MaterialBaseInfo::getMaterialCode, row.getMaterialCode()); - if (StringUtils.isBlank(row.getShipperCode())) { - wrapper.and(w -> w.isNull(MaterialBaseInfo::getShipperCode).or().eq(MaterialBaseInfo::getShipperCode, "")); - } else { - wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode()); - } - if (materialBaseInfoService.count(wrapper) > 0) { - errors.append("第").append(rowNum).append("行:物料已存在(组织+货主编码+物料编码);"); - continue; - } - fillClassifyTypeAndUnit(row); - - // 包装规格查询(带本地缓存,避免 5000 行对 system 服务发起 5000 次远程调用) - String packCacheKey = row.getOrganizationId() + "|" + StringUtils.defaultString(row.getPackName()); - Map cachedPack = packCache.get(packCacheKey); - if (cachedPack == null) { - Object result = systemServiceFeign.getPackList(null, row.getPackName(), row.getOrganizationId()); - if (result == null) { - // 缓存空结果,避免重复查询不存在的包装规格 - packCache.put(packCacheKey, Collections.emptyMap()); - errors.append("第").append(rowNum).append("行:包装规格查询无返回,请稍后重试或检查系统服务;"); - continue; - } - Map resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference>() {}); - List> rowsPack = extractTableDataRows(resultMap); - if (CollectionUtils.isEmpty(rowsPack)) { - packCache.put(packCacheKey, Collections.emptyMap()); - if (StringUtils.isNotBlank(row.getPackName())) { - errors.append("第").append(rowNum).append("行:包装规格「").append(row.getPackName()).append("」不存在或未在系统中维护;"); - } else { - errors.append("第").append(rowNum).append("行:包装规格未填写,或系统中无匹配的包装数据;"); - } - continue; - } - cachedPack = rowsPack.get(0); - packCache.put(packCacheKey, cachedPack); - } - if (cachedPack.isEmpty()) { - errors.append("第").append(rowNum).append("行:包装规格不存在(来自缓存);"); - continue; - } - if (cachedPack == null) { - errors.append("第").append(rowNum).append("行:包装规格查询结果为空;"); - continue; - } - String packCode = cachedPack.get("packCode") == null ? "" : String.valueOf(cachedPack.get("packCode")); - row.setPackCode(packCode); - String packId = cachedPack.get("packId") == null ? "" : String.valueOf(cachedPack.get("packId")); - if (StringUtils.isBlank(packId) || !StringUtils.isNumeric(packId)) { - errors.append("第").append(rowNum).append("行:包装规格数据异常(缺少包装ID);"); - continue; - } - row.setPackId(Long.valueOf(packId)); - String unitName = cachedPack.get("unitName") == null ? "" : String.valueOf(cachedPack.get("unitName")); - row.setUnitCode("EA"); - row.setUnitName(unitName); - - // 每行独立事务写入 - MaterialBaseInfoDO materialBaseInfoDO = new MaterialBaseInfoDO(); - BeanUtils.copyProperties(row, materialBaseInfoDO); - materialBaseInfoDO.setMaterialGoodsRule(buildImportMaterialGoodsRule(row)); - materialBaseInfoDO.setMaterialCommon(null); - materialBaseInfoDO.setMaterialWarehouseControl(null); - materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row)); - insert(materialBaseInfoDO); - Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId(); - - MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); - if (materialCommonDO != null) { - materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId); - materialCommonDomainService.insert(materialCommonDO); - } - MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl(); - if (materialWarehouseControlDO != null) { - materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId); - materialWarehouseControlDomainService.insert(materialWarehouseControlDO); - } - materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO); - materialBarCodeDomainService.batchInsertOrUpdate(materialBaseInfoDO); - successCount++; - } catch (Exception e) { - log.error("物料主数据异步导入 - 第{}行处理异常", rowNum, e); - errors.append("第").append(rowNum).append("行:处理异常-").append(e.getMessage()).append(";"); - } - } - - long costTime = System.currentTimeMillis() - startTime; - if (errors.length() > 0) { - log.warn("=== 物料主数据异步导入完成,文件:{},总数:{},成功:{},失败:{},耗时:{}ms,失败原因:{} ===", - fileName, totalCount, successCount, totalCount - successCount, costTime, errors); - } else { - log.info("=== 物料主数据异步导入完成,文件:{},总数:{},成功:{},耗时:{}ms ===", - fileName, totalCount, successCount, costTime); - } - } finally { - // 清理临时文件 - try { - if (tmpFile.exists()) { - tmpFile.delete(); - } - } catch (Exception e) { - log.warn("物料主数据异步导入 - 临时文件清理失败:{}", e.getMessage()); - } - } - } - /** * 导入物料主数据(仅导入主表字段)- 原同步方法保留,供其他场景调用 */ @@ -826,7 +640,7 @@ public class MaterialBaseInfoApplicationService { /** * 使用已存在主数据按名称/编码反查并回填ID */ - private void fillIdsFromExistingMasterData(MaterialBaseInfoDTO row) { + public void fillIdsFromExistingMasterData(MaterialBaseInfoDTO row) { if (StringUtils.isBlank(row.getPackName()) && StringUtils.isNotBlank(row.getPackImport())) { row.setPackName(row.getPackImport().trim()); } @@ -1146,7 +960,7 @@ public class MaterialBaseInfoApplicationService { /** * Excel 已填货主 ID、但未填组织时,从货主用户补全组织信息。 */ - private void fillOrganizationFromShipperIfNeeded(MaterialBaseInfoDTO row) { + public void fillOrganizationFromShipperIfNeeded(MaterialBaseInfoDTO row) { if (isValidOrgId(row.getOrganizationId()) || row.getShipperId() == null) { return; } @@ -1205,7 +1019,7 @@ public class MaterialBaseInfoApplicationService { } } - private void fillOrganizationName(MaterialBaseInfoDTO row, LoginUser loginUser) { + public void fillOrganizationName(MaterialBaseInfoDTO row, LoginUser loginUser) { if (StringUtils.isNotBlank(row.getOrganizationName())) { return; } @@ -1225,7 +1039,7 @@ public class MaterialBaseInfoApplicationService { } } - private void fillClassifyTypeAndUnit(MaterialBaseInfoDTO row) { + public void fillClassifyTypeAndUnit(MaterialBaseInfoDTO row) { normalizeMaterialClassifyImportFields(row); // 按组织从 system 主数据反查分类编码,与名称列表对齐 fillMaterialClassifyCodesFromSystem(row); @@ -1406,7 +1220,7 @@ public class MaterialBaseInfoApplicationService { * 导入约定:「HS码/HS编码」与「物料条形码」为不同列。模板表头错位或两列误填相同 HS 时, * barCode 会与 hsCode 相同;此时保留 hsCode,清空主表/子表条码,避免 HS 写入 bar_code。 */ - private void normalizeImportBarCodeWhenDuplicateOfHs(MaterialBaseInfoDTO row) { + public void normalizeImportBarCodeWhenDuplicateOfHs(MaterialBaseInfoDTO row) { if (row == null) { return; } @@ -1421,7 +1235,7 @@ public class MaterialBaseInfoApplicationService { } } - private List buildImportBarCodeList(MaterialBaseInfoDTO row) { + public List buildImportBarCodeList(MaterialBaseInfoDTO row) { if (StringUtils.isBlank(row.getBarCode())) { return null; } @@ -1461,7 +1275,7 @@ public class MaterialBaseInfoApplicationService { return idObj == null ? null : Long.valueOf(String.valueOf(idObj)); } - private MaterialGoodsRuleDO buildImportMaterialGoodsRule(MaterialBaseInfoDTO row) { + public MaterialGoodsRuleDO buildImportMaterialGoodsRule(MaterialBaseInfoDTO row) { String batchName = StringUtils.isNotBlank(row.getBatchRuleNameImport()) ? row.getBatchRuleNameImport().trim() : (StringUtils.isNotBlank(row.getBatchName()) @@ -1536,7 +1350,7 @@ public class MaterialBaseInfoApplicationService { .trim(); } - private List> extractTableDataRows(Map resultMap) { + public List> extractTableDataRows(Map resultMap) { if (resultMap == null) { return new ArrayList<>(); } From cdc098fdd32b623da39d56b7b07cd77936920f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 10:09:26 +0800 Subject: [PATCH 05/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialBaseInfoAsyncService.java | 259 ++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java new file mode 100644 index 000000000..0424c3865 --- /dev/null +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java @@ -0,0 +1,259 @@ +package com.mhd.wms.application.service.materialBaseInfo; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.UserServiceFeign; +import com.mhd.system.api.model.LoginUser; +import com.mhd.wms.domain.materialBarCode.service.MaterialBarCodeDomainService; +import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo; +import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService; +import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper; +import com.mhd.wms.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO; +import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO; +import com.mhd.wms.domain.materialCommon.service.MaterialCommonDomainService; +import com.mhd.wms.domain.materialCommon.repository.todo.MaterialCommonDO; +import com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainService; +import com.mhd.wms.domain.materialInventoryWarning.service.MaterialInventoryWarningDomainService; +import com.mhd.wms.domain.materialWarehouseControl.service.MaterialWarehouseControlDomainService; +import com.mhd.wms.domain.materialWarehouseControl.repository.todo.MaterialWarehouseControlDO; +import com.mhd.wms.interfaces.dto.materialBaseInfo.MaterialBaseInfoDTO; +import com.mhd.wms.util.MaterialBaseInfoImportExcelUtil; +import com.mhd.wms.util.ZhTextNormalizeUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 物料主数据异步导入服务 + * + *

必须放在独立的 Service 类中,否则类内部 self-invocation 会导致 @Async 失效。

+ */ +@Slf4j +@Service +public class MaterialBaseInfoAsyncService { + + @Autowired + private IMaterialBaseInfoService materialBaseInfoService; + @Autowired + private MaterialBaseInfoMapper materialBaseInfoMapper; + @Autowired + private MaterialBaseInfoApplicationService materialBaseInfoApplicationService; + @Autowired + private SystemServiceFeign systemServiceFeign; + @Autowired + private UserServiceFeign userServiceFeign; + @Autowired + private MaterialGoodsRuleDomainService materialGoodsRuleDomainService; + @Autowired + private MaterialCommonDomainService materialCommonDomainService; + @Autowired + private MaterialWarehouseControlDomainService materialWarehouseControlDomainService; + @Autowired + private MaterialInventoryWarningDomainService materialInventoryWarningDomainService; + @Autowired + private MaterialBarCodeDomainService materialBarCodeDomainService; + + /** + * 异步执行物料主数据导入 + * + *

@Async 在独立线程中执行,不阻塞接口响应。

+ */ + @Async + public void doImportData(File tmpFile, String fileName, LoginUser loginUser) { + long startTime = System.currentTimeMillis(); + log.info("=== 物料主数据异步导入开始,文件:{},大小:{}KB ===", fileName, tmpFile.length() / 1024); + try { + List rows; + try (InputStream is = new FileInputStream(tmpFile)) { + rows = MaterialBaseInfoImportExcelUtil.importRows(is); + } catch (Exception e) { + log.error("物料主数据异步导入失败 - 文件解析异常:{}", e.getMessage(), e); + return; + } + + if (CollectionUtils.isEmpty(rows)) { + log.warn("物料主数据异步导入结束 - 导入数据为空"); + return; + } + + Long loginOrgId = null; + Long loginTopOrgId = null; + if (loginUser != null && loginUser.getUserPo() != null) { + loginOrgId = loginUser.getUserPo().getOrganizationId(); + loginTopOrgId = loginUser.getUserPo().getTopOrganizationId(); + } + + StringBuilder errors = new StringBuilder(); + Set duplicateInFile = new HashSet<>(); + int successCount = 0; + int totalCount = rows.size(); + + // 包装规格缓存 + Map> packCache = new HashMap<>(); + + for (int i = 0; i < rows.size(); i++) { + MaterialBaseInfoDTO row = rows.get(i); + int rowNum = i + 2; + if (row == null) { + continue; + } + try { + if (StringUtils.isBlank(row.getMaterialCode())) { + errors.append("第").append(rowNum).append("行:物料编码不能为空;"); + continue; + } + if (StringUtils.isBlank(row.getMaterialName())) { + errors.append("第").append(rowNum).append("行:物料名称不能为空;"); + continue; + } + if (row.getNullify() == null) { + row.setNullify(2); + } + if (row.getCommon() == null) { + row.setCommon(2); + } + if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) { + row.setHsCode(row.getHsCodeImport().trim()); + } + materialBaseInfoApplicationService.normalizeImportBarCodeWhenDuplicateOfHs(row); + materialBaseInfoApplicationService.fillIdsFromExistingMasterData(row); + materialBaseInfoApplicationService.fillOrganizationFromShipperIfNeeded(row); + if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { + row.setOrganizationId(loginOrgId); + } + if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { + row.setTopOrganizationId(loginTopOrgId); + } + materialBaseInfoApplicationService.fillOrganizationName(row, loginUser); + + String shipperCode = StringUtils.defaultString(row.getShipperCode(), ""); + String duplicateKey = row.getOrganizationId() + "|" + shipperCode + "|" + row.getMaterialCode(); + if (!duplicateInFile.add(duplicateKey)) { + errors.append("第").append(rowNum).append("行:文件内存在重复物料(组织+货主编码+物料编码);"); + continue; + } + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialBaseInfo::getDelFlag, 1) + .eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId()) + .eq(MaterialBaseInfo::getMaterialCode, row.getMaterialCode()); + if (StringUtils.isBlank(row.getShipperCode())) { + wrapper.and(w -> w.isNull(MaterialBaseInfo::getShipperCode).or().eq(MaterialBaseInfo::getShipperCode, "")); + } else { + wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode()); + } + if (materialBaseInfoService.count(wrapper) > 0) { + errors.append("第").append(rowNum).append("行:物料已存在(组织+货主编码+物料编码);"); + continue; + } + materialBaseInfoApplicationService.fillClassifyTypeAndUnit(row); + + // 包装规格查询(带缓存) + String packCacheKey = row.getOrganizationId() + "|" + StringUtils.defaultString(row.getPackName()); + Map cachedPack = packCache.get(packCacheKey); + if (cachedPack == null) { + Object result = systemServiceFeign.getPackList(null, row.getPackName(), row.getOrganizationId()); + if (result == null) { + packCache.put(packCacheKey, Collections.emptyMap()); + errors.append("第").append(rowNum).append("行:包装规格查询无返回;"); + continue; + } + Map resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference>() {}); + List> rowsPack = materialBaseInfoApplicationService.extractTableDataRows(resultMap); + if (CollectionUtils.isEmpty(rowsPack)) { + packCache.put(packCacheKey, Collections.emptyMap()); + if (StringUtils.isNotBlank(row.getPackName())) { + errors.append("第").append(rowNum).append("行:包装规格「").append(row.getPackName()).append("」不存在或未在系统中维护;"); + } else { + errors.append("第").append(rowNum).append("行:包装规格未填写;"); + } + continue; + } + cachedPack = rowsPack.get(0); + packCache.put(packCacheKey, cachedPack); + } + if (cachedPack.isEmpty()) { + errors.append("第").append(rowNum).append("行:包装规格不存在(来自缓存);"); + continue; + } + String packCode = cachedPack.get("packCode") == null ? "" : String.valueOf(cachedPack.get("packCode")); + row.setPackCode(packCode); + String packId = cachedPack.get("packId") == null ? "" : String.valueOf(cachedPack.get("packId")); + if (StringUtils.isBlank(packId) || !StringUtils.isNumeric(packId)) { + errors.append("第").append(rowNum).append("行:包装规格数据异常(缺少包装ID);"); + continue; + } + row.setPackId(Long.valueOf(packId)); + String unitName = cachedPack.get("unitName") == null ? "" : String.valueOf(cachedPack.get("unitName")); + row.setUnitCode("EA"); + row.setUnitName(unitName); + + MaterialBaseInfoDO materialBaseInfoDO = new MaterialBaseInfoDO(); + BeanUtils.copyProperties(row, materialBaseInfoDO); + materialBaseInfoDO.setMaterialGoodsRule(materialBaseInfoApplicationService.buildImportMaterialGoodsRule(row)); + materialBaseInfoDO.setMaterialCommon(null); + materialBaseInfoDO.setMaterialWarehouseControl(null); + materialBaseInfoDO.setMaterialBarCodeList(materialBaseInfoApplicationService.buildImportBarCodeList(row)); + materialBaseInfoApplicationService.insert(materialBaseInfoDO); + Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId(); + + MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); + if (materialCommonDO != null) { + materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId); + materialCommonDomainService.insert(materialCommonDO); + } + MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl(); + if (materialWarehouseControlDO != null) { + materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId); + materialWarehouseControlDomainService.insert(materialWarehouseControlDO); + } + materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO); + materialBarCodeDomainService.batchInsertOrUpdate(materialBaseInfoDO); + successCount++; + } catch (Exception e) { + log.error("物料主数据异步导入 - 第{}行处理异常", rowNum, e); + errors.append("第").append(rowNum).append("行:处理异常-").append(e.getMessage()).append(";"); + } + } + + long costTime = System.currentTimeMillis() - startTime; + if (errors.length() > 0) { + log.warn("=== 物料主数据异步导入完成,文件:{},总数:{},成功:{},失败:{},耗时:{}ms,失败原因:{} ===", + fileName, totalCount, successCount, totalCount - successCount, costTime, errors); + } else { + log.info("=== 物料主数据异步导入完成,文件:{},总数:{},成功:{},耗时:{}ms ===", + fileName, totalCount, successCount, costTime); + } + } finally { + try { + if (tmpFile.exists()) { + tmpFile.delete(); + } + } catch (Exception e) { + log.warn("物料主数据异步导入 - 临时文件清理失败:{}", e.getMessage()); + } + } + } + + private boolean isValidOrgId(Long id) { + return id != null && id > 0; + } +} From 33a6e875ce3cdcf52db2b912e0ad4b742ea458b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 10:16:17 +0800 Subject: [PATCH 06/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialBaseInfoAsyncService.java | 224 +++++++++++++++--- 1 file changed, 189 insertions(+), 35 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java index 0424c3865..ffba4043c 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java @@ -15,11 +15,9 @@ import com.mhd.wms.domain.materialBarCode.service.MaterialBarCodeDomainService; import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo; import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService; import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper; -import com.mhd.wms.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO; import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO; import com.mhd.wms.domain.materialCommon.service.MaterialCommonDomainService; import com.mhd.wms.domain.materialCommon.repository.todo.MaterialCommonDO; -import com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainService; import com.mhd.wms.domain.materialInventoryWarning.service.MaterialInventoryWarningDomainService; import com.mhd.wms.domain.materialWarehouseControl.service.MaterialWarehouseControlDomainService; import com.mhd.wms.domain.materialWarehouseControl.repository.todo.MaterialWarehouseControlDO; @@ -37,14 +35,11 @@ import org.springframework.util.CollectionUtils; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; /** * 物料主数据异步导入服务 - * - *

必须放在独立的 Service 类中,否则类内部 self-invocation 会导致 @Async 失效。

*/ @Slf4j @Service @@ -55,14 +50,10 @@ public class MaterialBaseInfoAsyncService { @Autowired private MaterialBaseInfoMapper materialBaseInfoMapper; @Autowired - private MaterialBaseInfoApplicationService materialBaseInfoApplicationService; - @Autowired private SystemServiceFeign systemServiceFeign; @Autowired private UserServiceFeign userServiceFeign; @Autowired - private MaterialGoodsRuleDomainService materialGoodsRuleDomainService; - @Autowired private MaterialCommonDomainService materialCommonDomainService; @Autowired private MaterialWarehouseControlDomainService materialWarehouseControlDomainService; @@ -71,11 +62,6 @@ public class MaterialBaseInfoAsyncService { @Autowired private MaterialBarCodeDomainService materialBarCodeDomainService; - /** - * 异步执行物料主数据导入 - * - *

@Async 在独立线程中执行,不阻塞接口响应。

- */ @Async public void doImportData(File tmpFile, String fileName, LoginUser loginUser) { long startTime = System.currentTimeMillis(); @@ -88,7 +74,6 @@ public class MaterialBaseInfoAsyncService { log.error("物料主数据异步导入失败 - 文件解析异常:{}", e.getMessage(), e); return; } - if (CollectionUtils.isEmpty(rows)) { log.warn("物料主数据异步导入结束 - 导入数据为空"); return; @@ -105,8 +90,6 @@ public class MaterialBaseInfoAsyncService { Set duplicateInFile = new HashSet<>(); int successCount = 0; int totalCount = rows.size(); - - // 包装规格缓存 Map> packCache = new HashMap<>(); for (int i = 0; i < rows.size(); i++) { @@ -133,21 +116,21 @@ public class MaterialBaseInfoAsyncService { if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) { row.setHsCode(row.getHsCodeImport().trim()); } - materialBaseInfoApplicationService.normalizeImportBarCodeWhenDuplicateOfHs(row); - materialBaseInfoApplicationService.fillIdsFromExistingMasterData(row); - materialBaseInfoApplicationService.fillOrganizationFromShipperIfNeeded(row); + normalizeImportBarCodeWhenDuplicateOfHs(row); + fillIdsFromExistingMasterData(row); + fillOrganizationFromShipperIfNeeded(row); if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { row.setOrganizationId(loginOrgId); } if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { row.setTopOrganizationId(loginTopOrgId); } - materialBaseInfoApplicationService.fillOrganizationName(row, loginUser); + fillOrganizationName(row, loginUser); String shipperCode = StringUtils.defaultString(row.getShipperCode(), ""); String duplicateKey = row.getOrganizationId() + "|" + shipperCode + "|" + row.getMaterialCode(); if (!duplicateInFile.add(duplicateKey)) { - errors.append("第").append(rowNum).append("行:文件内存在重复物料(组织+货主编码+物料编码);"); + errors.append("第").append(rowNum).append("行:文件内存在重复物料;"); continue; } @@ -161,10 +144,10 @@ public class MaterialBaseInfoAsyncService { wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode()); } if (materialBaseInfoService.count(wrapper) > 0) { - errors.append("第").append(rowNum).append("行:物料已存在(组织+货主编码+物料编码);"); + errors.append("第").append(rowNum).append("行:物料已存在;"); continue; } - materialBaseInfoApplicationService.fillClassifyTypeAndUnit(row); + normalizeMaterialClassifyImportFields(row); // 包装规格查询(带缓存) String packCacheKey = row.getOrganizationId() + "|" + StringUtils.defaultString(row.getPackName()); @@ -177,28 +160,24 @@ public class MaterialBaseInfoAsyncService { continue; } Map resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference>() {}); - List> rowsPack = materialBaseInfoApplicationService.extractTableDataRows(resultMap); + List> rowsPack = extractTableDataRows(resultMap); if (CollectionUtils.isEmpty(rowsPack)) { packCache.put(packCacheKey, Collections.emptyMap()); - if (StringUtils.isNotBlank(row.getPackName())) { - errors.append("第").append(rowNum).append("行:包装规格「").append(row.getPackName()).append("」不存在或未在系统中维护;"); - } else { - errors.append("第").append(rowNum).append("行:包装规格未填写;"); - } + errors.append("第").append(rowNum).append("行:包装规格不存在;"); continue; } cachedPack = rowsPack.get(0); packCache.put(packCacheKey, cachedPack); } if (cachedPack.isEmpty()) { - errors.append("第").append(rowNum).append("行:包装规格不存在(来自缓存);"); + errors.append("第").append(rowNum).append("行:包装规格不存在(缓存);"); continue; } String packCode = cachedPack.get("packCode") == null ? "" : String.valueOf(cachedPack.get("packCode")); row.setPackCode(packCode); String packId = cachedPack.get("packId") == null ? "" : String.valueOf(cachedPack.get("packId")); if (StringUtils.isBlank(packId) || !StringUtils.isNumeric(packId)) { - errors.append("第").append(rowNum).append("行:包装规格数据异常(缺少包装ID);"); + errors.append("第").append(rowNum).append("行:包装规格数据异常;"); continue; } row.setPackId(Long.valueOf(packId)); @@ -208,11 +187,12 @@ public class MaterialBaseInfoAsyncService { MaterialBaseInfoDO materialBaseInfoDO = new MaterialBaseInfoDO(); BeanUtils.copyProperties(row, materialBaseInfoDO); - materialBaseInfoDO.setMaterialGoodsRule(materialBaseInfoApplicationService.buildImportMaterialGoodsRule(row)); + materialBaseInfoDO.setMaterialGoodsRule(buildImportMaterialGoodsRule(row)); materialBaseInfoDO.setMaterialCommon(null); materialBaseInfoDO.setMaterialWarehouseControl(null); - materialBaseInfoDO.setMaterialBarCodeList(materialBaseInfoApplicationService.buildImportBarCodeList(row)); - materialBaseInfoApplicationService.insert(materialBaseInfoDO); + materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row)); + // 直接调用 insert,通过自身注入的 materialBaseInfoService + materialBaseInfoService.save(convertToEntity(materialBaseInfoDO)); Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId(); MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); @@ -253,6 +233,180 @@ public class MaterialBaseInfoAsyncService { } } + // ====== 以下方法从 MaterialBaseInfoApplicationService 复制,避免循环依赖 ====== + + private MaterialBaseInfo convertToEntity(MaterialBaseInfoDO materialBaseInfoDO) { + com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo entity = new com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo(); + BeanUtils.copyProperties(materialBaseInfoDO, entity); + return entity; + } + + private void normalizeImportBarCodeWhenDuplicateOfHs(MaterialBaseInfoDTO row) { + if (row == null || StringUtils.isBlank(row.getBarCode())) { + return; + } + String hsCode = StringUtils.trimToEmpty(row.getHsCode()); + if (hsCode.isEmpty()) { + return; + } + if (row.getBarCode().trim().equals(hsCode)) { + row.setBarCode(null); + } + } + + private void fillIdsFromExistingMasterData(MaterialBaseInfoDTO row) { + if (StringUtils.isBlank(row.getPackName()) && StringUtils.isNotBlank(row.getPackImport())) { + row.setPackName(row.getPackImport().trim()); + } + if (row.getShipperId() == null && (StringUtils.isNotBlank(row.getShipperCode()) || StringUtils.isNotBlank(row.getShipperName()))) { + MaterialBaseInfo matched = findExistingMaterialByShipper(row); + if (matched != null) { + row.setShipperId(matched.getShipperId()); + if (StringUtils.isBlank(row.getShipperCode())) { + row.setShipperCode(matched.getShipperCode()); + } + if (StringUtils.isBlank(row.getShipperName())) { + row.setShipperName(matched.getShipperName()); + } + } + } + if (row.getShipperId() == null) { + fillShipperIdFromUserCenterForImport(row); + } + if (row.getPackId() == null && (StringUtils.isNotBlank(row.getPackCode()) || StringUtils.isNotBlank(row.getPackName()))) { + Long packId = queryPackIdByCodeOrName(row.getPackCode(), row.getPackName(), row.getOrganizationId()); + if (packId != null) { + row.setPackId(packId); + } + } + } + + private MaterialBaseInfo findExistingMaterialByShipper(MaterialBaseInfoDTO row) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialBaseInfo::getDelFlag, 1) + .eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId()); + if (StringUtils.isNotBlank(row.getShipperCode())) { + wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode()); + } + wrapper.last("limit 1"); + return materialBaseInfoService.getOne(wrapper, false); + } + + private void fillShipperIdFromUserCenterForImport(MaterialBaseInfoDTO row) { + if (row.getShipperId() != null) { + return; + } + if (StringUtils.isBlank(row.getShipperName()) && StringUtils.isBlank(row.getShipperCode())) { + return; + } + try { + AjaxResult ajaxResult = userServiceFeign.getInfoByName(row.getShipperName()); + if ("200".equals(String.valueOf(ajaxResult.get("code"))) && ajaxResult.get("data") != null) { + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + if (userPo != null) { + row.setShipperId(userPo.getUserId()); + } + } + } catch (Exception ignored) { + } + } + + private void fillOrganizationFromShipperIfNeeded(MaterialBaseInfoDTO row) { + if (isValidOrgId(row.getOrganizationId()) || row.getShipperId() == null) { + return; + } + try { + AjaxResult infoRes = userServiceFeign.getInfo(row.getShipperId()); + if ("200".equals(String.valueOf(infoRes.get("code"))) && infoRes.get("data") != null) { + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(infoRes.get("data")), UserPo.class); + if (userPo != null) { + row.setShipperId(userPo.getUserId()); + if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(userPo.getOrganizationId())) { + row.setOrganizationId(userPo.getOrganizationId()); + } + if (row.getTopOrganizationId() == null && isValidOrgId(userPo.getTopOrganizationId())) { + row.setTopOrganizationId(userPo.getTopOrganizationId()); + } + } + } + } catch (Exception ignored) { + } + } + + private void fillOrganizationName(MaterialBaseInfoDTO row, LoginUser loginUser) { + if (StringUtils.isNotBlank(row.getOrganizationName())) { + return; + } + if (loginUser != null && loginUser.getUserPo() != null && StringUtils.isNotBlank(loginUser.getUserPo().getOrganizationName())) { + row.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + } + } + + private void normalizeMaterialClassifyImportFields(MaterialBaseInfoDTO row) { + // 简化版:不做复杂分类查询,保持原值 + } + + private Long queryPackIdByCodeOrName(String packCode, String packName, Long organizationId) { + Object result = systemServiceFeign.getPackList(StringUtils.trimToNull(packCode), StringUtils.trimToNull(packName), organizationId); + if (result == null) { + return null; + } + Map resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference>() {}); + List> rows = extractTableDataRows(resultMap); + if (CollectionUtils.isEmpty(rows)) { + return null; + } + Map first = rows.get(0); + if (first == null) { + return null; + } + String packId = first.get("packId") == null ? "" : String.valueOf(first.get("packId")); + if (StringUtils.isBlank(packId) || !StringUtils.isNumeric(packId)) { + return null; + } + return Long.valueOf(packId); + } + + private List buildImportBarCodeList(MaterialBaseInfoDTO row) { + return Collections.emptyList(); + } + + private com.mhd.wms.domain.materialGoodsRule.repository.todo.MaterialGoodsRuleDO buildImportMaterialGoodsRule(MaterialBaseInfoDTO row) { + return null; + } + + private List> extractTableDataRows(Map resultMap) { + if (resultMap == null) { + return Collections.emptyList(); + } + Object data = resultMap.get("data"); + if (data == null) { + data = resultMap.get("rows"); + } + if (data instanceof List) { + @SuppressWarnings("unchecked") + List> list = (List>) data; + return list; + } + if (data instanceof Map) { + @SuppressWarnings("unchecked") + Map dataMap = (Map) data; + Object innerData = dataMap.get("data"); + if (innerData instanceof List) { + @SuppressWarnings("unchecked") + List> list = (List>) innerData; + return list; + } + Object rows = dataMap.get("rows"); + if (rows instanceof List) { + @SuppressWarnings("unchecked") + List> list = (List>) rows; + return list; + } + } + return Collections.emptyList(); + } + private boolean isValidOrgId(Long id) { return id != null && id > 0; } From 57cce338b158a5f4ce69aa1c9748d129f7cf6b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 13:13:32 +0800 Subject: [PATCH 07/43] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mhd/wms/MhdWmsApplication.java | 2 ++ .../MaterialBaseInfoAsyncService.java | 36 +++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/MhdWmsApplication.java b/mhd_wms/src/main/java/com/mhd/wms/MhdWmsApplication.java index f8b3d4145..a848debd3 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/MhdWmsApplication.java +++ b/mhd_wms/src/main/java/com/mhd/wms/MhdWmsApplication.java @@ -7,12 +7,14 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication @EnableRyFeignClients @EnableDiscoveryClient @MapperScan("com.mhd.wms.domain.**.mapper") @EnableMethodCache(basePackages = "com.mhd.platform.domain.**.cache") +@EnableAsync @ComponentScan(basePackages = { "com.mhd.wms", "com.mhd.system.api.factory" diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java index ffba4043c..92412d773 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java @@ -16,6 +16,8 @@ import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo; import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService; import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper; import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO; +import com.mhd.wms.domain.materialBaseInfo.service.MaterialBaseInfoDomainService; +import com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainService; import com.mhd.wms.domain.materialCommon.service.MaterialCommonDomainService; import com.mhd.wms.domain.materialCommon.repository.todo.MaterialCommonDO; import com.mhd.wms.domain.materialInventoryWarning.service.MaterialInventoryWarningDomainService; @@ -61,6 +63,10 @@ public class MaterialBaseInfoAsyncService { private MaterialInventoryWarningDomainService materialInventoryWarningDomainService; @Autowired private MaterialBarCodeDomainService materialBarCodeDomainService; + @Autowired + private MaterialBaseInfoDomainService materialBaseInfoDomainService; + @Autowired + private com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainService materialGoodsRuleDomainService; @Async public void doImportData(File tmpFile, String fileName, LoginUser loginUser) { @@ -191,21 +197,37 @@ public class MaterialBaseInfoAsyncService { materialBaseInfoDO.setMaterialCommon(null); materialBaseInfoDO.setMaterialWarehouseControl(null); materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row)); - // 直接调用 insert,通过自身注入的 materialBaseInfoService - materialBaseInfoService.save(convertToEntity(materialBaseInfoDO)); - Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId(); - + // 补全创建人信息(异步线程没有 SecurityContext,用 loginUser) + if (loginUser != null) { + materialBaseInfoDO.setCreateBy(loginUser.getUserid()); + materialBaseInfoDO.setCreateByName(loginUser.getUsername()); + } + materialBaseInfoDO.setCreateTime(new Date()); + materialBaseInfoDO.setDelFlag(1); + // 通过 domainService 插入,获取自增 ID + Long materialBaseInfoId = materialBaseInfoDomainService.insert(materialBaseInfoDO); + materialBaseInfoDO.setMaterialBaseInfoId(materialBaseInfoId); + // 商品规则 + com.mhd.wms.domain.materialGoodsRule.repository.todo.MaterialGoodsRuleDO goodsRule = materialBaseInfoDO.getMaterialGoodsRule(); + if (goodsRule != null) { + goodsRule.setMaterialBaseInfoId(materialBaseInfoId); + materialGoodsRuleDomainService.insert(goodsRule); + } + // 公共信息 MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); if (materialCommonDO != null) { materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId); materialCommonDomainService.insert(materialCommonDO); } + // 仓库控制信息 MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl(); if (materialWarehouseControlDO != null) { materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId); materialWarehouseControlDomainService.insert(materialWarehouseControlDO); } + // 库存预警 materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO); + // 条码信息 materialBarCodeDomainService.batchInsertOrUpdate(materialBaseInfoDO); successCount++; } catch (Exception e) { @@ -235,12 +257,6 @@ public class MaterialBaseInfoAsyncService { // ====== 以下方法从 MaterialBaseInfoApplicationService 复制,避免循环依赖 ====== - private MaterialBaseInfo convertToEntity(MaterialBaseInfoDO materialBaseInfoDO) { - com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo entity = new com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo(); - BeanUtils.copyProperties(materialBaseInfoDO, entity); - return entity; - } - private void normalizeImportBarCodeWhenDuplicateOfHs(MaterialBaseInfoDTO row) { if (row == null || StringUtils.isBlank(row.getBarCode())) { return; From a112aa1163d0ed5dee61b887ad4a8056717f74a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 17:21:22 +0800 Subject: [PATCH 08/43] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 91f2f8a11..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 03d48d2f4..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index ba9a45148..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 688e5ea7c..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 48d76d01e..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index 39eb710cb..fc7380c20 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From f3fc2b309391b0a521f14075a5d5642f5189c5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 17:54:17 +0800 Subject: [PATCH 09/43] 31 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..e8f169bf2 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -16,7 +16,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -25,7 +25,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 96c95dabc619e2faf4db7f9e5f6da34a1fb43bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 19:31:11 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 2 +- .../com/mhd/system/api/OmsServiceFeign.java | 2 +- .../com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../com/mhd/system/api/WmsServiceFeign.java | 2 +- .../com/mhd/system/api/YmsServiceFeign.java | 2 +- .../MaterialBaseInfoAsyncService.java | 181 ++---------------- mhd_wms/src/main/resources/bootstrap.yml | 16 +- 7 files changed, 26 insertions(+), 181 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java index 92412d773..5a3554478 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoAsyncService.java @@ -67,6 +67,9 @@ public class MaterialBaseInfoAsyncService { private MaterialBaseInfoDomainService materialBaseInfoDomainService; @Autowired private com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainService materialGoodsRuleDomainService; + @org.springframework.context.annotation.Lazy + @Autowired + private MaterialBaseInfoApplicationService materialBaseInfoApplicationService; @Async public void doImportData(File tmpFile, String fileName, LoginUser loginUser) { @@ -122,16 +125,16 @@ public class MaterialBaseInfoAsyncService { if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) { row.setHsCode(row.getHsCodeImport().trim()); } - normalizeImportBarCodeWhenDuplicateOfHs(row); - fillIdsFromExistingMasterData(row); - fillOrganizationFromShipperIfNeeded(row); + materialBaseInfoApplicationService.normalizeImportBarCodeWhenDuplicateOfHs(row); + materialBaseInfoApplicationService.fillIdsFromExistingMasterData(row); + materialBaseInfoApplicationService.fillOrganizationFromShipperIfNeeded(row); if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) { row.setOrganizationId(loginOrgId); } if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) { row.setTopOrganizationId(loginTopOrgId); } - fillOrganizationName(row, loginUser); + materialBaseInfoApplicationService.fillOrganizationName(row, loginUser); String shipperCode = StringUtils.defaultString(row.getShipperCode(), ""); String duplicateKey = row.getOrganizationId() + "|" + shipperCode + "|" + row.getMaterialCode(); @@ -153,7 +156,7 @@ public class MaterialBaseInfoAsyncService { errors.append("第").append(rowNum).append("行:物料已存在;"); continue; } - normalizeMaterialClassifyImportFields(row); + materialBaseInfoApplicationService.fillClassifyTypeAndUnit(row); // 包装规格查询(带缓存) String packCacheKey = row.getOrganizationId() + "|" + StringUtils.defaultString(row.getPackName()); @@ -193,42 +196,18 @@ public class MaterialBaseInfoAsyncService { MaterialBaseInfoDO materialBaseInfoDO = new MaterialBaseInfoDO(); BeanUtils.copyProperties(row, materialBaseInfoDO); - materialBaseInfoDO.setMaterialGoodsRule(buildImportMaterialGoodsRule(row)); + materialBaseInfoDO.setMaterialGoodsRule(materialBaseInfoApplicationService.buildImportMaterialGoodsRule(row)); materialBaseInfoDO.setMaterialCommon(null); materialBaseInfoDO.setMaterialWarehouseControl(null); - materialBaseInfoDO.setMaterialBarCodeList(buildImportBarCodeList(row)); + materialBaseInfoDO.setMaterialBarCodeList(materialBaseInfoApplicationService.buildImportBarCodeList(row)); // 补全创建人信息(异步线程没有 SecurityContext,用 loginUser) if (loginUser != null) { materialBaseInfoDO.setCreateBy(loginUser.getUserid()); materialBaseInfoDO.setCreateByName(loginUser.getUsername()); } materialBaseInfoDO.setCreateTime(new Date()); - materialBaseInfoDO.setDelFlag(1); - // 通过 domainService 插入,获取自增 ID - Long materialBaseInfoId = materialBaseInfoDomainService.insert(materialBaseInfoDO); - materialBaseInfoDO.setMaterialBaseInfoId(materialBaseInfoId); - // 商品规则 - com.mhd.wms.domain.materialGoodsRule.repository.todo.MaterialGoodsRuleDO goodsRule = materialBaseInfoDO.getMaterialGoodsRule(); - if (goodsRule != null) { - goodsRule.setMaterialBaseInfoId(materialBaseInfoId); - materialGoodsRuleDomainService.insert(goodsRule); - } - // 公共信息 - MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon(); - if (materialCommonDO != null) { - materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId); - materialCommonDomainService.insert(materialCommonDO); - } - // 仓库控制信息 - MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl(); - if (materialWarehouseControlDO != null) { - materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId); - materialWarehouseControlDomainService.insert(materialWarehouseControlDO); - } - // 库存预警 - materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO); - // 条码信息 - materialBarCodeDomainService.batchInsertOrUpdate(materialBaseInfoDO); + // 调用原 ApplicationService 的 insert,走完整的插入逻辑(含商品规则、公共信息、NC编码等) + materialBaseInfoApplicationService.insert(materialBaseInfoDO); successCount++; } catch (Exception e) { log.error("物料主数据异步导入 - 第{}行处理异常", rowNum, e); @@ -255,141 +234,7 @@ public class MaterialBaseInfoAsyncService { } } - // ====== 以下方法从 MaterialBaseInfoApplicationService 复制,避免循环依赖 ====== - - private void normalizeImportBarCodeWhenDuplicateOfHs(MaterialBaseInfoDTO row) { - if (row == null || StringUtils.isBlank(row.getBarCode())) { - return; - } - String hsCode = StringUtils.trimToEmpty(row.getHsCode()); - if (hsCode.isEmpty()) { - return; - } - if (row.getBarCode().trim().equals(hsCode)) { - row.setBarCode(null); - } - } - - private void fillIdsFromExistingMasterData(MaterialBaseInfoDTO row) { - if (StringUtils.isBlank(row.getPackName()) && StringUtils.isNotBlank(row.getPackImport())) { - row.setPackName(row.getPackImport().trim()); - } - if (row.getShipperId() == null && (StringUtils.isNotBlank(row.getShipperCode()) || StringUtils.isNotBlank(row.getShipperName()))) { - MaterialBaseInfo matched = findExistingMaterialByShipper(row); - if (matched != null) { - row.setShipperId(matched.getShipperId()); - if (StringUtils.isBlank(row.getShipperCode())) { - row.setShipperCode(matched.getShipperCode()); - } - if (StringUtils.isBlank(row.getShipperName())) { - row.setShipperName(matched.getShipperName()); - } - } - } - if (row.getShipperId() == null) { - fillShipperIdFromUserCenterForImport(row); - } - if (row.getPackId() == null && (StringUtils.isNotBlank(row.getPackCode()) || StringUtils.isNotBlank(row.getPackName()))) { - Long packId = queryPackIdByCodeOrName(row.getPackCode(), row.getPackName(), row.getOrganizationId()); - if (packId != null) { - row.setPackId(packId); - } - } - } - - private MaterialBaseInfo findExistingMaterialByShipper(MaterialBaseInfoDTO row) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(MaterialBaseInfo::getDelFlag, 1) - .eq(MaterialBaseInfo::getOrganizationId, row.getOrganizationId()); - if (StringUtils.isNotBlank(row.getShipperCode())) { - wrapper.eq(MaterialBaseInfo::getShipperCode, row.getShipperCode()); - } - wrapper.last("limit 1"); - return materialBaseInfoService.getOne(wrapper, false); - } - - private void fillShipperIdFromUserCenterForImport(MaterialBaseInfoDTO row) { - if (row.getShipperId() != null) { - return; - } - if (StringUtils.isBlank(row.getShipperName()) && StringUtils.isBlank(row.getShipperCode())) { - return; - } - try { - AjaxResult ajaxResult = userServiceFeign.getInfoByName(row.getShipperName()); - if ("200".equals(String.valueOf(ajaxResult.get("code"))) && ajaxResult.get("data") != null) { - UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); - if (userPo != null) { - row.setShipperId(userPo.getUserId()); - } - } - } catch (Exception ignored) { - } - } - - private void fillOrganizationFromShipperIfNeeded(MaterialBaseInfoDTO row) { - if (isValidOrgId(row.getOrganizationId()) || row.getShipperId() == null) { - return; - } - try { - AjaxResult infoRes = userServiceFeign.getInfo(row.getShipperId()); - if ("200".equals(String.valueOf(infoRes.get("code"))) && infoRes.get("data") != null) { - UserPo userPo = JSON.parseObject(JSONObject.toJSONString(infoRes.get("data")), UserPo.class); - if (userPo != null) { - row.setShipperId(userPo.getUserId()); - if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(userPo.getOrganizationId())) { - row.setOrganizationId(userPo.getOrganizationId()); - } - if (row.getTopOrganizationId() == null && isValidOrgId(userPo.getTopOrganizationId())) { - row.setTopOrganizationId(userPo.getTopOrganizationId()); - } - } - } - } catch (Exception ignored) { - } - } - - private void fillOrganizationName(MaterialBaseInfoDTO row, LoginUser loginUser) { - if (StringUtils.isNotBlank(row.getOrganizationName())) { - return; - } - if (loginUser != null && loginUser.getUserPo() != null && StringUtils.isNotBlank(loginUser.getUserPo().getOrganizationName())) { - row.setOrganizationName(loginUser.getUserPo().getOrganizationName()); - } - } - - private void normalizeMaterialClassifyImportFields(MaterialBaseInfoDTO row) { - // 简化版:不做复杂分类查询,保持原值 - } - - private Long queryPackIdByCodeOrName(String packCode, String packName, Long organizationId) { - Object result = systemServiceFeign.getPackList(StringUtils.trimToNull(packCode), StringUtils.trimToNull(packName), organizationId); - if (result == null) { - return null; - } - Map resultMap = JSON.parseObject(JSONObject.toJSONString(result), new TypeReference>() {}); - List> rows = extractTableDataRows(resultMap); - if (CollectionUtils.isEmpty(rows)) { - return null; - } - Map first = rows.get(0); - if (first == null) { - return null; - } - String packId = first.get("packId") == null ? "" : String.valueOf(first.get("packId")); - if (StringUtils.isBlank(packId) || !StringUtils.isNumeric(packId)) { - return null; - } - return Long.valueOf(packId); - } - - private List buildImportBarCodeList(MaterialBaseInfoDTO row) { - return Collections.emptyList(); - } - - private com.mhd.wms.domain.materialGoodsRule.repository.todo.MaterialGoodsRuleDO buildImportMaterialGoodsRule(MaterialBaseInfoDTO row) { - return null; - } + // ====== 以下工具方法 ====== private List> extractTableDataRows(Map resultMap) { if (resultMap == null) { diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index e8f169bf2..2b8e3f3b0 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,20 +14,20 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 - username: nacos - password: manhuoda@2023 +# server-addr: 10.102.192.31:6848 +# username: nacos +# password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 - username: nacos - password: manhuoda@2023 +# server-addr: 10.102.192.31:6848 +# username: nacos +# password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 # 配置文件格式 From 7aa75767996fc30dd4b1f97b2b776b280562d173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 19:37:11 +0800 Subject: [PATCH 11/43] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd-user-center/src/main/resources/bootstrap.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index 6bf4ff00a..7b6baaea4 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -20,15 +20,15 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 From ad55d49d6b8a557509f00c31d119023d0b6eb43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 19:49:47 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index 2b8e3f3b0..b97ce9a79 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -17,8 +17,8 @@ spring: server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 # server-addr: 10.102.192.31:6848 -# username: nacos -# password: manhuoda@2023 + username: nacos + password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: @@ -26,8 +26,8 @@ spring: server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 # server-addr: 10.102.192.31:6848 -# username: nacos -# password: manhuoda@2023 + username: nacos + password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 # 配置文件格式 From 14884053979199188e6c1ad56a078087dcb87e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 19:51:53 +0800 Subject: [PATCH 13/43] 31 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd-user-center/src/main/resources/bootstrap.yml | 8 ++++---- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 91f2f8a11..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 03d48d2f4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index ba9a45148..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 688e5ea7c..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 48d76d01e..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index 7b6baaea4..dd13bfba5 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -20,15 +20,15 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 - server-addr: 10.33.0.129:6010 -# server-addr: 10.102.192.30:6848 +# server-addr: 10.33.0.129:6010 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 - server-addr: 10.33.0.129:6010 -# server-addr: 10.102.192.30:6848 +# server-addr: 10.33.0.129:6010 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index b97ce9a79..e8f169bf2 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 9f2e8f1855fa825f16ce22dbc2ac05bdc8cecb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 21:02:13 +0800 Subject: [PATCH 14/43] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../MaterialBaseInfoApplicationService.java | 8 ++++++-- .../com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java | 2 ++ mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java index 56f2c7319..10b12490c 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialBaseInfo/MaterialBaseInfoApplicationService.java @@ -859,10 +859,14 @@ public class MaterialBaseInfoApplicationService { Object userCode = shipper.get("userCode"); Object userMemberCode = shipper.get("userMemberCode"); Object entName = shipper.get("shipperEnterpriseName"); - if (userName == null) { + // userName 可能为空字符串而非 null,需同时判断空字符串 + if (userName == null || String.valueOf(userName).trim().isEmpty()) { + userName = shipper.get("userNameShipper"); + } + if (userName == null || String.valueOf(userName).trim().isEmpty()) { userName = shipper.get("name"); } - if (userName == null) { + if (userName == null || String.valueOf(userName).trim().isEmpty()) { userName = shipper.get("shipperName"); } String normalizedName = StringUtils.isNotBlank(shipperName) ? shipperName : ""; diff --git a/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java b/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java index a986614ff..206e35fb2 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java +++ b/mhd_wms/src/main/java/com/mhd/wms/util/MaterialBaseInfoImportExcelUtil.java @@ -39,6 +39,8 @@ public final class MaterialBaseInfoImportExcelUtil { HEADER_ALIASES.put("长", "物料大小-长 单位:米"); HEADER_ALIASES.put("宽", "物料大小-宽 单位:米"); HEADER_ALIASES.put("高", "物料大小-高 单位:米"); + HEADER_ALIASES.put("公司名称", "货主名称"); + HEADER_ALIASES.put("公司名稱", "货主名称"); } public static List importRows(InputStream is) throws Exception { diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index e8f169bf2..b97ce9a79 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 +# server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 +# server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 25ed5160000e1580caba35d7a593ef641ddaf1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 21:55:16 +0800 Subject: [PATCH 15/43] 31 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 91f2f8a11..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 03d48d2f4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index ba9a45148..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 688e5ea7c..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 48d76d01e..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index b97ce9a79..e8f169bf2 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From a1f4953fb5099af575344ea1999d637bf3cce4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Sat, 25 Jul 2026 22:08:20 +0800 Subject: [PATCH 16/43] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index e8f169bf2..fc7380c20 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -16,7 +16,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -25,7 +25,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 23984e69d67c514aa94d6a8c9b39707e4d267109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 28 Jul 2026 11:06:07 +0800 Subject: [PATCH 17/43] =?UTF-8?q?=E4=B8=8A=E6=9E=B6=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E8=B4=A7=E4=B8=BB=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=EF=BC=8C?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=A4=8D=E6=A0=B8=E6=95=B0=E9=87=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BABUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stockOutOrder/StockOutOrderApplicationService.java | 3 --- .../repository/persistence/MaterialInventoryImpl.java | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java index 8e6556798..26de7300b 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockOutOrder/StockOutOrderApplicationService.java @@ -282,9 +282,6 @@ public class StockOutOrderApplicationService { stockOutOrderPO.setMaterialQuantity(cnt); } - BigDecimal checkSum = (mag != null && mag.getCheckQuantitySum() != null) - ? mag.getCheckQuantitySum() : BigDecimal.ZERO; - stockOutOrderPO.setCheckQuantity(checkSum); stockOutOrderPO.setReceiptOrderAccountList( accountByOrderId.getOrDefault(stockOutOrderPO.getOutOrderId(), Collections.emptyList())); } diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java index eab84edbf..8b25a0600 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java @@ -819,7 +819,12 @@ public class MaterialInventoryImpl extends ServiceImpl Date: Tue, 28 Jul 2026 14:43:24 +0800 Subject: [PATCH 18/43] =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 2 +- .../com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../com/mhd/system/api/WmsServiceFeign.java | 2 +- .../com/mhd/system/api/YmsServiceFeign.java | 2 +- .../controller/SsoAuthorizeController.java | 1 + .../system/service/SsoAuthorizeService.java | 2 +- mhd-auth/src/main/resources/bootstrap.yml | 6 +- .../AgreementDetailsApplicationService.java | 93 +++++++++++++++++-- .../repository/po/AgreementDetailsPo.java | 32 +++++++ 9 files changed, 127 insertions(+), 15 deletions(-) create mode 100644 mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/repository/po/AgreementDetailsPo.java diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-auth/src/main/java/com/mhd/auth/system/controller/SsoAuthorizeController.java b/mhd-auth/src/main/java/com/mhd/auth/system/controller/SsoAuthorizeController.java index 4891fb10e..024cb8c3f 100644 --- a/mhd-auth/src/main/java/com/mhd/auth/system/controller/SsoAuthorizeController.java +++ b/mhd-auth/src/main/java/com/mhd/auth/system/controller/SsoAuthorizeController.java @@ -79,6 +79,7 @@ public class SsoAuthorizeController { // 5. 重定向到前端页面,token通过URL参数传递 // 前端页面需读取URL中的token参数并存入localStorage log.info("SSO单点登录成功, account={}", account); + log.info("SSO单点登录成功, account={}, token={} , redirectUrl={}", account, accessToken, redirectUrl); response.sendRedirect(redirectUrl + "?token=" + URLEncoder.encode(accessToken, StandardCharsets.UTF_8.name())); } catch (Exception e) { diff --git a/mhd-auth/src/main/java/com/mhd/auth/system/service/SsoAuthorizeService.java b/mhd-auth/src/main/java/com/mhd/auth/system/service/SsoAuthorizeService.java index e3e6040d6..ee2613ecd 100644 --- a/mhd-auth/src/main/java/com/mhd/auth/system/service/SsoAuthorizeService.java +++ b/mhd-auth/src/main/java/com/mhd/auth/system/service/SsoAuthorizeService.java @@ -50,7 +50,7 @@ public class SsoAuthorizeService { @Value("${sso.public-key}") private String publicKeyStr; - @Value("https://diglog.namkwong.com.mo/main_app/sso") + @Value("${sso.redirect-url}") private String redirectUrl; @Resource diff --git a/mhd-auth/src/main/resources/bootstrap.yml b/mhd-auth/src/main/resources/bootstrap.yml index 0f7b839c1..828fff329 100644 --- a/mhd-auth/src/main/resources/bootstrap.yml +++ b/mhd-auth/src/main/resources/bootstrap.yml @@ -15,7 +15,7 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -24,7 +24,7 @@ spring: # password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 # 测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 @@ -52,4 +52,4 @@ sso: AwIDAQAB -----END PUBLIC KEY----- # SSO登录成功后跳转的前端页面地址 - redirect-url: "/" + redirect-url: "https://diglog.namkwong.com.mo/main_app/sso" diff --git a/mhd-user-center/src/main/java/com/mhd/user/application/service/AgreementDetailsApplicationService.java b/mhd-user-center/src/main/java/com/mhd/user/application/service/AgreementDetailsApplicationService.java index 4b9703459..99d56c911 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/application/service/AgreementDetailsApplicationService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/application/service/AgreementDetailsApplicationService.java @@ -1,12 +1,22 @@ package com.mhd.user.application.service; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.mhd.common.security.utils.SecurityUtils; import com.mhd.user.domain.userAggregate.entity.AgreementDetails; +import com.mhd.user.domain.userAggregate.entity.UserShipperEntity; import com.mhd.user.domain.userAggregate.repository.mapper.AgreementDetailsMapper; +import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper; +import com.mhd.user.domain.userAggregate.repository.po.AgreementDetailsPo; +import com.mhd.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -19,18 +29,87 @@ public class AgreementDetailsApplicationService { @Resource private AgreementDetailsMapper agreementDetailsMapper; + @Resource + private UserShipperMapper userShipperMapper; + /** - * 根据货主ID查询所有协议明细 + * 根据货主ID查询当前登录用户组织下的协议明细 + * 从user_shipper表的orgCode字段解析JSON,匹配当前登录用户组织code, + * 返回该组织下的agreedaydatas列表 * * @param shipperId 货主ID * @return 协议明细列表 */ - public List listByShipperId(Long shipperId) { - return agreementDetailsMapper.selectList( - new LambdaQueryWrapper() - .eq(AgreementDetails::getShipperId, shipperId) - .orderByDesc(AgreementDetails::getCreateTime) - ); + public List listByShipperId(Long shipperId) { + // 1. 获取当前登录用户组织ID + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser) || ObjectUtil.isNull(loginUser.getUserPo())) { + log.warn("未获取到登录用户信息"); + return Collections.emptyList(); + } + Long organizationId = loginUser.getUserPo().getOrganizationId(); + if (ObjectUtil.isNull(organizationId)) { + log.warn("当前登录用户无组织信息"); + return Collections.emptyList(); + } + + // 2. 根据shipperId查询货主信息,获取orgCode字段 + UserShipperEntity shipperEntity = userShipperMapper.selectById(shipperId); + if (ObjectUtil.isNull(shipperEntity)) { + log.warn("未找到货主信息,shipperId={}", shipperId); + return Collections.emptyList(); + } + String orgCodeJson = shipperEntity.getOrgCode(); + if (ObjectUtil.isNull(orgCodeJson) || orgCodeJson.isEmpty()) { + log.warn("货主orgCode为空,shipperId={}", shipperId); + return Collections.emptyList(); + } + + // 3. 解析orgCode JSON数组,匹配当前登录用户组织code + JSONArray orgCodeArray = JSONArray.parseArray(orgCodeJson); + if (orgCodeArray == null || orgCodeArray.isEmpty()) { + return Collections.emptyList(); + } + + JSONObject matchedOrg = null; + for (int i = 0; i < orgCodeArray.size(); i++) { + JSONObject orgItem = orgCodeArray.getJSONObject(i); + Long code = orgItem.getLong("code"); + if (organizationId.equals(code)) { + matchedOrg = orgItem; + break; + } + } + + if (matchedOrg == null) { + log.info("未匹配到当前组织的协议信息,shipperId={},organizationId={}", shipperId, organizationId); + return Collections.emptyList(); + } + + // 4. 获取匹配组织的agreedaydatas + JSONArray agreedaydatas = matchedOrg.getJSONArray("agreedaydatas"); + if (agreedaydatas == null || agreedaydatas.isEmpty()) { + log.info("当前组织下无协议天数数据,shipperId={},organizationId={}", shipperId, organizationId); + return Collections.emptyList(); + } + + // 5. 转换为AgreementDetailsPo列表 + List result = new ArrayList<>(); + for (int i = 0; i < agreedaydatas.size(); i++) { + JSONObject item = agreedaydatas.getJSONObject(i); + AgreementDetailsPo po = new AgreementDetailsPo(); + po.setCode(item.getString("code")); + po.setOrgcode(item.getString("orgcode")); + po.setPtypename(item.getString("ptypename")); + po.setPtype(item.getString("ptype")); + po.setPcode(item.getString("pcode")); + po.setPname(item.getString("pname")); + po.setPday(item.getString("pday")); + result.add(po); + } + + log.info("查询协议明细成功,shipperId={},organizationId={},共{}条", shipperId, organizationId, result.size()); + return result; } /** diff --git a/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/repository/po/AgreementDetailsPo.java b/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/repository/po/AgreementDetailsPo.java new file mode 100644 index 000000000..a01334043 --- /dev/null +++ b/mhd-user-center/src/main/java/com/mhd/user/domain/userAggregate/repository/po/AgreementDetailsPo.java @@ -0,0 +1,32 @@ +package com.mhd.user.domain.userAggregate.repository.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 协议天数PO + */ +@Data +public class AgreementDetailsPo { + + @ApiModelProperty("客户编码") + private String code; + + @ApiModelProperty("协议组织编码") + private String orgcode; + + @ApiModelProperty("协议类型名称") + private String ptypename; + + @ApiModelProperty("协议类型:1-付款协议天数,2-收款协议天数") + private String ptype; + + @ApiModelProperty("财务系统协议编码") + private String pcode; + + @ApiModelProperty("协议天数名称") + private String pname; + + @ApiModelProperty("协议天数") + private String pday; +} From 1f84ad71d8826cc61809d8b158bcfe227eceecbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E8=BE=89?= <2830717623@qq.com> Date: Tue, 28 Jul 2026 14:43:31 +0800 Subject: [PATCH 19/43] =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { From 55dfb6f4a130cbb5f2112be34a8d11888c5ef8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E8=BE=89?= <2830717623@qq.com> Date: Tue, 28 Jul 2026 14:47:06 +0800 Subject: [PATCH 20/43] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd-auth/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..2a6385817 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.32:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-auth/src/main/resources/bootstrap.yml b/mhd-auth/src/main/resources/bootstrap.yml index 828fff329..1132eea0d 100644 --- a/mhd-auth/src/main/resources/bootstrap.yml +++ b/mhd-auth/src/main/resources/bootstrap.yml @@ -15,7 +15,7 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -24,7 +24,7 @@ spring: # password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 # 测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 From 538a3b42bdcd21e9af2d838c071ae6eef602e6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 28 Jul 2026 16:07:00 +0800 Subject: [PATCH 21/43] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=A0=BC=E5=BC=8F=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../com/mhd/auth/system/service/SysLoginService.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index 2a6385817..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.32:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-auth/src/main/java/com/mhd/auth/system/service/SysLoginService.java b/mhd-auth/src/main/java/com/mhd/auth/system/service/SysLoginService.java index dbf6b5e80..09112dcc3 100644 --- a/mhd-auth/src/main/java/com/mhd/auth/system/service/SysLoginService.java +++ b/mhd-auth/src/main/java/com/mhd/auth/system/service/SysLoginService.java @@ -550,11 +550,11 @@ public class SysLoginService { throw new ServiceException("请输入手机号和短信验证码"); } - //调用工具类校验,校验手机号格式错误 - if (!RegexUtil.isPhoneLegal(userPhone)) { - recordLogininfor(userPhone, Constants.LOGIN_FAIL, UserError.USER_PHONE_REG_ERROR.errmsg(), 1); - throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR); - } +// //调用工具类校验,校验手机号格式错误 +// if (!RegexUtil.isPhoneLegal(userPhone)) { +// recordLogininfor(userPhone, Constants.LOGIN_FAIL, UserError.USER_PHONE_REG_ERROR.errmsg(), 1); +// throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR); +// } //根据域名获取一级组织ID AjaxResult topOrganizationIdR = organizationServiceFeign.getOrganizationByPath(path, SecurityConstants.INNER); From 07d9dacdedaaac1b90dd3f69b70d0305620bd26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 28 Jul 2026 16:10:37 +0800 Subject: [PATCH 22/43] 31 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd-auth/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-auth/src/main/resources/bootstrap.yml b/mhd-auth/src/main/resources/bootstrap.yml index 1132eea0d..828fff329 100644 --- a/mhd-auth/src/main/resources/bootstrap.yml +++ b/mhd-auth/src/main/resources/bootstrap.yml @@ -15,7 +15,7 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -24,7 +24,7 @@ spring: # password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 # 测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 From d8aa1e94906e74bc16ad0b220e847aab6e79ac5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 28 Jul 2026 21:10:15 +0800 Subject: [PATCH 23/43] 31 --- mhd_wms/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..e8f169bf2 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -16,7 +16,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -25,7 +25,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 489515f86598fb1ae5c1d3ecdf0b514f50259c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 28 Jul 2026 21:18:04 +0800 Subject: [PATCH 24/43] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index e8f169bf2..fc7380c20 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -16,7 +16,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -25,7 +25,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 01b2723e1f3acb2181d566208f8c569f680e93ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 29 Jul 2026 10:54:22 +0800 Subject: [PATCH 25/43] =?UTF-8?q?=E7=BB=B4=E4=BB=96=E5=A5=B6=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=B7=BB=E5=8A=A0=E5=BA=93=E5=AD=98=E4=BF=A1=E6=81=AF?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/ReservationStockInOrderImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java index af18fa80b..dc0f1c33c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java @@ -271,9 +271,23 @@ public class ReservationStockInOrderImpl extends ServiceImpl Date: Wed, 29 Jul 2026 11:02:00 +0800 Subject: [PATCH 26/43] =?UTF-8?q?=E5=8F=9131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_oms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index ee058f0f6..542b6bce7 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 674f56b2c21019e491e13b02d25416dbafb002f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 29 Jul 2026 14:25:12 +0800 Subject: [PATCH 27/43] =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=92=8C=E5=8D=95=E4=BD=8D=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/persistence/ReservationStockInOrderImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java index dc0f1c33c..93070d2f4 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java @@ -288,6 +288,8 @@ public class ReservationStockInOrderImpl extends ServiceImpl Date: Wed, 29 Jul 2026 14:32:11 +0800 Subject: [PATCH 28/43] =?UTF-8?q?=E5=8F=9130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_oms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index 542b6bce7..ee058f0f6 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From a1494846dbfae647bbb2a205f64ff8cc8aeabee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 29 Jul 2026 16:33:40 +0800 Subject: [PATCH 29/43] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=BA=93=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/StorageSectionDomainService.java | 24 ++++--------------- .../src/main/resources/bootstrap.yml | 8 +++---- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/storageSection/service/StorageSectionDomainService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/storageSection/service/StorageSectionDomainService.java index db2ba5435..5fbe57933 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/storageSection/service/StorageSectionDomainService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/storageSection/service/StorageSectionDomainService.java @@ -91,31 +91,15 @@ public class StorageSectionDomainService { public Boolean update(StorageSectionDO storageSectionDO) { LoginUser loginUser = SecurityUtils.getLoginUser(); Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); - AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); - if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) { - throw new ServiceException("获取当前登陆人组织与登陆仓库失败!"); + if (topOrganizationId == null || topOrganizationId == 0) { + throw new ServiceException("获取当前登陆人组织失败!"); } - checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(), + // 直接用记录自身的 warehouseId 做唯一校验,不再依赖缓存仓库 + checkStorageSectionDuplicate(topOrganizationId, storageSectionDO.getWarehouseId(), storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), storageSectionDO.getStorageSectionId()); //设置仓库 setWarehouseInfo(storageSectionDO); - String storageCode = storageSectionDO.getStorageCode(); - String storageName = storageSectionDO.getStorageName(); - Long warehouseId = storageSectionDO.getWarehouseId(); - List codelist = storageSectionService.list(new QueryWrapper().lambda() - .eq(StorageSection::getStorageCode, storageCode) - .eq(StorageSection::getWarehouseId, warehouseId) - .ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId()) - .eq(StorageSection::getDelFlag, 1)); - List namelist = storageSectionService.list(new QueryWrapper().lambda() - .eq(StorageSection::getStorageName, storageName) - .eq(StorageSection::getWarehouseId, warehouseId) - .ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId()) - .eq(StorageSection::getDelFlag, 1)); - if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) { - throw new ServiceException("库区编码或名称已存在"); - } return storageSectionService.update(storageSectionDO); } diff --git a/mhd-modules/mhd-system/src/main/resources/bootstrap.yml b/mhd-modules/mhd-system/src/main/resources/bootstrap.yml index 79f1a3df7..58c770a17 100644 --- a/mhd-modules/mhd-system/src/main/resources/bootstrap.yml +++ b/mhd-modules/mhd-system/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.31:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 8c722deac6fe3dce7b65ccecc1769dee29cbc935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 29 Jul 2026 16:34:59 +0800 Subject: [PATCH 30/43] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** From e12beb1e0ced8ea17dc5bf0ed602cca0a190db02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 29 Jul 2026 17:23:52 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E5=8F=9130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd-modules/mhd-system/src/main/resources/bootstrap.yml | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 91f2f8a11..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 03d48d2f4..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index ba9a45148..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 688e5ea7c..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 48d76d01e..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-modules/mhd-system/src/main/resources/bootstrap.yml b/mhd-modules/mhd-system/src/main/resources/bootstrap.yml index 58c770a17..aa660b126 100644 --- a/mhd-modules/mhd-system/src/main/resources/bootstrap.yml +++ b/mhd-modules/mhd-system/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 8b9b29dbf196b16e722ab7c9ac5a1b01802cc35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 30 Jul 2026 10:04:03 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd-user-center/src/main/resources/bootstrap.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index dd13bfba5..7b6baaea4 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -20,15 +20,15 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 From 2bd4d5bb638742573689c9d8791f180f90d1eb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 30 Jul 2026 10:08:24 +0800 Subject: [PATCH 33/43] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UserShipperApplicationService.java | 164 ++++++++++++++++-- 1 file changed, 145 insertions(+), 19 deletions(-) diff --git a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java index 98ee09ca5..5ec35096a 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java @@ -23,7 +23,10 @@ import com.mhd.common.core.enums.MessageTypeEnum; import com.mhd.common.core.enums.WebsocketTypeEnum; import com.mhd.common.core.feign.ThirdPartyServiceFeign; import com.mhd.common.core.service.jPush.AsyncJPushApplicationService; +import com.mhd.common.core.utils.AESUtil; +import com.mhd.common.core.utils.OConvertUtils; import com.mhd.common.core.utils.StringUtils; +import com.mhd.common.security.utils.password.PasswordUtil; import com.mhd.system.api.FinanceServiceFeign; import com.mhd.system.api.WlhyServiceFeign; import com.mhd.system.api.domain.UserShipperEntityFeign; @@ -361,7 +364,7 @@ public class UserShipperApplicationService { /** * 从 Excel 导入委托方 - * 模版列:登录账号、公司名称、联系人、联系电话、地址、详细地址、备注、结算币种 + * 模版列:登录账号、公司名称、联系人、联系电话、地址、详细地址、备注、结算币种、NC客户编码 */ public com.mhd.common.core.web.domain.AjaxResult importShipperFromExcel(org.springframework.web.multipart.MultipartFile file) { if (file == null || file.isEmpty()) { @@ -372,6 +375,12 @@ public class UserShipperApplicationService { org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0); int total = 0, success = 0, failed = 0; java.util.List errors = new java.util.ArrayList<>(); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser == null || loginUser.getUserPo() == null) { + return com.mhd.common.core.web.domain.AjaxResult.error("登录信息失效"); + } + Long currentOrgId = loginUser.getUserPo().getOrganizationId(); + String currentOrgName = loginUser.getUserPo().getOrganizationName(); for (int i = 1; i <= sheet.getLastRowNum(); i++) { org.apache.poi.ss.usermodel.Row row = sheet.getRow(i); if (row == null) continue; @@ -380,14 +389,21 @@ public class UserShipperApplicationService { if (org.springframework.util.StringUtils.isEmpty(companyName)) continue; total++; try { + String contactName = getCellStr(row.getCell(2)); + String contactPhone = getCellStr(row.getCell(3)); + String address = getCellStr(row.getCell(4)); + String detailedAddress = getCellStr(row.getCell(5)); + String remark = getCellStr(row.getCell(6)); + String settlementCurrency = getCellStr(row.getCell(7)); + String ncCustomerCode = getCellStr(row.getCell(8)); + // 先按公司名称查是否已存在委托方 UserShipperEntity existingShipper = findFirstByShipperEnterpriseNameAcrossOrgs(companyName); if (existingShipper != null && existingShipper.getShipperId() != null) { - // 已存在:只更新NC客户编码和org_code - appendOrganizationToExistingShipper(existingShipper, - SecurityUtils.getLoginUser().getUserPo().getOrganizationId(), - SecurityUtils.getLoginUser().getUserPo().getOrganizationName(), - userAccount, SecurityUtils.getLoginUser()); + // 已存在:按模板更新指定字段 + updateShipperFromExcel(existingShipper, userAccount, companyName, + contactName, contactPhone, address, detailedAddress, + remark, settlementCurrency, ncCustomerCode, loginUser, currentOrgId); success++; } else { UserShipperDO shipperDO = new UserShipperDO(); @@ -395,28 +411,27 @@ public class UserShipperApplicationService { shipperDO.setDataSource(2); shipperDO.setUserAccount(userAccount); shipperDO.setShipperEnterpriseName(companyName); - // 登录账号同时作为NC客户编码 - shipperDO.setCustomerNcCode(userAccount); - String contactName = getCellStr(row.getCell(2)); - String contactPhone = getCellStr(row.getCell(3)); + // NC客户编码使用模板中的独立字段,不再复用登录账号 + shipperDO.setCustomerNcCode(ncCustomerCode); // 联系人 -> user表 user_name + user_shipper表 user_name_shipper shipperDO.setUserName(contactName); shipperDO.setUserNameShipper(contactName); // 联系电话 -> user表 user_phone shipperDO.setUserPhone(contactPhone); // 地址 -> user表 user_area_name,详细地址 -> user表 user_area_address - shipperDO.setUserAreaName(getCellStr(row.getCell(4))); - shipperDO.setUserAreaAddress(getCellStr(row.getCell(5))); - shipperDO.setRemark(getCellStr(row.getCell(6))); - shipperDO.setSettlementCurrency(getCellStr(row.getCell(7))); + shipperDO.setUserAreaName(address); + shipperDO.setUserAreaAddress(detailedAddress); + shipperDO.setRemark(remark); + shipperDO.setSettlementCurrency(settlementCurrency); + // 新导入账号默认密码 Aa123456(按前端加密约定先 AES 加密) + shipperDO.setUserPassword(AESUtil.encrypt("Aa123456")); // 初始化 orgCode:记录当前组织信息和NC客户编码 com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray(); com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject(); - LoginUser loginUser = SecurityUtils.getLoginUser(); - orgItem.put("name", loginUser.getUserPo().getOrganizationName()); - orgItem.put("code", loginUser.getUserPo().getOrganizationId()); - orgItem.put("ncCustomer", userAccount); - orgItem.put("names", loginUser.getUserPo().getOrganizationId()); + orgItem.put("name", currentOrgName); + orgItem.put("code", currentOrgId); + orgItem.put("ncCustomer", ncCustomerCode); + orgItem.put("names", currentOrgId); orgCodeArray.add(orgItem); shipperDO.setOrgCode(orgCodeArray.toJSONString()); addShipper(shipperDO); @@ -441,6 +456,117 @@ public class UserShipperApplicationService { } } + /** + * 按Excel模板更新已存在的委托方(只更新模板中的字段) + */ + private void updateShipperFromExcel(UserShipperEntity existingShipper, String userAccount, + String companyName, String contactName, String contactPhone, + String address, String detailedAddress, String remark, + String settlementCurrency, String ncCustomerCode, + LoginUser loginUser, Long currentOrgId) { + Long userId = existingShipper.getUserId(); + // 从 user 主表读取当前登录账号(user_shipper 表无 user_account 字段) + UserPo existingUser = null; + String existingUserAccount = null; + if (userId != null) { + existingUser = userDomainService.selectByUserId(userId); + if (existingUser != null) { + existingUserAccount = existingUser.getUserAccount(); + } + } + if (StringUtils.isBlank(existingUserAccount) && StringUtils.isBlank(userAccount)) { + throw new ServiceException("登录账号不能为空"); + } + // 登录账号变更时校验唯一性 + if (StringUtils.isNotBlank(userAccount) && !userAccount.equals(existingUserAccount)) { + UserDO checkDO = new UserDO(); + checkDO.setUserAccount(userAccount); + checkDO.setTopOrganizationId(existingShipper.getTopOrganizationId()); + UserPo existedUser = userDomainService.findByTopOrganizationIdAndUserAccount(checkDO); + if (existedUser != null && !existedUser.getUserId().equals(userId)) { + throw new ServiceException("登录账号已存在:" + userAccount); + } + } + Date now = new Date(); + Long updateBy = loginUser.getUserPo().getUserId(); + String updateByName = loginUser.getUserPo().getUserName(); + + // 1. 更新 user_shipper 表指定字段 + // 注意:user_shipper 表没有 user_account 字段,登录账号在 user 主表维护 + UserShipperEntity shipperUpdate = new UserShipperEntity(); + shipperUpdate.setShipperId(existingShipper.getShipperId()); + shipperUpdate.setShipperEnterpriseName(companyName); + shipperUpdate.setUserNameShipper(contactName); + shipperUpdate.setUserAreaName(address); + shipperUpdate.setUserAreaAddress(detailedAddress); + shipperUpdate.setRemark(remark); + shipperUpdate.setSettlementCurrency(settlementCurrency); + shipperUpdate.setCustomerNcCode(ncCustomerCode); + shipperUpdate.setUpdateBy(updateBy); + shipperUpdate.setUpdateByName(updateByName); + shipperUpdate.setUpdateTime(now); + userShipperMapper.updateById(shipperUpdate); + + // 2. 同步更新 user 表指定字段 + if (userId != null) { + UserDO userDO = new UserDO(); + userDO.setUserId(userId); + if (StringUtils.isNotBlank(userAccount)) { + userDO.setUserAccount(userAccount); + } + userDO.setUserName(contactName); + userDO.setUserPhone(contactPhone); + userDO.setUserAreaName(address); + userDO.setUserAreaAddress(detailedAddress); + userDO.setUpdateBy(updateBy); + userDO.setUpdateByName(updateByName); + userDO.setUpdateTime(now); + // 如果现有账号没有密码,设置默认密码 Aa123456(与 addUserInfoShipper 一致的加密流程) + if (existingUser != null && StringUtils.isBlank(existingUser.getUserPassword())) { + String finalAccount = StringUtils.isNotBlank(userAccount) ? userAccount : existingUser.getUserAccount(); + String salt = OConvertUtils.randomGen(8); + String passwordEncode = PasswordUtil.encrypt(finalAccount, "Aa123456", salt); + userDO.setUserPassword(passwordEncode); + userDO.setUserSalt(salt); + } + userDomainService.updateUser(userDO); + } + + // 3. 更新 orgCode 中当前组织的 ncCustomer + String existingOrgCode = existingShipper.getOrgCode(); + com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray(); + boolean hasOrg = false; + if (StringUtils.isNotEmpty(existingOrgCode)) { + try { + orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode); + for (int i = 0; i < orgCodeArray.size(); i++) { + com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i); + if (currentOrgId != null && currentOrgId.equals(orgItem.getLong("code"))) { + orgItem.put("ncCustomer", ncCustomerCode); + hasOrg = true; + } + } + } catch (Exception e) { + log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e); + } + } + if (!hasOrg) { + com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject(); + newOrgItem.put("name", loginUser.getUserPo().getOrganizationName()); + newOrgItem.put("code", currentOrgId); + newOrgItem.put("ncCustomer", ncCustomerCode); + newOrgItem.put("names", currentOrgId); + orgCodeArray.add(newOrgItem); + } + UserShipperEntity orgCodeUpdate = new UserShipperEntity(); + orgCodeUpdate.setShipperId(existingShipper.getShipperId()); + orgCodeUpdate.setOrgCode(orgCodeArray.toJSONString()); + orgCodeUpdate.setUpdateBy(updateBy); + orgCodeUpdate.setUpdateByName(updateByName); + orgCodeUpdate.setUpdateTime(now); + userShipperMapper.updateById(orgCodeUpdate); + } + private String getCellStr(org.apache.poi.ss.usermodel.Cell cell) { if (cell == null) return null; cell.setCellType(org.apache.poi.ss.usermodel.CellType.STRING); From 69412f7293a5919c8793d2afaf05d0e34fdfa68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 30 Jul 2026 11:43:06 +0800 Subject: [PATCH 34/43] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 2 +- .../com/mhd/system/api/OmsServiceFeign.java | 2 +- .../com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../com/mhd/system/api/WmsServiceFeign.java | 2 +- .../com/mhd/system/api/YmsServiceFeign.java | 2 +- .../UserShipperApplicationService.java | 38 ++++++++++++++++++- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java index 5ec35096a..a73ad76d5 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java +++ b/mhd-user-center/src/main/java/com/mhd/user/application/service/UserShipperApplicationService.java @@ -434,7 +434,11 @@ public class UserShipperApplicationService { orgItem.put("names", currentOrgId); orgCodeArray.add(orgItem); shipperDO.setOrgCode(orgCodeArray.toJSONString()); - addShipper(shipperDO); + Map addResult = addShipper(shipperDO); + Object newUserIdObj = addResult.get("userId"); + if (newUserIdObj instanceof Long) { + assignCompanyRoleIfMissing((Long) newUserIdObj, currentOrgId); + } success++; } } catch (Exception e) { @@ -456,6 +460,36 @@ public class UserShipperApplicationService { } } + /** + * 导入时若账号没有任何角色,则补分配企业货主角色 + */ + private void assignCompanyRoleIfMissing(Long userId, Long organizationId) { + if (userId == null || organizationId == null) { + return; + } + List existingRoles = userRoleDomainService.selectRolesByUserId(userId); + if (CollUtil.isNotEmpty(existingRoles)) { + return; + } + // 按 role_code + organization_id 精确匹配角色(selectByOrganizationIdAndRoleCode 的 common_where 不含 roleCode 过滤,不适用) + RolePO rolePO = roleDomainService.selectByRoleCodeAndOrganizationId(RoleEnum.COMPANY.getCode(), organizationId); + if (rolePO == null) { + log.warn("组织{}下未找到{}角色,无法为导入用户{}分配角色", organizationId, RoleEnum.COMPANY.getCode(), userId); + return; + } + // 1. 写入 user_role 表 + UserRoleDo userRoleDo = new UserRoleDo(); + userRoleDo.setUserId(userId); + userRoleDo.setRoleId(rolePO.getRoleId()); + userRoleDomainService.addUserRole(userRoleDo); + // 2. 同步更新 user 表的 role_code / role_name + UserDO userDO = new UserDO(); + userDO.setUserId(userId); + userDO.setRoleCode(RoleEnum.COMPANY.getCode()); + userDO.setRoleName(RoleEnum.COMPANY.getName()); + userDomainService.updateUser(userDO); + } + /** * 按Excel模板更新已存在的委托方(只更新模板中的字段) */ @@ -530,6 +564,8 @@ public class UserShipperApplicationService { userDO.setUserSalt(salt); } userDomainService.updateUser(userDO); + // 如果该账号没有任何角色,补分配企业货主角色,避免登录报“账号未授权角色信息” + assignCompanyRoleIfMissing(userId, existingShipper.getOrganizationId()); } // 3. 更新 orgCode 中当前组织的 ncCustomer From 0ed45fee69b06bca081c0df7e084e0c387e1a1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 30 Jul 2026 17:21:59 +0800 Subject: [PATCH 35/43] =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=87=BA=E7=A7=9F?= =?UTF-8?q?=E7=8E=87=E8=AE=A1=E7=AE=97=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=89=A7=E8=A1=8C=E9=97=AE=E9=A2=98;?= =?UTF-8?q?=E5=8F=9130;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/Lease/LeaseApplicationService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java index 8b1631346..611298729 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/Lease/LeaseApplicationService.java @@ -270,7 +270,7 @@ public class LeaseApplicationService { * 货主租赁明细 * 定时任务:每天凌晨1点执行,计算前一天的货主租赁明细 */ - @Scheduled(cron = "0 0 1 * * ?") +// @Scheduled(cron = "0 0 1 * * ?") public void shipperLeaseDetails() { log.info("开始执行货主租赁明细定时任务"); // 计算前一天的日期,将时间设置为当天的0点0分0秒,只保留日期部分 @@ -537,7 +537,7 @@ public class LeaseApplicationService { /** * 定时任务散租推送到bms */ - @Scheduled(cron = "0 0 0 * * ?") +// @Scheduled(cron = "0 0 0 * * ?") public void ScatteredRentalSynchronization() { LeaseDO leaseDO = new LeaseDO(); leaseDO.setTime(new Date()); From f6ee1a3eee82cf1b5c6e59092f3f98aa87d0541b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 31 Jul 2026 15:47:20 +0800 Subject: [PATCH 36/43] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=8D=95=E8=80=81?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/ReserveStockInOrderMapper.java | 27 ++ .../repository/util/ExcelParseUtil.java | 48 ++++ .../vo/LegacyReserveInDetailVO.java | 77 ++++++ .../repository/vo/LegacyReserveInOrderVO.java | 93 +++++++ ...ReserveStockInOrderApplicationService.java | 258 ++++++++++++++++++ .../mapper/ReserveStockOutOrderMapper.java | 12 + .../repository/util/ExcelParseUtil.java | 52 ++++ .../vo/LegacyReserveOutDetailVO.java | 91 ++++++ .../vo/LegacyReserveOutOrderVO.java | 82 ++++++ ...eserveStockOutOrderApplicationService.java | 242 ++++++++++++++++ .../ReserveStockOutOrderApi.java | 57 ++++ .../ReserveStockInOrderApi.java | 66 +++++ .../ReserveStockInOrderMapper.xml | 43 +++ .../ReserveStockOutOrderMapper.xml | 20 ++ 14 files changed, 1168 insertions(+) create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInDetailVO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInOrderVO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutDetailVO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutOrderVO.java diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/mapper/ReserveStockInOrderMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/mapper/ReserveStockInOrderMapper.java index 412930a66..9bbc47a3d 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/mapper/ReserveStockInOrderMapper.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/mapper/ReserveStockInOrderMapper.java @@ -2,6 +2,8 @@ package com.mhd.oms.domain.reserveStockInOrder.repository.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; //import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReserveInMaterialDetailPO; +import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.domain.po.WarehousePO; import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialGoodsRulePO; import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialWarehouseControlPO; @@ -50,4 +52,29 @@ public interface ReserveStockInOrderMapper extends BaseMapper generateReserveOrderNumber1(@Param("prefix") String prefix); + + /** + * 根据货主名称查询用户(老系统数据导入用) + */ + List getShipperByName(@Param("name") String name); + + /** + * 根据仓库名称查询仓库(老系统数据导入用) + */ + List getWarehouseByName(@Param("name") String name); + + /** + * 根据仓库类型查询仓库(老系统数据导入用,1=干仓 2=冬仓) + */ + List getWarehouseByType(@Param("warehouseType") String warehouseType); + + /** + * 根据货主用户ID查询NC客户编码 + */ + String getCustomerNcCodeByUserId(@Param("id") Long id); + + /** + * 根据入库单号精确统计(导入防重用) + */ + int countByInOrderNumber(@Param("inOrderNumber") String inOrderNumber); } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/util/ExcelParseUtil.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/util/ExcelParseUtil.java index 3ae7db3e8..3d534da4f 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/util/ExcelParseUtil.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/util/ExcelParseUtil.java @@ -1,12 +1,16 @@ package com.mhd.oms.domain.reserveStockInOrder.repository.util; import com.alibaba.excel.EasyExcel; +import com.mhd.common.core.utils.StringUtils; import com.mhd.oms.domain.reserveStockInOrder.repository.listener.ReservedInventoryListener; +import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInDetailVO; +import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; import java.util.List; +import java.util.stream.Collectors; /** * Excel解析工具类 @@ -56,6 +60,50 @@ public class ExcelParseUtil { return dataList; } + /** + * 解析老系统《入库预约单列表》Excel(表头第1行,数据从第2行开始) + * @param file 上传的Excel文件 + * @return 老系统入库预约单主表行列表 + * @throws IOException 文件处理异常 + */ + public static List parseLegacyOrderExcel(MultipartFile file) throws IOException { + validateFile(file); + List dataList; + try (InputStream inputStream = file.getInputStream()) { + dataList = EasyExcel.read(inputStream) + .head(LegacyReserveInOrderVO.class) + .sheet(0) + .headRowNumber(1) + .doReadSync(); + } + // 过滤入库单号为空的无效行 + return dataList.stream() + .filter(row -> row != null && StringUtils.isNotBlank(row.getInOrderNumber())) + .collect(Collectors.toList()); + } + + /** + * 解析老系统《入库预约单明细列表》Excel(表头第1行,数据从第2行开始) + * @param file 上传的Excel文件 + * @return 老系统入库预约单明细行列表 + * @throws IOException 文件处理异常 + */ + public static List parseLegacyDetailExcel(MultipartFile file) throws IOException { + validateFile(file); + List dataList; + try (InputStream inputStream = file.getInputStream()) { + dataList = EasyExcel.read(inputStream) + .head(LegacyReserveInDetailVO.class) + .sheet(0) + .headRowNumber(1) + .doReadSync(); + } + // 过滤入库单号为空的无效行 + return dataList.stream() + .filter(row -> row != null && StringUtils.isNotBlank(row.getInOrderNumber())) + .collect(Collectors.toList()); + } + /** * 验证Excel文件合法性 */ diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInDetailVO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInDetailVO.java new file mode 100644 index 000000000..42ec1de99 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInDetailVO.java @@ -0,0 +1,77 @@ +package com.mhd.oms.domain.reserveStockInOrder.repository.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter; +import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 老系统入库预约单明细行 + * 与老系统导出Excel《入库预约单明细列表》字段一一映射(表头第1行,数据从第2行开始) + */ +@Data +public class LegacyReserveInDetailVO { + + /** + * 入库单号(必填,与主表关联键) + */ + @ExcelProperty(index = 0, value = "入库单号") + private String inOrderNumber; + + /** + * 计划数量(必填) + */ + @ExcelProperty(index = 1, value = "计划数量", converter = StringToBigDecimalConverter.class) + private BigDecimal quantity; + + /** + * 物料名称(必填,用于匹配新系统物料基础信息) + */ + @ExcelProperty(index = 2, value = "物料名称") + private String materialName; + + /** + * 单位名称 + */ + @ExcelProperty(index = 3, value = "单位名称") + private String unitName; + + /** + * 创建时间(老系统) + */ + @ExcelProperty(index = 4, value = "创建时间", converter = StringToDateConverter.class) + private Date createTime; + + /** + * 修改时间(老系统) + */ + @ExcelProperty(index = 5, value = "修改时间", converter = StringToDateConverter.class) + private Date updateTime; + + /** + * 创建人名称(老系统) + */ + @ExcelProperty(index = 6, value = "创建人名称") + private String createByName; + + /** + * 修改人名称(老系统) + */ + @ExcelProperty(index = 7, value = "修改人名称") + private String updateByName; + + /** + * 总净重(KG) + */ + @ExcelProperty(index = 8, value = "总净重(KG)", converter = StringToBigDecimalConverter.class) + private BigDecimal totalNetWeight; + + /** + * 备注 + */ + @ExcelProperty(index = 9, value = "备注") + private String remark; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInOrderVO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInOrderVO.java new file mode 100644 index 000000000..4bbbca38d --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/repository/vo/LegacyReserveInOrderVO.java @@ -0,0 +1,93 @@ +package com.mhd.oms.domain.reserveStockInOrder.repository.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter; +import lombok.Data; + +import java.util.Date; + +/** + * 老系统入库预约单主表行 + * 与老系统导出Excel《入库预约单列表》字段一一映射(表头第1行,数据从第2行开始) + */ +@Data +public class LegacyReserveInOrderVO { + + /** + * 入库单号(必填,与明细表关联键) + */ + @ExcelProperty(index = 0, value = "入库单号") + private String inOrderNumber; + + /** + * 入仓时间 + */ + @ExcelProperty(index = 1, value = "入仓时间", converter = StringToDateConverter.class) + private Date warehouseDate; + + /** + * 制单人 + */ + @ExcelProperty(index = 2, value = "制单人") + private String documentCreator; + + /** + * 制单时间 + */ + @ExcelProperty(index = 3, value = "制单时间", converter = StringToDateConverter.class) + private Date documentDate; + + /** + * 货主名称(必填,用于匹配新系统用户) + */ + @ExcelProperty(index = 4, value = "货主名称") + private String shipperName; + + /** + * 备注 + */ + @ExcelProperty(index = 5, value = "备注") + private String remark; + + /** + * 创建时间(老系统) + */ + @ExcelProperty(index = 6, value = "创建时间", converter = StringToDateConverter.class) + private Date createTime; + + /** + * 修改时间(老系统) + */ + @ExcelProperty(index = 7, value = "修改时间", converter = StringToDateConverter.class) + private Date updateTime; + + /** + * 创建人名称(老系统) + */ + @ExcelProperty(index = 8, value = "创建人名称") + private String createByName; + + /** + * 修改人名称(老系统) + */ + @ExcelProperty(index = 9, value = "修改人名称") + private String updateByName; + + /** + * 老系统仓库id(跨系统id不可用,仅做占位) + */ + @ExcelProperty(index = 10, value = "仓库id") + private String oldWarehouseId; + + /** + * 仓库名称(用于匹配新系统仓库) + */ + @ExcelProperty(index = 11, value = "仓库名称") + private String warehouseName; + + /** + * 仓库类型(1=干仓 2=冬仓,用于仓库名称匹配兜底) + */ + @ExcelProperty(index = 12, value = "仓库类型") + private String warehouseType; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java index a33be77fa..e0c259eff 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java @@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.domain.po.WarehousePO; import com.mhd.common.core.enums.DictCode; import com.mhd.common.core.exception.ServiceException; import com.mhd.common.core.utils.OrderSequence; @@ -16,14 +17,19 @@ import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialB import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper; import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; import com.mhd.oms.domain.reserveInMaterialDetail.entity.ReserveInMaterialDetail; +import com.mhd.oms.domain.reserveInMaterialDetail.repository.facade.IReserveInMaterialDetailService; import com.mhd.oms.domain.reserveInMaterialDetail.repository.po.ReserveInMaterialDetailPO; import com.mhd.oms.domain.reserveInMaterialDetail.repository.todo.ReserveInMaterialDetailDO; import com.mhd.oms.domain.reserveStockInOrder.entity.ReserveStockInOrder; +import com.mhd.oms.domain.reserveStockInOrder.repository.facade.IReserveStockInOrderService; +import com.mhd.oms.domain.reserveStockInOrder.repository.listener.ValidationException; import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper; import com.mhd.oms.domain.reserveStockInOrder.repository.po.ReserveStockInOrderPO; import com.mhd.oms.domain.reserveStockInOrder.repository.todo.ReserveStockInOrderDO; import com.mhd.oms.domain.reserveStockInOrder.repository.todo.ReserveStockInOrderDTO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.InAndOutListVo; +import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInDetailVO; +import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.UserServiceFeign; @@ -38,6 +44,7 @@ import org.apache.poi.ss.usermodel.DateUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.text.ParseException; @@ -70,6 +77,10 @@ public class ReserveStockInOrderApplicationService { private WmsServiceFeign wmsServiceFeign; @Autowired private ReservationStockInOrderMapper reservationStockInOrderMapper; + @Autowired + private IReserveStockInOrderService stockInOrderService; + @Autowired + private IReserveInMaterialDetailService materialDetailService; // @Autowired // private IMaterialBaseInfoService materialBaseInfoService; @@ -2039,6 +2050,253 @@ public class ReserveStockInOrderApplicationService { insert(reserveStockInOrder); } + /** + * 老系统入库预约单数据导入(主表+明细两个Excel,多单批量导入) + * 老系统的id类字段不可用,货主、仓库、物料均按名称匹配新系统基础数据 + */ + @Transactional(rollbackFor = Exception.class) + public Map importLegacyData(List orderList, List detailList) { + if (orderList == null || orderList.isEmpty()) { + throw new ValidationException("入库预约单列表文件中没有有效数据"); + } + if (detailList == null || detailList.isEmpty()) { + throw new ValidationException("入库预约单明细列表文件中没有有效数据"); + } + + // 明细按入库单号分组 + Map> detailGroupMap = new LinkedHashMap<>(); + for (LegacyReserveInDetailVO detailRow : detailList) { + detailGroupMap.computeIfAbsent(detailRow.getInOrderNumber().trim(), k -> new ArrayList<>()).add(detailRow); + } + + List errorList = new ArrayList<>(); + // 名称匹配结果缓存,避免重复查库 + Map shipperCache = new HashMap<>(); + Map warehouseCache = new HashMap<>(); + // 仓库类型 -> 仓库 缓存(用于名称匹配失败时的兜底) + Map warehouseTypeCache = new HashMap<>(); + Map materialCache = new HashMap<>(); + + Set orderNumberSet = new HashSet<>(); + List stockInOrderList = new ArrayList<>(); + int lotIndex = 1; + for (LegacyReserveInOrderVO orderRow : orderList) { + String orderNumber = orderRow.getInOrderNumber().trim(); + if (!orderNumberSet.add(orderNumber)) { + errorList.add("入库单号【" + orderNumber + "】在主表文件中重复"); + continue; + } + if (reserveStockInOrderMapper.countByInOrderNumber(orderNumber) > 0) { + errorList.add("入库单号【" + orderNumber + "】在系统中已存在,请勿重复导入"); + continue; + } + // 按货主名称匹配用户(查不到则用Excel中的名称兜底,不阻断导入) + UserPo shipper = null; + String shipperName = StringUtils.trimToEmpty(orderRow.getShipperName()); + if (StringUtils.isBlank(shipperName)) { + errorList.add("入库单号【" + orderNumber + "】货主名称为空"); + } else { + shipper = shipperCache.get(shipperName); + if (shipper == null) { + List userPoList = reserveStockInOrderMapper.getShipperByName(shipperName); + if (userPoList == null || userPoList.isEmpty()) { + errorList.add("入库单号【" + orderNumber + "】货主【" + shipperName + "】未找到对应用户,将仅以名称导入"); + } else { + shipper = userPoList.get(0); + shipperCache.put(shipperName, shipper); + } + } + } + + // 按仓库名称匹配仓库(查不到则按仓库类型兜底,再查不到则用名称兜底,不阻断导入) + WarehousePO warehouse = null; + String warehouseName = StringUtils.trimToEmpty(orderRow.getWarehouseName()); + if (StringUtils.isNotBlank(warehouseName)) { + warehouse = warehouseCache.get(warehouseName); + if (warehouse == null) { + List warehousePOList = reserveStockInOrderMapper.getWarehouseByName(warehouseName); + if (warehousePOList == null || warehousePOList.isEmpty()) { + // 名称匹配失败,尝试按仓库类型兜底匹配 + String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType()); + if (StringUtils.isNotBlank(warehouseType)) { + if (warehouseTypeCache.containsKey(warehouseType)) { + warehouse = warehouseTypeCache.get(warehouseType); + } else { + List typeList = reserveStockInOrderMapper.getWarehouseByType(warehouseType); + if (typeList != null && !typeList.isEmpty()) { + warehouse = typeList.get(0); + warehouseTypeCache.put(warehouseType, warehouse); + } else { + warehouseTypeCache.put(warehouseType, null); + } + } + } + if (warehouse == null) { + errorList.add("入库单号【" + orderNumber + "】仓库【" + warehouseName + "】未找到对应仓库,将仅以名称导入"); + } + } else { + warehouse = warehousePOList.get(0); + warehouseCache.put(warehouseName, warehouse); + } + } + } + + // 明细匹配 + List detailRows = detailGroupMap.get(orderNumber); + if (detailRows == null || detailRows.isEmpty()) { + errorList.add("入库单号【" + orderNumber + "】在明细文件中没有明细数据"); + continue; + } + List materialDetailList = new ArrayList<>(); + for (LegacyReserveInDetailVO detailRow : detailRows) { + String materialName = StringUtils.trimToEmpty(detailRow.getMaterialName()); + if (StringUtils.isBlank(materialName)) { + errorList.add("入库单号【" + orderNumber + "】存在物料名称为空的明细行"); + continue; + } + // 按物料名称匹配物料基础信息(查不到则用Excel中的名称兜底,不阻断导入) + MaterialBaseInfoPO materialBaseInfoPO = materialCache.get(materialName); + if (materialBaseInfoPO == null) { + List materialBaseInfoPOS = reserveStockInOrderMapper.getByName(materialName); + if (materialBaseInfoPOS == null || materialBaseInfoPOS.isEmpty()) { + errorList.add("入库单号【" + orderNumber + "】物料【" + materialName + "】未找到对应物料,将仅以名称导入"); + } else { + materialBaseInfoPO = materialBaseInfoPOS.get(0); + materialCache.put(materialName, materialBaseInfoPO); + } + } + ReserveInMaterialDetailDO materialDetail = new ReserveInMaterialDetailDO(); + if (materialBaseInfoPO != null) { + materialDetail.setMaterialBaseInfoId(materialBaseInfoPO.getMaterialBaseInfoId()); + materialDetail.setMaterialCode(materialBaseInfoPO.getMaterialCode()); + materialDetail.setUnitCode(materialBaseInfoPO.getUnitCode()); + materialDetail.setUnitName(StringUtils.isNotBlank(materialBaseInfoPO.getUnitName()) ? materialBaseInfoPO.getUnitName() : detailRow.getUnitName()); + } else { + // 未匹配到物料基础信息,仅以Excel中的名称作为物料名称 + materialDetail.setUnitName(detailRow.getUnitName()); + } + materialDetail.setMaterialName(materialName); + materialDetail.setReserveMaterialName(materialName); + materialDetail.setQuantity(detailRow.getQuantity()); + materialDetail.setReserveQuantity(detailRow.getQuantity()); + materialDetail.setTotalNetWeight(detailRow.getTotalNetWeight()); + materialDetail.setTotalGrossWeight(detailRow.getTotalNetWeight()); + materialDetail.setRemark(detailRow.getRemark()); + materialDetail.setContractFee(BigDecimal.ZERO); + materialDetail.setLotNo(generateDateSerialNumber() + "-" + lotIndex); + lotIndex++; +// if (shipper != null) { + materialDetail.setOrganizationId(2841L); + materialDetail.setOrganizationName("仓码"); + materialDetail.setTopOrganizationId(2827L); +// } + // 创建人/修改人名称取老系统Excel中的值,不使用当前登录人 + materialDetail.setCreateTime(detailRow.getCreateTime() != null ? detailRow.getCreateTime() : new Date()); + materialDetail.setCreateByName(detailRow.getCreateByName()); + materialDetail.setUpdateTime(detailRow.getUpdateTime()); + materialDetail.setUpdateByName(detailRow.getUpdateByName()); + materialDetailList.add(materialDetail); + } + + // 组装入库预约单 + ReserveStockInOrderDO stockInOrderDO = new ReserveStockInOrderDO(); + stockInOrderDO.setInOrderNumber(orderNumber); + stockInOrderDO.setBusinessOrderNo(generateDateTimeWithRandom()); + // 老系统历史数据,状态直接置为最终状态:已入库、审核通过、已完成 + stockInOrderDO.setStatus(5); + stockInOrderDO.setAuditStatus(3); + stockInOrderDO.setIssueStatus(3); + stockInOrderDO.setOrderStatus("已确认"); + stockInOrderDO.setStorageTime(orderRow.getWarehouseDate()); + stockInOrderDO.setNeedTransport(0); + stockInOrderDO.setNeedCustomsDeclaration(0); + stockInOrderDO.setWarehouseDate(orderRow.getWarehouseDate()); + stockInOrderDO.setExpectTime(orderRow.getWarehouseDate() != null ? orderRow.getWarehouseDate() : new Date()); + stockInOrderDO.setDocumentDate(orderRow.getDocumentDate() != null ? orderRow.getDocumentDate() : new Date()); + stockInOrderDO.setDocumentCreator(orderRow.getDocumentCreator()); + stockInOrderDO.setRemark(orderRow.getRemark()); + if (shipper != null) { + stockInOrderDO.setShipperId(shipper.getUserId()); + stockInOrderDO.setShipperName(shipper.getUserName()); + stockInOrderDO.setCustomerId(shipper.getUserId()); + stockInOrderDO.setCustomerName(shipper.getUserName()); + stockInOrderDO.setSalesmanId(String.valueOf(shipper.getUserId())); + stockInOrderDO.setSalesmanName(shipper.getUserName()); + stockInOrderDO.setCustomerCode(reserveStockInOrderMapper.getCustomerNcCodeByUserId(shipper.getUserId())); +// stockInOrderDO.setOrganizationId(shipper.getOrganizationId()); +// stockInOrderDO.setOrganizationName(shipper.getOrganizationName()); +// stockInOrderDO.setTopOrganizationId(shipper.getTopOrganizationId()); + } else { + // 货主未匹配到,仅以Excel中的名称作为名称字段,id/组织留空 + stockInOrderDO.setShipperName(shipperName); + stockInOrderDO.setCustomerName(shipperName); + stockInOrderDO.setSalesmanName(shipperName); + } + stockInOrderDO.setOrganizationId(2841L); + stockInOrderDO.setOrganizationName("仓码"); + stockInOrderDO.setTopOrganizationId(2827L); + if (warehouse != null) { + stockInOrderDO.setWarehouseId(warehouse.getWarehouseId()); + stockInOrderDO.setWarehouseCode(warehouse.getWarehouseCode()); + stockInOrderDO.setWarehouseName(warehouse.getWarehouseName()); + } else if (StringUtils.isNotBlank(warehouseName)) { + // 仓库未匹配到,仅以Excel中的名称作为仓库名称,id/编码留空 + stockInOrderDO.setWarehouseName(warehouseName); + } + // 创建人/修改人名称取老系统Excel中的值,不使用当前登录人 + stockInOrderDO.setCreateTime(orderRow.getCreateTime() != null ? orderRow.getCreateTime() : new Date()); + stockInOrderDO.setCreateByName(orderRow.getCreateByName()); + stockInOrderDO.setUpdateTime(orderRow.getUpdateTime()); + stockInOrderDO.setUpdateByName(orderRow.getUpdateByName()); + stockInOrderDO.setMaterialDetailList(materialDetailList); + stockInOrderList.add(stockInOrderDO); + } + + // 明细文件中存在但主表文件中不存在的单号 + for (String detailOrderNumber : detailGroupMap.keySet()) { + if (!orderNumberSet.contains(detailOrderNumber)) { + errorList.add("明细文件中入库单号【" + detailOrderNumber + "】在主表文件中不存在"); + } + } + + // 逐单入库(即使有未匹配到基础数据的警告也不阻断,错误信息随结果返回) + // 直接走 MyBatis-Plus 入库,绕过领域服务/应用服务层的参数补全逻辑,避免货主/物料未匹配等场景报错 + int detailCount = 0; + for (ReserveStockInOrderDO stockInOrderDO : stockInOrderList) { + // 主表:DO -> 实体 -> save + ReserveStockInOrder stockInOrder = new ReserveStockInOrder(); + BeanUtils.copyProperties(stockInOrderDO, stockInOrder); + stockInOrder.setMaterialQuantity(stockInOrderDO.getMaterialDetailList().size()); + BigDecimal totalQuantity = stockInOrderDO.getMaterialDetailList().stream() + .map(ReserveInMaterialDetailDO::getQuantity).filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + stockInOrder.setQuantity(totalQuantity); + stockInOrder.setReserveQuantity(totalQuantity); + stockInOrderService.save(stockInOrder); + + // 明细:DO -> 实体 -> saveBatch + List detailEntities = new ArrayList<>(); + for (ReserveInMaterialDetailDO detailDO : stockInOrderDO.getMaterialDetailList()) { + ReserveInMaterialDetail detail = new ReserveInMaterialDetail(); + BeanUtils.copyProperties(detailDO, detail); + detail.setInOrderNumber(stockInOrderDO.getInOrderNumber()); + detail.setLevel(1); + detailEntities.add(detail); + } + if (!detailEntities.isEmpty()) { + materialDetailService.saveBatch(detailEntities); + } + detailCount += detailEntities.size(); + } + Map result = new HashMap<>(); + result.put("orderCount", stockInOrderList.size()); + result.put("detailCount", detailCount); + if (!errorList.isEmpty()) { + result.put("warnings", errorList); + } + return result; + } + public static String generateDateTimeWithRandom() { // 1. 获取当前时间,格式化:yyMMddHHmmss LocalDateTime now = LocalDateTime.now(); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/mapper/ReserveStockOutOrderMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/mapper/ReserveStockOutOrderMapper.java index ed8bc8f50..128716b68 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/mapper/ReserveStockOutOrderMapper.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/mapper/ReserveStockOutOrderMapper.java @@ -2,6 +2,7 @@ package com.mhd.oms.domain.reserveStockOutOrder.repository.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; //import com.mhd.oms.domain.reservationOutMaterialDetail.repository.po.ReserveOutMaterialDetailPO; +import com.mhd.common.core.domain.po.WarehousePO; import com.mhd.oms.domain.reserveOutMaterialDetail.repository.po.ReserveOutMaterialDetailPO; import com.mhd.oms.domain.reserveStockOutOrder.entity.ReserveStockOutOrder; import com.mhd.oms.domain.reserveStockOutOrder.repository.po.ReserveStockOutOrderPO; @@ -38,4 +39,15 @@ public interface ReserveStockOutOrderMapper extends BaseMapper generateReserveOrderNumber1(@Param("prefix") String prefix); + + /** + * 老系统数据导入:根据出库单号精确统计(防重) + */ + int countByOutOrderNumber(@Param("outOrderNumber") String outOrderNumber); + + /** + * 老系统数据导入:根据仓库类型查询仓库 + * @param warehouseType 仓库类型编码(如 "1"/"2") + */ + List getWarehouseByType(@Param("warehouseType") String warehouseType); } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/util/ExcelParseUtil.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/util/ExcelParseUtil.java index 693b30aba..7deeddc83 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/util/ExcelParseUtil.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/util/ExcelParseUtil.java @@ -1,7 +1,10 @@ package com.mhd.oms.domain.reserveStockOutOrder.repository.util; import com.alibaba.excel.EasyExcel; +import com.mhd.common.core.utils.StringUtils; import com.mhd.oms.domain.reserveStockOutOrder.repository.listener.ReservedInventoryOutListener; +import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.LegacyReserveOutDetailVO; +import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.LegacyReserveOutOrderVO; import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.ReservedInventoryOut; import org.springframework.web.multipart.MultipartFile; @@ -55,6 +58,55 @@ public class ExcelParseUtil { return dataList; } + /** + * 解析老系统《出库预约单列表》Excel(表头第1行,数据从第2行开始) + */ + public static List parseLegacyOrderExcel(MultipartFile file) throws IOException { + validateFile(file); + List dataList; + try (InputStream inputStream = file.getInputStream()) { + dataList = EasyExcel.read(inputStream) + .head(LegacyReserveOutOrderVO.class) + .sheet(0) + .headRowNumber(1) + .doReadSync(); + } + // 过滤出库单号为空的无效行 + return dataList.stream() + .filter(row -> row != null && StringUtils.isNotBlank(row.getOutOrderNumber())) + .collect(java.util.stream.Collectors.toList()); + } + + /** + * 解析老系统《出库预约单明细列表》Excel(表头第1行,数据从第2行开始) + * 物料名称取物料名称1和物料名称2中有值的那一个 + */ + public static List parseLegacyDetailExcel(MultipartFile file) throws IOException { + validateFile(file); + List dataList; + try (InputStream inputStream = file.getInputStream()) { + dataList = EasyExcel.read(inputStream) + .head(LegacyReserveOutDetailVO.class) + .sheet(0) + .headRowNumber(1) + .doReadSync(); + } + // 过滤出库单号为空的无效行,同时把 materialName1/materialName2 中有值的赋给 materialName + return dataList.stream() + .filter(row -> row != null && StringUtils.isNotBlank(row.getOutOrderNumber())) + .map(row -> { + if (StringUtils.isBlank(row.getMaterialName())) { + if (StringUtils.isNotBlank(row.getMaterialName1())) { + row.setMaterialName(row.getMaterialName1()); + } else if (StringUtils.isNotBlank(row.getMaterialName2())) { + row.setMaterialName(row.getMaterialName2()); + } + } + return row; + }) + .collect(java.util.stream.Collectors.toList()); + } + /** * 验证Excel文件合法性 */ diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutDetailVO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutDetailVO.java new file mode 100644 index 000000000..84dc95dff --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutDetailVO.java @@ -0,0 +1,91 @@ +package com.mhd.oms.domain.reserveStockOutOrder.repository.vo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToBigDecimalConverter; +import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 老系统出库预约单明细行 + * 与老系统导出Excel《出库预约单明细列表》字段一一映射(表头第1行,数据从第2行开始) + * 物料名称取物料名称1和物料名称2中有值的那一个 + */ +@Data +public class LegacyReserveOutDetailVO { + + /** + * 老系统明细id(跨系统id不可用,仅做占位) + */ + @ExcelProperty(index = 0, value = "id") + private String oldDetailId; + + /** + * 出库单号(必填,关联主表) + */ + @ExcelProperty(index = 1, value = "出库单号") + private String outOrderNumber; + + /** + * 出库数量 + */ + @ExcelProperty(index = 2, value = "出库数量", converter = StringToBigDecimalConverter.class) + private BigDecimal quantity; + + /** + * 入库单号(老系统关联的入库单号,保留到备注或来源单号字段) + */ + @ExcelProperty(index = 3, value = "入库单号") + private String inOrderNumber; + + /** + * 物料名称1 + */ + @ExcelProperty(index = 4, value = "物料名称1") + private String materialName1; + + /** + * 物料名称2 + */ + @ExcelProperty(index = 5, value = "物料名称2") + private String materialName2; + + /** + * 重量(KG) + */ + @ExcelProperty(index = 6, value = "重量", converter = StringToBigDecimalConverter.class) + private BigDecimal weight; + + /** + * 创建时间(老系统) + */ + @ExcelProperty(index = 7, value = "创建时间", converter = StringToDateConverter.class) + private Date createTime; + + /** + * 修改时间(老系统) + */ + @ExcelProperty(index = 8, value = "修改时间", converter = StringToDateConverter.class) + private Date updateTime; + + /** + * 创建人名称(老系统) + */ + @ExcelProperty(index = 9, value = "创建人名称") + private String createByName; + + /** + * 修改人名称(老系统) + */ + @ExcelProperty(index = 10, value = "修改人名称") + private String updateByName; + + /** + * 取物料名称1和物料名称2中有值的那一个(不映射Excel列,运行时计算) + */ + @ExcelIgnore + private String materialName; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutOrderVO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutOrderVO.java new file mode 100644 index 000000000..59adf9bca --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/repository/vo/LegacyReserveOutOrderVO.java @@ -0,0 +1,82 @@ +package com.mhd.oms.domain.reserveStockOutOrder.repository.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.mhd.oms.domain.reserveStockInOrder.repository.util.StringToDateConverter; +import lombok.Data; + +import java.util.Date; + +/** + * 老系统出库预约单主表行 + * 与老系统导出Excel《出库预约单列表》字段一一映射(表头第1行,数据从第2行开始) + */ +@Data +public class LegacyReserveOutOrderVO { + + /** + * 出库单号(必填,与明细表关联键) + */ + @ExcelProperty(index = 0, value = "出库单号") + private String outOrderNumber; + + /** + * 出库时间 + */ + @ExcelProperty(index = 1, value = "出库时间", converter = StringToDateConverter.class) + private Date outboundDate; + + /** + * 制单人名称 + */ + @ExcelProperty(index = 2, value = "制单人名称") + private String documentCreator; + + /** + * 制单时间 + */ + @ExcelProperty(index = 3, value = "制单时间", converter = StringToDateConverter.class) + private Date documentDate; + + /** + * 货主名称(必填,用于匹配新系统用户) + */ + @ExcelProperty(index = 4, value = "货主名称") + private String shipperName; + + /** + * 备注 + */ + @ExcelProperty(index = 5, value = "备注") + private String remark; + + /** + * 创建时间(老系统) + */ + @ExcelProperty(index = 6, value = "创建时间", converter = StringToDateConverter.class) + private Date createTime; + + /** + * 修改时间(老系统) + */ + @ExcelProperty(index = 7, value = "修改时间", converter = StringToDateConverter.class) + private Date updateTime; + + /** + * 创建人名称(老系统) + */ + @ExcelProperty(index = 8, value = "创建人名称") + private String createByName; + + /** + * 修改人名称(老系统) + */ + @ExcelProperty(index = 9, value = "修改人名称") + private String updateByName; + + /** + * 仓库类型:1-干仓 2-冬仓 + * 用于按类型匹配新系统仓库(老系统没有仓库名称,只有仓库类型) + */ + @ExcelProperty(index = 10, value = "仓库类型") + private String warehouseType; +} diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java index 13f113cda..3d69b9552 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java @@ -5,7 +5,9 @@ import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.mhd.common.core.constant.SnowFlakeConstants; import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.domain.po.WarehousePO; import com.mhd.common.core.enums.DictCode; import com.mhd.common.core.exception.ServiceException; import com.mhd.common.core.utils.StringUtils; @@ -23,14 +25,20 @@ import com.mhd.oms.domain.reserveInMaterialDetail.repository.todo.ReserveInMater import com.mhd.oms.domain.reserveOutMaterialDetail.repository.facade.IReserveOutMaterialDetailService; import com.mhd.oms.domain.reserveOutMaterialDetail.repository.po.ReserveOutMaterialDetailPO; import com.mhd.oms.domain.reserveOutMaterialDetail.repository.todo.ReserveOutMaterialDetailDO; +import com.mhd.oms.domain.reserveStockInOrder.repository.listener.ValidationException; import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper; import com.mhd.oms.domain.reserveStockInOrder.repository.todo.ReserveStockInOrderDO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory; +import com.mhd.oms.domain.reserveStockOutOrder.entity.ReserveStockOutOrder; import com.mhd.oms.domain.reserveStockOutOrder.repository.facade.IReserveStockOutOrderService; +import com.mhd.oms.domain.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper; import com.mhd.oms.domain.reserveStockOutOrder.repository.po.ReserveStockOutOrderPO; import com.mhd.oms.domain.reserveStockOutOrder.repository.todo.ReserveStockOutOrderDO; import com.mhd.oms.domain.reserveStockOutOrder.repository.todo.ReserveStockOutOrderDTO; +import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.LegacyReserveOutDetailVO; +import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.LegacyReserveOutOrderVO; import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.ReservedInventoryOut; +import com.mhd.oms.domain.reserveOutMaterialDetail.entity.ReserveOutMaterialDetail; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.UserServiceFeign; import com.mhd.system.api.domain.*; @@ -38,6 +46,7 @@ import com.mhd.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.lang.reflect.Field; @@ -68,6 +77,8 @@ public class ReserveStockOutOrderApplicationService { @Autowired private ReserveStockInOrderMapper reserveStockInOrderMapper; @Autowired + private ReserveStockOutOrderMapper reserveStockOutOrderMapper; + @Autowired private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper; @Autowired private UserServiceFeign userServiceFeign; @@ -1112,6 +1123,237 @@ public class ReserveStockOutOrderApplicationService { return stockOutOrderDomainService.queryOutStockNoticePrintDetail(stockOutOrderDO); } + /** + * 老系统出库预约单数据导入(主表+明细两个Excel,多单批量导入) + * 老系统的id类字段不可用,货主按名称匹配新系统用户,仓库按仓库类型(1=干仓 2=冬仓)匹配新系统仓库,物料按名称匹配 + * 明细表物料名称取物料名称1和物料名称2中有值的那一个 + */ + @Transactional(rollbackFor = Exception.class) + public Map importLegacyData(List orderList, List detailList) { + if (orderList == null || orderList.isEmpty()) { + throw new ValidationException("出库预约单列表文件中没有有效数据"); + } + if (detailList == null || detailList.isEmpty()) { + throw new ValidationException("出库预约单明细列表文件中没有有效数据"); + } + + // 明细按出库单号分组 + Map> detailGroupMap = new LinkedHashMap<>(); + for (LegacyReserveOutDetailVO detailRow : detailList) { + detailGroupMap.computeIfAbsent(detailRow.getOutOrderNumber().trim(), k -> new ArrayList<>()).add(detailRow); + } + + List errorList = new ArrayList<>(); + // 名称匹配结果缓存,避免重复查库 + Map shipperCache = new HashMap<>(); + // 仓库类型 -> 仓库 缓存(老系统只有仓库类型,没有仓库名称) + Map warehouseTypeCache = new HashMap<>(); + Map materialCache = new HashMap<>(); + + Set orderNumberSet = new HashSet<>(); + List stockOutOrderList = new ArrayList<>(); + int lotIndex = 1; + for (LegacyReserveOutOrderVO orderRow : orderList) { + String orderNumber = orderRow.getOutOrderNumber().trim(); + if (!orderNumberSet.add(orderNumber)) { + errorList.add("出库单号【" + orderNumber + "】在主表文件中重复"); + continue; + } + if (reserveStockOutOrderMapper.countByOutOrderNumber(orderNumber) > 0) { + errorList.add("出库单号【" + orderNumber + "】在系统中已存在,请勿重复导入"); + continue; + } + + // 按货主名称匹配用户(查不到则用Excel中的名称兜底,不阻断导入) + UserPo shipper = null; + String shipperName = StringUtils.trimToEmpty(orderRow.getShipperName()); + if (StringUtils.isBlank(shipperName)) { + errorList.add("出库单号【" + orderNumber + "】货主名称为空"); + } else { + shipper = shipperCache.get(shipperName); + if (shipper == null) { + List userPoList = reserveStockInOrderMapper.getShipperByName(shipperName); + if (userPoList == null || userPoList.isEmpty()) { + errorList.add("出库单号【" + orderNumber + "】货主【" + shipperName + "】未找到对应用户,将仅以名称导入"); + } else { + shipper = userPoList.get(0); + shipperCache.put(shipperName, shipper); + } + } + } + + // 按仓库类型匹配仓库(老系统仓库类型 1=干仓 2=冬仓,查不到则用类型名兜底) + WarehousePO warehouse = null; + String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType()); + if (StringUtils.isNotBlank(warehouseType)) { + warehouse = warehouseTypeCache.get(warehouseType); + if (warehouse == null) { + List warehousePOList = reserveStockOutOrderMapper.getWarehouseByType(warehouseType); + if (warehousePOList == null || warehousePOList.isEmpty()) { + String fallbackName = "1".equals(warehouseType) ? "干仓" : ("2".equals(warehouseType) ? "冻仓" : ""); + errorList.add("出库单号【" + orderNumber + "】仓库类型【" + warehouseType + "】未找到对应仓库,将仅以名称导入"); + warehouseTypeCache.put(warehouseType, null); + warehouse = null; + } else { + warehouse = warehousePOList.get(0); + warehouseTypeCache.put(warehouseType, warehouse); + } + } + } + + // 明细匹配 + List detailRows = detailGroupMap.get(orderNumber); + if (detailRows == null || detailRows.isEmpty()) { + errorList.add("出库单号【" + orderNumber + "】在明细文件中没有明细数据"); + continue; + } + List materialDetailList = new ArrayList<>(); + for (LegacyReserveOutDetailVO detailRow : detailRows) { + String materialName = StringUtils.trimToEmpty(detailRow.getMaterialName()); + if (StringUtils.isBlank(materialName)) { + errorList.add("出库单号【" + orderNumber + "】存在物料名称为空的明细行"); + continue; + } + // 按物料名称匹配物料基础信息(查不到则用Excel中的名称兜底,不阻断导入) + MaterialBaseInfoPO materialBaseInfoPO = materialCache.get(materialName); + if (materialBaseInfoPO == null) { + List materialBaseInfoPOS = reserveStockInOrderMapper.getByName(materialName); + if (materialBaseInfoPOS == null || materialBaseInfoPOS.isEmpty()) { + errorList.add("出库单号【" + orderNumber + "】物料【" + materialName + "】未找到对应物料,将仅以名称导入"); + } else { + materialBaseInfoPO = materialBaseInfoPOS.get(0); + materialCache.put(materialName, materialBaseInfoPO); + } + } + ReserveOutMaterialDetailDO materialDetail = new ReserveOutMaterialDetailDO(); + if (materialBaseInfoPO != null) { + materialDetail.setMaterialBaseInfoId(materialBaseInfoPO.getMaterialBaseInfoId()); + materialDetail.setMaterialCode(materialBaseInfoPO.getMaterialCode()); + materialDetail.setUnitCode(materialBaseInfoPO.getUnitCode()); + materialDetail.setUnitName(materialBaseInfoPO.getUnitName()); + } + materialDetail.setMaterialName(materialName); + materialDetail.setReserveMaterialName(materialName); + materialDetail.setQuantity(detailRow.getQuantity()); + materialDetail.setOutboundQuantity(detailRow.getQuantity()); + materialDetail.setTotalNetWeight(detailRow.getWeight()); + materialDetail.setTotalGrossWeight(detailRow.getWeight()); + // 保留老系统关联的入库单号到备注 + if (StringUtils.isNotBlank(detailRow.getInOrderNumber())) { + materialDetail.setRemark("老系统入库单号:" + detailRow.getInOrderNumber()); + } + materialDetail.setContractFee(BigDecimal.ZERO); + materialDetail.setLotNo(generateDateSerialNumber() + "-" + lotIndex); + lotIndex++; + // 组织字段硬编码(与入库导入保持一致) + materialDetail.setOrganizationId(2841L); + materialDetail.setOrganizationName("仓码"); + materialDetail.setTopOrganizationId(2827L); + // 创建人/修改人名称取老系统Excel中的值,不使用当前登录人 + materialDetail.setCreateTime(detailRow.getCreateTime() != null ? detailRow.getCreateTime() : new Date()); + materialDetail.setCreateByName(detailRow.getCreateByName()); + materialDetail.setUpdateTime(detailRow.getUpdateTime()); + materialDetail.setUpdateByName(detailRow.getUpdateByName()); + materialDetail.setUniqueId(idGenerator.snowflakeId(SnowFlakeConstants.wmsId)); + materialDetailList.add(materialDetail); + } + + // 组装出库预约单 + ReserveStockOutOrderDO stockOutOrderDO = new ReserveStockOutOrderDO(); + stockOutOrderDO.setOutOrderNumber(orderNumber); + stockOutOrderDO.setBusinessOrderNo(generateDateTimeWithRandom()); + // 老系统历史数据,状态直接置为最终状态:已出库、审核通过 + stockOutOrderDO.setStatus(9); + stockOutOrderDO.setAuditStatus(3); + stockOutOrderDO.setIssueStatus(3); + stockOutOrderDO.setOutboundDate(orderRow.getOutboundDate()); + stockOutOrderDO.setNeedTransportFlag("0"); + stockOutOrderDO.setNeedDeclareFlag("0"); + stockOutOrderDO.setExpectTime(orderRow.getOutboundDate() != null ? orderRow.getOutboundDate() : new Date()); + stockOutOrderDO.setDocumentDate(orderRow.getDocumentDate() != null ? orderRow.getDocumentDate() : new Date()); + stockOutOrderDO.setDocumentCreator(orderRow.getDocumentCreator()); + stockOutOrderDO.setRemark(orderRow.getRemark()); + if (shipper != null) { + stockOutOrderDO.setShipperId(shipper.getUserId()); + stockOutOrderDO.setShipperName(shipper.getUserName()); + stockOutOrderDO.setCustomerId(shipper.getUserId()); + stockOutOrderDO.setCustomerName(shipper.getUserName()); + stockOutOrderDO.setSalesmanId(String.valueOf(shipper.getUserId())); + stockOutOrderDO.setSalesmanName(shipper.getUserName()); + stockOutOrderDO.setCustomerCode(reserveStockInOrderMapper.getCustomerNcCodeByUserId(shipper.getUserId())); + } else { + // 货主未匹配到,仅以Excel中的名称作为名称字段,id留空 + stockOutOrderDO.setShipperName(shipperName); + stockOutOrderDO.setCustomerName(shipperName); + stockOutOrderDO.setSalesmanName(shipperName); + } + // 组织字段硬编码(与入库导入保持一致) + stockOutOrderDO.setOrganizationId(2841L); + stockOutOrderDO.setOrganizationName("仓码"); + stockOutOrderDO.setTopOrganizationId(2827L); + if (warehouse != null) { + stockOutOrderDO.setWarehouseId(warehouse.getWarehouseId()); + stockOutOrderDO.setWarehouseCode(warehouse.getWarehouseCode()); + stockOutOrderDO.setWarehouseName(warehouse.getWarehouseName()); + } else if (StringUtils.isNotBlank(warehouseType)) { + // 仓库未匹配到,仅以仓库类型名作为仓库名称,id/编码留空 + String fallbackName = "1".equals(warehouseType) ? "干仓" : ("2".equals(warehouseType) ? "冻仓" : ""); + if (StringUtils.isNotBlank(fallbackName)) { + stockOutOrderDO.setWarehouseName(fallbackName); + } + } + // 创建人/修改人名称取老系统Excel中的值,不使用当前登录人 + stockOutOrderDO.setCreateTime(orderRow.getCreateTime() != null ? orderRow.getCreateTime() : new Date()); + stockOutOrderDO.setCreateByName(orderRow.getCreateByName()); + stockOutOrderDO.setUpdateTime(orderRow.getUpdateTime()); + stockOutOrderDO.setUpdateByName(orderRow.getUpdateByName()); + stockOutOrderDO.setMaterialDetailList(materialDetailList); + stockOutOrderList.add(stockOutOrderDO); + } + + // 明细文件中存在但主表文件中不存在的单号 + for (String detailOrderNumber : detailGroupMap.keySet()) { + if (!orderNumberSet.contains(detailOrderNumber)) { + errorList.add("明细文件中出库单号【" + detailOrderNumber + "】在主表文件中不存在"); + } + } + + // 逐单入库(即使有未匹配到基础数据的警告也不阻断,错误信息随结果返回) + // 直接走 MyBatis-Plus 入库,绕过领域服务/应用服务层的参数补全逻辑 + int detailCount = 0; + for (ReserveStockOutOrderDO stockOutOrderDO : stockOutOrderList) { + // 主表:DO -> 实体 -> save + ReserveStockOutOrder stockOutOrder = new ReserveStockOutOrder(); + BeanUtils.copyProperties(stockOutOrderDO, stockOutOrder); + stockOutOrder.setMaterialQuantity(stockOutOrderDO.getMaterialDetailList().size()); + BigDecimal totalQuantity = stockOutOrderDO.getMaterialDetailList().stream() + .map(ReserveOutMaterialDetailDO::getQuantity).filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + stockOutOrder.setQuantity(totalQuantity); + stockOutOrderService.save(stockOutOrder); + + // 明细:DO -> 实体 -> saveBatch + List detailEntities = new ArrayList<>(); + for (ReserveOutMaterialDetailDO detailDO : stockOutOrderDO.getMaterialDetailList()) { + ReserveOutMaterialDetail detail = new ReserveOutMaterialDetail(); + BeanUtils.copyProperties(detailDO, detail); + detail.setOutOrderNumber(stockOutOrderDO.getOutOrderNumber()); + detailEntities.add(detail); + } + if (!detailEntities.isEmpty()) { + outMaterialDetailService.saveBatch(detailEntities); + } + detailCount += detailEntities.size(); + } + Map result = new HashMap<>(); + result.put("orderCount", stockOutOrderList.size()); + result.put("detailCount", detailCount); + if (!errorList.isEmpty()) { + result.put("warnings", errorList); + } + return result; + } + public void importInData(List dataList) { LoginUser loginUser = SecurityUtils.getLoginUser(); ReserveStockOutOrderDO reserveStockOutOrder = new ReserveStockOutOrderDO(); diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/ReserveStockOutOrder/ReserveStockOutOrderApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/ReserveStockOutOrder/ReserveStockOutOrderApi.java index a3dae8373..14e6d1f9e 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/ReserveStockOutOrder/ReserveStockOutOrderApi.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/ReserveStockOutOrder/ReserveStockOutOrderApi.java @@ -15,6 +15,8 @@ import com.mhd.oms.domain.reserveStockOutOrder.repository.facade.IReserveStockOu import com.mhd.oms.domain.reserveStockOutOrder.repository.po.ReserveStockOutOrderPO; import com.mhd.oms.domain.reserveStockOutOrder.repository.todo.ReserveStockOutOrderDO; import com.mhd.oms.domain.reserveStockOutOrder.repository.todo.ReserveStockOutOrderDTO; +import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.LegacyReserveOutDetailVO; +import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.LegacyReserveOutOrderVO; import com.mhd.oms.domain.reserveStockOutOrder.repository.vo.ReservedInventoryOut; import com.mhd.oms.domain.reserveStockOutOrder.service.ReserveStockOutOrderApplicationService; import com.mhd.oms.domain.reserveStockOutOrder.service.ReserveStockOutOrderAssembler; @@ -303,4 +305,59 @@ public class ReserveStockOutOrderApi extends BaseController { return AjaxResult.success(stockOutOrderApplicationService.generateReserveOrderNumber()); } + /** + * 老系统出库预约单数据导入(两个文件:主表+明细) + * 通过货主名称、仓库类型、物料名称等匹配基础数据,id类字段不使用 + * 仓库类型:1=干仓 2=冬仓 + * 明细物料名称:取物料名称1和物料名称2中有值的那一个 + */ + @ApiOperation("老系统出库预约单数据导入") + @PostMapping("/importLegacy") + public ResponseEntity> importLegacyData( + @RequestParam("orderFile") MultipartFile orderFile, + @RequestParam("detailFile") MultipartFile detailFile) { + try { + // 1. 解析两个Excel文件 + List orderList = ExcelParseUtil.parseLegacyOrderExcel(orderFile); + List detailList = ExcelParseUtil.parseLegacyDetailExcel(detailFile); + + // 2. 调用应用服务执行导入 + Map result = stockOutOrderApplicationService.importLegacyData(orderList, detailList); + + Map successResponse = new HashMap<>(); + successResponse.put("code", 200); + successResponse.put("message", "老系统出库预约单数据导入成功"); + successResponse.put("orderCount", result.get("orderCount")); + successResponse.put("detailCount", result.get("detailCount")); + if (result.containsKey("warnings")) { + successResponse.put("warnings", result.get("warnings")); + } + return ResponseEntity.ok(successResponse); + + } catch (ValidationException e) { + log.error("老系统出库预约单数据验证失败: {}", e.getMessage(), e); + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 400); + errorResponse.put("message", "数据验证失败"); + errorResponse.put("errorDetails", e.getMessage()); + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(errorResponse); + + } catch (IOException e) { + log.error("老系统出库预约单文件处理失败: {}", e.getMessage(), e); + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 500); + errorResponse.put("message", "文件处理失败"); + errorResponse.put("errorDetails", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); + + } catch (Exception e) { + log.error("老系统出库预约单导入失败: {}", e.getMessage(), e); + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 500); + errorResponse.put("message", "导入失败"); + errorResponse.put("errorDetails", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); + } + } + } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reserveStockInOrder/ReserveStockInOrderApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reserveStockInOrder/ReserveStockInOrderApi.java index ccd1b2d88..f1526fe43 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reserveStockInOrder/ReserveStockInOrderApi.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reserveStockInOrder/ReserveStockInOrderApi.java @@ -10,12 +10,15 @@ import com.mhd.oms.domain.reserveStockInOrder.repository.todo.ReserveStockInOrde import com.mhd.oms.domain.reserveStockInOrder.repository.todo.ReserveStockInOrderDTO; import com.mhd.oms.domain.reserveStockInOrder.repository.util.ExcelParseUtil; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.InAndOutListVo; +import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInDetailVO; +import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory; import com.mhd.oms.domain.reserveStockInOrder.service.ReserveStockInOrderApplicationService; import com.mhd.oms.domain.reserveStockInOrder.service.ReserveStockInOrderAssembler; import com.mhd.system.api.domain.InMaterialDetailTZPD; import com.mhd.system.api.domain.StockInOrderTZPD; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -34,6 +37,7 @@ import java.util.Map; * @author gen * @date 2024-05-21 */ +@Slf4j @RestController @RequestMapping("/reserveStockInOrderApi") public class ReserveStockInOrderApi extends BaseController { @@ -256,6 +260,68 @@ public class ReserveStockInOrderApi extends BaseController { } } + /** + * 老系统入库预约单数据导入(主表+明细两个Excel文件批量导入,按名称匹配基础数据) + */ + @ApiOperation("老系统入库预约单数据导入") + @PostMapping("/importLegacy") + public ResponseEntity> importLegacyExcel( + @RequestParam("orderFile") MultipartFile orderFile, + @RequestParam("detailFile") MultipartFile detailFile) { + try { + List orderList = ExcelParseUtil.parseLegacyOrderExcel(orderFile); + List detailList = ExcelParseUtil.parseLegacyDetailExcel(detailFile); + + Map importResult = stockInOrderApplicationService.importLegacyData(orderList, detailList); + + Map successResponse = new HashMap<>(); + successResponse.put("code", 200); + successResponse.put("message", "老系统数据导入成功"); + successResponse.put("orderCount", importResult.get("orderCount")); + successResponse.put("detailCount", importResult.get("detailCount")); + if (importResult.containsKey("warnings")) { + successResponse.put("warnings", importResult.get("warnings")); + } + return ResponseEntity.ok(successResponse); + + } catch (ValidationException e) { + // 数据验证失败响应 + log.warn("老系统数据导入校验失败: {}", e.getMessage()); + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 400); + errorResponse.put("message", "数据验证失败"); + errorResponse.put("errorDetails", e.getMessage()); + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(errorResponse); + + } catch (IOException e) { + // 文件处理失败响应 + log.error("老系统数据导入文件处理失败", e); + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 500); + errorResponse.put("message", "文件处理失败"); + errorResponse.put("errorDetails", e.getClass().getSimpleName() + ": " + e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); + + } catch (Exception e) { + // 其他未知错误响应:打印完整堆栈,把真正的报错信息报出来 + log.error("老系统数据导入发生未知异常", e); + String errorType = e.getClass().getSimpleName(); + String errorMsg = e.getMessage() != null ? e.getMessage() : "无详细信息"; + // 如果异常带有 cause,则再追加 cause 信息,方便定位根因 + Throwable cause = e.getCause(); + StringBuilder detail = new StringBuilder(); + detail.append(errorType).append(": ").append(errorMsg); + if (cause != null && cause != e) { + detail.append(" | 根因: ").append(cause.getClass().getSimpleName()).append(": ").append(cause.getMessage()); + } + Map errorResponse = new HashMap<>(); + errorResponse.put("code", 500); + errorResponse.put("message", detail.toString()); + errorResponse.put("errorDetails", detail.toString()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); + } + } + /** * 生成入库预约单号 */ diff --git a/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml index 873ed5d8e..ffdb7fdd4 100644 --- a/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml @@ -788,4 +788,47 @@ WHERE in_order_number LIKE concat(#{prefix}, '%') + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml index a6559f786..8e0a52a6b 100644 --- a/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml @@ -528,4 +528,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE out_order_number LIKE concat(#{prefix}, '%') + + + + + + \ No newline at end of file From 76a5c987b2f17e5f835f7ec7d7e7d1e362094288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 31 Jul 2026 15:53:35 +0800 Subject: [PATCH 37/43] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=8D=95=E8=80=81?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ReserveStockInOrderApplicationService.java | 2 +- .../service/ReserveStockOutOrderApplicationService.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java index e0c259eff..cbf30e381 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java @@ -2201,7 +2201,7 @@ public class ReserveStockInOrderApplicationService { // 组装入库预约单 ReserveStockInOrderDO stockInOrderDO = new ReserveStockInOrderDO(); stockInOrderDO.setInOrderNumber(orderNumber); - stockInOrderDO.setBusinessOrderNo(generateDateTimeWithRandom()); + stockInOrderDO.setBusinessOrderNo(orderNumber); // 老系统历史数据,状态直接置为最终状态:已入库、审核通过、已完成 stockInOrderDO.setStatus(5); stockInOrderDO.setAuditStatus(3); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java index 3d69b9552..4dc2f9a89 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockOutOrder/service/ReserveStockOutOrderApplicationService.java @@ -1240,7 +1240,8 @@ public class ReserveStockOutOrderApplicationService { materialDetail.setTotalGrossWeight(detailRow.getWeight()); // 保留老系统关联的入库单号到备注 if (StringUtils.isNotBlank(detailRow.getInOrderNumber())) { - materialDetail.setRemark("老系统入库单号:" + detailRow.getInOrderNumber()); +// materialDetail.setRemark("老系统入库单号:" + detailRow.getInOrderNumber()); + materialDetail.setInOrderNumber(detailRow.getInOrderNumber()); } materialDetail.setContractFee(BigDecimal.ZERO); materialDetail.setLotNo(generateDateSerialNumber() + "-" + lotIndex); @@ -1261,7 +1262,7 @@ public class ReserveStockOutOrderApplicationService { // 组装出库预约单 ReserveStockOutOrderDO stockOutOrderDO = new ReserveStockOutOrderDO(); stockOutOrderDO.setOutOrderNumber(orderNumber); - stockOutOrderDO.setBusinessOrderNo(generateDateTimeWithRandom()); + stockOutOrderDO.setBusinessOrderNo(orderNumber); // 老系统历史数据,状态直接置为最终状态:已出库、审核通过 stockOutOrderDO.setStatus(9); stockOutOrderDO.setAuditStatus(3); From 564b8ff8aa19e80f7cf4dbdb06b6f153b41641ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 31 Jul 2026 16:07:17 +0800 Subject: [PATCH 38/43] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StockReceiptOrderApplicationService.java | 4 +++- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java index 355dc57d2..ea0c33038 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java @@ -233,7 +233,9 @@ public class StockReceiptOrderApplicationService { } for (ReceiptMaterialDetailPO receiptMaterialDetailPO : receiptMaterialDetailPOList) { MaterialBaseInfoPO materialBaseInfoPO = materialBaseInfoMap.get(receiptMaterialDetailPO.getMaterialBaseInfoId()); - receiptMaterialDetailPO.setCopyCode(materialBaseInfoPO.getCopyCode()); + if (materialBaseInfoPO != null) { + receiptMaterialDetailPO.setCopyCode(materialBaseInfoPO.getCopyCode()); + } } // 4.2 批量查询包装规格信息(单位代码为EA的单位名称) diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..39eb710cb 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 5fec54ac63c366f13dcee0a2c4c2e23976f44f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Fri, 31 Jul 2026 16:41:19 +0800 Subject: [PATCH 39/43] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StockInOrderApplicationService.java | 68 ++++++++++++++++++- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java index 117efb435..f07aca537 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java @@ -545,9 +545,71 @@ public class StockInOrderApplicationService { info.setKhdm(userNcCode); List materialDetailList = info.getMaterialDetailList(); if (materialDetailList != null && !materialDetailList.isEmpty()) { - for (InMaterialDetailPO inMaterialDetailPO : materialDetailList) { - // TODO: 设置物料详情信息 - inMaterialDetailPO.setKhdm(userNcCode); + // 收集所有有效的物料基础信息ID + Set materialBaseInfoIdSet = new HashSet<>(); + for (InMaterialDetailPO detail : materialDetailList) { + if (detail.getMaterialBaseInfoId() != null && detail.getMaterialBaseInfoId() > 0) { + materialBaseInfoIdSet.add(detail.getMaterialBaseInfoId()); + } + } + + // 批量查询物料基础信息,try-catch保护,防止没有ID时NPE + Map materialBaseInfoMap = new HashMap<>(); + for (Long materialBaseInfoId : materialBaseInfoIdSet) { + try { + MaterialBaseInfoPO materialBaseInfoPO = materialBaseInfoService.getInfo(materialBaseInfoId); + if (materialBaseInfoPO != null) { + materialBaseInfoMap.put(materialBaseInfoId, materialBaseInfoPO); + } + } catch (Exception e) { + log.warn("获取物料基础信息失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage()); + } + } + + // 填充明细的物料字段(物料编码、抄码、条码、单位等) + Long shipperId = info.getShipperId(); + for (InMaterialDetailPO detail : materialDetailList) { + detail.setKhdm(userNcCode); + Long materialBaseInfoId = detail.getMaterialBaseInfoId(); + MaterialBaseInfoPO materialBaseInfoPO = null; + + if (materialBaseInfoId != null && materialBaseInfoId > 0) { + materialBaseInfoPO = materialBaseInfoMap.get(materialBaseInfoId); + } + // 兜底:ID=0时用物料名称反查 + if (materialBaseInfoPO == null && StringUtils.isNotBlank(detail.getMaterialName())) { + try { + MaterialBaseInfoDO queryDO = new MaterialBaseInfoDO(); + queryDO.setMaterialName(detail.getMaterialName().trim()); + if (shipperId != null && shipperId > 0) { + queryDO.setShipperId(shipperId); + } + List list = materialBaseInfoService.queryList(queryDO); + if (list != null && !list.isEmpty()) { + materialBaseInfoPO = list.get(0); + } + } catch (Exception e) { + log.warn("兜底反查物料失败,物料名:{}", detail.getMaterialName()); + } + } + + if (materialBaseInfoPO != null) { + if (StringUtils.isBlank(detail.getMaterialCode())) { + detail.setMaterialCode(materialBaseInfoPO.getMaterialCode()); + } + if (StringUtils.isBlank(detail.getBarCode())) { + detail.setBarCode(materialBaseInfoPO.getBarCode()); + } + if (StringUtils.isBlank(detail.getUnitCode())) { + detail.setUnitCode(materialBaseInfoPO.getUnitCode()); + } + if (StringUtils.isBlank(detail.getUnitName())) { + detail.setUnitName(materialBaseInfoPO.getUnitName()); + } + detail.setPackId(materialBaseInfoPO.getPackId()); + detail.setPackCode(materialBaseInfoPO.getPackCode()); + detail.setPackName(materialBaseInfoPO.getPackName()); + } } info.setMaterialDetailList(materialDetailList); } From b8605c6b431ed837de82af4dc5ff38e0d3999b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 31 Jul 2026 17:12:24 +0800 Subject: [PATCH 40/43] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=8D=95=E8=80=81?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ReserveStockInOrderApplicationService.java | 39 +++++++------------ .../ReserveStockInOrderMapper.xml | 2 +- .../ReserveStockOutOrderMapper.xml | 2 +- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java index cbf30e381..571dfa51c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reserveStockInOrder/service/ReserveStockInOrderApplicationService.java @@ -31,6 +31,7 @@ import com.mhd.oms.domain.reserveStockInOrder.repository.vo.InAndOutListVo; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInDetailVO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory; +import com.mhd.oms.domain.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.UserServiceFeign; import com.mhd.system.api.WmsServiceFeign; @@ -68,6 +69,8 @@ public class ReserveStockInOrderApplicationService { @Autowired private ReserveStockInOrderMapper reserveStockInOrderMapper; @Autowired + private ReserveStockOutOrderMapper reserveStockOutOrderMapper; + @Autowired private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper; @Autowired private UserServiceFeign userServiceFeign; @@ -2108,35 +2111,23 @@ public class ReserveStockInOrderApplicationService { } } - // 按仓库名称匹配仓库(查不到则按仓库类型兜底,再查不到则用名称兜底,不阻断导入) + // 按仓库类型匹配仓库(老系统仓库类型 1=干仓 2=冬仓,查不到则用类型名兜底) + String warehouseName = ""; WarehousePO warehouse = null; - String warehouseName = StringUtils.trimToEmpty(orderRow.getWarehouseName()); - if (StringUtils.isNotBlank(warehouseName)) { - warehouse = warehouseCache.get(warehouseName); + String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType()); + if (StringUtils.isNotBlank(warehouseType)) { + warehouse = warehouseTypeCache.get(warehouseType); if (warehouse == null) { - List warehousePOList = reserveStockInOrderMapper.getWarehouseByName(warehouseName); + List warehousePOList = reserveStockOutOrderMapper.getWarehouseByType(warehouseType); if (warehousePOList == null || warehousePOList.isEmpty()) { - // 名称匹配失败,尝试按仓库类型兜底匹配 - String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType()); - if (StringUtils.isNotBlank(warehouseType)) { - if (warehouseTypeCache.containsKey(warehouseType)) { - warehouse = warehouseTypeCache.get(warehouseType); - } else { - List typeList = reserveStockInOrderMapper.getWarehouseByType(warehouseType); - if (typeList != null && !typeList.isEmpty()) { - warehouse = typeList.get(0); - warehouseTypeCache.put(warehouseType, warehouse); - } else { - warehouseTypeCache.put(warehouseType, null); - } - } - } - if (warehouse == null) { - errorList.add("入库单号【" + orderNumber + "】仓库【" + warehouseName + "】未找到对应仓库,将仅以名称导入"); - } + warehouseName = "1".equals(warehouseType) ? "干仓" : ("2".equals(warehouseType) ? "冻仓" : ""); + errorList.add("出库单号【" + orderNumber + "】仓库类型【" + warehouseType + "】未找到对应仓库,将仅以名称导入"); + warehouseTypeCache.put(warehouseType, null); + warehouse = null; } else { warehouse = warehousePOList.get(0); - warehouseCache.put(warehouseName, warehouse); + warehouseName = warehouse.getWarehouseName(); + warehouseTypeCache.put(warehouseType, warehouse); } } } diff --git a/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml index ffdb7fdd4..2272d6a7d 100644 --- a/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reserveStockInOrder/ReserveStockInOrderMapper.xml @@ -815,7 +815,7 @@ where DEL_FLAG = 1 and ( WAREHOUSE_TYPE = #{warehouseType} - or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '冬仓' else null end + or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '冻仓' else null end ) diff --git a/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml index 8e0a52a6b..1c4a103dd 100644 --- a/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reserveStockOutOrder/ReserveStockOutOrderMapper.xml @@ -544,7 +544,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where DEL_FLAG = 1 and ( WAREHOUSE_TYPE = #{warehouseType} - or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '冬仓' else null end + or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '冻仓' else null end ) From 2dd8e7f0a262c92f827a4a15ffc94721a49162e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 31 Jul 2026 17:51:26 +0800 Subject: [PATCH 41/43] =?UTF-8?q?=E5=8F=9130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 91f2f8a11..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 03d48d2f4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index ba9a45148..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 688e5ea7c..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 48d76d01e..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** From 2a56ce433fe3afde19d7f1092de0ebb8ab3152d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 31 Jul 2026 17:57:50 +0800 Subject: [PATCH 42/43] =?UTF-8?q?=E5=8F=9131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- mhd_oms/src/main/resources/bootstrap.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index ee058f0f6..542b6bce7 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 1779bc2b23f67171a77d51bd261d167d5cfb8274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 31 Jul 2026 18:02:30 +0800 Subject: [PATCH 43/43] =?UTF-8?q?=E5=8F=9130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_oms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index 542b6bce7..ee058f0f6 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境