feat():新增列表查询
parent
ef6e56e64e
commit
6ee248dc61
|
@ -0,0 +1,82 @@
|
|||
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;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "order_pay_info",autoResultMap = true)
|
||||
public class OrderPayInfo extends BaseEntity {
|
||||
|
||||
// `appName` COMMENT '客户名称' ,
|
||||
// `appCode` COMMENT '客户编号' ,
|
||||
// `cusOrderNumber` COMMENT '客户单号' ,
|
||||
// `payOrderNumber` COMMENT '支付单号' ,
|
||||
// `channelType` COMMENT '渠道商类型' ,
|
||||
// `channelOrderNumber` COMMENT '渠道商单号' ,
|
||||
// `status` VARCHAR(255) COMMENT '支付单状态;',
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@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,34 @@
|
|||
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;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户支付单",description = "客户支付单简略信息")
|
||||
public class CustomerOrderPaySimpleResp {
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
@Schema(name = "客户单号",type = "String",defaultValue = "OISEDSFd558588DF",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,8 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
|
@ -51,12 +53,21 @@ public class CustomerResp {
|
|||
@Schema(description = "创建时间",defaultValue = "2024-8-1 12:00:00",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())
|
||||
.appCode(orderPayCustomer.getAppCode())
|
||||
|
@ -64,6 +75,7 @@ public class CustomerResp {
|
|||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.orderPaySimpleRespList(function.get())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderPayResp {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* 支付持久层
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayMapper extends BaseMapper<OrderPayInfo> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderPayService extends IService<OrderPayInfo> {
|
||||
/***
|
||||
* 根据客户code和分页限制,查询结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||
}
|
|
@ -3,14 +3,16 @@ 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.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.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
@ -18,6 +20,9 @@ public class OrderPayCustomerServiceImpl extends
|
|||
ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
@Resource(type = OrderPayServiceImpl.class)
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -37,50 +42,14 @@ public class OrderPayCustomerServiceImpl extends
|
|||
OrderPayCustomer::getStatus, customerListReq.getStatus());
|
||||
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
List<CustomerResp> customerRespList=new ArrayList<>();
|
||||
|
||||
// for (OrderPayCustomer orderPayCustomer : orderPayCustomerList) {
|
||||
// CustomerResp customerResp = new CustomerResp();
|
||||
// customerResp.setId(orderPayCustomer.getId());
|
||||
// customerResp.setAppName(orderPayCustomer.getAppName());
|
||||
// customerResp.setStatus(orderPayCustomer.getStatus());
|
||||
// customerResp.setCreateBy(orderPayCustomer.getCreateBy());
|
||||
// customerResp.setCreateTime(orderPayCustomer.getCreateTime());
|
||||
// customerResp.setAppCode(orderPayCustomer.getAppCode());
|
||||
// customerRespList.add(customerResp);
|
||||
// }
|
||||
|
||||
//第四种方法
|
||||
// customerRespList =orderPayCustomerList
|
||||
// .stream().map(CustomerResp::customerBuild
|
||||
// ).toList();
|
||||
|
||||
|
||||
//第三种方法
|
||||
// customerRespList = orderPayCustomerList.stream()
|
||||
// .map(orderPayCustomer ->
|
||||
// CustomerResp.builder()
|
||||
// .id(orderPayCustomer.getId())
|
||||
// .appCode(orderPayCustomer.getAppCode())
|
||||
// .appName(orderPayCustomer.getAppName())
|
||||
// .createTime(orderPayCustomer.getCreateTime())
|
||||
// .status(orderPayCustomer.getStatus())
|
||||
// .createBy(orderPayCustomer.getCreateBy())
|
||||
// .build()).toList();
|
||||
|
||||
|
||||
|
||||
//第二种方法
|
||||
// customerResp.setAppName(orderPayCustomer.getAppName());
|
||||
// customerResp.setStatus(orderPayCustomer.getStatus());
|
||||
// customerResp.setCreateBy(orderPayCustomer.getCreateBy());
|
||||
// customerResp.setCreateTime(orderPayCustomer.getCreateTime());
|
||||
// customerResp.setAppCode(orderPayCustomer.getAppCode());
|
||||
// return customerResp;
|
||||
|
||||
|
||||
return orderPayCustomerList
|
||||
.stream().map(CustomerResp::customerBuild
|
||||
).toList();
|
||||
.stream().map(orderPayCustomer -> CustomerResp.customerBuild(orderPayCustomer,
|
||||
() ->
|
||||
orderPayService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(), 5)
|
||||
.stream()
|
||||
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
.toList())).toList();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
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;
|
||||
|
||||
@Service
|
||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService {
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit) {
|
||||
|
||||
LambdaQueryWrapper<OrderPayInfo> orderPayInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
orderPayInfoLambdaQueryWrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||
orderPayInfoLambdaQueryWrapper.orderBy(true,false,OrderPayInfo::getCreateTime);
|
||||
orderPayInfoLambdaQueryWrapper.last("limit"+limit);
|
||||
// List<OrderPayInfo> orderPayInfoList = this.list(orderPayInfoLambdaQueryWrapper);
|
||||
return this.list(orderPayInfoLambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
-- 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,3 @@
|
|||
-- 给order_pay_info 支付记录订单表 添加支付金额字段
|
||||
|
||||
ALTER TABLE `order_pay_info` ADD COLUMN `price` decimal(24, 6) NULL COMMENT '支付金额';
|
Loading…
Reference in New Issue