mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 汇付会员账户表实体类
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package com.jsowell.adapay.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.Member;
|
||||
@@ -13,13 +10,14 @@ import com.jsowell.adapay.response.QueryMemberResponse;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
import com.jsowell.adapay.vo.AdapayMemberVO;
|
||||
import com.jsowell.adapay.vo.AdapaySettleAccountVO;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
import com.jsowell.pile.domain.AdapayMemberInfo;
|
||||
import com.jsowell.pile.domain.AdapaySettleAccount;
|
||||
import com.jsowell.pile.service.AdapayMemberInfoService;
|
||||
import com.jsowell.pile.service.IAdapayMemberAccountService;
|
||||
import com.jsowell.pile.service.IAdapaySettleAccountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -45,6 +43,9 @@ public class AdapayMemberService {
|
||||
@Autowired
|
||||
private IAdapaySettleAccountService adapaySettleAccountService;
|
||||
|
||||
@Autowired
|
||||
private IAdapayMemberAccountService adapayMemberAccountService;
|
||||
|
||||
/**
|
||||
* 创建汇付会员
|
||||
* @param dto
|
||||
@@ -52,13 +53,14 @@ public class AdapayMemberService {
|
||||
*/
|
||||
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
|
||||
public void createMember(AdapayMemberInfoDTO dto) throws Exception {
|
||||
AdapayMemberInfo adapayMemberInfo = adapayMemberInfoService.selectByMerchantId(dto.getMerchantId());
|
||||
if (adapayMemberInfo != null) {
|
||||
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
||||
if (adapayMemberAccount != null) {
|
||||
return;
|
||||
}
|
||||
log.info("=======execute CreateMember begin=======");
|
||||
Map<String, Object> memberParams = Maps.newHashMap();
|
||||
memberParams.put("member_id", "AM" + IdUtils.getMemberId());
|
||||
String adapayMemberId = "AM" + IdUtils.getMemberId();
|
||||
memberParams.put("member_id", adapayMemberId);
|
||||
memberParams.put("app_id", ADAPAY_APP_ID);
|
||||
memberParams.put("location", dto.getLocation());
|
||||
memberParams.put("email", dto.getEmail());
|
||||
@@ -73,17 +75,8 @@ public class AdapayMemberService {
|
||||
String errorMsg = member == null ? "创建汇付用户失败" : (String) member.get("error_msg");
|
||||
throw new BusinessException("00500001", errorMsg);
|
||||
}
|
||||
// 创建成功保存到数据库
|
||||
JSONObject jsonObject = JSON.parseObject(String.valueOf(member));
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
||||
adapayMemberInfo = mapper.readValue(jsonObject.toJSONString(), AdapayMemberInfo.class);
|
||||
adapayMemberInfo.setMerchantId(dto.getMerchantId());
|
||||
adapayMemberInfoService.insert(adapayMemberInfo);
|
||||
|
||||
dto.setAdapayMemberId(adapayMemberInfo.getMemberId());
|
||||
// 创建结算账户
|
||||
// createSettleAccount(dto);
|
||||
Map<String, Object> accountInfo = Maps.newHashMap();
|
||||
// 银行卡号
|
||||
accountInfo.put("card_id", dto.getCardId());
|
||||
@@ -105,7 +98,7 @@ public class AdapayMemberService {
|
||||
accountInfo.put("area_code", dto.getAreaCode());
|
||||
|
||||
Map<String, Object> settleCountParams = Maps.newHashMap();
|
||||
settleCountParams.put("member_id", dto.getAdapayMemberId());
|
||||
settleCountParams.put("member_id", adapayMemberId);
|
||||
settleCountParams.put("app_id", ADAPAY_APP_ID);
|
||||
// channel String Y 目前仅支持:bank_account(银行卡)
|
||||
settleCountParams.put("channel", "bank_account");
|
||||
@@ -117,22 +110,14 @@ public class AdapayMemberService {
|
||||
String errorMsg = settleCount == null ? "创建汇付结算账户失败" : (String) settleCount.get("error_msg");
|
||||
throw new BusinessException("00500001", errorMsg);
|
||||
}
|
||||
JSONObject account_info = JSON.parseObject((String) settleCount.get("account_info"));
|
||||
|
||||
AdapaySettleAccount adapaySettleAccount = new AdapaySettleAccount();
|
||||
adapaySettleAccount.setSettleAccountId((String) settleCount.get("id"));
|
||||
adapaySettleAccount.setMerchantId(dto.getMerchantId());
|
||||
adapaySettleAccount.setAdapayMemberId(dto.getAdapayMemberId());
|
||||
adapaySettleAccount.setCardId(dto.getCardId());
|
||||
adapaySettleAccount.setCardName(dto.getCardName());
|
||||
adapaySettleAccount.setCertId(dto.getCertId());
|
||||
adapaySettleAccount.setCertType(Constants.DOUBLE_ZERO);
|
||||
adapaySettleAccount.setTelNo(dto.getTelNo());
|
||||
adapaySettleAccount.setBankAcctType(dto.getBankAcctType());
|
||||
adapaySettleAccount.setBankCode(account_info.getString("bank_code"));
|
||||
adapaySettleAccount.setProvCode(account_info.getString("prov_code"));
|
||||
adapaySettleAccount.setAreaCode(account_info.getString("area_code"));
|
||||
adapaySettleAccountService.insertAdapaySettleAccount(adapaySettleAccount);
|
||||
String settleAccountId = (String) settleCount.get("id");
|
||||
// 保存到数据库
|
||||
adapayMemberAccount = new AdapayMemberAccount();
|
||||
adapayMemberAccount.setMerchantId(dto.getMerchantId());
|
||||
adapayMemberAccount.setAdapayMemberId(adapayMemberId);
|
||||
adapayMemberAccount.setSettleAccountId(settleAccountId);
|
||||
adapayMemberAccountService.insertAdapayMemberAccount(adapayMemberAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,4 +60,6 @@ public interface AdapayMemberAccountMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAdapayMemberAccountByIds(Long[] ids);
|
||||
|
||||
AdapayMemberAccount selectByMerchantId(String merchantId);
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface IAdapayMemberAccountService {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAdapayMemberAccountById(Long id);
|
||||
|
||||
AdapayMemberAccount selectByMerchantId(String merchantId);
|
||||
}
|
||||
|
||||
@@ -87,4 +87,9 @@ public class AdapayMemberAccountServiceImpl implements IAdapayMemberAccountServi
|
||||
public int deleteAdapayMemberAccountById(Long id) {
|
||||
return adapayMemberAccountMapper.deleteAdapayMemberAccountById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdapayMemberAccount selectByMerchantId(String merchantId) {
|
||||
return adapayMemberAccountMapper.selectByMerchantId(merchantId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user