feat():增加未接入的客户
parent
746e3a1e71
commit
1af958d0e6
|
@ -89,6 +89,13 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-pay-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -6,15 +6,13 @@ 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;
|
||||
|
||||
|
@ -52,4 +50,16 @@ public class OrderPayCustomerController {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有客户的列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用NacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||
@Schema(description = "获取未接入的客户",defaultValue = "[\"客户1\",\"客户2\"]",type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,5 +17,16 @@ import java.util.List;
|
|||
*/
|
||||
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||
|
||||
/**
|
||||
* 查询客户集合
|
||||
* @param customerListReq 请求参数
|
||||
* @return 客户集合
|
||||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.nacos.service.NacosServiceService;
|
||||
import org.apache.catalina.mapper.Mapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -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:yang
|
||||
|
@ -34,7 +37,13 @@ public class OrderPayCustomerServiceImpl
|
|||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
@Resource
|
||||
private NacosServiceService nacosServiceService;
|
||||
/**
|
||||
* 查询客户集合
|
||||
* @param customerListReq 请求参数
|
||||
* @return 客户集合
|
||||
*/
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
|
||||
|
@ -63,4 +72,19 @@ public class OrderPayCustomerServiceImpl
|
|||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServiceService.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(nacosService -> !customerSet.contains(nacosService)).toList();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue