feat():增加未接入客户接口
parent
c11e41e93c
commit
662c8d5b55
|
@ -8,14 +8,8 @@
|
|||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/../cloud-common-nacos-remote/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/../cloud-common-nacos-remote/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
|
|
|
@ -18,11 +18,21 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -5,14 +5,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;
|
||||
|
||||
|
@ -39,4 +37,17 @@ public class OrderPayCustomerController {
|
|||
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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,10 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
* @return 返回集合
|
||||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
}
|
||||
|
|
|
@ -10,10 +10,13 @@ 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.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class OrderPayCustomerServiceImpl extends
|
||||
|
@ -22,6 +25,10 @@ public class OrderPayCustomerServiceImpl extends
|
|||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
|
@ -52,4 +59,21 @@ public class OrderPayCustomerServiceImpl extends
|
|||
.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