mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-18 21:18:01 +08:00
update 优化汇付结算账户一致性
This commit is contained in:
@@ -237,9 +237,12 @@ public class AdapayMemberController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
adapayService.updateSettleAccountConfig(dto);
|
adapayService.updateSettleAccountConfig(dto);
|
||||||
result = AjaxResult.success();
|
result = AjaxResult.success();
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.warn("修改汇付结算配置warn", e);
|
||||||
|
result = AjaxResult.error(e.getMessage());
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
logger.error("查询汇付账户余额error", e);
|
logger.error("修改汇付结算配置error", e);
|
||||||
result = AjaxResult.error();
|
result = AjaxResult.error("修改汇付结算配置异常");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -254,9 +257,12 @@ public class AdapayMemberController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
adapayService.changeBankCard(dto);
|
adapayService.changeBankCard(dto);
|
||||||
result = AjaxResult.success();
|
result = AjaxResult.success();
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.warn("换绑银行卡warn", e);
|
||||||
|
result = AjaxResult.error(e.getMessage());
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
logger.error("换绑银行卡error", e);
|
logger.error("换绑银行卡error", e);
|
||||||
result = AjaxResult.error();
|
result = AjaxResult.error("换绑银行卡异常");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -292,12 +298,14 @@ public class AdapayMemberController extends BaseController {
|
|||||||
public AjaxResult deleteSettleAccount(@RequestBody AdapayMemberInfoDTO dto) {
|
public AjaxResult deleteSettleAccount(@RequestBody AdapayMemberInfoDTO dto) {
|
||||||
AjaxResult result = null;
|
AjaxResult result = null;
|
||||||
try {
|
try {
|
||||||
// 新写删除方法
|
|
||||||
adapayService.deleteSettleAccount(dto);
|
adapayService.deleteSettleAccount(dto);
|
||||||
result = AjaxResult.success();
|
result = AjaxResult.success();
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.warn("删除结算账户warn", e);
|
||||||
|
result = AjaxResult.error(e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("删除结算账户 error,", e);
|
logger.error("删除结算账户 error,", e);
|
||||||
result = AjaxResult.error();
|
result = AjaxResult.error("删除结算账户异常");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -314,9 +322,13 @@ public class AdapayMemberController extends BaseController {
|
|||||||
AjaxResult result = null;
|
AjaxResult result = null;
|
||||||
try {
|
try {
|
||||||
adapayService.createBankAccount(dto);
|
adapayService.createBankAccount(dto);
|
||||||
|
result = AjaxResult.success();
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.warn("重新创建结算账户warn", e);
|
||||||
|
result = AjaxResult.error(e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("重新创建结算账户 error, ", e);
|
logger.error("重新创建结算账户 error, ", e);
|
||||||
result = AjaxResult.error();
|
result = AjaxResult.error("重新创建结算账户异常");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public enum AdapayOpenActionEnum {
|
|||||||
UPDATE_CORP_MEMBER("UPDATE_CORP_MEMBER", "更新企业资料"),
|
UPDATE_CORP_MEMBER("UPDATE_CORP_MEMBER", "更新企业资料"),
|
||||||
RESUBMIT_CORP_MEMBER("RESUBMIT_CORP_MEMBER", "重新提交企业开户"),
|
RESUBMIT_CORP_MEMBER("RESUBMIT_CORP_MEMBER", "重新提交企业开户"),
|
||||||
CREATE_SETTLE_ACCOUNT("CREATE_SETTLE_ACCOUNT", "创建结算账户"),
|
CREATE_SETTLE_ACCOUNT("CREATE_SETTLE_ACCOUNT", "创建结算账户"),
|
||||||
|
UPDATE_SETTLE_ACCOUNT_CONFIG("UPDATE_SETTLE_ACCOUNT_CONFIG", "修改结算配置"),
|
||||||
DELETE_SETTLE_ACCOUNT("DELETE_SETTLE_ACCOUNT", "删除结算账户"),
|
DELETE_SETTLE_ACCOUNT("DELETE_SETTLE_ACCOUNT", "删除结算账户"),
|
||||||
DELETE_MEMBER("DELETE_MEMBER", "删除账户(本地解绑)");
|
DELETE_MEMBER("DELETE_MEMBER", "删除账户(本地解绑)");
|
||||||
|
|
||||||
|
|||||||
@@ -59,5 +59,8 @@ public class QueryMemberResponse extends AdapayBaseResponse{
|
|||||||
private String bank_acct_type;
|
private String bank_acct_type;
|
||||||
private String prov_code;
|
private String prov_code;
|
||||||
private String card_id;
|
private String card_id;
|
||||||
|
private String min_amt;
|
||||||
|
private String remained_amt;
|
||||||
|
private String channel_remark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,8 +327,11 @@ public class AdapayService {
|
|||||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||||
SettleAccountDTO request = buildSettleAccountDTO(dto);
|
SettleAccountDTO request = buildSettleAccountDTO(dto);
|
||||||
Map<String, Object> settleCount = createSettleAccountRequest(request, adapayMemberAccount.getAdapayMemberId(), wechatAppId);
|
Map<String, Object> settleCount = createSettleAccountRequest(request, adapayMemberAccount.getAdapayMemberId(), wechatAppId);
|
||||||
if (settleCount == null || StringUtils.equals((String) settleCount.get("status"), "failed")) {
|
if (settleCount == null
|
||||||
String errorMsg = settleCount == null ? "创建汇付结算账户失败" : (String) settleCount.get("error_msg");
|
|| !AdapayStatusEnum.SUCCEEDED.getValue().equals(settleCount.get("status"))
|
||||||
|
|| StringUtils.isBlank((String) settleCount.get("id"))) {
|
||||||
|
String errorMsg = settleCount == null ? null : (String) settleCount.get("error_msg");
|
||||||
|
errorMsg = StringUtils.isNotBlank(errorMsg) ? errorMsg : "创建汇付结算账户失败";
|
||||||
throw new BusinessException("00500001", errorMsg);
|
throw new BusinessException("00500001", errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,13 +351,7 @@ public class AdapayService {
|
|||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId);
|
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId);
|
||||||
String settleAccountId = adapayMemberAccount.getSettleAccountId();
|
String settleAccountId = resolveSettleAccountId(adapayMemberAccount, wechatAppId);
|
||||||
if (StringUtils.isBlank(settleAccountId) && isCorpMember(adapayMemberAccount.getAdapayMemberId())) {
|
|
||||||
AdapayCorpMemberVO corpMemberVO = queryCorpAdapayMemberInfo(adapayMemberAccount.getAdapayMemberId(), wechatAppId);
|
|
||||||
if (corpMemberVO != null) {
|
|
||||||
settleAccountId = corpMemberVO.getSettleAccountId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AdapaySettleAccountVO adapaySettleAccountVO = queryAdapaySettleAccount(adapayMemberAccount.getAdapayMemberId(), settleAccountId, wechatAppId);
|
AdapaySettleAccountVO adapaySettleAccountVO = queryAdapaySettleAccount(adapayMemberAccount.getAdapayMemberId(), settleAccountId, wechatAppId);
|
||||||
if (adapaySettleAccountVO == null) {
|
if (adapaySettleAccountVO == null) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
@@ -363,6 +360,35 @@ public class AdapayService {
|
|||||||
return Lists.newArrayList(adapaySettleAccountVO);
|
return Lists.newArrayList(adapaySettleAccountVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String resolveSettleAccountId(AdapayMemberAccount account, String wechatAppId) throws BaseAdaPayException {
|
||||||
|
if (StringUtils.isNotBlank(account.getSettleAccountId())) {
|
||||||
|
return account.getSettleAccountId();
|
||||||
|
}
|
||||||
|
|
||||||
|
String settleAccountId = null;
|
||||||
|
if (isPersonalMember(account.getAdapayMemberId())) {
|
||||||
|
AdapayMemberInfoVO memberInfo = queryAdapayMemberInfo(account.getAdapayMemberId(), wechatAppId);
|
||||||
|
if (memberInfo != null) {
|
||||||
|
settleAccountId = memberInfo.getSettleAccountId();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AdapayCorpMemberVO corpMember = queryCorpAdapayMemberInfo(account.getAdapayMemberId(), wechatAppId);
|
||||||
|
if (corpMember != null) {
|
||||||
|
settleAccountId = corpMember.getSettleAccountId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(settleAccountId)) {
|
||||||
|
AdapayMemberAccount updateRecord = new AdapayMemberAccount();
|
||||||
|
updateRecord.setMerchantId(account.getMerchantId());
|
||||||
|
updateRecord.setAdapayMemberId(account.getAdapayMemberId());
|
||||||
|
updateRecord.setSettleAccountId(settleAccountId);
|
||||||
|
adapayMemberAccountService.updateAdapayMemberAccountByMemberId(updateRecord);
|
||||||
|
account.setSettleAccountId(settleAccountId);
|
||||||
|
}
|
||||||
|
return settleAccountId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建汇付会员
|
* 创建汇付会员
|
||||||
*
|
*
|
||||||
@@ -501,12 +527,21 @@ public class AdapayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryMemberResponse queryMemberResponse = JSON.parseObject(JSON.toJSONString(member), QueryMemberResponse.class);
|
QueryMemberResponse queryMemberResponse = JSON.parseObject(JSON.toJSONString(member), QueryMemberResponse.class);
|
||||||
|
String settleAccountId = null;
|
||||||
|
if (CollectionUtils.isNotEmpty(queryMemberResponse.getSettle_accounts())) {
|
||||||
|
settleAccountId = queryMemberResponse.getSettle_accounts().stream()
|
||||||
|
.map(QueryMemberResponse.SettleAccount::getId)
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
AdapayMemberInfoVO resultVO = AdapayMemberInfoVO.builder()
|
AdapayMemberInfoVO resultVO = AdapayMemberInfoVO.builder()
|
||||||
.memberId(adapayMemberId)
|
.memberId(adapayMemberId)
|
||||||
.nickname(queryMemberResponse.getNickname())
|
.nickname(queryMemberResponse.getNickname())
|
||||||
.gender(queryMemberResponse.getGender())
|
.gender(queryMemberResponse.getGender())
|
||||||
.email(queryMemberResponse.getEmail())
|
.email(queryMemberResponse.getEmail())
|
||||||
.location(queryMemberResponse.getLocation())
|
.location(queryMemberResponse.getLocation())
|
||||||
|
.settleAccountId(settleAccountId)
|
||||||
.build();
|
.build();
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
@@ -686,6 +721,9 @@ public class AdapayService {
|
|||||||
.bankAcctType(accountInfo.getBank_acct_type())
|
.bankAcctType(accountInfo.getBank_acct_type())
|
||||||
.provCode(accountInfo.getProv_code())
|
.provCode(accountInfo.getProv_code())
|
||||||
.areaCode(accountInfo.getArea_code())
|
.areaCode(accountInfo.getArea_code())
|
||||||
|
.minAmt(accountInfo.getMin_amt())
|
||||||
|
.remainedAmt(accountInfo.getRemained_amt())
|
||||||
|
.channelRemark(accountInfo.getChannel_remark())
|
||||||
.build();
|
.build();
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
@@ -776,6 +814,7 @@ public class AdapayService {
|
|||||||
* @throws BaseAdaPayException
|
* @throws BaseAdaPayException
|
||||||
*/
|
*/
|
||||||
public void updateSettleAccountConfig(UpdateAccountConfigDTO dto) throws BaseAdaPayException {
|
public void updateSettleAccountConfig(UpdateAccountConfigDTO dto) throws BaseAdaPayException {
|
||||||
|
assertActionAllowed(dto.getMerchantId(), AdapayOpenActionEnum.UPDATE_SETTLE_ACCOUNT_CONFIG);
|
||||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||||
// 获取汇付支付配置
|
// 获取汇付支付配置
|
||||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||||
@@ -784,16 +823,19 @@ public class AdapayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通过merchantId 查询出汇付会员id 和 结算账户id,用来查询余额
|
// 通过merchantId 查询出汇付会员id 和 结算账户id,用来查询余额
|
||||||
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
AdapayMemberAccount adapayMemberAccount = requireCurrentMemberAccount(dto.getMerchantId());
|
||||||
if (adapayMemberAccount == null) {
|
String settleAccountId = resolveSettleAccountId(adapayMemberAccount, wechatAppId);
|
||||||
log.error("通过merchantId:{}, 没有查询到结算账户配置", dto.getMerchantId());
|
if (StringUtils.isBlank(settleAccountId)) {
|
||||||
return;
|
throw new BusinessException("", "未查询到结算账户");
|
||||||
|
}
|
||||||
|
if (StringUtils.isAllBlank(dto.getMinAmt(), dto.getRemainedAmt(), dto.getChannelRemark())) {
|
||||||
|
throw new BusinessException("", "结算起始金额、结算留存金额和结算摘要至少填写一项");
|
||||||
}
|
}
|
||||||
// 修改账户配置
|
// 修改账户配置
|
||||||
Map<String, Object> params = Maps.newHashMap();
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
params.put("app_id", config.getAdapayAppId());
|
params.put("app_id", config.getAdapayAppId());
|
||||||
params.put("member_id", adapayMemberAccount.getAdapayMemberId());
|
params.put("member_id", adapayMemberAccount.getAdapayMemberId());
|
||||||
params.put("settle_account_id", adapayMemberAccount.getSettleAccountId());
|
params.put("settle_account_id", settleAccountId);
|
||||||
if (StringUtils.isNotBlank(dto.getMinAmt())) {
|
if (StringUtils.isNotBlank(dto.getMinAmt())) {
|
||||||
params.put("min_amt", dto.getMinAmt());
|
params.put("min_amt", dto.getMinAmt());
|
||||||
}
|
}
|
||||||
@@ -803,8 +845,13 @@ public class AdapayService {
|
|||||||
if (StringUtils.isNotBlank(dto.getChannelRemark())) {
|
if (StringUtils.isNotBlank(dto.getChannelRemark())) {
|
||||||
params.put("channel_remark", dto.getChannelRemark());
|
params.put("channel_remark", dto.getChannelRemark());
|
||||||
}
|
}
|
||||||
Map<String, Object> settleCount = SettleAccount.update(params);
|
Map<String, Object> settleCount = SettleAccount.modify(params, config.getWechatAppId());
|
||||||
log.info("更新结算账户设置 param:{}, result:{}", JSON.toJSONString(params), JSON.toJSONString(settleCount));
|
log.info("更新结算账户设置 param:{}, result:{}", JSON.toJSONString(params), JSON.toJSONString(settleCount));
|
||||||
|
if (settleCount == null
|
||||||
|
|| !AdapayStatusEnum.SUCCEEDED.getValue().equals(settleCount.get("status"))) {
|
||||||
|
String errorMsg = settleCount == null ? null : (String) settleCount.get("error_msg");
|
||||||
|
throw new BusinessException("", StringUtils.isNotBlank(errorMsg) ? errorMsg : "修改汇付结算配置失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1683,38 +1730,20 @@ public class AdapayService {
|
|||||||
* 用户需要换绑银行卡 1-删除结算账户信息,2-使用新账户信息创建结算账户】
|
* 用户需要换绑银行卡 1-删除结算账户信息,2-使用新账户信息创建结算账户】
|
||||||
*/
|
*/
|
||||||
public void changeBankCard(ChangeBankCardDTO dto) throws BaseAdaPayException {
|
public void changeBankCard(ChangeBankCardDTO dto) throws BaseAdaPayException {
|
||||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
deleteSettleAccount(AdapayMemberInfoDTO.builder().merchantId(dto.getMerchantId()).build());
|
||||||
// 获取汇付支会员信息
|
CreateSettleAccountDTO createRequest = CreateSettleAccountDTO.builder()
|
||||||
AdapayMemberAccount account = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
.merchantId(dto.getMerchantId())
|
||||||
if (account == null) {
|
.bankAcctType(dto.getBankAcctType())
|
||||||
return;
|
.cardId(dto.getCardId())
|
||||||
}
|
.cardName(dto.getCardName())
|
||||||
|
.certId(dto.getCertId())
|
||||||
// 1-删除结算账户信息
|
.certType(dto.getCertType())
|
||||||
String adapayMemberId = account.getAdapayMemberId();
|
.telNo(dto.getTelNo())
|
||||||
String settleAccountId = null;
|
.bankCode(dto.getBankCode())
|
||||||
AdapayCorpMemberVO adapayCorpMemberVO = this.queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId);
|
.provCode(dto.getProvCode())
|
||||||
if (adapayCorpMemberVO != null) {
|
.areaCode(dto.getAreaCode())
|
||||||
settleAccountId = adapayCorpMemberVO.getSettleAccountId();
|
.build();
|
||||||
}
|
createSettleAccount(createRequest);
|
||||||
this.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
|
|
||||||
// 2-使用新账户信息创建结算账户
|
|
||||||
SettleAccountDTO settleAccountDTO = new SettleAccountDTO();
|
|
||||||
settleAccountDTO.setCardId(dto.getCardId());
|
|
||||||
settleAccountDTO.setCardName(dto.getCardName());
|
|
||||||
settleAccountDTO.setTelNo(dto.getTelNo());
|
|
||||||
settleAccountDTO.setBankCode(dto.getBankCode());
|
|
||||||
settleAccountDTO.setBankAcctType(dto.getBankAcctType());
|
|
||||||
settleAccountDTO.setProvCode(dto.getProvCode());
|
|
||||||
settleAccountDTO.setAreaCode(dto.getAreaCode());
|
|
||||||
Map<String, Object> settleAccount = this.createSettleAccountRequest(settleAccountDTO, adapayMemberId, wechatAppId);
|
|
||||||
if (settleAccount != null && !StringUtils.equals((String) settleAccount.get("status"), "failed")) {
|
|
||||||
AdapayMemberAccount updateRecord = new AdapayMemberAccount();
|
|
||||||
updateRecord.setAdapayMemberId(adapayMemberId);
|
|
||||||
updateRecord.setMerchantId(dto.getMerchantId());
|
|
||||||
updateRecord.setSettleAccountId((String) settleAccount.get("id"));
|
|
||||||
adapayMemberAccountService.updateAdapayMemberAccountByMemberId(updateRecord);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1805,21 +1834,27 @@ public class AdapayService {
|
|||||||
assertActionAllowed(dto.getMerchantId(), AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT);
|
assertActionAllowed(dto.getMerchantId(), AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT);
|
||||||
AdapayMemberAccount adapayMemberAccount = requireCurrentMemberAccount(dto.getMerchantId());
|
AdapayMemberAccount adapayMemberAccount = requireCurrentMemberAccount(dto.getMerchantId());
|
||||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||||
String adapayMemberId = StringUtils.isNotBlank(dto.getAdapayMemberId()) ? dto.getAdapayMemberId() : adapayMemberAccount.getAdapayMemberId();
|
String adapayMemberId = adapayMemberAccount.getAdapayMemberId();
|
||||||
String settleAccountId = StringUtils.isNotBlank(dto.getSettleAccountId()) ? dto.getSettleAccountId() : adapayMemberAccount.getSettleAccountId();
|
if (StringUtils.isNotBlank(dto.getAdapayMemberId())
|
||||||
if (StringUtils.isBlank(settleAccountId) && isCorpMember(adapayMemberId)) {
|
&& !StringUtils.equals(dto.getAdapayMemberId(), adapayMemberId)) {
|
||||||
AdapayCorpMemberVO corpMemberVO = queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId);
|
throw new BusinessException("", "汇付用户信息不匹配");
|
||||||
if (corpMemberVO != null) {
|
|
||||||
settleAccountId = corpMemberVO.getSettleAccountId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
String settleAccountId = resolveSettleAccountId(adapayMemberAccount, wechatAppId);
|
||||||
if (StringUtils.isBlank(settleAccountId)) {
|
if (StringUtils.isBlank(settleAccountId)) {
|
||||||
throw new BusinessException("", "未查询到结算账户");
|
throw new BusinessException("", "未查询到结算账户");
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(dto.getSettleAccountId())
|
||||||
|
&& !StringUtils.equals(dto.getSettleAccountId(), settleAccountId)) {
|
||||||
|
throw new BusinessException("", "结算账户信息不匹配");
|
||||||
|
}
|
||||||
|
|
||||||
assertSettleAccountCanDelete(dto.getMerchantId());
|
assertSettleAccountCanDelete(dto.getMerchantId());
|
||||||
this.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
|
this.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
|
||||||
adapayMemberAccountService.clearSettleAccountByMerchantId(dto.getMerchantId());
|
int cleared = adapayMemberAccountService.clearCurrentSettleAccount(
|
||||||
|
adapayMemberAccount.getId(), dto.getMerchantId(), adapayMemberId, settleAccountId);
|
||||||
|
if (cleared != 1) {
|
||||||
|
throw new BusinessException("", "汇付结算账户已删除,但本地账户状态更新失败,请联系管理员处理");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteAdapayMember(DeleteAdapayMemberDTO dto) throws BaseAdaPayException {
|
public void deleteAdapayMember(DeleteAdapayMemberDTO dto) throws BaseAdaPayException {
|
||||||
@@ -2018,6 +2053,7 @@ public class AdapayService {
|
|||||||
break;
|
break;
|
||||||
case PERSONAL_COMPLETED:
|
case PERSONAL_COMPLETED:
|
||||||
actions.add(AdapayOpenActionEnum.UPDATE_PERSONAL_MEMBER.getValue());
|
actions.add(AdapayOpenActionEnum.UPDATE_PERSONAL_MEMBER.getValue());
|
||||||
|
actions.add(AdapayOpenActionEnum.UPDATE_SETTLE_ACCOUNT_CONFIG.getValue());
|
||||||
actions.add(AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT.getValue());
|
actions.add(AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT.getValue());
|
||||||
break;
|
break;
|
||||||
case CORP_AUDITING:
|
case CORP_AUDITING:
|
||||||
@@ -2035,6 +2071,7 @@ public class AdapayService {
|
|||||||
break;
|
break;
|
||||||
case CORP_COMPLETED:
|
case CORP_COMPLETED:
|
||||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||||
|
actions.add(AdapayOpenActionEnum.UPDATE_SETTLE_ACCOUNT_CONFIG.getValue());
|
||||||
actions.add(AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT.getValue());
|
actions.add(AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT.getValue());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -20,4 +20,6 @@ public class AdapayMemberInfoVO {
|
|||||||
private String gender;
|
private String gender;
|
||||||
// 昵称
|
// 昵称
|
||||||
private String nickname;
|
private String nickname;
|
||||||
|
// 结算账户id
|
||||||
|
private String settleAccountId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,4 +73,10 @@ public class AdapaySettleAccountVO {
|
|||||||
* 银行账户开户银行所在地区编码(省市编码),银行账户类型为对公时,必填
|
* 银行账户开户银行所在地区编码(省市编码),银行账户类型为对公时,必填
|
||||||
*/
|
*/
|
||||||
private String areaCode;
|
private String areaCode;
|
||||||
|
|
||||||
|
private String minAmt;
|
||||||
|
|
||||||
|
private String remainedAmt;
|
||||||
|
|
||||||
|
private String channelRemark;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,10 @@ public interface AdapayMemberAccountMapper {
|
|||||||
@Param("merchantId") String merchantId,
|
@Param("merchantId") String merchantId,
|
||||||
@Param("adapayMemberId") String adapayMemberId);
|
@Param("adapayMemberId") String adapayMemberId);
|
||||||
|
|
||||||
void clearSettleAccountByMerchantId(String merchantId);
|
int clearCurrentSettleAccount(@Param("id") Integer id,
|
||||||
|
@Param("merchantId") String merchantId,
|
||||||
|
@Param("adapayMemberId") String adapayMemberId,
|
||||||
|
@Param("settleAccountId") String settleAccountId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据运营商id查询最近一条的信息
|
* 根据运营商id查询最近一条的信息
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public interface AdapayMemberAccountService {
|
|||||||
*/
|
*/
|
||||||
int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId);
|
int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId);
|
||||||
|
|
||||||
void clearSettleAccountByMerchantId(String merchantId);
|
int clearCurrentSettleAccount(Integer id, String merchantId, String adapayMemberId, String settleAccountId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据运营商Id查询最近一条的信息
|
* 根据运营商Id查询最近一条的信息
|
||||||
|
|||||||
@@ -279,10 +279,13 @@ public class AdapayMemberAccountServiceImpl implements AdapayMemberAccountServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearSettleAccountByMerchantId(String merchantId) {
|
public int clearCurrentSettleAccount(Integer id, String merchantId, String adapayMemberId, String settleAccountId) {
|
||||||
adapayMemberAccountMapper.clearSettleAccountByMerchantId(merchantId);
|
int result = adapayMemberAccountMapper.clearCurrentSettleAccount(id, merchantId, adapayMemberId, settleAccountId);
|
||||||
|
if (result > 0) {
|
||||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据运营商id查询最近一条的信息
|
* 根据运营商id查询最近一条的信息
|
||||||
|
|||||||
@@ -583,12 +583,15 @@
|
|||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="clearSettleAccountByMerchantId">
|
<update id="clearCurrentSettleAccount">
|
||||||
update
|
update
|
||||||
adapay_member_account
|
adapay_member_account
|
||||||
set settle_account_id = null,
|
set settle_account_id = null,
|
||||||
update_time = now()
|
update_time = now()
|
||||||
where merchant_id = #{merchantId,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
and merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||||
|
and adapay_member_id = #{adapayMemberId,jdbcType=VARCHAR}
|
||||||
|
and settle_account_id = #{settleAccountId,jdbcType=VARCHAR}
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user