feat():新增列表查询
parent
ba308ed3e6
commit
9cb17eb3f0
|
@ -89,6 +89,11 @@
|
|||
<artifactId>cloud-pay-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -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.log4j.Log4j2;
|
||||
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;
|
||||
|
||||
|
@ -48,6 +46,25 @@ 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<List<String>> getCustomerAllList(){
|
||||
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);//客户业务层
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,4 +26,13 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,13 +13,17 @@ import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
|||
import com.muyu.cloud.pay.service.OrderPayInfoService;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.remote.service.NacosServerService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
|
@ -36,6 +40,8 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
|||
@Autowired
|
||||
private OrderPayInfoService orderPayService;
|
||||
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
|
@ -69,4 +75,18 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
|||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> naocsServiceAllList = nacosServerService.naocsServiceAllList();
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
Set<String> customerSet
|
||||
= orderPayCustomerList.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
|
||||
return naocsServiceAllList.stream()
|
||||
.filter(nacosServer -> !customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue