解决删除应用, 支付参数不存在数据时报错的问题

This commit is contained in:
terrfly 2021-06-18 16:21:30 +08:00
parent cf67837fc1
commit 0debee5147

View File

@ -36,23 +36,16 @@ public class MchAppService extends ServiceImpl<MchAppMapper, MchApp> {
if (payCount > 0) throw new BizException("该应用已存在交易数据,不可删除"); if (payCount > 0) throw new BizException("该应用已存在交易数据,不可删除");
// 2.删除应用关联的支付通道 // 2.删除应用关联的支付通道
boolean result = mchPayPassageService.remove(MchPayPassage.gw().eq(MchPayPassage::getAppId, appId)); mchPayPassageService.remove(MchPayPassage.gw().eq(MchPayPassage::getAppId, appId));
if (!result) {
throw new BizException(ApiCodeEnum.SYS_OPERATION_FAIL_DELETE);
}
// 3.删除应用配置的支付参数 // 3.删除应用配置的支付参数
result = payInterfaceConfigService.remove(PayInterfaceConfig.gw() payInterfaceConfigService.remove(PayInterfaceConfig.gw()
.eq(PayInterfaceConfig::getInfoId, appId) .eq(PayInterfaceConfig::getInfoId, appId)
.eq(PayInterfaceConfig::getInfoType, CS.INFO_TYPE_MCH_APP) .eq(PayInterfaceConfig::getInfoType, CS.INFO_TYPE_MCH_APP)
); );
if (!result) {
throw new BizException(ApiCodeEnum.SYS_OPERATION_FAIL_DELETE);
}
// 4.删除当前应用 // 4.删除当前应用
result = removeById(appId); if (!removeById(appId)) {
if (!result) {
throw new BizException(ApiCodeEnum.SYS_OPERATION_FAIL_DELETE); throw new BizException(ApiCodeEnum.SYS_OPERATION_FAIL_DELETE);
} }
} }