feat():增加了客户接口
parent
ed1061196d
commit
53fc73b14a
|
@ -86,6 +86,10 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-pay-common</artifactId>
|
<artifactId>cloud-pay-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-nacos-api</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<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.common.domain.resp.CustomerResp;
|
||||||
import com.muyu.pay.server.service.OrderPayCustomerService;
|
import com.muyu.pay.server.service.OrderPayCustomerService;
|
||||||
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.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -22,18 +20,31 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("customer")
|
@RequestMapping("customer")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Tag(name = "客户控制层",description = "进行客户管理查询操作")
|
@Tag(name = "客户控制层", description = "进行客户管理查询操作")
|
||||||
public class OrderPayCustomerController {
|
public class OrderPayCustomerController {
|
||||||
|
|
||||||
private final OrderPayCustomerService orderPayCustomerService;
|
private final OrderPayCustomerService orderPayCustomerService;
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "查看客户",description = "根据客户名称 编号 状态 查询")
|
@Operation(summary = "查看客户", description = "根据客户名称 编号 状态 查询")
|
||||||
public Result<List<CustomerResp>> selectList(
|
public Result<List<CustomerResp>> selectList(
|
||||||
@Validated @RequestBody CustomerListReq req){
|
@Validated @RequestBody CustomerListReq req) {
|
||||||
return Result.success(orderPayCustomerService.selectList(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);
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.enums.SysPayType;
|
import com.muyu.common.core.enums.SysPayType;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
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.OrderPayCustomer;
|
||||||
import com.muyu.pay.common.domain.OrderPayInfo;
|
import com.muyu.pay.common.domain.OrderPayInfo;
|
||||||
import com.muyu.pay.common.domain.req.CustomerListReq;
|
import com.muyu.pay.common.domain.req.CustomerListReq;
|
||||||
|
@ -18,7 +19,9 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
|
@ -30,6 +33,9 @@ public class OrderPayCustomerServiceImpl
|
||||||
@Resource
|
@Resource
|
||||||
private OrderPayInfoService orderPayInfoService;
|
private OrderPayInfoService orderPayInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NacosServerService nacosServerService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CustomerResp> selectList(CustomerListReq req) {
|
public List<CustomerResp> selectList(CustomerListReq req) {
|
||||||
|
@ -61,4 +67,16 @@ public class OrderPayCustomerServiceImpl
|
||||||
.toList();
|
.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