mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-23 15:41:17 +08:00
update 汇付账户本地删除与结算校验
This commit is contained in:
@@ -83,6 +83,9 @@ public class AdapayService {
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private StationSplitConfigService stationSplitConfigService;
|
||||
|
||||
@Autowired
|
||||
private MemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
@@ -635,6 +638,11 @@ public class AdapayService {
|
||||
settleCountParams.put("app_id", config.getAdapayAppId());
|
||||
Map<String, Object> settleCount = SettleAccount.delete(settleCountParams, wechatAppId);
|
||||
log.info("创建删除结算账户请求param:{}, result:{}", JSON.toJSONString(settleCountParams), 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 : "删除汇付结算账户失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1825,7 +1833,16 @@ public class AdapayService {
|
||||
if (CollectionUtils.isNotEmpty(selectSettleAccount(dto.getMerchantId()))) {
|
||||
throw new BusinessException("", "请先删除结算账户");
|
||||
}
|
||||
adapayMemberAccountService.deleteAccountByMerchantId(dto.getMerchantId());
|
||||
assertSettleAccountCanDelete(dto.getMerchantId());
|
||||
int splitStationCount = stationSplitConfigService.countActiveByAdapayMemberId(adapayMemberAccount.getAdapayMemberId());
|
||||
if (splitStationCount > 0) {
|
||||
throw new BusinessException("", String.format("当前账户仍被%d个站点的分账配置引用,请先调整分账配置", splitStationCount));
|
||||
}
|
||||
int deleted = adapayMemberAccountService.deleteCurrentAccount(
|
||||
adapayMemberAccount.getId(), dto.getMerchantId(), adapayMemberAccount.getAdapayMemberId());
|
||||
if (deleted != 1) {
|
||||
throw new BusinessException("", "账户状态已变化,请刷新后重试");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2014,6 +2031,7 @@ public class AdapayService {
|
||||
case CORP_OPENED_NO_SETTLE:
|
||||
actions.add(AdapayOpenActionEnum.CREATE_SETTLE_ACCOUNT.getValue());
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||
actions.add(AdapayOpenActionEnum.DELETE_MEMBER.getValue());
|
||||
break;
|
||||
case CORP_COMPLETED:
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||
|
||||
@@ -120,11 +120,9 @@ public interface AdapayMemberAccountMapper {
|
||||
|
||||
AdapayMemberAccount selectByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 通过运营商id删除账户信息
|
||||
* @param merchantId
|
||||
*/
|
||||
void deleteAccountByMerchantId(String merchantId);
|
||||
int deleteCurrentAccount(@Param("id") Integer id,
|
||||
@Param("merchantId") String merchantId,
|
||||
@Param("adapayMemberId") String adapayMemberId);
|
||||
|
||||
void clearSettleAccountByMerchantId(String merchantId);
|
||||
|
||||
|
||||
@@ -35,4 +35,6 @@ public interface StationSplitConfigMapper {
|
||||
* @return
|
||||
*/
|
||||
List<SplitConfigStationVO> queryStationList(String adapayMemberId);
|
||||
|
||||
int countActiveByAdapayMemberId(String adapayMemberId);
|
||||
}
|
||||
|
||||
@@ -111,10 +111,9 @@ public interface AdapayMemberAccountService {
|
||||
String selectMerchantNameByAdapayMemberId(String adapayMemberId);
|
||||
|
||||
/**
|
||||
* 根据运营商id删除记录
|
||||
* @param merchantId
|
||||
* 精确逻辑删除当前有效账户,避免并发开户时误删新记录。
|
||||
*/
|
||||
void deleteAccountByMerchantId(String merchantId);
|
||||
int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId);
|
||||
|
||||
void clearSettleAccountByMerchantId(String merchantId);
|
||||
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface StationSplitConfigService {
|
||||
* @return
|
||||
*/
|
||||
Map<String,List<SplitConfigStationVO>> queryStationList(SplitConfigStationDTO splitConfigStationDTO);
|
||||
|
||||
int countActiveByAdapayMemberId(String adapayMemberId);
|
||||
}
|
||||
|
||||
@@ -270,9 +270,12 @@ public class AdapayMemberAccountServiceImpl implements AdapayMemberAccountServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccountByMerchantId(String merchantId) {
|
||||
adapayMemberAccountMapper.deleteAccountByMerchantId(merchantId);
|
||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||
public int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId) {
|
||||
int result = adapayMemberAccountMapper.deleteCurrentAccount(id, merchantId, adapayMemberId);
|
||||
if (result > 0) {
|
||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -316,4 +316,9 @@ public class StationSplitConfigServiceImpl implements StationSplitConfigService{
|
||||
return stationMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countActiveByAdapayMemberId(String adapayMemberId) {
|
||||
return stationSplitConfigMapper.countActiveByAdapayMemberId(adapayMemberId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user