feat():增加了客户接口

master
Cui YongXing 2024-08-04 14:17:38 +08:00
parent ed1061196d
commit 53fc73b14a
5 changed files with 43 additions and 8 deletions

View File

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

View File

@ -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;
@ -34,6 +32,19 @@ public class OrderPayCustomerController {
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()
);
}
}

View File

@ -12,4 +12,6 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
public List<CustomerResp> selectList(CustomerListReq req);
List<String> getCustomerAllList();
}

View File

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

View File

@ -8,7 +8,7 @@
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-server-parent</artifactId>
<version>3.6.3</version>
<version>3.6.4</version>
</parent>