diff --git a/cloud-pay-server/pom.xml b/cloud-pay-server/pom.xml
index 8a7bd40..57a2617 100644
--- a/cloud-pay-server/pom.xml
+++ b/cloud-pay-server/pom.xml
@@ -89,6 +89,13 @@
com.muyu
cloud-pay-common
+
+
+ com.muyu
+ cloud-common-nacos-remote
+ 1.0.0
+
+
diff --git a/cloud-pay-server/src/main/java/com/muyu/cloud/pay/controller/OrderPayCustomerController.java b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/controller/OrderPayCustomerController.java
index c5cca1b..118daa1 100644
--- a/cloud-pay-server/src/main/java/com/muyu/cloud/pay/controller/OrderPayCustomerController.java
+++ b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/controller/OrderPayCustomerController.java
@@ -6,15 +6,13 @@ import com.muyu.cloud.pay.domain.resp.CustomerResp;
import com.muyu.cloud.pay.service.OrderPayCustomerService;
import com.muyu.common.core.domain.Result;
import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -52,4 +50,16 @@ public class OrderPayCustomerController {
);
}
+ /**
+ * 获取所有客户的列表
+ * @return 客户集合
+ */
+ @GetMapping("/all")
+ @Operation(summary = "获取未接入的客户",description = "调用NacosAPI获取所有的微服务名称,作为支付中台的客户")
+ @Schema(description = "获取未接入的客户",defaultValue = "[\"客户1\",\"客户2\"]",type = "List")
+ public Result> getCustomerAllList(){
+ return Result.success(
+ orderPayCustomerService.getCustomerAllList()
+ );
+ }
}
diff --git a/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/OrderPayCustomerService.java b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/OrderPayCustomerService.java
index c1e3633..bdeddd4 100644
--- a/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/OrderPayCustomerService.java
+++ b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/OrderPayCustomerService.java
@@ -17,5 +17,16 @@ import java.util.List;
*/
public interface OrderPayCustomerService extends IService {
+ /**
+ * 查询客户集合
+ * @param customerListReq 请求参数
+ * @return 客户集合
+ */
public List selectList(CustomerListReq customerListReq);
+
+ /**
+ * 获取所有的客户
+ * @return 客户集合
+ */
+ List getCustomerAllList();
}
diff --git a/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/impl/OrderPayCustomerServiceImpl.java b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/impl/OrderPayCustomerServiceImpl.java
index 8c615f5..c04c150 100644
--- a/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/impl/OrderPayCustomerServiceImpl.java
+++ b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/impl/OrderPayCustomerServiceImpl.java
@@ -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.nacos.service.NacosServiceService;
import org.apache.catalina.mapper.Mapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@@ -18,7 +19,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import java.util.function.Function;
+import java.util.stream.Collectors;
/**
* @Author:yang
@@ -34,7 +37,13 @@ public class OrderPayCustomerServiceImpl
@Resource(type = OrderPayServiceImpl.class)
private OrderPayService orderPayService;
-
+ @Resource
+ private NacosServiceService nacosServiceService;
+ /**
+ * 查询客户集合
+ * @param customerListReq 请求参数
+ * @return 客户集合
+ */
@Override
public List selectList(CustomerListReq customerListReq) {
@@ -63,4 +72,19 @@ public class OrderPayCustomerServiceImpl
)
.toList();
}
+
+ /**
+ * 获取所有的客户
+ * @return 客户集合
+ */
+ @Override
+ public List getCustomerAllList() {
+ List nacosServerAllList = nacosServiceService.nacosServerAllList();
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.select(OrderPayCustomer::getAppCode);
+ List orderPayCustomerList = this.list(queryWrapper);
+ Set customerSet = orderPayCustomerList.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
+
+ return nacosServerAllList.stream().filter(nacosService -> !customerSet.contains(nacosService)).toList();
+ }
}