客商委托方数据同步修改

This commit is contained in:
秦鸿展
2026-06-08 16:16:05 +08:00
parent c59fa363ee
commit 536077ec3a
2 changed files with 32 additions and 20 deletions
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.linke.thirdParty.domain.departInterfaceInfo.entity.SysDepartInterfaceInfo;
import com.linke.thirdParty.domain.departInterfaceInfo.service.SysDepartInterfaceInfoDomainService;
import com.linke.thirdParty.domain.departInterfaceInfo.repository.mapper.SysDepartInterfaceInfoMapper;
import com.mhd.common.core.domain.thirdparty.MdmMerchantQueryDTO;
import com.mhd.common.core.domain.thirdparty.MdmMerchantQueryResultDTO;
import com.mhd.common.core.domain.thirdparty.MdmMerchantRecordDTO;
@@ -35,7 +35,7 @@ public class MdmMasterDataApplicationService {
private static final String DEFAULT_URL = "http://10.30.70.2/esbmule/services/query/mdm_nkks_query";
@Autowired
private SysDepartInterfaceInfoDomainService sysDepartInterfaceInfoDomainService;
private SysDepartInterfaceInfoMapper sysDepartInterfaceInfoMapper;
public MdmMerchantQueryResultDTO queryMerchant(MdmMerchantQueryDTO queryDTO) {
MdmConfig config = loadConfig();
@@ -49,27 +49,32 @@ public class MdmMasterDataApplicationService {
private MdmConfig loadConfig() {
MdmConfig config = new MdmConfig();
config.url = DEFAULT_URL;
List<SysDepartInterfaceInfo> list = sysDepartInterfaceInfoDomainService.queryListByInterfaceType(INTERFACE_TYPE);
for (SysDepartInterfaceInfo info : list) {
if (info == null || StringUtils.isEmpty(info.getInterfaceTypeKey())) {
continue;
}
switch (info.getInterfaceTypeKey()) {
case "url":
config.url = info.getInterfaceTypeValue();
break;
case "usercode":
config.usercode = info.getInterfaceTypeValue();
break;
case "password":
config.password = info.getInterfaceTypeValue();
break;
default:
break;
List<SysDepartInterfaceInfo> list = sysDepartInterfaceInfoMapper.queryConfigByInterfaceType(INTERFACE_TYPE);
log.info("MDM客商配置查询到 {} 条记录", list == null ? 0 : list.size());
if (list != null) {
for (SysDepartInterfaceInfo info : list) {
if (info == null || StringUtils.isEmpty(info.getInterfaceTypeKey())) {
continue;
}
String key = info.getInterfaceTypeKey().trim().toLowerCase();
switch (key) {
case "url":
config.url = info.getInterfaceTypeValue();
break;
case "usercode":
config.usercode = info.getInterfaceTypeValue();
break;
case "password":
config.password = info.getInterfaceTypeValue();
break;
default:
break;
}
}
}
if (StringUtils.isEmpty(config.usercode) || StringUtils.isEmpty(config.password)) {
throw new ServiceException("MDM客商接口未配置 usercode/password,请在三方接口配置中维护 interfaceType=mdm_merchant");
throw new ServiceException("MDM客商接口未配置 usercode/password,请在三方接口配置中维护 interfaceType=mdm_merchant"
+ "(当前查到 " + (list == null ? 0 : list.size()) + " 条配置)");
}
return config;
}
@@ -42,6 +42,13 @@ public interface SysDepartInterfaceInfoMapper extends BaseMapper<SysDepartInterf
*/
@Select("SELECT * FROM sys_depart_interface_info WHERE interface_type = #{interfaceType} and del_flag = 1")
public List<SysDepartInterfaceInfo> queryListByInterfaceType(String interfaceType);
/**
* 达梦库下 SELECT * 字段映射可能失败,显式别名保证 interfaceTypeKey/interfaceTypeValue 可读
*/
@Select("SELECT interface_type_key AS interfaceTypeKey, interface_type_value AS interfaceTypeValue "
+ "FROM sys_depart_interface_info WHERE interface_type = #{interfaceType} AND del_flag = 1")
List<SysDepartInterfaceInfo> queryConfigByInterfaceType(@Param("interfaceType") String interfaceType);
@Select("select a.interface_type_key,a.interface_type_value from sys_depart_interface_info a where del_flag = 1")
List<SysDepartInterfaceInfo> queryAllList();
@Select("select * from sys_depart_interface_info a where del_flag = 1")