mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
创建企业用户账号逻辑优化
This commit is contained in:
@@ -571,8 +571,26 @@ public class AdapayService {
|
|||||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
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();
|
Map<String, Object> memberParams = Maps.newHashMap();
|
||||||
String adapayMemberId = Constants.ADAPAY_CORP_MEMBER_PREFIX + IdUtils.getMemberId();
|
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("member_id", adapayMemberId);
|
||||||
memberParams.put("app_id", config.getAdapayAppId());
|
memberParams.put("app_id", config.getAdapayAppId());
|
||||||
memberParams.put("order_no", "jsdk_order" + System.currentTimeMillis());
|
memberParams.put("order_no", "jsdk_order" + System.currentTimeMillis());
|
||||||
@@ -602,15 +620,6 @@ public class AdapayService {
|
|||||||
throw new BusinessException("", (String) member.get("error_msg"));
|
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());
|
Map<String, Object> settleCount = createSettleAccountRequest(dto, adapayMemberId, dto.getWechatAppId());
|
||||||
|
|
||||||
@@ -619,13 +628,9 @@ public class AdapayService {
|
|||||||
throw new BusinessException("00500001", errorMsg);
|
throw new BusinessException("00500001", errorMsg);
|
||||||
}
|
}
|
||||||
String settleAccountId = (String) settleCount.get("id");
|
String settleAccountId = (String) settleCount.get("id");
|
||||||
// 保存到数据库
|
// 更新数据库
|
||||||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
|
||||||
adapayMemberAccount.setMerchantId(dto.getMerchantId());
|
|
||||||
adapayMemberAccount.setAdapayMemberId(adapayMemberId);
|
|
||||||
adapayMemberAccount.setSettleAccountId(settleAccountId);
|
adapayMemberAccount.setSettleAccountId(settleAccountId);
|
||||||
adapayMemberAccount.setStatus(Constants.ZERO);
|
adapayMemberAccountService.updateAdapayMemberAccount(adapayMemberAccount);
|
||||||
adapayMemberAccountService.insertAdapayMemberAccount(adapayMemberAccount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user