diff --git a/jsowell-admin/src/main/java/com/jsowell/service/AgentDevService.java b/jsowell-admin/src/main/java/com/jsowell/service/AgentDevService.java index 0403a85f7..5ecc66bff 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/AgentDevService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/AgentDevService.java @@ -633,7 +633,7 @@ public class AgentDevService { // 获取openId String openId = getOpenIdByCode(dto.getOpenIdCode(), appId); // 通过 appid 查询 merchantId - String merchantId = pileMerchantInfoService.getMerchantIdByAppId(appId); + String merchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(appId); logger.info("微信一键登录 获取merchantId:{}", merchantId); // 下面方法有判断 merchantId 是否为空,因此可直接传值 return memberService.memberRegisterAndLogin(phoneNumber, merchantId, openId); diff --git a/jsowell-admin/src/main/java/com/jsowell/service/MemberService.java b/jsowell-admin/src/main/java/com/jsowell/service/MemberService.java index fc6401ec0..97980cb66 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/MemberService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/MemberService.java @@ -207,7 +207,7 @@ public class MemberService { log.error("getOpenIdByCode发生异常", e); } // 根据appid查询merchantId - String merchantId = pileMerchantInfoService.getMerchantIdByAppId(APP_ID); + String merchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(APP_ID); // 查询手机号码是否注册过 return memberRegisterAndLogin(mobileNumber, merchantId, openId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java index 28be2bdeb..bc4de775d 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java @@ -89,4 +89,11 @@ public interface PileMerchantInfoMapper { * 查询一级运营商 */ List queryFirstLevelMerchant(); + + /** + * 根据appid查询对应一级运营商id + * @param appId + * @return + */ + String getFirstLevelMerchantIdByAppId(String appId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java index 488864d5d..127cd7b20 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java @@ -64,9 +64,12 @@ public interface IPileMerchantInfoService { */ public int deletePileMerchantInfoById(Long id); - String getMerchantIdByAppId(String appId); - - List getMerchantIdsByAppId(String appId); + /** + * 获取一级运营商merchantId + * @param appId + * @return + */ + String getFirstLevelMerchantIdByAppId(String appId); MerchantInfoVO getMerchantInfo(String merchantId); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java index d92ac4477..930664435 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java @@ -253,14 +253,14 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService { } @Override - public String getMerchantIdByAppId(String appId) { + public String getFirstLevelMerchantIdByAppId(String appId) { if (StringUtils.isBlank(appId)) { return null; } try { - List pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoByAppId(appId); - if (CollectionUtils.isNotEmpty(pileMerchantInfos)) { - return pileMerchantInfos.get(0).getId().toString(); + String merchantId = pileMerchantInfoMapper.getFirstLevelMerchantIdByAppId(appId); + if (StringUtils.isNotBlank(merchantId)) { + return merchantId; } } catch (Exception e) { log.error("通过appid获取运营商id error", e); @@ -268,23 +268,6 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService { return null; } - @Override - public List getMerchantIdsByAppId(String appId) { - if (StringUtils.isBlank(appId)) { - return null; - } - List resultList = Lists.newArrayList(); - try { - List pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoByAppId(appId); - if (CollectionUtils.isNotEmpty(pileMerchantInfos)) { - resultList = pileMerchantInfos.stream().map(x -> String.valueOf(x.getId())).collect(Collectors.toList()); - } - } catch (Exception e) { - log.error("通过appid获取运营商ids error", e); - } - return resultList; - } - @Override public MerchantInfoVO getMerchantInfo(String merchantId) { PileMerchantInfo pileMerchantInfo = selectPileMerchantInfoById(Long.parseLong(merchantId)); diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml index 9cf85548f..dac8f655e 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml @@ -333,4 +333,14 @@ where del_flag = '0' and merchant_level = '1' + + \ No newline at end of file