feat():增加列表查询
parent
b4181778ae
commit
fa4c27713d
|
@ -3,6 +3,8 @@ package com.muyu.cloud.pay.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
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 com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -59,4 +61,13 @@ public class OrderPayInfo extends BaseEntity {
|
||||||
* 支付单状态
|
* 支付单状态
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp() {
|
||||||
|
return CustomerOrderPaySimpleResp.builder()
|
||||||
|
.cusOrderNumber(this.cusOrderNumber)
|
||||||
|
.price(this.price)
|
||||||
|
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户结合返回值
|
* 客户结合返回值
|
||||||
|
@ -59,7 +61,7 @@ public class CustomerResp {
|
||||||
* @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())
|
||||||
.appCode(orderPayCustomer.getAppCode())
|
.appCode(orderPayCustomer.getAppCode())
|
||||||
|
@ -67,6 +69,7 @@ public class CustomerResp {
|
||||||
.createBy(orderPayCustomer.getCreateBy())
|
.createBy(orderPayCustomer.getCreateBy())
|
||||||
.createTime(orderPayCustomer.getCreateTime())
|
.createTime(orderPayCustomer.getCreateTime())
|
||||||
.status(orderPayCustomer.getStatus())
|
.status(orderPayCustomer.getStatus())
|
||||||
|
.orderPaySimpleRespList(function.get())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,17 @@ package com.muyu.cloud.pay.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单支付业务层
|
* 订单支付业务层
|
||||||
*/
|
*/
|
||||||
public interface OrderPayService extends IService<OrderPayInfo> {
|
public interface OrderPayService extends IService<OrderPayInfo> {
|
||||||
|
/**
|
||||||
|
* 根据客户code和分页限制,查询结果
|
||||||
|
* @param appCode 客户code
|
||||||
|
* @param limit 分页限制
|
||||||
|
* @return 支付订单记录
|
||||||
|
*/
|
||||||
|
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ 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.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 lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@ -41,24 +43,45 @@ public class OrderPayCustomerServiceImpl extends ServiceImpl<OrderPayCustomerMap
|
||||||
OrderPayCustomer::getStatus, customerListReq.getStatus() //是否开启
|
OrderPayCustomer::getStatus, customerListReq.getStatus() //是否开启
|
||||||
);
|
);
|
||||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||||
List<CustomerResp> customerRespList = 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();
|
||||||
|
// for (CustomerResp customerResp : customerRespList) {
|
||||||
|
|
||||||
|
//注释的这一部分在OrderPayServiceImpl中实现
|
||||||
|
// orderPayService.selectOrderPayByAppCodeAndLimit(customerResp.getAppCode(), 5);
|
||||||
|
//
|
||||||
|
// LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode, customerResp.getAppCode());
|
||||||
|
// orderPayInfoQueryWrapper.orderBy(true, false, OrderPayInfo::getCreateTime);
|
||||||
|
// orderPayInfoQueryWrapper.last("limit 5");
|
||||||
|
|
||||||
|
// List<OrderPayInfo> orderPayInfoList = orderPayService.selectOrderPayByAppCodeAndLimit(customerResp.getAppCode(),5);
|
||||||
|
|
||||||
|
// ArrayList<CustomerOrderPaySimpleResp> customerOrderPaySimpleList = new ArrayList<>();
|
||||||
|
// for (OrderPayInfo orderPayInfo : orderPayInfoList) {
|
||||||
|
// CustomerOrderPaySimpleResp customerOrderPaySimpleResp = new CustomerOrderPaySimpleResp();
|
||||||
|
// customerOrderPaySimpleResp.setCusOrderNumber(orderPayInfo.getCusOrderNumber());
|
||||||
|
// customerOrderPaySimpleResp.setPrice(orderPayInfo.getPrice());
|
||||||
|
// customerOrderPaySimpleResp.setChannelTypeName(SysPayType.getInfoByCode(orderPayInfo.getChannelType()));
|
||||||
|
// customerOrderPaySimpleList.add(customerOrderPaySimpleResp);
|
||||||
|
// }
|
||||||
|
// customerResp.setOrderPaySimpleRespList(customerOrderPaySimpleList);
|
||||||
|
|
||||||
|
// customerResp.setOrderPaySimpleRespList(
|
||||||
|
// orderPayService.selectOrderPayByAppCodeAndLimit(customerResp.getAppCode(),5)
|
||||||
|
// .stream()
|
||||||
|
// .map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||||
|
// .toList()
|
||||||
|
// );
|
||||||
|
|
||||||
|
|
||||||
for (CustomerResp customerResp : customerRespList) {
|
|
||||||
LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode, customerResp.getAppCode());
|
|
||||||
orderPayInfoQueryWrapper.orderBy(true, false, OrderPayInfo::getCreateTime);
|
|
||||||
orderPayInfoQueryWrapper.last("limit 5");
|
|
||||||
List<OrderPayInfo> orderPayInfoList = orderPayService.list(orderPayInfoQueryWrapper);
|
|
||||||
ArrayList<CustomerOrderPaySimpleResp> customerOrderPaySimpleList = new ArrayList<>();
|
|
||||||
for (OrderPayInfo orderPayInfo : orderPayInfoList) {
|
|
||||||
CustomerOrderPaySimpleResp customerOrderPaySimpleResp = new CustomerOrderPaySimpleResp();
|
|
||||||
customerOrderPaySimpleResp.setCusOrderNumber(orderPayInfo.getCusOrderNumber());
|
|
||||||
customerOrderPaySimpleResp.setPrice(orderPayInfo.getPrice());
|
|
||||||
customerOrderPaySimpleResp.setChannelTypeName(orderPayInfo.getChannelType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return customerRespList;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
package com.muyu.cloud.pay.service.impl;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||||
import com.muyu.cloud.pay.mapper.OrderPayMapper;
|
import com.muyu.cloud.pay.mapper.OrderPayMapper;
|
||||||
import com.muyu.cloud.pay.service.OrderPayService;
|
import com.muyu.cloud.pay.service.OrderPayService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单支付业务实现层
|
* 订单支付业务实现层
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue