feat(): 增加未介入客户接口
parent
ef7fbae0fa
commit
b1357df409
|
@ -19,6 +19,11 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -6,14 +6,12 @@ import com.bwie.cloud.pay.domain.resp.CustomerResp;
|
|||
import com.bwie.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.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;
|
||||
|
||||
|
@ -45,4 +43,14 @@ public class OrderPayCustomerController {
|
|||
return Result.success(orderPayCustomerService.selectList(customerListReq));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用nacosAPI获取所有的微服务,作为支付中台的客户")
|
||||
@Schema(description = "获取未接入的客户",defaultValue = "[\"客户1\"],[\"客户2\"]",type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,4 +21,6 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
* @return
|
||||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
List<String> getCustomerAllList();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.bwie.cloud.pay.domain.resp.CustomerResp;
|
|||
import com.bwie.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.bwie.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.bwie.cloud.pay.service.OrderPayService;
|
||||
import com.bwie.nacos.remote.service.NacosServeService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -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:zhangzhihao
|
||||
|
@ -33,6 +36,9 @@ public class OrderPayCustomerServiceImpl
|
|||
implements OrderPayCustomerService {
|
||||
|
||||
|
||||
@Resource
|
||||
private NacosServeService nacosServeService;
|
||||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
|
@ -66,5 +72,20 @@ public class OrderPayCustomerServiceImpl
|
|||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServeService.nacosServerAllList();
|
||||
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 nacosServerAllList.stream()
|
||||
.filter(nacosServer ->!customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue