获取未接入的客户
parent
06282724af
commit
da72ba458f
|
@ -34,5 +34,10 @@
|
|||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
<artifactId>cloud-pay-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
@ -83,6 +89,11 @@
|
|||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XllJob定时任务 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
|||
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.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -42,4 +43,16 @@ public class OrderPayCustomerController {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看所有客户列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用nacosApi获取所有的微服务名称,作为支付中台的客户")
|
||||
@Schema(description = "获取未接入的客户",defaultValue = "[\'客户1'\'客户2'\'客户3']",type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,11 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
* @return 客户集合
|
||||
*/
|
||||
public List<CustomerListResp> selectList(CustomerListReq req);
|
||||
|
||||
/**
|
||||
* 查看所有客户列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.cloud.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
|
@ -8,10 +9,12 @@ import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
|||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.nacos.service.NacosServerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -25,6 +28,10 @@ import java.util.stream.Collectors;
|
|||
public class OrderPayCustomerServiceImpl
|
||||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
@Override
|
||||
public List<CustomerListResp> selectList(CustomerListReq req) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -46,4 +53,20 @@ public class OrderPayCustomerServiceImpl
|
|||
.map(CustomerListResp::customerBuild).collect(Collectors.toList());
|
||||
return customerListRespList;
|
||||
}
|
||||
/**
|
||||
* 查看所有客户列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
Set<String> collect = orderPayCustomerList.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
|
||||
return nacosServerAllList.stream()
|
||||
.filter(nacosServer -> !collect.contains(nacosServer))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue