增加未接入客户接口

master
李东佳 2024-08-10 09:03:57 +08:00
parent cbc5e0e6c1
commit 9efadbdc6c
4 changed files with 44 additions and 4 deletions

View File

@ -91,6 +91,11 @@
<groupId>com.muyu</groupId>
<artifactId>cloud-pay-common</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-nacos-remote</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -6,14 +6,12 @@ import com.muyu.cloud.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;
@ -49,4 +47,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()
);
}
}

View File

@ -23,4 +23,9 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
*/
public List<CustomerResp> selectList(CustomerListReq customerListReq);
/**
*
* @return
*/
List<String> getCustomerAllList();
}

View File

@ -12,13 +12,16 @@ 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.core.utils.StringUtils;
import com.muyu.common.nacos.service.NacosServerService;
import lombok.extern.log4j.Log4j2;
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:LiDongJia
@ -36,6 +39,9 @@ public class OrderPayCustomerServiceImpl
@Resource(type = OrderPayServiceImpl.class)
private OrderPayService orderPayService;
@Resource
private NacosServerService nacosServerService;
/**
*
*
@ -69,4 +75,17 @@ public class OrderPayCustomerServiceImpl
)
.toList();
}
@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();
}
}