This commit is contained in:
Lemon
2023-08-25 14:23:43 +08:00
4 changed files with 50 additions and 54 deletions

View File

@@ -160,6 +160,15 @@ public class AdapayService {
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
dto.setWechatAppId(wechatAppId);
String cardId = dto.getCardId();
String cardNo = dto.getCardNo();
if (StringUtils.isBlank(cardId) && StringUtils.isNotBlank(cardNo)) {
dto.setCardId(cardNo);
}
if (StringUtils.isBlank(cardNo) && StringUtils.isNotBlank(cardId)) {
dto.setCardNo(cardId);
}
if (StringUtils.equals(bankAcctType, Constants.ONE)) {
createCorpMember(dto);
} else if (StringUtils.equals(bankAcctType, Constants.TWO)) {
@@ -205,45 +214,6 @@ public class AdapayService {
throw new BusinessException("00500001", errorMsg);
}
/*// 创建结算账户
Map<String, Object> accountInfo = Maps.newHashMap();
// 银行卡号
accountInfo.put("card_id", dto.getCardId());
// 银行卡对应的户名
accountInfo.put("card_name", dto.getCardName());
// 证件号,银行账户类型为对私时,必填
if (StringUtils.isNotBlank(dto.getCertId())) {
accountInfo.put("cert_id", dto.getCertId());
}
// 证件类型仅支持00-身份证,银行账户类型为对私时,必填
accountInfo.put("cert_type", "00");
// 手机号
accountInfo.put("tel_no", dto.getTelNo());
// 银行编码,详见附录 银行代码,银行账户类型对公时,必填
if (StringUtils.isNotBlank(dto.getBankCode())) {
accountInfo.put("bank_code", dto.getBankCode());
}
// 银行账户类型1-对公2-对私
accountInfo.put("bank_acct_type", dto.getBankAcctType());
// 银行账户开户银行所在省份编码 (省市编码),银行账户类型为对公时,必填
if (StringUtils.isNotBlank(dto.getProvCode())) {
accountInfo.put("prov_code", dto.getProvCode());
}
// 银行账户开户银行所在地区编码(省市编码),银行账户类型为对公时,必填
if (StringUtils.isNotBlank(dto.getAreaCode())) {
accountInfo.put("area_code", dto.getAreaCode());
}
Map<String, Object> settleCountParams = Maps.newHashMap();
settleCountParams.put("member_id", adapayMemberId);
settleCountParams.put("app_id", config.getAdapayAppId());
// channel String Y 目前仅支持bank_account银行卡
settleCountParams.put("channel", "bank_account");
settleCountParams.put("account_info", accountInfo);
log.info("创建汇付结算账户param:{}", settleCountParams);
Map<String, Object> settleCount = SettleAccount.create(settleCountParams, config.getWechatAppId());
log.info("创建汇付结算账户result:{}", settleCount);*/
Map<String, Object> settleCount = createSettleAccountRequest(dto, adapayMemberId, dto.getWechatAppId());
if (settleCount == null || StringUtils.equals((String) settleCount.get("status"), "failed")) {
@@ -418,6 +388,7 @@ public class AdapayService {
Map<String, Object> accountInfo = Maps.newHashMap();
// 银行卡号
accountInfo.put("card_id", dto.getCardId());
accountInfo.put("card_no", dto.getCardNo());
// 银行卡对应的户名
accountInfo.put("card_name", dto.getCardName());
// 证件号,银行账户类型为对私时,必填
@@ -600,8 +571,26 @@ public class AdapayService {
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
}
// 逻辑删除原来审核不通过的记录
List<AdapayMemberAccount> accountList = adapayMemberAccountService.selectAdapayMemberAccountList(dto.getMerchantId());
if (CollectionUtils.isNotEmpty(accountList)) {
Long[] ids = accountList.stream()
.map(AdapayMemberAccount::getId)
.toArray(Long[]::new);
adapayMemberAccountService.deleteAdapayMemberAccountByIds(ids);
}
// 创建企业用户参数
Map<String, Object> memberParams = Maps.newHashMap();
String adapayMemberId = Constants.ADAPAY_CORP_MEMBER_PREFIX + IdUtils.getMemberId();
// 先保存一条记录
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
adapayMemberAccount.setMerchantId(dto.getMerchantId());
adapayMemberAccount.setAdapayMemberId(adapayMemberId);
adapayMemberAccount.setStatus(Constants.ZERO);
adapayMemberAccountService.insertAdapayMemberAccount(adapayMemberAccount);
memberParams.put("member_id", adapayMemberId);
memberParams.put("app_id", config.getAdapayAppId());
memberParams.put("order_no", "jsdk_order" + System.currentTimeMillis());
@@ -631,15 +620,6 @@ public class AdapayService {
throw new BusinessException("", (String) member.get("error_msg"));
}
// 逻辑删除原来审核不通过的记录
List<AdapayMemberAccount> accountList = adapayMemberAccountService.selectAdapayMemberAccountList(dto.getMerchantId());
if (CollectionUtils.isNotEmpty(accountList)) {
Long[] ids = accountList.stream()
.map(AdapayMemberAccount::getId)
.toArray(Long[]::new);
adapayMemberAccountService.deleteAdapayMemberAccountByIds(ids);
}
// 取消自动创建结算账户,手动创建结算账户
Map<String, Object> settleCount = createSettleAccountRequest(dto, adapayMemberId, dto.getWechatAppId());
@@ -648,13 +628,9 @@ public class AdapayService {
throw new BusinessException("00500001", errorMsg);
}
String settleAccountId = (String) settleCount.get("id");
// 保存到数据库
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
adapayMemberAccount.setMerchantId(dto.getMerchantId());
adapayMemberAccount.setAdapayMemberId(adapayMemberId);
// 更新数据库
adapayMemberAccount.setSettleAccountId(settleAccountId);
adapayMemberAccount.setStatus(Constants.ZERO);
adapayMemberAccountService.insertAdapayMemberAccount(adapayMemberAccount);
adapayMemberAccountService.updateAdapayMemberAccount(adapayMemberAccount);
}
/**

View File

@@ -32,6 +32,11 @@ public class PileMerchantInfo extends BaseEntity {
*/
private String merchantLevel;
/**
* 延时分账模式0-不延时1-延时分账)
*/
private String delayMode;
/**
* 父级运营商id
*/

View File

@@ -2847,6 +2847,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
* 余额支付订单分账工具
*/
public void splitTheBillForOrderTemp(AdapayMemberAccount adapayMemberAccount, OrderBasicInfo orderBasicInfo, String wechatAppId) throws BaseAdaPayException {
logger.info("");
// 查询会员余额支付记录
List<MemberAdapayRecord> recordList = memberAdapayRecordService.selectAdapayRecordList(orderBasicInfo.getMemberId(), ScenarioEnum.BALANCE.getValue());
if (CollectionUtils.isEmpty(recordList)) {