feat():新增列表查询
parent
374ddfffe2
commit
192f196b11
|
@ -23,7 +23,7 @@ import lombok.experimental.SuperBuilder;
|
|||
public class OrderPayCustomer extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 注解
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type= IdType.AUTO)
|
||||
private Long id;
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package com.muyu.cloud.pay.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
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;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cloud.pay.domain
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayInfo
|
||||
* @Date:2024/8/8 22:11
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "order_pay_info",autoResultMap = true)
|
||||
public class OrderPayInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type= IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String appName;
|
||||
/**
|
||||
* 客户编号
|
||||
*/
|
||||
private String appCode;
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
private String cusOrderNumber;
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
private String price;
|
||||
/**
|
||||
* 聚到商类型
|
||||
*/
|
||||
private String channelType;
|
||||
/**
|
||||
* 聚到商单号
|
||||
*/
|
||||
private String channelOrderNumber;
|
||||
/**
|
||||
* 支付单状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp(){
|
||||
return CustomerOrderPaySimpleResp.builder()
|
||||
.cusOrderNumber(this.cusOrderNumber)
|
||||
.channelTypeName(SysPayType.getInifByCode(this.channelType))
|
||||
.price(this.getPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
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;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:CustomerOrderPaySimpleResp
|
||||
* @Date:2024/8/8 22:23
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户支付单",description = "客户支付单简略信息")
|
||||
public class CustomerOrderPaySimpleResp {
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
@Schema(name = "客户单号",type = "String",defaultValue = "OIEJSO723DOE12DIL",description = "客户传入的支付单信息")
|
||||
private String cusOrderNumber;
|
||||
// /**
|
||||
// * 支付单号
|
||||
// */
|
||||
// private String payOrderNumber;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
@Schema(name = "支付金额",type = "BigDecimal",defaultValue = "36.56",description = "客户传入的支付金额")
|
||||
private String price;
|
||||
/**
|
||||
* 聚到商类型
|
||||
*/
|
||||
@Schema(name = "支付聚到商",type = "String",defaultValue = "支付宝",description = "用户支付的时候选择的聚到是哪个建")
|
||||
private String channelTypeName;
|
||||
}
|
|
@ -10,6 +10,9 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
|
@ -26,7 +29,7 @@ import java.util.Date;
|
|||
public class CustomerResp {
|
||||
|
||||
/**
|
||||
* 注解
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "客户ID",defaultValue = "1",type = "Long")
|
||||
private Long id;
|
||||
|
@ -56,12 +59,17 @@ public class CustomerResp {
|
|||
@Schema(description = "创建时间",defaultValue = "2024-7-31 14:33:23",type = "Date")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 客户最近5条支付单
|
||||
*/
|
||||
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespList;
|
||||
|
||||
/**
|
||||
* 数据库对象构建为返回结果对象
|
||||
* @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())
|
||||
|
@ -69,6 +77,7 @@ public class CustomerResp {
|
|||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.orderPaySimpleRespList(function.get())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayResp
|
||||
* @Date:2024/8/8 22:21
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderPayResp {
|
||||
}
|
|
@ -45,7 +45,8 @@ public class OrderPayCustomerController {
|
|||
*/
|
||||
@RequestMapping(path = "/list" ,method = RequestMethod.POST)
|
||||
@Operation(summary = "查询客户",description = "根据客户的名称,编码,是否开启等可以进行客户的筛选")
|
||||
public Result<List<CustomerResp>> selectList(@Validated @RequestBody CustomerListReq customerListReq){
|
||||
public Result<List<CustomerResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq customerListReq){
|
||||
return Result.success(
|
||||
orderPayCustomerService.selectList(customerListReq)
|
||||
);
|
||||
|
|
|
@ -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:yang
|
||||
* @Package:com.muyu.cloud.pay.mapper
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayMapper
|
||||
* @Date:2024/8/9 9:30
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayMapper extends BaseMapper<OrderPayInfo> {
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cloud.pay.service
|
||||
* @Project:cloud-pay
|
||||
* @name:OderPayService
|
||||
* @Date:2024/8/9 9:32
|
||||
*/
|
||||
public interface OrderPayService extends IService<OrderPayInfo> {
|
||||
|
||||
/**
|
||||
* 根据客户code和分页限制,查询结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付结果记录
|
||||
*/
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||
}
|
|
@ -3,16 +3,22 @@ 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 org.apache.catalina.mapper.Mapper;
|
||||
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.function.Function;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
|
@ -26,6 +32,8 @@ public class OrderPayCustomerServiceImpl
|
|||
extends ServiceImpl<OrderPayCustomerMapper,OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
|
@ -44,7 +52,15 @@ public class OrderPayCustomerServiceImpl
|
|||
OrderPayCustomer::getStatus,customerListReq.getClass()
|
||||
);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
|
||||
return orderPayCustomerList.stream().map(CustomerResp::customerBuild).toList();
|
||||
return orderPayCustomerList.stream()
|
||||
.map(orderPayCustomer -> CustomerResp.customerBuild(
|
||||
orderPayCustomer,
|
||||
() -> orderPayService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(),5)
|
||||
.stream()
|
||||
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
.toList()
|
||||
)
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.cloud.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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:yang
|
||||
* @Package:com.muyu.cloud.pay.service.impl
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayServiceImpl
|
||||
* @Date:2024/8/9 9:33
|
||||
*/
|
||||
@Service
|
||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService
|
||||
{
|
||||
@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);
|
||||
//
|
||||
return this.list(orderPayInfoQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
CREATE TABLE order_pay_customer(
|
||||
`id` INT AUTO_INCREMENT COMMENT '主键' ,
|
||||
`app_name` VARCHAR(16) NOT NULL COMMENT '服务/客户名称' ,
|
||||
`app_code` VARCHAR(16) NOT NULL 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_info(
|
||||
`id` INT AUTO_INCREMENT COMMENT '主键' ,
|
||||
`app_name` VARCHAR(16) NOT NULL COMMENT '客户名称' ,
|
||||
`app_code` VARCHAR(16) NOT NULL 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_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,8 @@
|
|||
-- 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,30 @@
|
|||
-- order_pay_customer 支付单客户 修改创建人字段
|
||||
ALTER TABLE `order_pay_customer` CHANGE COLUMN `created_by` `create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建人';
|
||||
|
||||
-- order_pay_customer 支付单客户 修改创建时间字段
|
||||
ALTER TABLE `order_pay_customer` CHANGE COLUMN `created_time` `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间' ;
|
||||
|
||||
-- order_pay_customer 支付单客户 修改更新时间字段
|
||||
ALTER TABLE `order_pay_customer` CHANGE COLUMN `updated_time` `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间' ;
|
||||
|
||||
-- order_pay_info 订单支付信息 修改创建人字段
|
||||
ALTER TABLE `order_pay_info` CHANGE COLUMN `created_by` `create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建人';
|
||||
|
||||
-- order_pay_info 订单支付信息 修改创建时间字段
|
||||
ALTER TABLE `order_pay_info` CHANGE COLUMN `created_time` `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间' ;
|
||||
|
||||
-- order_pay_info 订单支付信息 修改更新时间字段
|
||||
ALTER TABLE `order_pay_info` CHANGE COLUMN `updated_time` `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间' ;
|
||||
|
||||
-- order_pay_refund 订单支付退款表 修改创建人字段
|
||||
ALTER TABLE `order_pay_refund` CHANGE COLUMN `created_by` `create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建人';
|
||||
|
||||
-- order_pay_refund 订单支付退款表 修改创建时间字段
|
||||
ALTER TABLE `order_pay_refund` CHANGE COLUMN `created_time` `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间' ;
|
||||
|
||||
-- order_pay_refund 订单支付退款表 修改更新时间字段
|
||||
ALTER TABLE `order_pay_refund` CHANGE COLUMN `updated_time` `update_time` datetime NULL DEFAULT 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