Subversion Repositories SmartDukaan

Rev

Rev 23504 | Rev 23585 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23504 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
import java.time.format.DateTimeFormatter;
6
 
7
import javax.persistence.Column;
8
import javax.persistence.Convert;
9
import javax.persistence.Entity;
10
import javax.persistence.EnumType;
11
import javax.persistence.Enumerated;
12
import javax.persistence.GeneratedValue;
13
import javax.persistence.GenerationType;
14
import javax.persistence.Id;
15
import javax.persistence.Table;
16
 
17
import org.hibernate.annotations.UpdateTimestamp;
18
 
19
import com.spice.profitmandi.common.enumuration.RechargeStatus;
20
import com.spice.profitmandi.common.model.OperatorType;
21
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
22
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
23
 
24
/**
25
 * This class basically contains recharge transaction details
26
 * 
27
 * @author ashikali
28
 *
29
 */
30
 
31
@Entity
32
@Table(name="dtr.recharge_transaction", schema = "dtr")
33
public class RechargeTransaction implements Serializable{
34
 
35
	private static final long serialVersionUID = 1L;
36
 
37
	public RechargeTransaction() {
38
	}
39
 
40
	@Id
41
	@Column(name="id", unique=true, updatable=false)
42
	@GeneratedValue(strategy = GenerationType.IDENTITY)
43
	private int id;
44
 
45
	@Column(name = "retailer_id")
46
	private int retailerId;
47
 
48
	@Column(name = "request_id")
49
	private String requestId;
50
 
51
	@Column(name = "provider_id")
52
	private int providerId;
53
 
54
	@Column(name="operator_id", unique = true)
55
	private int operatorId;
56
 
57
	@Column(name="reference_number", unique = true)
58
	private String referenceNumber;
59
 
60
	@Column(name = "operator_type")
61
	@Enumerated(EnumType.STRING)
62
	private OperatorType operatorType;
63
 
64
	@Column(name = "type")
65
	@Enumerated(EnumType.STRING)
66
	private RechargeType type;
67
 
68
	@Column(name = "amount")
69
	private float amount;
70
 
23527 ashik.ali 71
	@Column(name = "commission")
72
	private float commission;
73
 
23504 ashik.ali 74
	@Column(name = "status")
75
	@Enumerated(EnumType.STRING)
76
	private RechargeStatus status;
77
 
78
	@Column(name = "status_message")
79
	private String statusMessage;
80
 
81
	@Convert(converter = LocalDateTimeAttributeConverter.class)
82
	@Column(name="create_timestamp", updatable = false)
83
	private LocalDateTime createTimestamp = LocalDateTime.now();
84
 
85
	@Convert(converter = LocalDateTimeAttributeConverter.class)
86
	@Column(name="update_timestamp")
87
	@UpdateTimestamp
88
	private LocalDateTime updateTimestamp = LocalDateTime.now();
89
 
90
	public int getId() {
91
		return id;
92
	}
93
 
94
	public void setId(int id) {
95
		this.id = id;
96
	}
97
 
98
	public int getRetailerId() {
99
		return retailerId;
100
	}
101
 
102
	public void setRetailerId(int retailerId) {
103
		this.retailerId = retailerId;
104
	}
105
 
106
	public String getRequestId() {
107
		return requestId;
108
	}
109
 
110
	public void setRequestId(String requestId) {
111
		this.requestId = requestId;
112
	}
113
 
114
	public int getProviderId() {
115
		return providerId;
116
	}
117
 
118
	public void setProviderId(int providerId) {
119
		this.providerId = providerId;
120
	}
121
 
122
	public int getOperatorId() {
123
		return operatorId;
124
	}
125
 
126
	public void setOperatorId(int operatorId) {
127
		this.operatorId = operatorId;
128
	}
129
 
130
	public String getReferenceNumber() {
131
		return referenceNumber;
132
	}
133
 
134
	public void setReferenceNumber(String referenceNumber) {
135
		this.referenceNumber = referenceNumber;
136
	}
137
 
138
	public OperatorType getOperatorType() {
139
		return operatorType;
140
	}
141
 
142
	public void setOperatorType(OperatorType operatorType) {
143
		this.operatorType = operatorType;
144
	}
145
 
146
	public RechargeType getType() {
147
		return type;
148
	}
149
 
150
	public void setType(RechargeType type) {
151
		this.type = type;
152
	}
153
 
154
	public float getAmount() {
155
		return amount;
156
	}
157
 
158
	public void setAmount(float amount) {
159
		this.amount = amount;
160
	}
23527 ashik.ali 161
 
162
	public float getCommission() {
163
		return commission;
164
	}
165
 
166
	public void setCommission(float commission) {
167
		this.commission = commission;
168
	}
23504 ashik.ali 169
 
170
	public RechargeStatus getStatus() {
171
		return status;
172
	}
173
 
174
	public void setStatus(RechargeStatus status) {
175
		this.status = status;
176
	}
177
 
178
	public String getStatusMessage() {
179
		return statusMessage;
180
	}
181
 
182
	public void setStatusMessage(String statusMessage) {
183
		this.statusMessage = statusMessage;
184
	}
185
 
186
	public LocalDateTime getCreateTimestamp() {
187
		return createTimestamp;
188
	}
189
 
190
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
191
		this.createTimestamp = createTimestamp;
192
	}
193
 
194
	public LocalDateTime getUpdateTimestamp() {
195
		return updateTimestamp;
196
	}
197
 
198
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
199
		this.updateTimestamp = updateTimestamp;
200
	}
201
 
202
	public String getFormattedCreateTimestamp(){
203
		if(createTimestamp == null){
204
			return null;
205
		}
206
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
207
		return createTimestamp.format(formatter);
208
    }
209
 
210
	public String getFormattedUpdateTimestamp(){
211
		if(updateTimestamp == null){
212
			return null;
213
		}
214
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
215
		return updateTimestamp.format(formatter);
216
    }
217
 
218
	@Override
219
	public int hashCode() {
220
		final int prime = 31;
221
		int result = 1;
222
		result = prime * result + id;
223
		return result;
224
	}
225
 
226
	@Override
227
	public boolean equals(Object obj) {
228
		if (this == obj)
229
			return true;
230
		if (obj == null)
231
			return false;
232
		if (getClass() != obj.getClass())
233
			return false;
234
		RechargeTransaction other = (RechargeTransaction) obj;
235
		if (id != other.id)
236
			return false;
237
		return true;
238
	}
239
 
240
	@Override
241
	public String toString() {
242
		return "RechargeTransaction [id=" + id + ", retailerId=" + retailerId + ", requestId=" + requestId
243
				+ ", providerId=" + providerId + ", operatorId=" + operatorId + ", referenceNumber=" + referenceNumber
23527 ashik.ali 244
				+ ", operatorType=" + operatorType + ", type=" + type + ", amount=" + amount + ", commission="
245
				+ commission + ", status=" + status + ", statusMessage=" + statusMessage + ", createTimestamp="
246
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
23504 ashik.ali 247
	}
248
 
249
}