master
parent
9b1e16e2c9
commit
ebb11d9cd1
|
@ -3,17 +3,15 @@ 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.req.CustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerUpdReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.domain
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayCustomer
|
||||
* @Date:2024/7/31 19:41
|
||||
*/
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
|
@ -47,4 +45,31 @@ public class OrderPayCustomer extends BaseEntity {
|
|||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
public static OrderPayCustomer addBuild(CustomerAddReq customerAddReq){
|
||||
return OrderPayCustomer.builder()
|
||||
.appName(customerAddReq.getAppName())
|
||||
.appCode(customerAddReq.getAppCode())
|
||||
.appDesc(customerAddReq.getAppDesc())
|
||||
.status(customerAddReq.getStatus())
|
||||
.remark(customerAddReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static OrderPayCustomer updBuild(CustomerUpdReq customerUpdReq, Supplier<Long> id){
|
||||
return OrderPayCustomer.builder()
|
||||
.id(id.get())
|
||||
.appName(customerUpdReq.getAppName())
|
||||
.appDesc(customerUpdReq.getAppDesc())
|
||||
.status(customerUpdReq.getStatus())
|
||||
.remark(customerUpdReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
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;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
@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 String channelType;
|
||||
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 渠道商单号
|
||||
*/
|
||||
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,63 @@
|
|||
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.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "order_pay_refund",autoResultMap = true)
|
||||
public class OrderPayRefund extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户退单号
|
||||
*/
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
*支付退单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
|
||||
/**
|
||||
* 渠道商退单号
|
||||
*/
|
||||
private String channelOrderNumber;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payInfoNumber;
|
||||
|
||||
/**
|
||||
* 到账时间
|
||||
*/
|
||||
private Date toAccountTIme;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.cloud.pay.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
@ -9,29 +10,22 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.domain.req
|
||||
* @Project:cloud-pay
|
||||
* @name:CustomerAddReq
|
||||
* @Date:2024/8/9 0:15
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "支付服务客户请求对象",description = "根据入参进行服务的添加")
|
||||
public class CustomerAddReq {
|
||||
/**
|
||||
* 服务名称
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@NotEmpty(message = "服务/客户名称不可为空")
|
||||
@Schema(
|
||||
title = "服务客户名称",
|
||||
description = "客户名称一般为微服务详细中文名称,方便使用者区分",
|
||||
description = "客户名称一般为微服务详细中文名称 方便使用者区分",
|
||||
type = "String",
|
||||
defaultValue = "会员服务",
|
||||
requiredProperties = {"appName"}
|
||||
requiredProperties ={"appName"}
|
||||
)
|
||||
private String appName;
|
||||
|
||||
|
@ -49,7 +43,7 @@ public class CustomerAddReq {
|
|||
private String appCode;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(title = "客户描述",type = "String")
|
||||
private String appDesc;
|
||||
|
@ -58,9 +52,11 @@ public class CustomerAddReq {
|
|||
* 状态
|
||||
*/
|
||||
@Schema(
|
||||
title = "开通状态",description = "状态为Y和N 如果为Y客户可以使用支付接口为N则不可以使用客户接口",
|
||||
title = "开通状态",description = "状态为Y和N 如果为Y客户可以使用支付接口为N不可以使用客户接口",
|
||||
type = "String",defaultValue = "Y"
|
||||
)
|
||||
@NotEmpty(message = "客户使用状态不能为空")
|
||||
@IsSystemYesNo
|
||||
private String status;
|
||||
|
||||
/**
|
||||
|
@ -68,4 +64,5 @@ public class CustomerAddReq {
|
|||
*/
|
||||
@Schema(title = "客户备注",type = "String")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
|
|
@ -3,42 +3,35 @@ package com.muyu.cloud.pay.domain.req;
|
|||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.domain.req
|
||||
* @Project:cloud-pay
|
||||
* @name:CustomerListReq
|
||||
* @Date:2024/7/31 20:37
|
||||
*/
|
||||
@Tag(name = "客户列表请求对象")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "客户列表请求对象" )
|
||||
public class CustomerListReq {
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@Schema( defaultValue ="客户名称1", description = "客户名称 为微服务名称",type = "Long")
|
||||
private String appName;
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@Schema(defaultValue = "服务名称1",type = "String",description = "客户名称,为微服务中文名称")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(name = "appCode",defaultValue = "ASDFGHJKL8848" ,type = "String",description = "客户名称,为微服务名称")
|
||||
@Schema(defaultValue = "customer_code",description = "客户编吗 为微服务名称",type = "String")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* sys_yes_no
|
||||
*
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "Y",description = "客户状态,Y是开启,N是关闭")
|
||||
@Schema(defaultValue = "Y",description = "客户状态 Y是开启 N是关闭",type = "String")
|
||||
@IsSystemYesNo
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.cloud.pay.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CustomerUpdReq {
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@NotEmpty(message = "服务/客户名称不可为空")
|
||||
@Schema(
|
||||
title = "服务客户名称",
|
||||
description = "客户名称一般为微服务详细中文名称 方便使用者区分",
|
||||
type = "String",
|
||||
defaultValue = "会员服务",
|
||||
requiredProperties ={"appName"}
|
||||
)
|
||||
private String appName;
|
||||
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(title = "客户描述",type = "String")
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(
|
||||
title = "开通状态",description = "状态为Y和N 如果为Y客户可以使用支付接口为N不可以使用客户接口",
|
||||
type = "String",defaultValue = "Y"
|
||||
)
|
||||
@NotEmpty(message = "客户使用状态不能为空")
|
||||
@IsSystemYesNo
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(title = "客户备注",type = "String")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
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;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.domain.resp
|
||||
* @Project:cloud-pay
|
||||
* @name:CustomerList
|
||||
* @Date:2024/8/4 14:57
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "客户信息相应对象",description = "负责客户信息查询的响应结果")
|
||||
public class CustomerListResp {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(defaultValue = "1",type = "Long",description = "客户id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@Schema(defaultValue = "商品服务",type = "String",description = "客户名称")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@Schema(defaultValue = "cloud_server",type = "String",description = "客户编码")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(defaultValue = "Y",type = "String",description = "客户状态:同数据字典 - 系统是否")
|
||||
private String status;
|
||||
|
||||
@Schema(defaultValue = "zy",type = "String",description = "创建人")
|
||||
private String createBy;
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
|
||||
@Schema(defaultValue = "2024年8月4日15:16:18",type = "Date",description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 数据库对象转换为查询结果对象
|
||||
* @param orderPayCustomer 数据库对象
|
||||
* @return 查询结果对象
|
||||
*/
|
||||
public static CustomerListResp customerBuild(OrderPayCustomer orderPayCustomer) {
|
||||
|
||||
return CustomerListResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppName())
|
||||
.appCode(orderPayCustomer.getAppCode())
|
||||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.cloud.pay.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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.muyu.cloud.pay.domain.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
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.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "客户信息响应对象",description = "负责客户信息查询的响应结果")
|
||||
public class CustomerResp {
|
||||
|
||||
@Schema(description = "客户ID",defaultValue = "1",type = "Long")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@Schema(description = "客户名称",defaultValue = "商品服务",type = "String")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@Schema(description = "客户编号",defaultValue = "cloud_order",type = "String")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(description = "客户描述",defaultValue = "------",type = "String")
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "客户状态:同数据字典",defaultValue = "Y",type = "String")
|
||||
private String status;
|
||||
|
||||
|
||||
@Schema(description = "创建人",defaultValue = "大壮",type = "String")
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建时间",defaultValue = "2024-7-31 21:16:45",type = "Date")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 客户最近5条支付单
|
||||
*/
|
||||
@Schema(description = "客户最近5条支付单")
|
||||
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespsList;
|
||||
|
||||
|
||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function){
|
||||
|
||||
return CustomerResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppCode())
|
||||
.appCode(orderPayCustomer.getAppCode())
|
||||
.appDesc(orderPayCustomer.getAppDesc())
|
||||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.orderPaySimpleRespsList(function.get())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.cloud.pay.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;
|
||||
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package com.muyu.cloud.pay.controller;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.controller
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayCustomerController
|
||||
* @Date:2024/7/31 20:12
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/customer")
|
||||
@Tag(name = "客户控制层",description = "进行客户管理,查看等相关操作")
|
||||
public class OrderPayCustomerController {
|
||||
|
||||
@Autowired
|
||||
private OrderPayCustomerService orderPayCustomerService;
|
||||
|
||||
/* public OrderPayCustomerController(){
|
||||
log.info("forest{}扫描路径", ForestScannerRegister.getBasePackages());
|
||||
}*/
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查看客户",description = "根据客户的名称,编码,是否开启等可以进行客户的筛选")
|
||||
public Result<List<CustomerListResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq customerListReq){
|
||||
|
||||
return Result.success(
|
||||
orderPayCustomerService.selectList(customerListReq)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看所有客户列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户",description = "调用nacosApi获取所有的微服务名称,作为支付中台的客户")
|
||||
@Schema(description = "获取未接入的客户",defaultValue = "[\'客户1'\'客户2'\'客户3']",type = "List")
|
||||
public Result<List<String>> getCustomerAllList(){
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "添加客户信息",description = "添加支付平台客户信息,添加成功后可以使用支付信息")
|
||||
public Result<String> save(@Validated @RequestBody CustomerAddReq customerAddReq){
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.cloud.pay.server;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.ConfigurableBootstrapContext;
|
||||
import org.springframework.boot.SpringApplicationRunListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@Log4j2
|
||||
public class MySpringApplicationRunListener implements SpringApplicationRunListener {
|
||||
public MySpringApplicationRunListener() {
|
||||
log.info("MySpringApplicationRunListener");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void starting(ConfigurableBootstrapContext bootstrapContext) {
|
||||
log.info("执行:starting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
|
||||
log.info("执行:starting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextPrepared(ConfigurableApplicationContext context) {
|
||||
log.info("执行:contextPrepared");
|
||||
SpringApplicationRunListener.super.contextPrepared(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextLoaded(ConfigurableApplicationContext context) {
|
||||
log.info("执行:contextLoaded");
|
||||
SpringApplicationRunListener.super.contextLoaded(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void started(ConfigurableApplicationContext context, Duration timeTaken) {
|
||||
log.info("执行:started");
|
||||
SpringApplicationRunListener.super.started(context, timeTaken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ready(ConfigurableApplicationContext context, Duration timeTaken) {
|
||||
log.info("执行:ready");
|
||||
SpringApplicationRunListener.super.ready(context, timeTaken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(ConfigurableApplicationContext context, Throwable exception) {
|
||||
log.info("执行:failed");
|
||||
SpringApplicationRunListener.super.failed(context, exception);
|
||||
}
|
||||
}
|
|
@ -1,23 +1,16 @@
|
|||
package com.muyu.cloud.pay;
|
||||
package com.muyu.cloud.pay.server;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScan;
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay
|
||||
* @Project:cloud-pay
|
||||
* @name:MuyuPayApplication
|
||||
* @Date:2024/7/29 21:24
|
||||
*/
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuyuPayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuyuPayApplication.class,args);
|
||||
public class PayApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(PayApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package com.muyu.cloud.pay.server.controller;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerUpdReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.server.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("customer")
|
||||
@Tag(name = "客户控制层", description = "进行客户管理查询操作")
|
||||
public class OrderPayCustomerController {
|
||||
|
||||
|
||||
public OrderPayCustomerController(){
|
||||
log.info("forest{}扫描路径", ForestScannerRegister.getBasePackages());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private OrderPayCustomerService orderPayCustomerService;
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "查看客户", description = "根据客户名称 编号 状态 查询")
|
||||
public Result<List<CustomerResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq req) {
|
||||
return Result.success(orderPayCustomerService.selectList(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所以客户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("all")
|
||||
@Operation(summary = "获取未接入客户",description = "调用nacosAPI")
|
||||
@Schema(description = "获取未接入客户",type = "List")
|
||||
public Result<List<String>> getCustomerAllList() {
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加客户
|
||||
* @param customerAddReq
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "添加客户信息",description = "添加支付平台客户信息,添加成功后可以使用支付信息")
|
||||
public Result<String> save(@Validated @RequestBody CustomerAddReq customerAddReq){
|
||||
orderPayCustomerService.save(OrderPayCustomer.addBuild(customerAddReq));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @param customerUpdReq
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息修改",description = "通过客户id修改客户信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户Id",type = "Long",defaultValue = "1")
|
||||
@PathVariable("orderCustomerId") Long orderCustomerId,
|
||||
@RequestBody @Validated CustomerUpdReq customerUpdReq){
|
||||
orderPayCustomerService.updateById( OrderPayCustomer.updBuild(customerUpdReq, ()->orderCustomerId));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户信息
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息删除",description = "通过客户id删除,七天内使用过接口不可删除")
|
||||
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.removeById(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
/**
|
||||
* 通过id获取用户信息
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "通过id获取用户信息",description = "通过id获取用户信息")
|
||||
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId),"操作成功");
|
||||
}
|
||||
/**
|
||||
* 客户禁用支付接口
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/disable/{orderCustomerId}")
|
||||
@Operation(summary = "通过id禁用客户",description = "通过id禁用客户调用支付接口")
|
||||
public Result<String> disable(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.disable(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户启用支付接口
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/enable/{orderCustomerId}")
|
||||
@Operation(summary = "通过id启用客户",description = "通过id启用客户调用支付接口")
|
||||
public Result<String> enable(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.enable(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.pay.server.controller;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("info")
|
||||
public class OrderPayInfoController {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.muyu.cloud.pay.server.controller;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("refund")
|
||||
public class OrderPayRefundController {
|
||||
|
||||
}
|
|
@ -1,17 +1,9 @@
|
|||
package com.muyu.cloud.pay.mapper;
|
||||
package com.muyu.cloud.pay.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.mapper
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayCustomerMapper
|
||||
* @Date:2024/7/31 19:58
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayCustomerMapper extends BaseMapper<OrderPayCustomer> {
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.pay.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPayInfoMapper extends BaseMapper<OrderPayInfo> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.cloud.pay.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayRefund;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderPayRefundMapper extends BaseMapper<OrderPayRefund> {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.cloud.pay.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||
|
||||
|
||||
public List<CustomerResp> selectList(CustomerListReq req);
|
||||
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
/**
|
||||
* 禁用客户id
|
||||
* @param orderCustomerId
|
||||
*/
|
||||
void disable(Long orderCustomerId);
|
||||
|
||||
/**
|
||||
* 启用客户id
|
||||
* @param orderCustomerId
|
||||
*/
|
||||
void enable(Long orderCustomerId);
|
||||
|
||||
void settingStatus(Long orderCustomerId,String status);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.pay.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderPayInfoService extends IService<OrderPayInfo> {
|
||||
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int status);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.cloud.pay.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayRefund;
|
||||
|
||||
public interface OrderPayRefundService extends IService<OrderPayRefund> {
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
package com.muyu.cloud.pay.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.server.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.cloud.pay.server.service.OrderPayCustomerService;
|
||||
import com.muyu.cloud.pay.server.service.OrderPayInfoService;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.enums.SystemYesNo;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
public class OrderPayCustomerServiceImpl
|
||||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
|
||||
@Resource
|
||||
private OrderPayInfoService orderPayInfoService;
|
||||
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq req) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(req.getAppName()),
|
||||
OrderPayCustomer::getAppName,
|
||||
req.getAppName()
|
||||
);
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(req.getAppCode()),
|
||||
OrderPayCustomer::getAppCode,
|
||||
req.getAppCode()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(req.getStatus()),
|
||||
OrderPayCustomer::getStatus,
|
||||
req.getStatus()
|
||||
);
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||
List<OrderPayCustomer> list = this.list(queryWrapper);
|
||||
Set<String> customerSet = list.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
return nacosServerAllList.stream()
|
||||
.filter(nacosServer -> !customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(Long orderCustomerId) {
|
||||
this.settingStatus(orderCustomerId, SystemYesNo.NO.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(Long orderCustomerId) {
|
||||
this.settingStatus(orderCustomerId,SystemYesNo.YES.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingStatus(Long orderCustomerId, String status) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayCustomer::getId,orderCustomerId);
|
||||
boolean exists = this.exists(queryWrapper);
|
||||
if (!exists){
|
||||
throw new ServiceException("操作客户不存在");
|
||||
}
|
||||
if (!SystemYesNo.isCode(status)){
|
||||
throw new ServiceException("设置状态值违法");
|
||||
}
|
||||
LambdaUpdateWrapper<OrderPayCustomer> updQueryWrapper = new LambdaUpdateWrapper<>();
|
||||
updQueryWrapper.eq(OrderPayCustomer::getId,orderCustomerId);
|
||||
updQueryWrapper.set(OrderPayCustomer::getStatus,status);
|
||||
this.update(updQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
OrderPayCustomer orderPayCustomer = this.getById(id);
|
||||
if (orderPayCustomer==null){
|
||||
throw new ServiceException("客户不存在");
|
||||
}
|
||||
LambdaQueryWrapper<OrderPayInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayInfo::getAppCode,orderPayCustomer.getAppCode());
|
||||
queryWrapper.gt(OrderPayInfo::getCreateTime, DateUtils.addDays(new Date(),-7));
|
||||
long count = orderPayInfoService.count(queryWrapper);
|
||||
if (count>0){
|
||||
throw new ServiceException(
|
||||
StringUtils.format("客户:[{}],近七天还在使用,不可删除",orderPayCustomer.getAppName())
|
||||
);
|
||||
}
|
||||
return super.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(OrderPayCustomer orderPayCustomer) {
|
||||
|
||||
String appCode = orderPayCustomer.getAppCode();
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
log.info("进行服务合法性判断:[{}->{}]",appCode,nacosServerAllList);
|
||||
if (!nacosServerAllList.contains(appCode)){
|
||||
throw new ServiceException("客户编码违法");
|
||||
}
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayCustomer::getAppCode,appCode);
|
||||
long count = this.count(queryWrapper);
|
||||
log.info("进行服务code唯一性校验[{}->{}]",appCode,count);
|
||||
if (count >0) {
|
||||
throw new ServiceException("客户编码重复");
|
||||
}
|
||||
return super.save(orderPayCustomer);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.cloud.pay.server.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.server.mapper.OrderPayInfoMapper;
|
||||
import com.muyu.cloud.pay.server.service.OrderPayInfoService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.cloud.pay.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayRefund;
|
||||
import com.muyu.cloud.pay.server.mapper.OrderPayRefundMapper;
|
||||
import com.muyu.cloud.pay.server.service.OrderPayRefundService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Log4j2
|
||||
@Service
|
||||
public class OrderPayRefundServiceImpl
|
||||
extends ServiceImpl<OrderPayRefundMapper, OrderPayRefund>
|
||||
implements OrderPayRefundService {
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package com.muyu.cloud.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.service
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayCustomerService
|
||||
* @Date:2024/7/31 20:03
|
||||
*/
|
||||
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||
|
||||
/**
|
||||
* @param req 请求参数
|
||||
* @return 客户集合
|
||||
*/
|
||||
public List<CustomerListResp> selectList(CustomerListReq req);
|
||||
|
||||
/**
|
||||
* 查看所有客户列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
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.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerListResp;
|
||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.cloud.pay.service.impl
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderPayCustomerServiceImpl
|
||||
* @Date:2024/7/31 20:03
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Log4j2
|
||||
public class OrderPayCustomerServiceImpl
|
||||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
|
||||
@Resource
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
@Override
|
||||
public List<CustomerListResp> selectList(CustomerListReq req) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(req.getAppName()),
|
||||
OrderPayCustomer::getAppName, req.getAppName()
|
||||
);
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(req.getAppCode()),
|
||||
OrderPayCustomer::getAppCode,req.getAppCode()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(req.getStatus()),
|
||||
OrderPayCustomer::getStatus,req.getStatus()
|
||||
);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
List<CustomerListResp> customerListRespList = new ArrayList<>();
|
||||
orderPayCustomerList.stream()
|
||||
.map(CustomerListResp::customerBuild).collect(Collectors.toList());
|
||||
return customerListRespList;
|
||||
}
|
||||
/**
|
||||
* 查看所有客户列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||
List<OrderPayCustomer> list = this.list(queryWrapper);
|
||||
Set<String> customerSet = list.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
return nacosServerAllList.stream()
|
||||
.filter(nacosServer -> !customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.pay.server.MySpringApplicationRunListener
|
Loading…
Reference in New Issue