mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
updateupdate 汇付会员账户表实体类
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.adapay.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.Member;
|
||||
@@ -8,7 +9,7 @@ import com.huifu.adapay.model.SettleAccount;
|
||||
import com.jsowell.adapay.dto.AdapayMemberInfoDTO;
|
||||
import com.jsowell.adapay.response.QueryMemberResponse;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
import com.jsowell.adapay.vo.AdapayMemberVO;
|
||||
import com.jsowell.adapay.vo.AdapayMemberInfoVO;
|
||||
import com.jsowell.adapay.vo.AdapaySettleAccountVO;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -114,38 +115,97 @@ public class AdapayMemberService {
|
||||
* @param merchantId
|
||||
* @return
|
||||
*/
|
||||
public AdapayMemberVO selectAdapayMember(String merchantId) {
|
||||
AdapayMemberVO resultVO = new AdapayMemberVO();
|
||||
public Map<String, Object> selectAdapayMember(String merchantId) throws BaseAdaPayException {
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(merchantId);
|
||||
if (adapayMemberAccount == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return resultVO;
|
||||
String adapayMemberId = adapayMemberAccount.getAdapayMemberId();
|
||||
String settleAccountId = adapayMemberAccount.getSettleAccountId();
|
||||
|
||||
AdapayMemberInfoVO adapayMemberInfoVO = queryAdapayMemberInfo(adapayMemberId);
|
||||
if (adapayMemberInfoVO != null) {
|
||||
adapayMemberInfoVO.setMerchantId(merchantId);
|
||||
}
|
||||
AdapaySettleAccountVO adapaySettleAccountVO = queryAdapaySettleAccount(adapayMemberId, settleAccountId);
|
||||
if (adapaySettleAccountVO != null) {
|
||||
adapaySettleAccountVO.setMerchantId(merchantId);
|
||||
}
|
||||
map.put("adapayMember", adapayMemberInfoVO);
|
||||
map.put("settleAccountList", Lists.newArrayList(adapaySettleAccountVO));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询汇付会员信息
|
||||
*/
|
||||
public void queryAdapayMemberInfo(String adapayMemberId) throws BaseAdaPayException {
|
||||
public AdapayMemberInfoVO queryAdapayMemberInfo(String adapayMemberId) throws BaseAdaPayException {
|
||||
if (StringUtils.isBlank(adapayMemberId)) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> memberParams = Maps.newHashMap();
|
||||
memberParams.put("member_id", adapayMemberId);
|
||||
memberParams.put("app_id", ADAPAY_APP_ID);
|
||||
log.info("查询用户,请求参数:{}", JSON.toJSONString(memberParams));
|
||||
Map<String, Object> member = Member.query(memberParams);
|
||||
log.info("查询用户,返回参数:{}", JSON.toJSONString(member));
|
||||
|
||||
if (member == null || member.isEmpty() || !"succeeded".equals(member.get("status"))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryMemberResponse queryMemberResponse = JSON.parseObject(JSON.toJSONString(member), QueryMemberResponse.class);
|
||||
log.info("查询用户,返回参数:{}", JSON.toJSONString(queryMemberResponse));
|
||||
AdapayMemberInfoVO resultVO = AdapayMemberInfoVO.builder()
|
||||
.nickname(queryMemberResponse.getNickname())
|
||||
.gender(queryMemberResponse.getGender())
|
||||
.email(queryMemberResponse.getEmail())
|
||||
.location(queryMemberResponse.getLocation())
|
||||
.build();
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇付结算账户信息
|
||||
*/
|
||||
public void queryAdapaySettleAccount(String adapayMemberId, String settleAccountId) throws BaseAdaPayException {
|
||||
public AdapaySettleAccountVO queryAdapaySettleAccount(String adapayMemberId, String settleAccountId) throws BaseAdaPayException {
|
||||
if (StringUtils.isBlank(adapayMemberId) || StringUtils.isBlank(settleAccountId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, Object> settleCountParams = Maps.newHashMap();
|
||||
settleCountParams.put("settle_account_id", settleAccountId);
|
||||
settleCountParams.put("member_id", adapayMemberId);
|
||||
settleCountParams.put("app_id", ADAPAY_APP_ID);
|
||||
|
||||
log.info("查询汇付结算账户信息param:{}", JSON.toJSONString(settleCountParams));
|
||||
Map<String, Object> settleCount = SettleAccount.query(settleCountParams);
|
||||
QueryMemberResponse.SettleAccount settleAccount = JSON.parseObject(JSON.toJSONString(settleCount), QueryMemberResponse.SettleAccount.class);
|
||||
Map<String, Object> settleAccount = SettleAccount.query(settleCountParams);
|
||||
log.info("查询汇付结算账户信息result:{}", JSON.toJSONString(settleAccount));
|
||||
|
||||
if (settleAccount == null || settleAccount.isEmpty() || !"succeeded".equals(settleAccount.get("status"))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryMemberResponse.SettleAccount settleAccountInfo = JSON.parseObject(JSON.toJSONString(settleAccount), QueryMemberResponse.SettleAccount.class);
|
||||
QueryMemberResponse.AccountInfo accountInfo = settleAccountInfo.getAccount_info();
|
||||
|
||||
AdapaySettleAccountVO resultVO = AdapaySettleAccountVO.builder()
|
||||
.adapayMemberId(settleAccountInfo.getMember_id())
|
||||
.settleAccountId(settleAccountInfo.getId())
|
||||
.cardId(accountInfo.getCard_id())
|
||||
.cardName(accountInfo.getCard_name())
|
||||
.certId(accountInfo.getCert_id())
|
||||
.certType(accountInfo.getCert_type())
|
||||
.telNo(accountInfo.getTel_no())
|
||||
.bankName(accountInfo.getBank_name())
|
||||
.bankCode(accountInfo.getBank_code())
|
||||
.bankAcctType(accountInfo.getBank_acct_type())
|
||||
.provCode(accountInfo.getProv_code())
|
||||
.areaCode(accountInfo.getArea_code())
|
||||
.build();
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +225,7 @@ public class AdapayMemberService {
|
||||
queryParams.put("member_id", member_id);
|
||||
queryParams.put("app_id", ADAPAY_APP_ID);
|
||||
Map<String, Object> settleCount = SettleAccount.balance(queryParams);
|
||||
if (settleCount == null || settleCount.isEmpty() || "succeeded".equals(settleCount.get("status"))) {
|
||||
if (settleCount == null || settleCount.isEmpty() || !"succeeded".equals(settleCount.get("status"))) {
|
||||
return vo;
|
||||
}
|
||||
vo.setFrzBalance(new BigDecimal((String) settleCount.get("frz_balance")));
|
||||
|
||||
Reference in New Issue
Block a user