feat(): 新增未接入客户接口
parent
9d0f3b5435
commit
6ee23a97dc
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.cloud.pay.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerOrderPaySimpleResp;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -65,6 +67,13 @@ public class OrderPayInfo extends BaseEntity{
|
|||
*/
|
||||
private String status;
|
||||
|
||||
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp() {
|
||||
|
||||
return CustomerOrderPaySimpleResp.builder()
|
||||
.cusOrderNumber(this.cusOrderNumber)
|
||||
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||
.price(this.price)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -18,27 +20,27 @@ import java.math.BigDecimal;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户支付单", description = "客户支付单简略信息")
|
||||
public class CustomerOrderPaySimpleResp {
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
@Schema(name = "客户单号",type="String",defaultValue = "YX20031223183DSG",description = "客户传入的支付单信息")
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
|
||||
/**
|
||||
*支付金额
|
||||
*/
|
||||
@Schema(name = "支付金额",type = "BigDecimal",defaultValue = "36.56",description = "客户传入的支付金额")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
private String channelType;
|
||||
@Schema(name = "支付渠道商",type = "String",defaultValue = "支付宝",description = "用户支付的时候选择的渠道商")
|
||||
private String channelTypeName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import lombok.Data;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
|
@ -70,13 +72,14 @@ public class CustomerResp {
|
|||
* @param orderPayCustomer 数据对象
|
||||
* @return 视图对象
|
||||
*/
|
||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer) {
|
||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function){
|
||||
return CustomerResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppName())
|
||||
.appCode(orderPayCustomer.getAppCode())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.orderPaySimpleRespList(function.get())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayResp
|
||||
* @Date:2024/8/4 11:28
|
||||
*/
|
||||
public class OrderPayResp {
|
||||
}
|
|
@ -92,6 +92,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-xxl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@ 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 jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -49,4 +48,19 @@ public class OrderPayCustomerServiceController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有客户的列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用nacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||
@Schema(description = "获取未接入的客户",defaultValue = "[\"客户1\",\"客户2\"]",type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.cloud.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.mapper
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayMapper
|
||||
* @Date:2024/8/6 20:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayMapper extends BaseMapper<OrderPayInfo>{
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.service
|
||||
|
@ -23,4 +20,10 @@ public interface OrderPayCustomerService extends IService<OrderPayCustomer>{
|
|||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.service
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayService
|
||||
* @Date:2024/8/6 20:30
|
||||
*/
|
||||
public interface OrderPayService extends IService<OrderPayInfo>{
|
||||
/**
|
||||
* 根据客户code和分页限制,查询结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||
}
|
|
@ -2,14 +2,27 @@ package com.muyu.cloud.pay.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerOrderPaySimpleResp;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
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.remote.NacosServiceRemote;
|
||||
import com.muyu.common.nacos.service.NacosServiceService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.service.impl
|
||||
|
@ -23,6 +36,14 @@ public class OrderPayCustomerServiceImpl
|
|||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService{
|
||||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
|
||||
@Resource
|
||||
private NacosServiceService nacosServiceService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询客户集合
|
||||
* @param customerListReq 请求参数
|
||||
|
@ -49,9 +70,52 @@ public class OrderPayCustomerServiceImpl
|
|||
);
|
||||
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
|
||||
return orderPayCustomerList.stream()
|
||||
.map(CustomerResp::customerBuild)
|
||||
.map(orderPayCustomer -> CustomerResp.customerBuild(orderPayCustomer,
|
||||
() -> orderPayService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(),5)
|
||||
.stream()
|
||||
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
.toList()))
|
||||
.toList();
|
||||
|
||||
}
|
||||
|
||||
@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(nacosServer -> !customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//List<CustomerOrderPaySimpleResp> customerOrderPaySimpleRespList=new ArrayList<>();
|
||||
// for (OrderPayInfo orderPayInfo : orderPayInfoList) {
|
||||
//
|
||||
//CustomerOrderPaySimpleResp customerOrderPaySimpleResp = new CustomerOrderPaySimpleResp();
|
||||
// customerOrderPaySimpleResp.setCusOrderNumber(orderPayInfo.getCusOrderNumber());
|
||||
// customerOrderPaySimpleResp.setPrice(orderPayInfo.getPrice());
|
||||
// customerOrderPaySimpleResp.setChannelTypeName(SysPayType.getInfoByCode(orderPayInfo.getChannelType()));
|
||||
// customerOrderPaySimpleRespList.add(customerOrderPaySimpleResp);
|
||||
//
|
||||
//
|
||||
// customerResp.setOrderPaySimpleRespList(
|
||||
// orderPayCustomerList.stream()
|
||||
// .map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
// .toList()
|
||||
// );
|
||||
//
|
||||
// }
|
||||
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package com.muyu.cloud.pay.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import com.muyu.cloud.pay.mapper.OrderPayMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.service.impl
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayServiceImpl
|
||||
* @Date:2024/8/6 20:31
|
||||
*/
|
||||
@Service
|
||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService{
|
||||
|
||||
|
||||
/**
|
||||
* 根据客户code和分页限制,查询结果
|
||||
*
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit) {
|
||||
|
||||
|
||||
LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
|
||||
orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||
orderPayInfoQueryWrapper.orderBy(true,false,OrderPayInfo::getCreateTime);
|
||||
orderPayInfoQueryWrapper.last("limit"+limit);
|
||||
List<OrderPayInfo> orderPayInfoList = this.list(orderPayInfoQueryWrapper);
|
||||
return this.list(orderPayInfoQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
|
||||
CREATE TABLE order_pay_info(
|
||||
`id` INT AUTO_INCREMENT COMMENT '主键' ,
|
||||
`app_name` VARCHAR(16) NOT NULL COMMENT '客户名称' ,
|
||||
`app_code` VARCHAR(16) COMMENT '客户编号' ,
|
||||
`cus_order_number` VARCHAR(32) COMMENT '客户单号' ,
|
||||
`pay_order_number` VARCHAR(32) COMMENT '支付单号' ,
|
||||
`channel_type` VARCHAR(32) COMMENT '渠道商类型' ,
|
||||
`channel_order_number` VARCHAR(64) COMMENT '渠道商单号' ,
|
||||
`status` VARCHAR(32) COMMENT '支付单状态;0:新建 1:待支付 2:支付中 3:支付成功 4:支付失败 5:支付超时' ,
|
||||
`create_by` bigint COMMENT '创建人' ,
|
||||
`create_time` DATETIME COMMENT '创建时间' ,
|
||||
`update_by` bigint COMMENT '更新人' ,
|
||||
`update_time` DATETIME COMMENT '更新时间' ,
|
||||
PRIMARY KEY (id)
|
||||
) COMMENT = '订单支付信息';
|
||||
|
||||
|
||||
CREATE TABLE order_pay_customer(
|
||||
`id` INT AUTO_INCREMENT COMMENT '主键' ,
|
||||
`app_name` VARCHAR(16) NOT NULL COMMENT '服务/客户名称' ,
|
||||
`app_code` VARCHAR(16) COMMENT '服务/客户编码' ,
|
||||
`app_desc` TEXT COMMENT '客户描述' ,
|
||||
`status` VARCHAR(32) COMMENT '是否开启' ,
|
||||
`create_by` bigint COMMENT '创建人' ,
|
||||
`create_time` DATETIME COMMENT '创建时间' ,
|
||||
`update_by` bigint COMMENT '更新人' ,
|
||||
`update_time` DATETIME COMMENT '更新时间' ,
|
||||
PRIMARY KEY (id)
|
||||
) COMMENT = '支付单客户';
|
||||
|
||||
|
||||
CREATE TABLE order_pay_refund(
|
||||
`id` INT AUTO_INCREMENT COMMENT '主键' ,
|
||||
`cus_order_number` VARCHAR(32) NOT NULL COMMENT '客户退单号' ,
|
||||
`pay_order_number` VARCHAR(32) NOT NULL COMMENT '支付单号' ,
|
||||
`channel_order_number` VARCHAR(64) NOT NULL COMMENT '渠道商退单号' ,
|
||||
`price` DECIMAL(24,6) NOT NULL COMMENT '退款金额' ,
|
||||
`pay_info_number` VARCHAR(32) COMMENT '支付单号' ,
|
||||
`to_account_time` DATETIME COMMENT '到账时间' ,
|
||||
`status` VARCHAR(32) COMMENT '退单状态' ,
|
||||
`create_by` bigint COMMENT '创建人' ,
|
||||
`create_time` DATETIME COMMENT '创建时间' ,
|
||||
`update_by` bigint COMMENT '更新人' ,
|
||||
`update_time` DATETIME COMMENT '更新时间' ,
|
||||
PRIMARY KEY (id)
|
||||
) COMMENT = '订单支付退款表';
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
-- order_pay_customer 支付单客户 增加备注字段
|
||||
ALTER TABLE `order_pay_customer` ADD COLUMN `remark` varchar(64) NULL COMMENT '备注';
|
||||
-- order_pay_info 支付订单记录表 增加备注字段
|
||||
ALTER TABLE `order_pay_info` ADD COLUMN `remark` varchar(64) NULL COMMENT '备注';
|
||||
-- order_pay_refund 支付退款表 增加备注字段
|
||||
ALTER TABLE `order_pay_refund` ADD COLUMN `remark` varchar(64) NULL COMMENT '备注';
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-- 给order_pay_info 支付记录订单表 添加支付金额字段
|
||||
ALTER TABLE `order_pay_info` ADD COLUMN `price` decimal(24, 6) NULL COMMENT '支付价格' ;
|
Loading…
Reference in New Issue