feat():优化新增客户支付接口逻辑

master
Number7 2024-08-08 21:13:14 +08:00
parent 2761e77985
commit 0ef21b8fe0
1 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package com.muyu.cloud.pay.service.impl; package com.muyu.cloud.pay.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.cloud.pay.domain.OrderPayCustomer; import com.muyu.cloud.pay.domain.OrderPayCustomer;
import com.muyu.cloud.pay.domain.OrderPayInfo; import com.muyu.cloud.pay.domain.OrderPayInfo;
@ -109,15 +110,17 @@ public class OrderPayCustomerServiceImpl
String appCode = orderPayCustomer.getAppCode(); String appCode = orderPayCustomer.getAppCode();
List<String> customerAllList = this.getCustomerAllList(); List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
if(!customerAllList.contains(appCode)){
throw new ServiceException("客户编码重复");
if(!nacosServerAllList.contains(appCode)){
throw new ServiceException("客户编码违法");
}
LambdaUpdateWrapper<OrderPayCustomer> queryWrapper = new LambdaUpdateWrapper<>();
queryWrapper.eq(OrderPayCustomer::getAppCode, appCode);
List<String> customerAllList = this.getCustomerAllList();
if(this.count(queryWrapper)>0){
throw new ServiceException("客户编码重复");
} }
return super.save(orderPayCustomer); return super.save(orderPayCustomer);
} }
} }