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:
@@ -15,7 +15,7 @@ public enum AdapayOpenActionEnum {
|
|||||||
RESUBMIT_CORP_MEMBER("RESUBMIT_CORP_MEMBER", "重新提交企业开户"),
|
RESUBMIT_CORP_MEMBER("RESUBMIT_CORP_MEMBER", "重新提交企业开户"),
|
||||||
CREATE_SETTLE_ACCOUNT("CREATE_SETTLE_ACCOUNT", "创建结算账户"),
|
CREATE_SETTLE_ACCOUNT("CREATE_SETTLE_ACCOUNT", "创建结算账户"),
|
||||||
DELETE_SETTLE_ACCOUNT("DELETE_SETTLE_ACCOUNT", "删除结算账户"),
|
DELETE_SETTLE_ACCOUNT("DELETE_SETTLE_ACCOUNT", "删除结算账户"),
|
||||||
DELETE_MEMBER("DELETE_MEMBER", "删除汇付用户");
|
DELETE_MEMBER("DELETE_MEMBER", "删除账户(本地解绑)");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
private final String label;
|
private final String label;
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ public class AdapayService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PileMerchantInfoService pileMerchantInfoService;
|
private PileMerchantInfoService pileMerchantInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StationSplitConfigService stationSplitConfigService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberBasicInfoService memberBasicInfoService;
|
private MemberBasicInfoService memberBasicInfoService;
|
||||||
|
|
||||||
@@ -635,6 +638,11 @@ public class AdapayService {
|
|||||||
settleCountParams.put("app_id", config.getAdapayAppId());
|
settleCountParams.put("app_id", config.getAdapayAppId());
|
||||||
Map<String, Object> settleCount = SettleAccount.delete(settleCountParams, wechatAppId);
|
Map<String, Object> settleCount = SettleAccount.delete(settleCountParams, wechatAppId);
|
||||||
log.info("创建删除结算账户请求param:{}, result:{}", JSON.toJSONString(settleCountParams), JSON.toJSONString(settleCount));
|
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()))) {
|
if (CollectionUtils.isNotEmpty(selectSettleAccount(dto.getMerchantId()))) {
|
||||||
throw new BusinessException("", "请先删除结算账户");
|
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:
|
case CORP_OPENED_NO_SETTLE:
|
||||||
actions.add(AdapayOpenActionEnum.CREATE_SETTLE_ACCOUNT.getValue());
|
actions.add(AdapayOpenActionEnum.CREATE_SETTLE_ACCOUNT.getValue());
|
||||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||||
|
actions.add(AdapayOpenActionEnum.DELETE_MEMBER.getValue());
|
||||||
break;
|
break;
|
||||||
case CORP_COMPLETED:
|
case CORP_COMPLETED:
|
||||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||||
|
|||||||
@@ -120,11 +120,9 @@ public interface AdapayMemberAccountMapper {
|
|||||||
|
|
||||||
AdapayMemberAccount selectByMemberId(String memberId);
|
AdapayMemberAccount selectByMemberId(String memberId);
|
||||||
|
|
||||||
/**
|
int deleteCurrentAccount(@Param("id") Integer id,
|
||||||
* 通过运营商id删除账户信息
|
@Param("merchantId") String merchantId,
|
||||||
* @param merchantId
|
@Param("adapayMemberId") String adapayMemberId);
|
||||||
*/
|
|
||||||
void deleteAccountByMerchantId(String merchantId);
|
|
||||||
|
|
||||||
void clearSettleAccountByMerchantId(String merchantId);
|
void clearSettleAccountByMerchantId(String merchantId);
|
||||||
|
|
||||||
|
|||||||
@@ -35,4 +35,6 @@ public interface StationSplitConfigMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SplitConfigStationVO> queryStationList(String adapayMemberId);
|
List<SplitConfigStationVO> queryStationList(String adapayMemberId);
|
||||||
|
|
||||||
|
int countActiveByAdapayMemberId(String adapayMemberId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,10 +111,9 @@ public interface AdapayMemberAccountService {
|
|||||||
String selectMerchantNameByAdapayMemberId(String adapayMemberId);
|
String selectMerchantNameByAdapayMemberId(String adapayMemberId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据运营商id删除记录
|
* 精确逻辑删除当前有效账户,避免并发开户时误删新记录。
|
||||||
* @param merchantId
|
|
||||||
*/
|
*/
|
||||||
void deleteAccountByMerchantId(String merchantId);
|
int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId);
|
||||||
|
|
||||||
void clearSettleAccountByMerchantId(String merchantId);
|
void clearSettleAccountByMerchantId(String merchantId);
|
||||||
|
|
||||||
|
|||||||
@@ -59,4 +59,6 @@ public interface StationSplitConfigService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String,List<SplitConfigStationVO>> queryStationList(SplitConfigStationDTO splitConfigStationDTO);
|
Map<String,List<SplitConfigStationVO>> queryStationList(SplitConfigStationDTO splitConfigStationDTO);
|
||||||
|
|
||||||
|
int countActiveByAdapayMemberId(String adapayMemberId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,9 +270,12 @@ public class AdapayMemberAccountServiceImpl implements AdapayMemberAccountServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAccountByMerchantId(String merchantId) {
|
public int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId) {
|
||||||
adapayMemberAccountMapper.deleteAccountByMerchantId(merchantId);
|
int result = adapayMemberAccountMapper.deleteCurrentAccount(id, merchantId, adapayMemberId);
|
||||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
if (result > 0) {
|
||||||
|
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -316,4 +316,9 @@ public class StationSplitConfigServiceImpl implements StationSplitConfigService{
|
|||||||
return stationMap;
|
return stationMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countActiveByAdapayMemberId(String adapayMemberId) {
|
||||||
|
return stationSplitConfigMapper.countActiveByAdapayMemberId(adapayMemberId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -572,11 +572,14 @@
|
|||||||
and adapay_member_id = #{memberId,jdbcType=VARCHAR}
|
and adapay_member_id = #{memberId,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="deleteAccountByMerchantId">
|
<update id="deleteCurrentAccount">
|
||||||
update
|
update
|
||||||
adapay_member_account
|
adapay_member_account
|
||||||
set del_flag = '1'
|
set del_flag = '1',
|
||||||
where merchant_id = #{merchantId,jdbcType=VARCHAR}
|
update_time = now()
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
and merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||||
|
and adapay_member_id = #{adapayMemberId,jdbcType=VARCHAR}
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,13 @@
|
|||||||
where t1.adapay_member_id = #{adapayMemberId}
|
where t1.adapay_member_id = #{adapayMemberId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countActiveByAdapayMemberId" resultType="int">
|
||||||
|
select count(distinct station_id)
|
||||||
|
from station_split_config
|
||||||
|
where adapay_member_id = #{adapayMemberId}
|
||||||
|
and del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="batchInsert" parameterType="map">
|
<insert id="batchInsert" parameterType="map">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into station_split_config
|
insert into station_split_config
|
||||||
|
|||||||
Reference in New Issue
Block a user