Subversion Repositories SmartDukaan

Rev

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