1
dd
2025-11-06 1e0848427a1f5c771b61a2939af3ff78b9b1d37b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package com.ruoyi.system.domain;
 
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
 
/**
 * 支付记录实体类
 */
@Data
public class PaymentRecord {
 
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
 
    /**
     * 用户ID
     */
    private Integer userId;
 
    // 邀请码
    private String invitationCode;
 
    // 姓名
    private String name;
 
    // 账号(唯一)
    private String account;
 
    // 产品名称
    private String productName;
 
    /**
     * 产品ID
     */
    private Integer productId;
 
    /**
     * 订单ID
     */
    private Integer orderId;
 
    /**
     * 支付状态
     */
    private Integer paymentStatus;
 
    /**
     * 支付订单号
     */
    private String payOrdeNo;
 
    //支付方式  1 支付宝 2微信  3余额
    private Integer modePayment;
 
    /**
     * 新增时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
 
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
 
    /**
     * 支付状态枚举
     */
    public enum PaymentStatus {
        FAILED(0, "拉取失败"),
        PENDING(1, "待支付"),
        PAID(2, "已支付"),
        EXPIRED(3, "超时/过期");
 
        private final Integer code;
        private final String description;
 
        PaymentStatus(Integer code, String description) {
            this.code = code;
            this.description = description;
        }
 
        public Integer getCode() {
            return code;
        }
 
        public String getDescription() {
            return description;
        }
 
        public static PaymentStatus getByCode(Integer code) {
            for (PaymentStatus status : values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            return null;
        }
 
        public static String getDescriptionByCode(Integer code) {
            PaymentStatus status = getByCode(code);
            return status != null ? status.getDescription() : "未知状态";
        }
    }
 
    /**
     * 获取支付状态描述
     */
    public String getPaymentStatusDesc() {
        return PaymentStatus.getDescriptionByCode(this.paymentStatus);
    }
 
    /**
     * 判断是否已支付
     */
    public boolean isPaid() {
        return PaymentStatus.PAID.getCode().equals(this.paymentStatus);
    }
 
    /**
     * 判断是否待支付
     */
    public boolean isPending() {
        return PaymentStatus.PENDING.getCode().equals(this.paymentStatus);
    }
}