feat():增加了客户接口
parent
ed1061196d
commit
53fc73b14a
|
@ -86,6 +86,10 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-pay-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -6,14 +6,12 @@ import com.muyu.pay.common.domain.req.CustomerListReq;
|
|||
import com.muyu.pay.common.domain.resp.CustomerResp;
|
||||
import com.muyu.pay.server.service.OrderPayCustomerService;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
@ -22,18 +20,31 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("customer")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "客户控制层",description = "进行客户管理查询操作")
|
||||
@Tag(name = "客户控制层", description = "进行客户管理查询操作")
|
||||
public class OrderPayCustomerController {
|
||||
|
||||
private final OrderPayCustomerService orderPayCustomerService;
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "查看客户",description = "根据客户名称 编号 状态 查询")
|
||||
@Operation(summary = "查看客户", description = "根据客户名称 编号 状态 查询")
|
||||
public Result<List<CustomerResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq req){
|
||||
@Validated @RequestBody CustomerListReq req) {
|
||||
return Result.success(orderPayCustomerService.selectList(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所以客户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("all")
|
||||
@Operation(summary = "获取未接入客户",description = "调用nacosAPI")
|
||||
@Schema(description = "获取未接入客户",type = "List")
|
||||
public Result<List<String>> getCustomerAllList() {
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,4 +12,6 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
|||
|
||||
public List<CustomerResp> selectList(CustomerListReq req);
|
||||
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import com.muyu.pay.common.domain.OrderPayCustomer;
|
||||
import com.muyu.pay.common.domain.OrderPayInfo;
|
||||
import com.muyu.pay.common.domain.req.CustomerListReq;
|
||||
|
@ -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;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
|
@ -30,6 +33,9 @@ public class OrderPayCustomerServiceImpl
|
|||
@Resource
|
||||
private OrderPayInfoService orderPayInfoService;
|
||||
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq req) {
|
||||
|
@ -61,4 +67,16 @@ 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> list = this.list(queryWrapper);
|
||||
Set<String> customerSet = list.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
return nacosServerAllList.stream()
|
||||
.filter(nacosServer->!customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue