feat():监听

master
chentaisen 2024-08-09 16:09:57 +08:00
parent b3e7c9913f
commit e6a3ccba69
1 changed files with 15 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
import com.muyu.cloud.pay.service.OrderPayCustomerService;
import com.muyu.cloud.pay.service.OrderPayService;
import com.muyu.common.core.enums.SysPayType;
import com.muyu.common.core.exception.ServiceException;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.nacos.service.NacosServerService;
import jakarta.annotation.Resource;
@ -91,4 +92,18 @@ public class OrderPayCustomerServiceImpl
.toList();
}
@Override
public boolean save(OrderPayCustomer orderPayCustomer) {
String appCode = orderPayCustomer.getAppCode();
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
if (!nacosServerAllList.contains(appCode)){
throw new ServiceException("客户编码违法");
}
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OrderPayCustomer::getAppCode,appCode);
if (this.count(queryWrapper)>0){
throw new ServiceException("客户编码重复");
}
return super.save(orderPayCustomer);
}
}