feat():增加未接入客户接口
parent
2bc4b72e67
commit
627c5c6622
|
@ -92,6 +92,12 @@
|
||||||
<artifactId>cloud-pay-common</artifactId>
|
<artifactId>cloud-pay-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -7,15 +7,14 @@ import com.muyu.cloud.pay.domain.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.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
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;
|
||||||
|
@ -47,4 +46,17 @@ public class OrderPayCustomerController {
|
||||||
); //客户lei
|
); //客户lei
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有客户的列表
|
||||||
|
* @return 客户集合
|
||||||
|
*/
|
||||||
|
@GetMapping("/all")
|
||||||
|
@Operation(summary = "获取未接入的客户" , description = "调用nacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||||
|
@Schema(description = "获取未接入的客户",defaultValue = "[\"客户1\",\"客户1\"]",type = "List")
|
||||||
|
public Result<List<String>> getCustomerAllList(){
|
||||||
|
return Result.success(
|
||||||
|
orderPayCustomerService.getCustomerAllList()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,9 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||||
*/
|
*/
|
||||||
List<CustomerResp> selectList(CustomerListReq customerListReq);
|
List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有客户的列表
|
||||||
|
* @return 客户集合
|
||||||
|
*/
|
||||||
|
List<String> getCustomerAllList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,15 @@ import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
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.nacos.service.NacosServerService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
|
@ -26,6 +29,10 @@ public class OrderPayCustomerServiceImpl
|
||||||
@Resource(type = OrderPayServiceImpl.class)
|
@Resource(type = OrderPayServiceImpl.class)
|
||||||
private OrderPayService orderPayService;
|
private OrderPayService orderPayService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NacosServerService nacosServerService;
|
||||||
|
|
||||||
|
|
||||||
@Override //查询客户集合
|
@Override //查询客户集合
|
||||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
@ -102,4 +109,22 @@ public class OrderPayCustomerServiceImpl
|
||||||
)
|
)
|
||||||
.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