Subversion Repositories SmartDukaan

Rev

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