feat():新增列表查询
parent
146490a424
commit
74ef4065e2
|
@ -3,7 +3,13 @@ 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.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
|
@ -13,11 +19,12 @@ import lombok.*;
|
|||
* @Date:2024/7/31 9:32
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName( value = "order_pay_info",autoResultMap = true)
|
||||
public class OrderPayInfo {
|
||||
public class OrderPayInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
@ -49,6 +56,13 @@ public class OrderPayInfo {
|
|||
|
||||
private String payOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
|
@ -69,16 +83,13 @@ public class OrderPayInfo {
|
|||
|
||||
|
||||
|
||||
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return CustomerOrderPaySimpleResp.builder()
|
||||
.cusOrderNumber(this.getCusOrderNumber())
|
||||
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||
.price(this.price)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:CustomerOrderPaySimpleResp
|
||||
* @Date:2024/8/4 11:09
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户支付单",description = "客户支付单简略信息")
|
||||
public class CustomerOrderPaySimpleResp {
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
@Schema(name = "客户单号",type = "String",defaultValue = "OIEJSO798DOE79DIL",description = "客户传入的支付单信息")
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
@Schema(name = "支付金额",type = "BigDecimal",defaultValue = "36.56",description = "客户传入的支付金额")
|
||||
private BigDecimal price;
|
||||
|
||||
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
@Schema(name = "支付渠道商",type = "String",defaultValue = "支付宝",description = "用户支付的时候选择的渠道商")
|
||||
private String channelTypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +1,5 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import cn.hutool.db.sql.Order;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -11,9 +8,10 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
|
@ -61,7 +59,19 @@ public class CustomerResp {
|
|||
private Date createTime;
|
||||
|
||||
|
||||
public static CustomerResp customerBuild (OrderPayCustomer orderPayCustomer){
|
||||
/**
|
||||
* 客户最近5条支付单
|
||||
*/
|
||||
|
||||
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespList;
|
||||
|
||||
|
||||
/**
|
||||
* @param orderPayCustomer
|
||||
* @return 视图对象
|
||||
*/
|
||||
|
||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function) {
|
||||
return CustomerResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppName())
|
||||
|
@ -69,10 +79,9 @@ public class CustomerResp {
|
|||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.orderPaySimpleRespList(function.get())
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayCustomer
|
||||
* @Date:2024/8/4 11:24
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderPayCustomer {
|
||||
}
|
|
@ -3,6 +3,8 @@ 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:zhangchengzhi
|
||||
* @Package:com.muyu.cloud.pay.service
|
||||
|
@ -10,5 +12,16 @@ import com.muyu.cloud.pay.domain.OrderPayInfo;
|
|||
* @name:OrderPayInfoService
|
||||
* @Date:2024/7/31 9:54
|
||||
*/
|
||||
|
||||
public interface OrderPayInfoService extends IService<OrderPayInfo> {
|
||||
|
||||
/**
|
||||
* 根据客户code和分页限制,限制结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
|
||||
List<OrderPayInfo> selectOrderPayByAppAndLimit(String appCode, int limit);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,17 +4,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.OrderPayInfoService;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
|
@ -28,6 +33,10 @@ import java.util.List;
|
|||
public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer> implements OrderPayCustomerService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private OrderPayInfoService orderPayService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
|
||||
|
@ -47,13 +56,17 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
|||
OrderPayCustomer::getStatus, customerListReq.getStatus()
|
||||
);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
List<CustomerResp> customerRespList = new ArrayList<>();
|
||||
|
||||
return orderPayCustomerList.stream()
|
||||
.map(orderPayCustomer -> CustomerResp.customerBuild(
|
||||
orderPayCustomer,
|
||||
() -> orderPayService.selectOrderPayByAppAndLimit(orderPayCustomer.getAppCode(),5)
|
||||
.stream()
|
||||
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
.toList())
|
||||
)
|
||||
.toList();
|
||||
|
||||
|
||||
customerRespList = orderPayCustomerList.stream()
|
||||
.map(CustomerResp::customerBuild).toList();
|
||||
|
||||
|
||||
return customerRespList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
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.OrderPayInfoMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:zhangchengzhi
|
||||
* @Package:com.muyu.cloud.pay.service.impl
|
||||
|
@ -18,6 +21,15 @@ public class OrderPayInfoServiceImpl extends ServiceImpl<OrderPayInfoMapper, Ord
|
|||
implements OrderPayInfoService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppAndLimit(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,2 @@
|
|||
-- 给order_pay_info 支付记录订单表 添加支付金额 字段
|
||||
ALTER TABLE `order_pay_info` ADD COLUMN `price` decimal(24, 6) NULL COMMENT '支付金额' ;
|
Loading…
Reference in New Issue