From 53fc73b14abcc2cf6359a4085cc7360f717fe883 Mon Sep 17 00:00:00 2001 From: Cui YongXing <2835316714@qq.com> Date: Sun, 4 Aug 2024 14:17:38 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud-pay-server/pom.xml | 4 +++ .../OrderPayCustomerController.java | 25 +++++++++++++------ .../service/OrderPayCustomerService.java | 2 ++ .../impl/OrderPayCustomerServiceImpl.java | 18 +++++++++++++ pom.xml | 2 +- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/cloud-pay-server/pom.xml b/cloud-pay-server/pom.xml index ffe90c9..f1fe572 100644 --- a/cloud-pay-server/pom.xml +++ b/cloud-pay-server/pom.xml @@ -86,6 +86,10 @@ com.muyu cloud-pay-common + + com.muyu + cloud-common-nacos-api + diff --git a/cloud-pay-server/src/main/java/com/muyu/pay/server/controller/OrderPayCustomerController.java b/cloud-pay-server/src/main/java/com/muyu/pay/server/controller/OrderPayCustomerController.java index a4b0af9..158382f 100644 --- a/cloud-pay-server/src/main/java/com/muyu/pay/server/controller/OrderPayCustomerController.java +++ b/cloud-pay-server/src/main/java/com/muyu/pay/server/controller/OrderPayCustomerController.java @@ -6,14 +6,12 @@ import com.muyu.pay.common.domain.req.CustomerListReq; import com.muyu.pay.common.domain.resp.CustomerResp; import com.muyu.pay.server.service.OrderPayCustomerService; 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.log4j.Log4j2; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -22,18 +20,31 @@ import java.util.List; @RestController @RequestMapping("customer") @RequiredArgsConstructor -@Tag(name = "客户控制层",description = "进行客户管理查询操作") +@Tag(name = "客户控制层", description = "进行客户管理查询操作") public class OrderPayCustomerController { private final OrderPayCustomerService orderPayCustomerService; @PostMapping("/list") - @Operation(summary = "查看客户",description = "根据客户名称 编号 状态 查询") + @Operation(summary = "查看客户", description = "根据客户名称 编号 状态 查询") public Result> selectList( - @Validated @RequestBody CustomerListReq req){ + @Validated @RequestBody CustomerListReq req) { return Result.success(orderPayCustomerService.selectList(req)); } + /** + * 获取所以客户 + * + * @return + */ + @GetMapping("all") + @Operation(summary = "获取未接入客户",description = "调用nacosAPI") + @Schema(description = "获取未接入客户",type = "List") + public Result> getCustomerAllList() { + return Result.success( + orderPayCustomerService.getCustomerAllList() + ); + } } diff --git a/cloud-pay-server/src/main/java/com/muyu/pay/server/service/OrderPayCustomerService.java b/cloud-pay-server/src/main/java/com/muyu/pay/server/service/OrderPayCustomerService.java index b605840..fb78a08 100644 --- a/cloud-pay-server/src/main/java/com/muyu/pay/server/service/OrderPayCustomerService.java +++ b/cloud-pay-server/src/main/java/com/muyu/pay/server/service/OrderPayCustomerService.java @@ -12,4 +12,6 @@ public interface OrderPayCustomerService extends IService { public List selectList(CustomerListReq req); + List getCustomerAllList(); + } diff --git a/cloud-pay-server/src/main/java/com/muyu/pay/server/service/impl/OrderPayCustomerServiceImpl.java b/cloud-pay-server/src/main/java/com/muyu/pay/server/service/impl/OrderPayCustomerServiceImpl.java index 01dc27a..0be0c6e 100644 --- a/cloud-pay-server/src/main/java/com/muyu/pay/server/service/impl/OrderPayCustomerServiceImpl.java +++ b/cloud-pay-server/src/main/java/com/muyu/pay/server/service/impl/OrderPayCustomerServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.common.core.enums.SysPayType; import com.muyu.common.core.utils.StringUtils; +import com.muyu.common.nacos.service.NacosServerService; import com.muyu.pay.common.domain.OrderPayCustomer; import com.muyu.pay.common.domain.OrderPayInfo; import com.muyu.pay.common.domain.req.CustomerListReq; @@ -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; @Log4j2 @Service @@ -30,6 +33,9 @@ public class OrderPayCustomerServiceImpl @Resource private OrderPayInfoService orderPayInfoService; + @Resource + private NacosServerService nacosServerService; + @Override public List selectList(CustomerListReq req) { @@ -61,4 +67,16 @@ public class OrderPayCustomerServiceImpl .toList(); } + + @Override + public List getCustomerAllList() { + List nacosServerAllList = nacosServerService.nacosServerAllList(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.select(OrderPayCustomer::getAppCode); + List list = this.list(queryWrapper); + Set customerSet = list.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet()); + return nacosServerAllList.stream() + .filter(nacosServer->!customerSet.contains(nacosServer)) + .toList(); + } } diff --git a/pom.xml b/pom.xml index 4bd9dd1..ff3492b 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.muyu cloud-server-parent - 3.6.3 + 3.6.4