feat():新增列表查询
parent
b147ec9e06
commit
63cac11fce
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MarkdownSettingsMigration">
|
<component name="MarkdownSettingsMigration">
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName OrderPayInfo
|
||||||
|
* @Description 交易订单信息
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/7 22:04
|
||||||
|
*/
|
||||||
|
@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 BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 渠道商类型
|
||||||
|
*/
|
||||||
|
private String channelType;
|
||||||
|
/**
|
||||||
|
* 渠道商单号
|
||||||
|
*/
|
||||||
|
private String channelOrderNumber;
|
||||||
|
/**
|
||||||
|
* 支付单状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp(){
|
||||||
|
return CustomerOrderPaySimpleResp.builder()
|
||||||
|
.cusOrderNumber(this.cusOrderNumber)
|
||||||
|
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||||
|
.price(this.price)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName CustomerOrderPaySimpleResp
|
||||||
|
* @Description 客户支付单简略返回实体
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/7 22:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name="客户支付单",description = "客户支付单简略信息")
|
||||||
|
public class CustomerOrderPaySimpleResp {
|
||||||
|
/**
|
||||||
|
* 客户单号
|
||||||
|
*/
|
||||||
|
@Schema(name = "客户单号",type = "String",defaultValue = "YUIO3679FCVBNM",description = "客户单传入的支付信息")
|
||||||
|
private String cusOrderNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
@Schema(name = "客户单号",type = "BigDecimal",defaultValue = "36.56",description = "客户传入的支付金额")
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 渠道商类型
|
||||||
|
*/
|
||||||
|
@Schema(name = "支付渠道商",type = "String",defaultValue = "支付宝",description = "用户支付的时候选择的渠道商")
|
||||||
|
private String channelTypeName;
|
||||||
|
}
|
|
@ -10,6 +10,9 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName CustomerListResp
|
* @ClassName CustomerListResp
|
||||||
|
@ -51,12 +54,16 @@ public class CustomerResp {
|
||||||
@Schema(description = "创建时间", defaultValue = "2024-8-7 11:51:02", type = "Date")
|
@Schema(description = "创建时间", defaultValue = "2024-8-7 11:51:02", type = "Date")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户最近5条支付单
|
||||||
|
*/
|
||||||
|
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespList;
|
||||||
/**
|
/**
|
||||||
* 数据库对象构建为返回结果对象
|
* 数据库对象构建为返回结果对象
|
||||||
* @param orderPayCustomer
|
* @param orderPayCustomer
|
||||||
* @return 视图对象
|
* @return 视图对象
|
||||||
*/
|
*/
|
||||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer) {
|
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function) {
|
||||||
return CustomerResp.builder()
|
return CustomerResp.builder()
|
||||||
.id(orderPayCustomer.getId())
|
.id(orderPayCustomer.getId())
|
||||||
.appName(orderPayCustomer.getAppName())
|
.appName(orderPayCustomer.getAppName())
|
||||||
|
@ -64,6 +71,7 @@ public class CustomerResp {
|
||||||
.status(orderPayCustomer.getStatus())
|
.status(orderPayCustomer.getStatus())
|
||||||
.createBy(orderPayCustomer.getCreateBy())
|
.createBy(orderPayCustomer.getCreateBy())
|
||||||
.createTime(orderPayCustomer.getCreateTime())
|
.createTime(orderPayCustomer.getCreateTime())
|
||||||
|
.orderPaySimpleRespList(function.get())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.cloud.pay.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName OrderPayResp
|
||||||
|
* @Description 支付返回结果
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/7 22:10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class OrderPayResp {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
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;
|
||||||
|
/**
|
||||||
|
* @ClassName OrderPayCustomerMapper
|
||||||
|
* @Description 订单支付持久层
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/5 21:12
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OrderPayMapper extends BaseMapper<OrderPayInfo> {
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.cloud.pay.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName OrderPayCustomerMapper
|
||||||
|
* @Description 订单支付业务层
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/5 21:12
|
||||||
|
*/
|
||||||
|
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.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
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.req.CustomerListReq;
|
||||||
|
import com.muyu.cloud.pay.domain.resp.CustomerOrderPaySimpleResp;
|
||||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
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.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName OrderPayCustomerServiceImpl
|
* @ClassName OrderPayCustomerServiceImpl
|
||||||
|
@ -25,7 +31,8 @@ import java.util.List;
|
||||||
public class OrderPayCustomerServiceImpl
|
public class OrderPayCustomerServiceImpl
|
||||||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||||
implements OrderPayCustomerService {
|
implements OrderPayCustomerService {
|
||||||
|
@Resource(type = OrderPayServiceImpl.class)
|
||||||
|
private OrderPayService orderPayService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||||
|
@ -44,7 +51,11 @@ public class OrderPayCustomerServiceImpl
|
||||||
);
|
);
|
||||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||||
return orderPayCustomerList.stream()
|
return orderPayCustomerList.stream()
|
||||||
.map(CustomerResp::customerBuild)
|
.map(orderPayCustomer -> CustomerResp.customerBuild(orderPayCustomer,
|
||||||
|
() -> orderPayService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(), 5)
|
||||||
|
.stream()
|
||||||
|
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||||
|
.toList()))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
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.OrderPayInfo;
|
||||||
|
import com.muyu.cloud.pay.mapper.OrderPayMapper;
|
||||||
|
import com.muyu.cloud.pay.service.OrderPayService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName OrderPayServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/7 22:24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit) {
|
||||||
|
LambdaQueryWrapper<OrderPayInfo> orderPayInfoWrapper = new LambdaQueryWrapper<>();
|
||||||
|
orderPayInfoWrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||||
|
orderPayInfoWrapper.orderBy(true,false,OrderPayInfo::getCreateTime);
|
||||||
|
orderPayInfoWrapper.last("limit "+limit);
|
||||||
|
|
||||||
|
return this.list(orderPayInfoWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
-- order_pay_customer 支付单客户 增加备注字段
|
||||||
|
ALTER TABLE `order_pay_customer` ADD COLUMN `remark` varchar(64) NULL COMMENT '备注';
|
||||||
|
-- order_pay_customer 支付订单记录表 增加备注字段
|
||||||
|
ALTER TABLE `order_pay_info` ADD COLUMN `remark` varchar(64) NULL COMMENT '备注';
|
||||||
|
-- order_pay_customer 支付退款表 增加备注字段
|
||||||
|
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