diff --git a/mhd_thrid_party/src/main/java/com/linke/thirdParty/application/server/MdmMasterDataApplicationService.java b/mhd_thrid_party/src/main/java/com/linke/thirdParty/application/server/MdmMasterDataApplicationService.java index f31a7798d..c36a9a003 100644 --- a/mhd_thrid_party/src/main/java/com/linke/thirdParty/application/server/MdmMasterDataApplicationService.java +++ b/mhd_thrid_party/src/main/java/com/linke/thirdParty/application/server/MdmMasterDataApplicationService.java @@ -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 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 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; } diff --git a/mhd_thrid_party/src/main/java/com/linke/thirdParty/domain/departInterfaceInfo/repository/mapper/SysDepartInterfaceInfoMapper.java b/mhd_thrid_party/src/main/java/com/linke/thirdParty/domain/departInterfaceInfo/repository/mapper/SysDepartInterfaceInfoMapper.java index 5cbe55a13..6fbdef820 100644 --- a/mhd_thrid_party/src/main/java/com/linke/thirdParty/domain/departInterfaceInfo/repository/mapper/SysDepartInterfaceInfoMapper.java +++ b/mhd_thrid_party/src/main/java/com/linke/thirdParty/domain/departInterfaceInfo/repository/mapper/SysDepartInterfaceInfoMapper.java @@ -42,6 +42,13 @@ public interface SysDepartInterfaceInfoMapper extends BaseMapper 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 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 queryAllList(); @Select("select * from sys_depart_interface_info a where del_flag = 1")