Merge branch 'dev' into cangmapda_260710
This commit is contained in:
@@ -18,7 +18,7 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* bms财务结算系统feign调用接口
|
* 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 {
|
public interface BmsServiceFeign {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
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 {
|
public interface OmsServiceFeign {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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 {
|
public interface WlhyServiceFeign {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
|||||||
* @description: TODO
|
* @description: TODO
|
||||||
* @date 2024/5/10 8:58
|
* @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 {
|
public interface WmsServiceFeign {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
|
|||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
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 {
|
public interface YmsServiceFeign {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -17,6 +18,7 @@ import java.util.List;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@ApiModel("BI-港澳服务专区")
|
@ApiModel("BI-港澳服务专区")
|
||||||
public class HkMacaoServiceZoneVO {
|
public class HkMacaoServiceZoneVO {
|
||||||
|
|
||||||
|
|||||||
+2
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -11,6 +12,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@ApiModel("BI-港澳服务专区-地图点位")
|
@ApiModel("BI-港澳服务专区-地图点位")
|
||||||
public class HkMapPointVO {
|
public class HkMapPointVO {
|
||||||
|
|
||||||
|
|||||||
+21
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -38,4 +39,24 @@ public class HkVehicleDetailsVO {
|
|||||||
@JsonProperty("update_time")
|
@JsonProperty("update_time")
|
||||||
@ApiModelProperty("更新时间")
|
@ApiModelProperty("更新时间")
|
||||||
private String updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty("运输方向")
|
||||||
|
private String direction;
|
||||||
|
|
||||||
|
@ApiModelProperty("货物类型")
|
||||||
|
private String cargo;
|
||||||
|
|
||||||
|
@ApiModelProperty("预计到达时间")
|
||||||
|
private String eta;
|
||||||
|
|
||||||
|
@JsonProperty("transportion_number")
|
||||||
|
@ApiModelProperty("运单号")
|
||||||
|
private String transportionNumber;
|
||||||
|
|
||||||
|
@JsonProperty("cargo_source")
|
||||||
|
@ApiModelProperty("货源")
|
||||||
|
private String cargoSource;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -46,6 +46,9 @@ public class MdmMerchantRecordDTO implements Serializable {
|
|||||||
@ApiModelProperty("电子邮件")
|
@ApiModelProperty("电子邮件")
|
||||||
private String desc16;
|
private String desc16;
|
||||||
|
|
||||||
|
@ApiModelProperty("nc编码")
|
||||||
|
private String desc17;
|
||||||
|
|
||||||
@ApiModelProperty("身份证号")
|
@ApiModelProperty("身份证号")
|
||||||
private String desc23;
|
private String desc23;
|
||||||
|
|
||||||
|
|||||||
+1
-10
@@ -95,21 +95,12 @@ public final class MdmMerchantSyncFilter {
|
|||||||
|
|
||||||
public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode,
|
public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode,
|
||||||
Long syncOrganizationId, Long topOrganizationId) {
|
Long syncOrganizationId, Long topOrganizationId) {
|
||||||
if (record == null || StringUtils.isEmpty(record.getCode())) {
|
if (StringUtils.isEmpty(trim(record.getDesc17()))) {
|
||||||
return SkipReason.EMPTY_CODE;
|
return SkipReason.EMPTY_CODE;
|
||||||
}
|
}
|
||||||
if (!isCustomer(record)) {
|
|
||||||
return SkipReason.NOT_CUSTOMER;
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(orgNcCode) && !orgNcCode.equals(trim(record.getCode()))) {
|
|
||||||
return SkipReason.ORG_MISMATCH;
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(trim(record.getDesc1()))) {
|
if (StringUtils.isEmpty(trim(record.getDesc1()))) {
|
||||||
return SkipReason.MISSING_NAME;
|
return SkipReason.MISSING_NAME;
|
||||||
}
|
}
|
||||||
if (isDisabled(record)) {
|
|
||||||
return SkipReason.DISABLED;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ public class AsyncUserShipperMasterDataSyncService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RedisLock redisLock;
|
private RedisLock redisLock;
|
||||||
|
|
||||||
@Async
|
@Async("taskScheduler")
|
||||||
public void syncMasterDataAsync(LoginUser loginUser, String lockKey) {
|
public void syncMasterDataAsync(LoginUser loginUser, String lockKey) {
|
||||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||||
try {
|
try {
|
||||||
|
|||||||
+89
-56
@@ -1349,6 +1349,82 @@ public class UserShipperApplicationService {
|
|||||||
organizationId);
|
organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按公司名跨组织查询第一个未删除的委托方(包含 orgCode)。
|
||||||
|
* 用于 MDM 同步时:同公司名可能在不同组织下 nc 编码不同,但本地是同一条委托方记录。
|
||||||
|
*/
|
||||||
|
public UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(String shipperEnterpriseName) {
|
||||||
|
if (StringUtils.isEmpty(shipperEnterpriseName)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return userShipperMapper.findFirstByShipperEnterpriseNameAcrossOrgs(shipperEnterpriseName.trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在已存在的同公司名委托方(可能属于其他组织)的 orgCode JSON 数组中追加当前组织信息。
|
||||||
|
* 若目标组织已存在于数组中则跳过(不重复追加)。
|
||||||
|
*
|
||||||
|
* @param existingShipper 本地已存在的同公司名委托方
|
||||||
|
* @param targetOrganizationId 当前同步组织 ID
|
||||||
|
* @param targetOrganizationName 当前同步组织名称
|
||||||
|
* @param ncCustomerCode MDM 客商 code(作为该组织下的 ncCustomer 记录)
|
||||||
|
* @param loginUser 登录用户(用于写入 updateBy)
|
||||||
|
* @return true 表示实际写入(新增组织或已存在都返回 true,方便调用方统计),false 表示参数无效
|
||||||
|
*/
|
||||||
|
public boolean appendOrganizationToExistingShipper(UserShipperEntity existingShipper,
|
||||||
|
Long targetOrganizationId, String targetOrganizationName,
|
||||||
|
String ncCustomerCode, LoginUser loginUser) {
|
||||||
|
if (existingShipper == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String existingOrgCode = existingShipper.getOrgCode();
|
||||||
|
|
||||||
|
boolean hasOrg = false;
|
||||||
|
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||||
|
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);
|
||||||
|
Long itemCode = orgItem.getLong("code");
|
||||||
|
if (targetOrganizationId != null && targetOrganizationId.equals(itemCode)) {
|
||||||
|
hasOrg = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasOrg) {
|
||||||
|
// 添加新组织到orgCode数组
|
||||||
|
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||||
|
newOrgItem.put("name", targetOrganizationName);
|
||||||
|
newOrgItem.put("code", targetOrganizationId);
|
||||||
|
newOrgItem.put("ncCustomer", ncCustomerCode);
|
||||||
|
newOrgItem.put("names", targetOrganizationId);
|
||||||
|
orgCodeArray.add(newOrgItem);
|
||||||
|
|
||||||
|
// 更新委托方的orgCode字段
|
||||||
|
existingShipper.setOrgCode(orgCodeArray.toJSONString());
|
||||||
|
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||||
|
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
|
||||||
|
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||||
|
}
|
||||||
|
existingShipper.setUpdateTime(new Date());
|
||||||
|
userShipperMapper.updateById(existingShipper);
|
||||||
|
|
||||||
|
log.info("委托方已存在,添加新组织到orgCode,customerNcCode={},新增组织code={},name={}",
|
||||||
|
ncCustomerCode, targetOrganizationId, targetOrganizationName);
|
||||||
|
} else {
|
||||||
|
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
|
||||||
|
ncCustomerCode, targetOrganizationId);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static String buildMasterDataMatchKey(String ncCode, String companyName) {
|
public static String buildMasterDataMatchKey(String ncCode, String companyName) {
|
||||||
return normalizeMasterDataKey(ncCode) + "|" + normalizeMasterDataKey(companyName);
|
return normalizeMasterDataKey(ncCode) + "|" + normalizeMasterDataKey(companyName);
|
||||||
}
|
}
|
||||||
@@ -1374,61 +1450,8 @@ public class UserShipperApplicationService {
|
|||||||
throw new ServiceException("获取组织配置失败");
|
throw new ServiceException("获取组织配置失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否已存在相同customerNcCode的委托方(可能在不同组织)
|
// 按公司名跨组织匹配已存在委托方的逻辑已迁移到 doSync 层(先调用 appendOrganizationToExistingShipper),
|
||||||
List<UserShipperEntity> existingShippers = userShipperMapper.selectList(
|
// 走到这里说明按 ncCode+companyName 与公司名均未匹配到,本方法只负责"新增"。
|
||||||
new LambdaQueryWrapper<UserShipperEntity>()
|
|
||||||
.eq(UserShipperEntity::getShipperEnterpriseName, record.getDesc1())
|
|
||||||
.eq(UserShipperEntity::getDelFlag, 1));
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(existingShippers)) {
|
|
||||||
// 找到已存在的委托方,检查是否已经有该组织
|
|
||||||
UserShipperEntity existingShipper = existingShippers.get(0);
|
|
||||||
String existingOrgCode = existingShipper.getOrgCode();
|
|
||||||
|
|
||||||
boolean hasOrg = false;
|
|
||||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
|
||||||
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);
|
|
||||||
Long itemCode = orgItem.getLong("code");
|
|
||||||
if (targetOrganizationId.equals(itemCode)) {
|
|
||||||
hasOrg = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasOrg) {
|
|
||||||
// 添加新组织到orgCode数组
|
|
||||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
|
||||||
newOrgItem.put("name", targetOrganizationName);
|
|
||||||
newOrgItem.put("code", targetOrganizationId);
|
|
||||||
newOrgItem.put("ncCustomer", record.getCode());
|
|
||||||
newOrgItem.put("names", targetOrganizationId);
|
|
||||||
orgCodeArray.add(newOrgItem);
|
|
||||||
|
|
||||||
// 更新委托方的orgCode字段
|
|
||||||
existingShipper.setOrgCode(orgCodeArray.toJSONString());
|
|
||||||
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
|
|
||||||
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
|
|
||||||
existingShipper.setUpdateTime(new Date());
|
|
||||||
userShipperMapper.updateById(existingShipper);
|
|
||||||
|
|
||||||
log.info("委托方已存在,添加新组织到orgCode,customerNcCode={},新增组织code={},name={}",
|
|
||||||
record.getCode(), targetOrganizationId, targetOrganizationName);
|
|
||||||
} else {
|
|
||||||
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
|
|
||||||
record.getCode(), targetOrganizationId);
|
|
||||||
}
|
|
||||||
return; // 不新增,直接返回
|
|
||||||
}
|
|
||||||
|
|
||||||
// 不存在相同的委托方,执行新增逻辑
|
// 不存在相同的委托方,执行新增逻辑
|
||||||
UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser,
|
UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser,
|
||||||
targetOrganizationId, targetOrganizationName, targetTopOrganizationId);
|
targetOrganizationId, targetOrganizationName, targetTopOrganizationId);
|
||||||
@@ -1441,6 +1464,16 @@ public class UserShipperApplicationService {
|
|||||||
userShipperDO.setAuthType(2);
|
userShipperDO.setAuthType(2);
|
||||||
userShipperDO.setShipperAuthStatus(3);
|
userShipperDO.setShipperAuthStatus(3);
|
||||||
|
|
||||||
|
// 初始化 orgCode:新加的客商属于当前组织,将当前组织信息写入 orgCode JSON 数组
|
||||||
|
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||||
|
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
|
||||||
|
orgItem.put("name", targetOrganizationName);
|
||||||
|
orgItem.put("code", targetOrganizationId);
|
||||||
|
orgItem.put("ncCustomer", record.getCode());
|
||||||
|
orgItem.put("names", targetOrganizationId);
|
||||||
|
orgCodeArray.add(orgItem);
|
||||||
|
userShipperDO.setOrgCode(orgCodeArray.toJSONString());
|
||||||
|
|
||||||
String userAccount = buildMasterDataUserAccount(record.getCode());
|
String userAccount = buildMasterDataUserAccount(record.getCode());
|
||||||
checkUserAccountUnique(userAccount, null, configSwitch.getTopOrganizationId());
|
checkUserAccountUnique(userAccount, null, configSwitch.getTopOrganizationId());
|
||||||
userShipperDO.setUserAccount(userAccount);
|
userShipperDO.setUserAccount(userAccount);
|
||||||
@@ -1556,7 +1589,7 @@ public class UserShipperApplicationService {
|
|||||||
Long targetOrganizationId, String targetOrganizationName,
|
Long targetOrganizationId, String targetOrganizationName,
|
||||||
Long targetTopOrganizationId) {
|
Long targetTopOrganizationId) {
|
||||||
UserShipperDO userShipperDO = new UserShipperDO();
|
UserShipperDO userShipperDO = new UserShipperDO();
|
||||||
userShipperDO.setCustomerNcCode(record.getCode());
|
userShipperDO.setCustomerNcCode(record.getDesc17()); // NC编码用desc17,与匹配Key一致
|
||||||
userShipperDO.setUserMemberCode(record.getCode());
|
userShipperDO.setUserMemberCode(record.getCode());
|
||||||
userShipperDO.setShipperEnterpriseName(record.getDesc1());
|
userShipperDO.setShipperEnterpriseName(record.getDesc1());
|
||||||
userShipperDO.setUserNameShipper(record.getDesc1());
|
userShipperDO.setUserNameShipper(record.getDesc1());
|
||||||
|
|||||||
+51
-17
@@ -13,6 +13,7 @@ import com.mhd.common.core.utils.StringUtils;
|
|||||||
import com.mhd.common.redis.service.RedisLock;
|
import com.mhd.common.redis.service.RedisLock;
|
||||||
import com.mhd.common.security.utils.SecurityUtils;
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
import com.mhd.system.api.model.LoginUser;
|
import com.mhd.system.api.model.LoginUser;
|
||||||
|
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
|
||||||
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
|
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
|
||||||
import com.mhd.user.domain.userShipperMdmSync.entity.UserShipperMdmSyncEntity;
|
import com.mhd.user.domain.userShipperMdmSync.entity.UserShipperMdmSyncEntity;
|
||||||
import com.mhd.user.domain.userShipperMdmSync.mapper.UserShipperMdmSyncMapper;
|
import com.mhd.user.domain.userShipperMdmSync.mapper.UserShipperMdmSyncMapper;
|
||||||
@@ -69,13 +70,28 @@ public class UserShipperMasterDataSyncService {
|
|||||||
public void syncMasterData() {
|
public void syncMasterData() {
|
||||||
LoginUser loginUser = requireLoginUser();
|
LoginUser loginUser = requireLoginUser();
|
||||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||||
String lockKey = LOCK_PREFIX + organizationId;
|
new Thread(() -> {
|
||||||
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
|
String lockKey = LOCK_PREFIX + organizationId;
|
||||||
if (!locked) {
|
try {
|
||||||
throw new ServiceException("当前组织正在同步主数据,请稍后再试");
|
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
|
||||||
}
|
if (!locked) {
|
||||||
markSyncInProgress(organizationId);
|
log.warn("当前组织正在同步主数据,跳过本次同步");
|
||||||
asyncUserShipperMasterDataSyncService.syncMasterDataAsync(loginUser, lockKey);
|
return;
|
||||||
|
}
|
||||||
|
markSyncInProgress(organizationId);
|
||||||
|
try {
|
||||||
|
ShipperMasterDataSyncResultVo resultVo = doSync(loginUser);
|
||||||
|
log.info("MDM同步完成: {}", resultVo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("同步主数据失败, organizationId={}", organizationId, e);
|
||||||
|
markSyncFailed(organizationId, e.getMessage());
|
||||||
|
} finally {
|
||||||
|
redisLock.unlock(lockKey);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取同步锁失败", e);
|
||||||
|
}
|
||||||
|
}, "mdm-sync-thread").start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShipperMasterDataSyncResultVo executeSync(LoginUser loginUser) {
|
public ShipperMasterDataSyncResultVo executeSync(LoginUser loginUser) {
|
||||||
@@ -184,14 +200,31 @@ public class UserShipperMasterDataSyncService {
|
|||||||
targetOrganizationId, organizationId, topOrganizationId, loginUser);
|
targetOrganizationId, organizationId, topOrganizationId, loginUser);
|
||||||
UserShipperPo existing = existingMap.get(matchKey);
|
UserShipperPo existing = existingMap.get(matchKey);
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
userShipperApplicationService.addEnterpriseShipperFromMasterData(
|
// 按 ncCode+companyName 未匹配到时,再按公司名跨组织查询已存在的同公司名委托方。
|
||||||
record, loginUser, saveTarget.getOrganizationId(),
|
// 同一个客商在 MDM 中可能属于不同组织(nc 编码不同),但本地是同一条委托方记录。
|
||||||
saveTarget.getOrganizationName(), saveTarget.getTopOrganizationId());
|
// 如果匹配到的委托方属于“另外的组织”(非当前同步组织),则不新增,
|
||||||
resultVo.setAddCount(resultVo.getAddCount() + 1);
|
// 而是在其 orgCode 上追加当前同步组织的信息(连同本组织下的 ncCustomer)。
|
||||||
UserShipperPo added = userShipperApplicationService.findByCustomerNcCodeAndCompanyName(
|
UserShipperEntity existingByName = userShipperApplicationService
|
||||||
ncCode, companyName, saveTarget.getOrganizationId());
|
.findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
|
||||||
if (added != null) {
|
if (existingByName != null
|
||||||
existingMap.put(matchKey, added);
|
&& saveTarget.getOrganizationId() != null
|
||||||
|
&& !saveTarget.getOrganizationId().equals(existingByName.getOrganizationId())) {
|
||||||
|
userShipperApplicationService.appendOrganizationToExistingShipper(
|
||||||
|
existingByName, saveTarget.getOrganizationId(),
|
||||||
|
saveTarget.getOrganizationName(), ncCode, loginUser);
|
||||||
|
resultVo.setLinkCount(resultVo.getLinkCount() + 1);
|
||||||
|
log.info("MDM同步按公司名跨组织合并:customerNcCode={},companyName={},本组织code={},已存在委托方shipperId={}(其他组织)",
|
||||||
|
ncCode, companyName, saveTarget.getOrganizationId(), existingByName.getShipperId());
|
||||||
|
} else {
|
||||||
|
userShipperApplicationService.addEnterpriseShipperFromMasterData(
|
||||||
|
record, loginUser, saveTarget.getOrganizationId(),
|
||||||
|
saveTarget.getOrganizationName(), saveTarget.getTopOrganizationId());
|
||||||
|
resultVo.setAddCount(resultVo.getAddCount() + 1);
|
||||||
|
UserShipperPo added = userShipperApplicationService.findByCustomerNcCodeAndCompanyName(
|
||||||
|
ncCode, companyName, saveTarget.getOrganizationId());
|
||||||
|
if (added != null) {
|
||||||
|
existingMap.put(matchKey, added);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
userShipperApplicationService.updateEnterpriseShipperFromMasterData(
|
userShipperApplicationService.updateEnterpriseShipperFromMasterData(
|
||||||
@@ -261,8 +294,9 @@ public class UserShipperMasterDataSyncService {
|
|||||||
entity.setLastSyncTime(syncTime);
|
entity.setLastSyncTime(syncTime);
|
||||||
entity.setSyncStatus(resultVo.getFailCount() > 0 ? 2 : 1);
|
entity.setSyncStatus(resultVo.getFailCount() > 0 ? 2 : 1);
|
||||||
String syncMessage = String.format(
|
String syncMessage = String.format(
|
||||||
"新增%d,更新%d,跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
|
"新增%d,更新%d,关联%d,跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
|
||||||
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getSkipCount(), resultVo.getFailCount(),
|
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getLinkCount(),
|
||||||
|
resultVo.getSkipCount(), resultVo.getFailCount(),
|
||||||
orgNcCode, skipOrgMismatch, skipNotCustomer, skipInternalOrg, skipDisabled, skipOther);
|
orgNcCode, skipOrgMismatch, skipNotCustomer, skipInternalOrg, skipDisabled, skipOther);
|
||||||
if (resultVo.getFailCount() > 0 && !resultVo.getErrorMessages().isEmpty()) {
|
if (resultVo.getFailCount() > 0 && !resultVo.getErrorMessages().isEmpty()) {
|
||||||
syncMessage += ";" + resultVo.getErrorMessages().get(0);
|
syncMessage += ";" + resultVo.getErrorMessages().get(0);
|
||||||
|
|||||||
+6
@@ -52,5 +52,11 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
|
|||||||
@Param("companyName") String companyName,
|
@Param("companyName") String companyName,
|
||||||
@Param("organizationId") Long organizationId);
|
@Param("organizationId") Long organizationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按公司名跨组织查询第一个未删除的委托方(包含 orgCode 字段)。
|
||||||
|
* 用于 MDM 同步时按"公司名"匹配已存在的委托方(可能是其他组织的),以便在其 orgCode 上追加新组织。
|
||||||
|
*/
|
||||||
|
UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(@Param("shipperEnterpriseName") String shipperEnterpriseName);
|
||||||
|
|
||||||
String getOrgNcCode(Long organizationId);
|
String getOrgNcCode(Long organizationId);
|
||||||
}
|
}
|
||||||
+3
@@ -18,6 +18,9 @@ public class ShipperMasterDataSyncResultVo {
|
|||||||
@ApiModelProperty("更新条数")
|
@ApiModelProperty("更新条数")
|
||||||
private int updateCount;
|
private int updateCount;
|
||||||
|
|
||||||
|
@ApiModelProperty("关联到已存在委托方条数(按公司名跨组织匹配到同公司名委托方,仅在 orgCode 上追加新组织,不新增委托方)")
|
||||||
|
private int linkCount;
|
||||||
|
|
||||||
@ApiModelProperty("跳过条数")
|
@ApiModelProperty("跳过条数")
|
||||||
private int skipCount;
|
private int skipCount;
|
||||||
|
|
||||||
|
|||||||
@@ -43,3 +43,12 @@ spring:
|
|||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
feign:
|
||||||
|
client:
|
||||||
|
config:
|
||||||
|
default:
|
||||||
|
connectTimeout: 10000
|
||||||
|
readTimeout: 120000
|
||||||
|
mhd-third-party-service:
|
||||||
|
connectTimeout: 10000
|
||||||
|
readTimeout: 120000
|
||||||
@@ -629,6 +629,22 @@
|
|||||||
AND a.organization_id = #{organizationId}
|
AND a.organization_id = #{organizationId}
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 按公司名跨组织查询第一个未删除的委托方(包含 orgCode),用于 MDM 同步时按"公司名"匹配已存在委托方 -->
|
||||||
|
<select id="findFirstByShipperEnterpriseNameAcrossOrgs" resultType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity">
|
||||||
|
SELECT b.shipper_id,
|
||||||
|
b.user_id,
|
||||||
|
b.customer_nc_code,
|
||||||
|
b.data_source,
|
||||||
|
b.shipper_enterprise_name,
|
||||||
|
b.user_name_shipper,
|
||||||
|
b.org_code
|
||||||
|
FROM user_shipper b
|
||||||
|
WHERE b.del_flag = 1
|
||||||
|
AND b.shipper_enterprise_name = #{shipperEnterpriseName}
|
||||||
|
ORDER BY b.shipper_id ASC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
<select id="getOrgNcCode" resultType="java.lang.String">
|
<select id="getOrgNcCode" resultType="java.lang.String">
|
||||||
select NC_CODE from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
|
select NC_CODE from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ spring:
|
|||||||
# server-addr: 127.0.0.1:8848
|
# 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
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# 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
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and a.inner_number like concat('%', #{innerNumber}, '%')
|
and a.inner_number like concat('%', #{innerNumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="partyName != null and partyName != ''">
|
<if test="partyName != null and partyName != ''">
|
||||||
and a.inner_number like concat('%', #{partyName}, '%')
|
and a.party_name like concat('%', #{partyName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="billRemark != null and billRemark != ''">
|
<if test="billRemark != null and billRemark != ''">
|
||||||
and a.bill_remark like concat('%', #{billRemark}, '%')
|
and a.bill_remark like concat('%', #{billRemark}, '%')
|
||||||
|
|||||||
+3
@@ -293,6 +293,9 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
|||||||
reservationDeliveryDetailsLink.setAmount(customerDeliveryDetail.getAmount());
|
reservationDeliveryDetailsLink.setAmount(customerDeliveryDetail.getAmount());
|
||||||
reservationDeliveryDetailsLink.setCustomerNumber(customerDeliveryDetail.getCustomerCode());
|
reservationDeliveryDetailsLink.setCustomerNumber(customerDeliveryDetail.getCustomerCode());
|
||||||
reservationDeliveryDetailsLink.setDeliveryName(customerDeliveryDetail.getCustomerName());
|
reservationDeliveryDetailsLink.setDeliveryName(customerDeliveryDetail.getCustomerName());
|
||||||
|
String customerCode = customerDeliveryDetail.getCustomerCode();
|
||||||
|
Long userId = stockOutOrderMapper.queryShipperId(customerCode, loginUser.getUserPo().getOrganizationId());
|
||||||
|
reservationDeliveryDetailsLink.setCustomerId(userId);
|
||||||
reservationDeliveryDetailsLink.setBox(customerDeliveryDetail.getBoxCount());
|
reservationDeliveryDetailsLink.setBox(customerDeliveryDetail.getBoxCount());
|
||||||
reservationDeliveryDetailsLink.setBag(customerDeliveryDetail.getPackageCount());
|
reservationDeliveryDetailsLink.setBag(customerDeliveryDetail.getPackageCount());
|
||||||
reservationDeliveryDetailsLink.setCategory(customerDeliveryDetail.getCategory());
|
reservationDeliveryDetailsLink.setCategory(customerDeliveryDetail.getCategory());
|
||||||
|
|||||||
-4
@@ -234,10 +234,6 @@ public class ReservationStockInOrderApplicationService {
|
|||||||
if (stockInOrderPO == null) {
|
if (stockInOrderPO == null) {
|
||||||
throw new ServiceException("入库单不存在,入库单ID:" + inOrderId);
|
throw new ServiceException("入库单不存在,入库单ID:" + inOrderId);
|
||||||
}
|
}
|
||||||
// 只有已创建状态(status = 1)的入库单可以删除
|
|
||||||
if (stockInOrderPO.getStatus() == null || !stockInOrderPO.getStatus().equals(1)) {
|
|
||||||
throw new ServiceException("只有已创建状态的入库单可以删除,入库单号:" + stockInOrderPO.getInOrderNumber() + ",当前状态:" + getStatusName(stockInOrderPO.getStatus()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return stockInOrderDomainService.delete(inOrderIds);
|
return stockInOrderDomainService.delete(inOrderIds);
|
||||||
|
|||||||
+3
@@ -6,6 +6,7 @@ import com.mhd.oms.domain.reservationOutMaterialDetail.repository.po.Reservation
|
|||||||
import com.mhd.oms.domain.reservationStockOutOrder.entity.ReservationStockOutOrder;
|
import com.mhd.oms.domain.reservationStockOutOrder.entity.ReservationStockOutOrder;
|
||||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.po.ReservationStockOutOrderPO;
|
import com.mhd.oms.domain.reservationStockOutOrder.repository.po.ReservationStockOutOrderPO;
|
||||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
//import com.mhd.wms.domain.stockOutOrder.entity.ReservationStockOutOrder;
|
//import com.mhd.wms.domain.stockOutOrder.entity.ReservationStockOutOrder;
|
||||||
//import com.mhd.wms.domain.stockOutOrder.repository.po.ReservationStockOutOrderPO;
|
//import com.mhd.wms.domain.stockOutOrder.repository.po.ReservationStockOutOrderPO;
|
||||||
//import com.mhd.wms.domain.stockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
//import com.mhd.wms.domain.stockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||||
@@ -34,4 +35,6 @@ public interface ReservationStockOutOrderMapper extends BaseMapper<ReservationSt
|
|||||||
* 出库单提货单打印-明细
|
* 出库单提货单打印-明细
|
||||||
*/
|
*/
|
||||||
List<ReservationOutMaterialDetailPO> queryOutStockNoticePrintDetail(ReservationStockOutOrderDO stockOutOrderDO);
|
List<ReservationOutMaterialDetailPO> queryOutStockNoticePrintDetail(ReservationStockOutOrderDO stockOutOrderDO);
|
||||||
|
|
||||||
|
Long queryShipperId(@Param("userMemberCode") String userMemberCode,@Param("organizationId") Long organizationId);
|
||||||
}
|
}
|
||||||
@@ -18,15 +18,15 @@ spring:
|
|||||||
discovery:
|
discovery:
|
||||||
# server-addr: 127.0.0.1:8848
|
# 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
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# 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
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
|
|||||||
+4
@@ -466,4 +466,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="boxPalletNo" column="box_pallet_no"/>
|
<result property="boxPalletNo" column="box_pallet_no"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="queryShipperId" resultType="java.lang.Long">
|
||||||
|
select max(user_id) as user_id from NGWL_TEST_USER."USER" where ORGANIZATION_ID = #{organizationId} and USER_MEMBER_CODE = #{userMemberCode} and DEL_FLAG = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
+8
-30
@@ -8,7 +8,6 @@ import com.linke.thirdParty.domain.departInterfaceInfo.repository.mapper.SysDepa
|
|||||||
import com.mhd.common.core.domain.thirdparty.MdmMerchantQueryDTO;
|
import com.mhd.common.core.domain.thirdparty.MdmMerchantQueryDTO;
|
||||||
import com.mhd.common.core.domain.thirdparty.MdmMerchantQueryResultDTO;
|
import com.mhd.common.core.domain.thirdparty.MdmMerchantQueryResultDTO;
|
||||||
import com.mhd.common.core.domain.thirdparty.MdmMerchantRecordDTO;
|
import com.mhd.common.core.domain.thirdparty.MdmMerchantRecordDTO;
|
||||||
import com.mhd.common.core.domain.thirdparty.MdmMerchantSyncFilter;
|
|
||||||
import com.mhd.common.core.exception.ServiceException;
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
import com.mhd.common.core.utils.StringUtils;
|
import com.mhd.common.core.utils.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -24,7 +23,6 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 北京三维天地 MDM 客商主数据查询
|
* 北京三维天地 MDM 客商主数据查询
|
||||||
@@ -42,35 +40,10 @@ public class MdmMasterDataApplicationService {
|
|||||||
public MdmMerchantQueryResultDTO queryMerchant(MdmMerchantQueryDTO queryDTO) {
|
public MdmMerchantQueryResultDTO queryMerchant(MdmMerchantQueryDTO queryDTO) {
|
||||||
MdmConfig config = loadConfig();
|
MdmConfig config = loadConfig();
|
||||||
String requestBody = buildRequestBody(queryDTO);
|
String requestBody = buildRequestBody(queryDTO);
|
||||||
log.info("MDM客商查询请求 orgNcCode={}, page={}, lastTime={}",
|
log.info("MDM客商查询请求 orgNcCode={}, page={}, lastTime={}, body={}",
|
||||||
queryDTO.getOrgNcCode(), queryDTO.getCurrentPage(), queryDTO.getLastModifyRecordTime());
|
queryDTO.getOrgNcCode(), queryDTO.getCurrentPage(), queryDTO.getLastModifyRecordTime(), requestBody);
|
||||||
String responseBody = doPost(config.url, config.usercode, config.password, requestBody);
|
String responseBody = doPost(config.url, config.usercode, config.password, requestBody);
|
||||||
MdmMerchantQueryResultDTO result = parseResponse(responseBody);
|
MdmMerchantQueryResultDTO result = parseResponse(responseBody);
|
||||||
return applyOrgFilter(queryDTO, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按组织NC编码匹配客商CODE,过滤无关数据并修正分页描述。
|
|
||||||
*/
|
|
||||||
private MdmMerchantQueryResultDTO applyOrgFilter(MdmMerchantQueryDTO queryDTO, MdmMerchantQueryResultDTO result) {
|
|
||||||
if (result == null || StringUtils.isEmpty(queryDTO.getOrgNcCode())
|
|
||||||
|| result.getDataInfo() == null || result.getDataInfo().isEmpty()) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String orgNcCode = queryDTO.getOrgNcCode().trim();
|
|
||||||
int rawCount = result.getDataInfo().size();
|
|
||||||
List<MdmMerchantRecordDTO> filtered = result.getDataInfo().stream()
|
|
||||||
.filter(record -> orgNcCode.equals(record.getCode()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
result.setDataInfo(filtered);
|
|
||||||
if (rawCount != filtered.size()) {
|
|
||||||
String note = String.format(
|
|
||||||
"(MDM原始%d条,按CODE=%s过滤后%d条;MDM总条数totalNumber为未过滤全库统计)",
|
|
||||||
rawCount, orgNcCode, filtered.size());
|
|
||||||
result.setDesc(StringUtils.isEmpty(result.getDesc()) ? note : result.getDesc() + note);
|
|
||||||
log.info("MDM客商查询应用侧过滤 orgNcCode={}, rawPageSize={}, filteredPageSize={}, mdmTotalNumber={}",
|
|
||||||
orgNcCode, rawCount, filtered.size(), result.getTotalNumber());
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +85,10 @@ public class MdmMasterDataApplicationService {
|
|||||||
if (StringUtils.isNotEmpty(queryDTO.getLastModifyRecordTime())) {
|
if (StringUtils.isNotEmpty(queryDTO.getLastModifyRecordTime())) {
|
||||||
dataInfoItem.put("LASTMODIFYRECORDTIME", queryDTO.getLastModifyRecordTime());
|
dataInfoItem.put("LASTMODIFYRECORDTIME", queryDTO.getLastModifyRecordTime());
|
||||||
}
|
}
|
||||||
|
// 按单位编码模糊过滤(MDM的DESC17支持LIKE语法)
|
||||||
|
if (StringUtils.isNotEmpty(queryDTO.getOrgNcCode())) {
|
||||||
|
dataInfoItem.put("DESC17", "%%" + queryDTO.getOrgNcCode().trim() + "%%");
|
||||||
|
}
|
||||||
|
|
||||||
JSONArray dataInfoArray = new JSONArray();
|
JSONArray dataInfoArray = new JSONArray();
|
||||||
dataInfoArray.add(dataInfoItem);
|
dataInfoArray.add(dataInfoItem);
|
||||||
@@ -142,7 +119,7 @@ public class MdmMasterDataApplicationService {
|
|||||||
conn = (HttpURLConnection) new URL(url).openConnection();
|
conn = (HttpURLConnection) new URL(url).openConnection();
|
||||||
conn.setRequestMethod("POST");
|
conn.setRequestMethod("POST");
|
||||||
conn.setConnectTimeout(30000);
|
conn.setConnectTimeout(30000);
|
||||||
conn.setReadTimeout(60000);
|
conn.setReadTimeout(300000);
|
||||||
conn.setDoOutput(true);
|
conn.setDoOutput(true);
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
||||||
@@ -233,6 +210,7 @@ public class MdmMasterDataApplicationService {
|
|||||||
record.setDesc14(item.getString("DESC14"));
|
record.setDesc14(item.getString("DESC14"));
|
||||||
record.setDesc15(item.getString("DESC15"));
|
record.setDesc15(item.getString("DESC15"));
|
||||||
record.setDesc16(item.getString("DESC16"));
|
record.setDesc16(item.getString("DESC16"));
|
||||||
|
record.setDesc17(item.getString("DESC17"));
|
||||||
record.setDesc23(item.getString("DESC23"));
|
record.setDesc23(item.getString("DESC23"));
|
||||||
record.setDesc24(item.getString("DESC24"));
|
record.setDesc24(item.getString("DESC24"));
|
||||||
record.setDesc25(item.getString("DESC25"));
|
record.setDesc25(item.getString("DESC25"));
|
||||||
|
|||||||
@@ -14,18 +14,18 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# server-addr: 127.0.0.1:8848
|
# 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
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
# server-addr: 10.102.192.105:6848
|
# server-addr: 10.102.192.105:6848
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# 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
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
|
|||||||
Reference in New Issue
Block a user