This commit is contained in:
2023-08-04 14:32:09 +08:00
7 changed files with 30 additions and 26 deletions

View File

@@ -633,7 +633,7 @@ public class AgentDevService {
// 获取openId // 获取openId
String openId = getOpenIdByCode(dto.getOpenIdCode(), appId); String openId = getOpenIdByCode(dto.getOpenIdCode(), appId);
// 通过 appid 查询 merchantId // 通过 appid 查询 merchantId
String merchantId = pileMerchantInfoService.getMerchantIdByAppId(appId); String merchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(appId);
logger.info("微信一键登录 获取merchantId:{}", merchantId); logger.info("微信一键登录 获取merchantId:{}", merchantId);
// 下面方法有判断 merchantId 是否为空,因此可直接传值 // 下面方法有判断 merchantId 是否为空,因此可直接传值
return memberService.memberRegisterAndLogin(phoneNumber, merchantId, openId); return memberService.memberRegisterAndLogin(phoneNumber, merchantId, openId);

View File

@@ -207,7 +207,7 @@ public class MemberService {
log.error("getOpenIdByCode发生异常", e); log.error("getOpenIdByCode发生异常", e);
} }
// 根据appid查询merchantId // 根据appid查询merchantId
String merchantId = pileMerchantInfoService.getMerchantIdByAppId(APP_ID); String merchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(APP_ID);
// 查询手机号码是否注册过 // 查询手机号码是否注册过
return memberRegisterAndLogin(mobileNumber, merchantId, openId); return memberRegisterAndLogin(mobileNumber, merchantId, openId);
} }

View File

@@ -89,4 +89,11 @@ public interface PileMerchantInfoMapper {
* 查询一级运营商 * 查询一级运营商
*/ */
List<PileMerchantInfo> queryFirstLevelMerchant(); List<PileMerchantInfo> queryFirstLevelMerchant();
/**
* 根据appid查询对应一级运营商id
* @param appId
* @return
*/
String getFirstLevelMerchantIdByAppId(String appId);
} }

View File

@@ -64,9 +64,12 @@ public interface IPileMerchantInfoService {
*/ */
public int deletePileMerchantInfoById(Long id); public int deletePileMerchantInfoById(Long id);
String getMerchantIdByAppId(String appId); /**
* 获取一级运营商merchantId
List<String> getMerchantIdsByAppId(String appId); * @param appId
* @return
*/
String getFirstLevelMerchantIdByAppId(String appId);
MerchantInfoVO getMerchantInfo(String merchantId); MerchantInfoVO getMerchantInfo(String merchantId);

View File

@@ -259,14 +259,14 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
} }
@Override @Override
public String getMerchantIdByAppId(String appId) { public String getFirstLevelMerchantIdByAppId(String appId) {
if (StringUtils.isBlank(appId)) { if (StringUtils.isBlank(appId)) {
return null; return null;
} }
try { try {
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoByAppId(appId); String merchantId = pileMerchantInfoMapper.getFirstLevelMerchantIdByAppId(appId);
if (CollectionUtils.isNotEmpty(pileMerchantInfos)) { if (StringUtils.isNotBlank(merchantId)) {
return pileMerchantInfos.get(0).getId().toString(); return merchantId;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("通过appid获取运营商id error", e); log.error("通过appid获取运营商id error", e);
@@ -274,23 +274,6 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
return null; return null;
} }
@Override
public List<String> getMerchantIdsByAppId(String appId) {
if (StringUtils.isBlank(appId)) {
return null;
}
List<String> resultList = Lists.newArrayList();
try {
List<PileMerchantInfo> 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 @Override
public MerchantInfoVO getMerchantInfo(String merchantId) { public MerchantInfoVO getMerchantInfo(String merchantId) {
PileMerchantInfo pileMerchantInfo = selectPileMerchantInfoById(Long.parseLong(merchantId)); PileMerchantInfo pileMerchantInfo = selectPileMerchantInfoById(Long.parseLong(merchantId));

View File

@@ -44,6 +44,7 @@
<if test="totalServiceAmount != null "> and total_service_amount = #{totalServiceAmount}</if> <if test="totalServiceAmount != null "> and total_service_amount = #{totalServiceAmount}</if>
<if test="totalElecAmount != null "> and total_elec_amount = #{totalElecAmount}</if> <if test="totalElecAmount != null "> and total_elec_amount = #{totalElecAmount}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectOrderInvoiceRecordById" parameterType="Integer" resultMap="OrderInvoiceRecordResult"> <select id="selectOrderInvoiceRecordById" parameterType="Integer" resultMap="OrderInvoiceRecordResult">

View File

@@ -333,4 +333,14 @@
where del_flag = '0' where del_flag = '0'
and merchant_level = '1' and merchant_level = '1'
</select> </select>
<select id="getFirstLevelMerchantIdByAppId" resultType="java.lang.String">
select
id
from
pile_merchant_info
where
app_id = #{appId,jdbcType=VARCHAR}
and merchant_level = '1'
</select>
</mapper> </mapper>