feat():增加未接入的客户

master
Yueng 2024-08-09 21:44:10 +08:00
parent 746e3a1e71
commit 1af958d0e6
4 changed files with 57 additions and 5 deletions

View File

@ -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>

View File

@ -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()
);
}
}

View File

@ -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();
}

View File

@ -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;
/**
* @Authoryang
@ -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();
}
}