mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
支付宝登录
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.util.PageUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -13,6 +14,7 @@ import com.huifu.adapay.model.Payment;
|
||||
import com.jsowell.adapay.common.CreateAdaPaymentParam;
|
||||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
import com.jsowell.alipay.service.AliAppletRemoteService;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.UserConstants;
|
||||
@@ -76,6 +78,9 @@ public class MemberService {
|
||||
@Autowired
|
||||
private WxAppletRemoteService wxAppletRemoteService;
|
||||
|
||||
@Autowired
|
||||
private AliAppletRemoteService aliAppletRemoteService;
|
||||
|
||||
@Autowired
|
||||
private MemberPlateNumberRelationService memberPlateNumberRelationService;
|
||||
|
||||
@@ -146,9 +151,12 @@ public class MemberService {
|
||||
if (StringUtils.isBlank(firstLevelMerchantId)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_MERCHANT_ID_BY_APP_ID_ERROR);
|
||||
}
|
||||
if (StringUtils.isBlank(openId)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_OPEN_ID_IS_NULL_ERROR);
|
||||
}
|
||||
|
||||
// 2024年6月11日15点37分 支付宝没有openid,改为不校验openid
|
||||
// if (StringUtils.isBlank(openId)) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_OPEN_ID_IS_NULL_ERROR);
|
||||
// }
|
||||
|
||||
// 查询手机号码是否注册过
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumber(phoneNumber, firstLevelMerchantId);
|
||||
if (Objects.isNull(memberBasicInfo)) {
|
||||
@@ -160,7 +168,9 @@ public class MemberService {
|
||||
memberBasicInfo.setNickName("会员" + memberId);
|
||||
memberBasicInfo.setMobileNumber(phoneNumber);
|
||||
memberBasicInfo.setMerchantId(Long.valueOf(firstLevelMerchantId));
|
||||
memberBasicInfo.setOpenId(openId);
|
||||
if (StringUtils.isBlank(openId)) {
|
||||
memberBasicInfo.setOpenId(openId);
|
||||
}
|
||||
|
||||
MemberTransactionDTO memberTransactionDTO = new MemberTransactionDTO();
|
||||
memberTransactionDTO.setMemberBasicInfo(memberBasicInfo);
|
||||
@@ -208,26 +218,28 @@ public class MemberService {
|
||||
if (StringUtils.isBlank(mobileNumber)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_GET_MOBILE_NUMBER_BY_CODE_ERROR);
|
||||
}
|
||||
// 通过appid获取运营商id
|
||||
// String merchantId = pileMerchantInfoService.getMerchantIdByAppId(dto.getAppId());
|
||||
// if (Objects.isNull(merchantId)) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_GET_MERCHANT_ID_BY_APP_ID_ERROR);
|
||||
// }
|
||||
// 通过code获取openId
|
||||
String openId = "";
|
||||
try {
|
||||
openId = getOpenIdByCode(dto.getOpenIdCode());
|
||||
openId = wxAppletRemoteService.getOpenIdByCode(dto.getOpenIdCode());
|
||||
} catch (Exception e) {
|
||||
log.error("getOpenIdByCode发生异常", e);
|
||||
}
|
||||
// 根据appid查询merchantId
|
||||
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(APP_ID);
|
||||
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(dto.getAppId());
|
||||
// 查询手机号码是否注册过
|
||||
return memberRegisterAndLogin(mobileNumber, firstLevelMerchantId, openId);
|
||||
}
|
||||
|
||||
public String alipayLogin(WechatLoginDTO dto) {
|
||||
return "";
|
||||
public String alipayLogin(AlipayLoginDTO dto) throws Exception {
|
||||
// 通过密文解密 获取手机号码
|
||||
String mobileNumber = Factory.Util.AES().decrypt(dto.getMobileNumberCiphertext());
|
||||
|
||||
// 根据appid查询merchantId
|
||||
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(dto.getAppId());
|
||||
|
||||
// 查询手机号码是否注册过
|
||||
return memberRegisterAndLogin(mobileNumber, firstLevelMerchantId, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,9 +247,9 @@ public class MemberService {
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public String getOpenIdByCode(String code) {
|
||||
return wxAppletRemoteService.getOpenIdByCode(code);
|
||||
}
|
||||
// public String getOpenIdByCode(String code) {
|
||||
// return wxAppletRemoteService.getOpenIdByCode(code);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 处理用户信息
|
||||
|
||||
Reference in New Issue
Block a user