feat():增加未接入客户接口
parent
2730d286d8
commit
034cb9a0f4
|
@ -90,6 +90,11 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-pay-common</artifactId>
|
<artifactId>cloud-pay-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@ import com.muyu.cloud.pay.domin.resp.CustomerResp;
|
||||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -49,5 +47,18 @@ public class OrderPayCustomerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有客户的列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/all")
|
||||||
|
@Operation(summary = "获取未接入的客户",description = "调用nacosAPI获取有的微服务名称,作为支付中台的客户")
|
||||||
|
@Schema(description = "客户列表",defaultValue = "[\"客户1\",\"客户2\"]",type = "Long")
|
||||||
|
public Result<List<String>>getCustomerAllList(){
|
||||||
|
return Result.success(
|
||||||
|
orderPayCustomerService.getCustomerAllList()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,10 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<CustomerResp> selectList(CustomerListReq CustomerListReq);
|
public List<CustomerResp> selectList(CustomerListReq CustomerListReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有的客户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getCustomerAllList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||||
import com.muyu.cloud.pay.service.OrderPayService;
|
import com.muyu.cloud.pay.service.OrderPayService;
|
||||||
import com.muyu.common.core.enums.SysPayType;
|
import com.muyu.common.core.enums.SysPayType;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.nacos.service.NacosServerService;
|
||||||
import io.jsonwebtoken.lang.Strings;
|
import io.jsonwebtoken.lang.Strings;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -19,7 +20,9 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:weiran
|
* @Author:weiran
|
||||||
|
@ -34,6 +37,8 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderPayService orderPayService;
|
private OrderPayService orderPayService;
|
||||||
|
@Autowired
|
||||||
|
private NacosServerService nacosServerService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||||
|
@ -57,4 +62,23 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有的客户
|
||||||
|
* @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> customerSet = orderPayCustomerList.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
return nacosServerAllList.stream()
|
||||||
|
.filter(nacosServer->customerSet.contains(nacosServer))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue