Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
22653 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
2
 
3
import java.io.Serializable;
23339 ashik.ali 4
import java.time.LocalDateTime;
22653 ashik.ali 5
 
6
import javax.persistence.Column;
7
import javax.persistence.Entity;
27377 amit.gupta 8
import javax.persistence.EnumType;
9
import javax.persistence.Enumerated;
23968 amit.gupta 10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
22653 ashik.ali 12
import javax.persistence.Id;
29578 tejbeer 13
import javax.persistence.NamedQueries;
14
import javax.persistence.NamedQuery;
22653 ashik.ali 15
import javax.persistence.Table;
24592 amit.gupta 16
import javax.persistence.Transient;
22653 ashik.ali 17
 
24592 amit.gupta 18
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
27377 amit.gupta 19
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
24592 amit.gupta 20
 
22653 ashik.ali 21
@Entity
24592 amit.gupta 22
@Table(name = "fofo.scheme_in_out", schema = "fofo")
29578 tejbeer 23
 
24
@NamedQueries({
25
 
26
		@NamedQuery(name = "SchemeInOut.selectPendingActivationGroupByBrandYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationYearMonthModel(i.brand, "
27
				+ "   DATE_FORMAT(sio.createTimestamp, '%m-%Y'),sum(cast(sio.amount As int)) ) from Scheme sc join  SchemeInOut sio  on"
28
				+ " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
29
				+ " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp >= :startDate and ii.fofoId = :fofoId  "
30
				+ "  group by i.brand, DATE_FORMAT(sio.createTimestamp, '%m-%Y')"),
31
 
32
		@NamedQuery(name = "SchemeInOut.selectByYearMonthActivationGroupByBrand", query = "select new com.spice.profitmandi.dao.model.ActivationBrandModel(i.brand, "
33
				+ "  sum(cast(sio.amount As int)) ) from Scheme sc join  SchemeInOut sio  on"
34
				+ " sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
35
				+ " join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and sio.createTimestamp <= :endDate and ii.fofoId = :fofoId  "
36
				+ "  group by i.brand"),
37
 
38
		@NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetails", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
39
				+ "  i.modelName,i.modelNumber,cast(sio.amount As int),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
40
				+ "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
41
				+ "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
42
				+ "  ii.fofoId = :fofoId and i.brand = :brand and  DATE_FORMAT(sio.createTimestamp, '%m-%Y') = :yearMonthValue"),
43
 
44
		@NamedQuery(name = "SchemeInOut.selectBrandPendingActivationItemDetailByYearMonth", query = "select new com.spice.profitmandi.dao.model.ActivationItemDetailModel(i.brand, "
45
				+ "  i.modelName,i.modelNumber,cast(sio.amount As int),ii.serialNumber, ii.id) from Scheme sc join SchemeInOut sio  on"
46
				+ "	 sc.id = sio.schemeId join InventoryItem ii  on ii.id = sio.inventoryItemId"
47
				+ "	 join Item i on i.id = ii.itemId where sc.type = 'ACTIVATION' and sio.status ='PENDING' and "
48
				+ "  ii.fofoId = :fofoId and i.brand = :brand and sio.createTimestamp <= :endDate"),
49
 
50
})
27377 amit.gupta 51
public class SchemeInOut implements Serializable {
52
 
24592 amit.gupta 53
	public SchemeInOut(int schemeId, int inventoryItemId) {
54
		this.schemeId = schemeId;
55
		this.inventoryItemId = inventoryItemId;
56
	}
22653 ashik.ali 57
 
24592 amit.gupta 58
	public SchemeInOut() {
59
	}
27377 amit.gupta 60
 
22653 ashik.ali 61
	private static final long serialVersionUID = 1L;
24592 amit.gupta 62
 
22859 ashik.ali 63
	@Id
23968 amit.gupta 64
	@GeneratedValue(strategy = GenerationType.IDENTITY)
65
	private int id;
24592 amit.gupta 66
 
22859 ashik.ali 67
	@Column(name = "scheme_id")
68
	private int schemeId;
22653 ashik.ali 69
 
22859 ashik.ali 70
	@Column(name = "inventory_item_id")
71
	private int inventoryItemId;
24592 amit.gupta 72
 
22653 ashik.ali 73
	@Column(name = "amount")
74
	private float amount;
24592 amit.gupta 75
 
27377 amit.gupta 76
	@Column(name = "status")
77
	@Enumerated(EnumType.STRING)
78
	private SchemePayoutStatus status;
79
 
23345 ashik.ali 80
	@Column(name = "create_timestamp")
23339 ashik.ali 81
	private LocalDateTime createTimestamp = LocalDateTime.now();
24592 amit.gupta 82
 
23509 amit.gupta 83
	@Column(name = "rolled_back_timestamp")
23527 ashik.ali 84
	private LocalDateTime rolledBackTimestamp;
27377 amit.gupta 85
 
86
	@Column(name = "credit_timestamp")
87
	private LocalDateTime creditTimestamp;
88
 
27381 amit.gupta 89
	@Column(name = "description")
27377 amit.gupta 90
	private String statusDescription;
91
 
92
	public int getId() {
93
		return id;
94
	}
95
 
96
	public void setId(int id) {
97
		this.id = id;
98
	}
99
 
100
	public SchemePayoutStatus getStatus() {
101
		return status;
102
	}
103
 
104
	public void setStatus(SchemePayoutStatus status) {
105
		this.status = status;
106
	}
107
 
108
	public LocalDateTime getCreditTimestamp() {
109
		return creditTimestamp;
110
	}
111
 
112
	public void setCreditTimestamp(LocalDateTime creditTimestamp) {
113
		this.creditTimestamp = creditTimestamp;
114
	}
115
 
116
	public String getStatusDescription() {
117
		return statusDescription;
118
	}
119
 
120
	public void setStatusDescription(String statusDescription) {
121
		this.statusDescription = statusDescription;
122
	}
123
 
24592 amit.gupta 124
	@Transient
24671 amit.gupta 125
	private int reference;
27377 amit.gupta 126
 
24671 amit.gupta 127
	public int getReference() {
128
		return reference;
129
	}
130
 
131
	public void setReference(int reference) {
132
		this.reference = reference;
133
	}
134
 
135
	@Transient
24592 amit.gupta 136
	private String serialNumber;
27377 amit.gupta 137
 
24592 amit.gupta 138
	@Transient
139
	private String storeCode;
27377 amit.gupta 140
 
24592 amit.gupta 141
	@Transient
142
	private SchemeType schemeType;
23509 amit.gupta 143
 
24592 amit.gupta 144
	public String getStoreCode() {
145
		return storeCode;
146
	}
147
 
148
	public void setStoreCode(String storeCode) {
149
		this.storeCode = storeCode;
150
	}
151
 
152
	public SchemeType getSchemeType() {
153
		return schemeType;
154
	}
155
 
156
	public void setSchemeType(SchemeType schemeType) {
157
		this.schemeType = schemeType;
158
	}
159
 
160
	public String getSerialNumber() {
161
		return serialNumber;
162
	}
163
 
164
	public void setSerialNumber(String serialNumber) {
165
		this.serialNumber = serialNumber;
166
	}
167
 
22859 ashik.ali 168
	public int getSchemeId() {
169
		return schemeId;
22653 ashik.ali 170
	}
24592 amit.gupta 171
 
22859 ashik.ali 172
	public void setSchemeId(int schemeId) {
173
		this.schemeId = schemeId;
22653 ashik.ali 174
	}
24592 amit.gupta 175
 
22859 ashik.ali 176
	public int getInventoryItemId() {
177
		return inventoryItemId;
178
	}
24592 amit.gupta 179
 
22859 ashik.ali 180
	public void setInventoryItemId(int inventoryItemId) {
181
		this.inventoryItemId = inventoryItemId;
182
	}
24592 amit.gupta 183
 
22653 ashik.ali 184
	public float getAmount() {
185
		return amount;
186
	}
24592 amit.gupta 187
 
22653 ashik.ali 188
	public void setAmount(float amount) {
189
		this.amount = amount;
190
	}
24592 amit.gupta 191
 
23339 ashik.ali 192
	public LocalDateTime getCreateTimestamp() {
193
		return createTimestamp;
194
	}
24592 amit.gupta 195
 
23339 ashik.ali 196
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
197
		this.createTimestamp = createTimestamp;
198
	}
24592 amit.gupta 199
 
23527 ashik.ali 200
	public LocalDateTime getRolledBackTimestamp() {
201
		return rolledBackTimestamp;
202
	}
24592 amit.gupta 203
 
23527 ashik.ali 204
	public void setRolledBackTimestamp(LocalDateTime rolledBackTimestamp) {
205
		this.rolledBackTimestamp = rolledBackTimestamp;
206
	}
22859 ashik.ali 207
 
22653 ashik.ali 208
	@Override
209
	public int hashCode() {
210
		final int prime = 31;
211
		int result = 1;
22859 ashik.ali 212
		result = prime * result + Float.floatToIntBits(amount);
23339 ashik.ali 213
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
24592 amit.gupta 214
		result = prime * result + id;
22859 ashik.ali 215
		result = prime * result + inventoryItemId;
24592 amit.gupta 216
		result = prime * result + ((rolledBackTimestamp == null) ? 0 : rolledBackTimestamp.hashCode());
22859 ashik.ali 217
		result = prime * result + schemeId;
24592 amit.gupta 218
		result = prime * result + ((schemeType == null) ? 0 : schemeType.hashCode());
219
		result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
22653 ashik.ali 220
		return result;
221
	}
22859 ashik.ali 222
 
22653 ashik.ali 223
	@Override
224
	public boolean equals(Object obj) {
225
		if (this == obj)
226
			return true;
227
		if (obj == null)
228
			return false;
229
		if (getClass() != obj.getClass())
230
			return false;
22859 ashik.ali 231
		SchemeInOut other = (SchemeInOut) obj;
232
		if (Float.floatToIntBits(amount) != Float.floatToIntBits(other.amount))
22653 ashik.ali 233
			return false;
23339 ashik.ali 234
		if (createTimestamp == null) {
235
			if (other.createTimestamp != null)
236
				return false;
237
		} else if (!createTimestamp.equals(other.createTimestamp))
238
			return false;
24592 amit.gupta 239
		if (id != other.id)
240
			return false;
22859 ashik.ali 241
		if (inventoryItemId != other.inventoryItemId)
242
			return false;
24592 amit.gupta 243
		if (rolledBackTimestamp == null) {
244
			if (other.rolledBackTimestamp != null)
245
				return false;
246
		} else if (!rolledBackTimestamp.equals(other.rolledBackTimestamp))
247
			return false;
22859 ashik.ali 248
		if (schemeId != other.schemeId)
249
			return false;
24592 amit.gupta 250
		if (schemeType != other.schemeType)
251
			return false;
252
		if (serialNumber == null) {
253
			if (other.serialNumber != null)
254
				return false;
255
		} else if (!serialNumber.equals(other.serialNumber))
256
			return false;
22653 ashik.ali 257
		return true;
258
	}
259
 
260
	@Override
261
	public String toString() {
24592 amit.gupta 262
		return "SchemeInOut [id=" + id + ", schemeId=" + schemeId + ", inventoryItemId=" + inventoryItemId + ", amount="
27377 amit.gupta 263
				+ amount + ", status=" + status + ", createTimestamp=" + createTimestamp + ", rolledBackTimestamp="
264
				+ rolledBackTimestamp + ", creditTimestamp=" + creditTimestamp + ", statusDescription="
265
				+ statusDescription + ", reference=" + reference + ", serialNumber=" + serialNumber + ", storeCode="
266
				+ storeCode + ", schemeType=" + schemeType + "]";
22653 ashik.ali 267
	}
24592 amit.gupta 268
 
22653 ashik.ali 269
}