2021与蓝度共同重构项目,服务端
liuhaonan
2022-10-25 dda268997ca8f8a364f7c19b45d7a43a50a98efe
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package com.sandu.ximon.admin.vo;
 
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.sandu.ximon.admin.utils.OrderUtils;
import com.sandu.ximon.dao.domain.C3mOrder;
import com.sandu.ximon.dao.enums.OrderStatus;
import com.sandu.ximon.dao.enums.OrderType;
import lombok.Data;
 
import java.util.Date;
 
/**
 * @Author liuhaonan
 * @Date 2022/3/10 11:48
 * @Version 1.0
 */
@Data
public class C3mOrderVO extends C3mOrder{
 
 
    public static String REQUEST_URL = "http://www.ximonsmart.com/charge/#/charge/";
    /**
     * 订单ID
     */
 
    private Long orderId;
 
    /**
     * 灯杆ID
     */
    private Long poleId;
 
    /**
     * 充电桩MAC
     */
    private String c3Mac;
 
    /**
     * 对应的灯杆设备mac
     */
    private String poleMac;
 
    /**
     * 订单商户号
     */
    private String outTradeNo;
 
    /**
     * 订单类型(C3mOrderType)
     */
    private String orderType;
 
    /**
     * 订单总金额
     */
    private Double totalAmount;
 
    /**
     * 实收金额
     */
    private Double receiptAmount;
 
    /**
     * 退款
     */
    private Double refundAmount;
 
    /**
     * 买家帐号(支付宝)
     */
    private String aliBuyerLogonId;
 
    /**
     * 预约电量
     */
    private Integer subscribeChargingCapacity;
 
    /**
     * 实充电量
     */
    private Double actualChargingCapacity;
 
    /**
     * 订单创建时间戳
     */
    private Long createTimestamp;
 
    /**
     * 订单支付时间戳
     */
    private Long payTimestamp;
 
    /**
     * 订单退款时间戳
     */
    private Long refundTimestamp;
 
    /**
     * 订单退款说明
     */
    private String refundMsg;
 
    /**
     * 开始充电时间戳
     */
    private Long startChargingTimestamp;
 
    /**
     * 结束充电时间戳
     */
    private Long stopChargingTimestamp;
 
    /**
     * 订单状态:// 未支付(0),已支付(1),已退款(2),退款中(3),退款失败(4),订单完成(5)
     */
    private Integer orderStatus;
 
    /**
     * 充电桩名称
     */
    private String c3Name;
 
    /**
     * 灯杆名称
     */
    private String poleName;
 
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     * 生成新订单
     * @param c3Mac C3物理地址
     * @param orderType 订单类型
     * @param totalAmount   总金额
     * @param subscribeChargingCapacity 预充电量
     */
    public C3mOrder generateOrder(Long poleId, String poleMac, String c3Mac, OrderType orderType, Double totalAmount,
                                  Integer subscribeChargingCapacity) {
        this.poleId = poleId;
        this.poleMac = poleMac;
        this.orderId = -1L;
        this.c3Mac = c3Mac;
        this.outTradeNo = OrderUtils.generateOutTradeNo();
        this.orderType = orderType.getCode();
        this.totalAmount = totalAmount;
        this.receiptAmount = 0d;
        this.refundAmount = 0d;
        this.aliBuyerLogonId = "";
        this.subscribeChargingCapacity = subscribeChargingCapacity;
        this.actualChargingCapacity = 0d;
        this.createTimestamp = new Date().getTime();
        this.payTimestamp = 0L;
        this.startChargingTimestamp = 0L;
        this.stopChargingTimestamp = 0L;
        this.refundTimestamp = 0L;
        this.refundMsg = "";
        this.orderStatus = OrderStatus.NO_PAY.getStatus();
        return this;
    }
}