Subversion Repositories SmartDukaan

Rev

Rev 23527 | Rev 23740 | 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
 
23504 ashik.ali 75
	@Column(name = "status")
76
	@Enumerated(EnumType.STRING)
77
	private RechargeStatus status;
78
 
79
	@Column(name = "status_message")
80
	private String statusMessage;
81
 
82
	@Convert(converter = LocalDateTimeAttributeConverter.class)
83
	@Column(name="create_timestamp", updatable = false)
84
	private LocalDateTime createTimestamp = LocalDateTime.now();
85
 
86
	@Convert(converter = LocalDateTimeAttributeConverter.class)
87
	@Column(name="update_timestamp")
88
	@UpdateTimestamp
89
	private LocalDateTime updateTimestamp = LocalDateTime.now();
23585 tejbeer 90
 
91
	@Transient
92
	private String operatorName;
23504 ashik.ali 93
 
23585 tejbeer 94
	public String getOperatorName() {
95
		return operatorName;
96
	}
97
 
98
	public void setOperatorName(String operatorName) {
99
		this.operatorName = operatorName;
100
	}
101
 
23504 ashik.ali 102
	public int getId() {
103
		return id;
104
	}
105
 
106
	public void setId(int id) {
107
		this.id = id;
108
	}
109
 
110
	public int getRetailerId() {
111
		return retailerId;
112
	}
113
 
114
	public void setRetailerId(int retailerId) {
115
		this.retailerId = retailerId;
116
	}
117
 
118
	public String getRequestId() {
119
		return requestId;
120
	}
121
 
122
	public void setRequestId(String requestId) {
123
		this.requestId = requestId;
124
	}
125
 
126
	public int getProviderId() {
127
		return providerId;
128
	}
129
 
130
	public void setProviderId(int providerId) {
131
		this.providerId = providerId;
132
	}
133
 
134
	public int getOperatorId() {
135
		return operatorId;
136
	}
137
 
138
	public void setOperatorId(int operatorId) {
139
		this.operatorId = operatorId;
140
	}
141
 
142
	public String getReferenceNumber() {
143
		return referenceNumber;
144
	}
145
 
146
	public void setReferenceNumber(String referenceNumber) {
147
		this.referenceNumber = referenceNumber;
148
	}
149
 
150
	public OperatorType getOperatorType() {
151
		return operatorType;
152
	}
153
 
154
	public void setOperatorType(OperatorType operatorType) {
155
		this.operatorType = operatorType;
156
	}
157
 
158
	public RechargeType getType() {
159
		return type;
160
	}
161
 
162
	public void setType(RechargeType type) {
163
		this.type = type;
164
	}
165
 
166
	public float getAmount() {
167
		return amount;
168
	}
169
 
170
	public void setAmount(float amount) {
171
		this.amount = amount;
172
	}
23527 ashik.ali 173
 
174
	public float getCommission() {
175
		return commission;
176
	}
177
 
178
	public void setCommission(float commission) {
179
		this.commission = commission;
180
	}
23504 ashik.ali 181
 
182
	public RechargeStatus getStatus() {
183
		return status;
184
	}
185
 
186
	public void setStatus(RechargeStatus status) {
187
		this.status = status;
188
	}
189
 
190
	public String getStatusMessage() {
191
		return statusMessage;
192
	}
193
 
194
	public void setStatusMessage(String statusMessage) {
195
		this.statusMessage = statusMessage;
196
	}
197
 
198
	public LocalDateTime getCreateTimestamp() {
199
		return createTimestamp;
200
	}
201
 
202
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
203
		this.createTimestamp = createTimestamp;
204
	}
205
 
206
	public LocalDateTime getUpdateTimestamp() {
207
		return updateTimestamp;
208
	}
209
 
210
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
211
		this.updateTimestamp = updateTimestamp;
212
	}
213
 
214
	public String getFormattedCreateTimestamp(){
215
		if(createTimestamp == null){
216
			return null;
217
		}
218
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
219
		return createTimestamp.format(formatter);
220
    }
221
 
222
	public String getFormattedUpdateTimestamp(){
223
		if(updateTimestamp == null){
224
			return null;
225
		}
226
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
227
		return updateTimestamp.format(formatter);
228
    }
229
 
230
	@Override
231
	public int hashCode() {
232
		final int prime = 31;
233
		int result = 1;
234
		result = prime * result + id;
235
		return result;
236
	}
237
 
238
	@Override
239
	public boolean equals(Object obj) {
240
		if (this == obj)
241
			return true;
242
		if (obj == null)
243
			return false;
244
		if (getClass() != obj.getClass())
245
			return false;
246
		RechargeTransaction other = (RechargeTransaction) obj;
247
		if (id != other.id)
248
			return false;
249
		return true;
250
	}
251
 
252
	@Override
253
	public String toString() {
254
		return "RechargeTransaction [id=" + id + ", retailerId=" + retailerId + ", requestId=" + requestId
255
				+ ", providerId=" + providerId + ", operatorId=" + operatorId + ", referenceNumber=" + referenceNumber
23527 ashik.ali 256
				+ ", operatorType=" + operatorType + ", type=" + type + ", amount=" + amount + ", commission="
257
				+ commission + ", status=" + status + ", statusMessage=" + statusMessage + ", createTimestamp="
258
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
23504 ashik.ali 259
	}
260
 
261
}