diff --git a/cloud-pay-server/pom.xml b/cloud-pay-server/pom.xml index 92902a5..b86ebd1 100644 --- a/cloud-pay-server/pom.xml +++ b/cloud-pay-server/pom.xml @@ -6,7 +6,7 @@ com.muyu cloud-pay - 1.0.0 + 1.0.1 cloud-pay-server @@ -91,6 +91,12 @@ com.muyu cloud-pay-common + + + com.muyu + cloud-common-nacos-remote + + 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 b3720fe..53236b0 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,14 +6,12 @@ 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; @@ -40,4 +38,17 @@ public class OrderPayCustomerController { return Result.success(orderPayCustomerService.selectList(customerListReq)); //查询客户集合 | 封装返回结果 } + /** + * 获取所有的客户的列表 + * @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/impl/OrderPayCustomerServiceImpl.java b/cloud-pay-server/src/main/java/com/muyu/cloud/pay/service/impl/OrderPayCustomerServiceImpl.java index 1f9bc99..d29d987 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 @@ -5,20 +5,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.cloud.pay.domain.OrderPayCustomer; import com.muyu.cloud.pay.domain.OrderPayInfo; import com.muyu.cloud.pay.domain.req.CustomerListReq; -import com.muyu.cloud.pay.domain.resp.CustomerOrderPaySimpleResp; import com.muyu.cloud.pay.domain.resp.CustomerResp; 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.utils.StringUtils; +import com.muyu.common.nacos.service.NacosService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; import java.util.List; -import java.util.function.Function; +import java.util.Set; +import java.util.stream.Collectors; @Slf4j @Service @@ -27,6 +27,7 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl selectList(CustomerListReq customerListReq) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -84,4 +85,24 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl getCustomerAllList() { + List nacosServerAllList = nacosService.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(); + } }