feat():增加了客户接口
parent
2f356008f8
commit
0192c67fbe
|
@ -3,14 +3,21 @@ package com.muyu.pay.common.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.common.core.enums.SysPayType;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.*;
|
import com.muyu.pay.common.domain.resp.CustomerOrderPaySimpleResp;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@TableName(value = "order_pay_info" ,autoResultMap = true)
|
@TableName(value = "order_pay_info" ,autoResultMap = true)
|
||||||
public class OrderPayInfo extends BaseEntity {
|
public class OrderPayInfo extends BaseEntity {
|
||||||
|
@ -46,6 +53,12 @@ public class OrderPayInfo extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String channelType;
|
private String channelType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渠道商单号
|
* 渠道商单号
|
||||||
*/
|
*/
|
||||||
|
@ -57,5 +70,16 @@ public class OrderPayInfo extends BaseEntity {
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp(){
|
||||||
|
return CustomerOrderPaySimpleResp.builder()
|
||||||
|
.cusOrderNumber(this.cusOrderNumber)
|
||||||
|
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||||
|
.price(this.price)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.pay.common.domain.req;
|
||||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.muyu.pay.common.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
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
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Tag(name = "客户支付单",description = "客户支付单信息")
|
||||||
|
public class CustomerOrderPaySimpleResp {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户单号
|
||||||
|
*/
|
||||||
|
@Schema(name = "客户单号",description = "客户单号",type = "String",defaultValue = "aliyunzfb1239912331")
|
||||||
|
private String cusOrderNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付单号
|
||||||
|
*/
|
||||||
|
@Schema(name = "支付金额",description = "支付金额",type = "String",defaultValue = "llffasd31231223")
|
||||||
|
private String payOrderNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
@Schema(name = "支付金额",description = "支付金额",type = "BigDecimal",defaultValue = "25.3")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道商类型
|
||||||
|
*/
|
||||||
|
@Schema(name = "渠道商类型",description = "用户支付的时候选择渠道商",type = "BigDecimal",defaultValue = "支付宝")
|
||||||
|
private String channelTypeName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -10,8 +10,12 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -55,7 +59,15 @@ public class CustomerResp {
|
||||||
@Schema(description = "创建时间",defaultValue = "2024-7-31 21:16:45",type = "Date")
|
@Schema(description = "创建时间",defaultValue = "2024-7-31 21:16:45",type = "Date")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer){
|
/**
|
||||||
|
* 客户最近5条支付单
|
||||||
|
*/
|
||||||
|
@Schema(description = "客户最近5条支付单")
|
||||||
|
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespsList;
|
||||||
|
|
||||||
|
|
||||||
|
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function){
|
||||||
|
|
||||||
return CustomerResp.builder()
|
return CustomerResp.builder()
|
||||||
.id(orderPayCustomer.getId())
|
.id(orderPayCustomer.getId())
|
||||||
.appName(orderPayCustomer.getAppCode())
|
.appName(orderPayCustomer.getAppCode())
|
||||||
|
@ -64,6 +76,7 @@ public class CustomerResp {
|
||||||
.status(orderPayCustomer.getStatus())
|
.status(orderPayCustomer.getStatus())
|
||||||
.createBy(orderPayCustomer.getCreateBy())
|
.createBy(orderPayCustomer.getCreateBy())
|
||||||
.createTime(orderPayCustomer.getCreateTime())
|
.createTime(orderPayCustomer.getCreateTime())
|
||||||
|
.orderPaySimpleRespsList(function.get())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.muyu.pay.common.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OrderPayResp {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户编号
|
||||||
|
*/
|
||||||
|
private String appCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户单号
|
||||||
|
*/
|
||||||
|
private String cusOrderNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付单号
|
||||||
|
*/
|
||||||
|
private String payOrderNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道商类型
|
||||||
|
*/
|
||||||
|
private String channelType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道商单号
|
||||||
|
*/
|
||||||
|
private String channelOrderNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付单状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.pay.common.domain.OrderPayInfo;
|
import com.muyu.pay.common.domain.OrderPayInfo;
|
||||||
import com.muyu.pay.server.mapper.OrderPayInfoMapper;
|
import com.muyu.pay.server.mapper.OrderPayInfoMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface OrderPayInfoService extends IService<OrderPayInfo> {
|
public interface OrderPayInfoService extends IService<OrderPayInfo> {
|
||||||
|
|
||||||
|
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,23 @@ package com.muyu.pay.server.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.common.core.enums.SysPayType;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.pay.common.domain.OrderPayCustomer;
|
import com.muyu.pay.common.domain.OrderPayCustomer;
|
||||||
|
import com.muyu.pay.common.domain.OrderPayInfo;
|
||||||
import com.muyu.pay.common.domain.req.CustomerListReq;
|
import com.muyu.pay.common.domain.req.CustomerListReq;
|
||||||
|
import com.muyu.pay.common.domain.resp.CustomerOrderPaySimpleResp;
|
||||||
import com.muyu.pay.common.domain.resp.CustomerResp;
|
import com.muyu.pay.common.domain.resp.CustomerResp;
|
||||||
import com.muyu.pay.server.mapper.OrderPayCustomerMapper;
|
import com.muyu.pay.server.mapper.OrderPayCustomerMapper;
|
||||||
import com.muyu.pay.server.service.OrderPayCustomerService;
|
import com.muyu.pay.server.service.OrderPayCustomerService;
|
||||||
|
import com.muyu.pay.server.service.OrderPayInfoService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
|
@ -19,6 +26,11 @@ public class OrderPayCustomerServiceImpl
|
||||||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||||
implements OrderPayCustomerService {
|
implements OrderPayCustomerService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderPayInfoService orderPayInfoService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CustomerResp> selectList(CustomerListReq req) {
|
public List<CustomerResp> selectList(CustomerListReq req) {
|
||||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
@ -38,7 +50,15 @@ public class OrderPayCustomerServiceImpl
|
||||||
req.getStatus()
|
req.getStatus()
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.list(queryWrapper).stream().map(CustomerResp::customerBuild).toList();
|
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||||
|
return orderPayCustomerList.stream()
|
||||||
|
.map(orderPayCustomer -> CustomerResp.customerBuild(orderPayCustomer, () ->
|
||||||
|
orderPayInfoService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(), 5)
|
||||||
|
.stream()
|
||||||
|
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||||
|
.toList()
|
||||||
|
))
|
||||||
|
.toList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.pay.server.service.impl;
|
package com.muyu.pay.server.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.pay.common.domain.OrderPayInfo;
|
import com.muyu.pay.common.domain.OrderPayInfo;
|
||||||
import com.muyu.pay.server.mapper.OrderPayInfoMapper;
|
import com.muyu.pay.server.mapper.OrderPayInfoMapper;
|
||||||
|
@ -7,7 +8,17 @@ import com.muyu.pay.server.service.OrderPayInfoService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
public class OrderPayInfoServiceImpl extends ServiceImpl<OrderPayInfoMapper, OrderPayInfo> implements OrderPayInfoService {
|
public class OrderPayInfoServiceImpl extends ServiceImpl<OrderPayInfoMapper, OrderPayInfo> implements OrderPayInfoService {
|
||||||
|
@Override
|
||||||
|
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int status) {
|
||||||
|
LambdaQueryWrapper<OrderPayInfo> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||||
|
wrapper.orderBy(true,false,OrderPayInfo::getCreateBy);
|
||||||
|
wrapper.last("limit "+status);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue