Subversion Repositories SmartDukaan

Rev

Rev 25278 | Rev 27574 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25278 Rev 27556
Line 6... Line 6...
6
import javax.persistence.Column;
6
import javax.persistence.Column;
7
import javax.persistence.Entity;
7
import javax.persistence.Entity;
8
import javax.persistence.EnumType;
8
import javax.persistence.EnumType;
9
import javax.persistence.Enumerated;
9
import javax.persistence.Enumerated;
10
import javax.persistence.Id;
10
import javax.persistence.Id;
-
 
11
import javax.persistence.NamedQueries;
-
 
12
import javax.persistence.NamedQuery;
11
import javax.persistence.Table;
13
import javax.persistence.Table;
12
import javax.persistence.Transient;
14
import javax.persistence.Transient;
13
 
15
 
14
import com.spice.profitmandi.common.enumuration.CounterSize;
16
import com.spice.profitmandi.common.enumuration.CounterSize;
15
import com.spice.profitmandi.dao.entity.user.Address;
17
import com.spice.profitmandi.dao.entity.user.Address;
Line 19... Line 21...
19
 * 
21
 * 
20
 * @author ashikali
22
 * @author ashikali
21
 *
23
 *
22
 */
24
 */
23
@Entity
25
@Entity
24
@Table(name="fofo.fofo_store", schema = "fofo")
26
@Table(name = "fofo.fofo_store", schema = "fofo")
-
 
27
 
-
 
28
@NamedQueries({
-
 
29
 
-
 
30
		@NamedQuery(name = "FofoStore.selectGroupByWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWisePartnerSaleModel(fs.warehouseId,"
-
 
31
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then CAST(foi.mop  AS int) else 0 end),"
-
 
32
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then foi.quantity  else 0 end),"
-
 
33
				+ "sum(case when month(foi.createTimestamp) = month(now()) then CAST(foi.mop  AS int) else 0 end),"
-
 
34
				+ "sum(case when month(foi.createTimestamp) = month(now()) then foi.quantity  else 0 end))"
-
 
35
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true"
-
 
36
				+ " group by fs.warehouseId"),
-
 
37
 
-
 
38
		@NamedQuery(name = "FofoStore.selectGroupByBrandWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel(i.brand, "
-
 
39
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then CAST(foi.mop  AS int) else 0 end),"
-
 
40
				+ "sum(case when month(foi.createTimestamp) = month(now())-1 then foi.quantity  else 0 end),"
-
 
41
				+ "sum(case when month(foi.createTimestamp) = month(now()) then CAST(foi.mop  AS int) else 0 end),"
-
 
42
				+ "sum(case when month(foi.createTimestamp) = month(now()) then foi.quantity  else 0 end))"
-
 
43
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true and "
-
 
44
				+ " :warehouseId IS NULL OR fs.warehouseId = :warehouseId" + " group by i.brand"),
-
 
45
 
-
 
46
		@NamedQuery(name = "FofoStore.selectWarehouseBrandItemSale", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel(fs.warehouseId, i.brand, i.modelName, i.modelNumber,i.color,"
-
 
47
				+ "case when month(foi.createTimestamp) = month(now())-1 then foi.mop else 0 end,"
-
 
48
				+ "case when month(foi.createTimestamp) = month(now())-1 then foi.quantity  else 0 end,"
-
 
49
				+ "case when month(foi.createTimestamp) = month(now()) then foi.mop   else 0 end,"
-
 
50
				+ "case when month(foi.createTimestamp) = month(now()) then foi.quantity  else 0 end)"
-
 
51
				+ " from FofoStore fs join FofoOrder fo on fs.id = fo.fofoId join FofoOrderItem foi on foi.orderId = fo.id  join Item i on i.id = foi.itemId  where fo.cancelledTimestamp is null and fs.active = true"
-
 
52
				+ " and fs.warehouseId in :warehouseId and i.brand = :brand"),
-
 
53
 
-
 
54
})
25
public class FofoStore implements Serializable{
55
public class FofoStore implements Serializable {
26
	
56
 
27
	private static final long serialVersionUID = 1L;
57
	private static final long serialVersionUID = 1L;
28
	
58
 
29
	public FofoStore() {
59
	public FofoStore() {
30
	}
60
	}
31
	
61
 
32
	@Id
62
	@Id
33
	@Column(name="id", unique=true, updatable=false)
63
	@Column(name = "id", unique = true, updatable = false)
34
	private int id;
64
	private int id;
35
	
65
 
36
	@Column(name="code", unique = true)
66
	@Column(name = "code", unique = true)
37
	private String code;
67
	private String code;
38
	
68
 
39
	@Column(name = "latitude")
69
	@Column(name = "latitude")
40
	private String latitude;
70
	private String latitude;
41
	
71
 
42
	@Column(name = "longitude")
72
	@Column(name = "longitude")
43
	private String longitude;
73
	private String longitude;
44
	
74
 
45
	@Column(name="counter_size")
75
	@Column(name = "counter_size")
46
	@Enumerated(EnumType.STRING)
76
	@Enumerated(EnumType.STRING)
47
	private CounterSize counterSize = CounterSize.TEN_LAC;
77
	private CounterSize counterSize = CounterSize.TEN_LAC;
48
	
78
 
49
	@Column(name="warehouse_id")
79
	@Column(name = "warehouse_id")
50
	private int warehouseId;
80
	private int warehouseId;
51
	
81
 
52
	public int getWarehouseId() {
82
	public int getWarehouseId() {
53
		return warehouseId;
83
		return warehouseId;
54
	}
84
	}
-
 
85
 
55
	public void setWarehouseId(int warehouseId) {
86
	public void setWarehouseId(int warehouseId) {
56
		this.warehouseId = warehouseId;
87
		this.warehouseId = warehouseId;
57
	}
88
	}
58
 
89
 
59
	@Column(name="minimum_investment")
90
	@Column(name = "minimum_investment")
60
	private float minimumInvestment;
91
	private float minimumInvestment;
61
	
92
 
62
	@Column(name="grace_date")
93
	@Column(name = "grace_date")
63
	private LocalDate graceDate;
94
	private LocalDate graceDate;
64
	
95
 
65
	@Column(name="investment_ok") 
96
	@Column(name = "investment_ok")
66
	private boolean investmentOk;
97
	private boolean investmentOk;
67
	
-
 
68
	
98
 
69
	public boolean isInvestmentOk() {
99
	public boolean isInvestmentOk() {
70
		return investmentOk;
100
		return investmentOk;
71
	}
101
	}
-
 
102
 
72
	public void setInvestmentOk(boolean investmentOk) {
103
	public void setInvestmentOk(boolean investmentOk) {
73
		this.investmentOk = investmentOk;
104
		this.investmentOk = investmentOk;
74
	}
105
	}
75
 
106
 
76
	@Column(name="grace_count")
107
	@Column(name = "grace_count")
77
	private int graceCount;
108
	private int graceCount;
78
 
109
 
79
	@Column
110
	@Column
80
	private boolean active=true;
111
	private boolean active = true;
81
 
112
 
82
	
-
 
83
	public int getGraceCount() {
113
	public int getGraceCount() {
84
		return graceCount;
114
		return graceCount;
85
	}
115
	}
-
 
116
 
86
	public boolean isActive() {
117
	public boolean isActive() {
87
		return active;
118
		return active;
88
	}
119
	}
-
 
120
 
89
	public void setActive(boolean active) {
121
	public void setActive(boolean active) {
90
		this.active = active;
122
		this.active = active;
91
	}
123
	}
-
 
124
 
92
	public void setGraceCount(int graceCount) {
125
	public void setGraceCount(int graceCount) {
93
		this.graceCount = graceCount;
126
		this.graceCount = graceCount;
94
	}
127
	}
-
 
128
 
95
	public LocalDate getGraceDate() {
129
	public LocalDate getGraceDate() {
96
		return graceDate;
130
		return graceDate;
97
	}
131
	}
-
 
132
 
98
	public void setGraceDate(LocalDate graceDate) {
133
	public void setGraceDate(LocalDate graceDate) {
99
		this.graceDate = graceDate;
134
		this.graceDate = graceDate;
100
	}
135
	}
-
 
136
 
101
	public float getMinimumInvestment() {
137
	public float getMinimumInvestment() {
102
		return minimumInvestment;
138
		return minimumInvestment;
103
	}
139
	}
-
 
140
 
104
	public void setMinimumInvestment(float minimumInvestment) {
141
	public void setMinimumInvestment(float minimumInvestment) {
105
		this.minimumInvestment = minimumInvestment;
142
		this.minimumInvestment = minimumInvestment;
106
	}
143
	}
107
 
144
 
108
	@Transient
145
	@Transient
109
	private Address userAddress;
146
	private Address userAddress;
110
	
-
 
111
	
147
 
112
	/*public int getCreditCycle() {
-
 
113
		return creditCycle;
-
 
114
	}
148
	/*
115
	public void setCreditCycle(int creditCycle) {
149
	 * public int getCreditCycle() { return creditCycle; } public void
116
		this.creditCycle = creditCycle;
150
	 * setCreditCycle(int creditCycle) { this.creditCycle = creditCycle; }
117
	}*/
151
	 */
118
	public CounterSize getCounterSize() {
152
	public CounterSize getCounterSize() {
119
		return counterSize;
153
		return counterSize;
120
	}
154
	}
-
 
155
 
121
	public void setCounterSize(CounterSize counterSize) {
156
	public void setCounterSize(CounterSize counterSize) {
122
		this.counterSize = counterSize;
157
		this.counterSize = counterSize;
123
	}
158
	}
-
 
159
 
124
	public int getId() {
160
	public int getId() {
125
		return id;
161
		return id;
126
	}
162
	}
-
 
163
 
127
	public void setId(int id) {
164
	public void setId(int id) {
128
		this.id = id;
165
		this.id = id;
129
	}
166
	}
130
	
167
 
131
    public String getCode() {
168
	public String getCode() {
132
		return code;
169
		return code;
133
	}
170
	}
134
    
171
 
135
    public void setCode(String code) {
172
	public void setCode(String code) {
136
		this.code = code;
173
		this.code = code;
137
	}
174
	}
138
    
175
 
139
    public String getLatitude() {
176
	public String getLatitude() {
140
		return latitude;
177
		return latitude;
141
	}
178
	}
142
    
179
 
143
    public void setLatitude(String latitude) {
180
	public void setLatitude(String latitude) {
144
		this.latitude = latitude;
181
		this.latitude = latitude;
145
	}
182
	}
146
    
183
 
147
    public String getLongitude() {
184
	public String getLongitude() {
148
		return longitude;
185
		return longitude;
149
	}
186
	}
150
    
187
 
151
    public void setLongitude(String longitude) {
188
	public void setLongitude(String longitude) {
152
		this.longitude = longitude;
189
		this.longitude = longitude;
153
	}
190
	}
154
    
-
 
155
	
191
 
156
	public Address getUserAddress() {
192
	public Address getUserAddress() {
157
		return userAddress;
193
		return userAddress;
158
	}
194
	}
-
 
195
 
159
	public void setUserAddress(Address userAddress) {
196
	public void setUserAddress(Address userAddress) {
160
		this.userAddress = userAddress;
197
		this.userAddress = userAddress;
161
	}
198
	}
-
 
199
 
162
	@Override
200
	@Override
163
	public int hashCode() {
201
	public int hashCode() {
164
		final int prime = 31;
202
		final int prime = 31;
165
		int result = 1;
203
		int result = 1;
166
		result = prime * result + (active ? 1231 : 1237);
204
		result = prime * result + (active ? 1231 : 1237);
Line 175... Line 213...
175
		result = prime * result + Float.floatToIntBits(minimumInvestment);
213
		result = prime * result + Float.floatToIntBits(minimumInvestment);
176
		result = prime * result + ((userAddress == null) ? 0 : userAddress.hashCode());
214
		result = prime * result + ((userAddress == null) ? 0 : userAddress.hashCode());
177
		result = prime * result + warehouseId;
215
		result = prime * result + warehouseId;
178
		return result;
216
		return result;
179
	}
217
	}
-
 
218
 
180
	@Override
219
	@Override
181
	public boolean equals(Object obj) {
220
	public boolean equals(Object obj) {
182
		if (this == obj)
221
		if (this == obj)
183
			return true;
222
			return true;
184
		if (obj == null)
223
		if (obj == null)
Line 225... Line 264...
225
			return false;
264
			return false;
226
		if (warehouseId != other.warehouseId)
265
		if (warehouseId != other.warehouseId)
227
			return false;
266
			return false;
228
		return true;
267
		return true;
229
	}
268
	}
230
	
269
 
231
	@Override
270
	@Override
232
	public String toString() {
271
	public String toString() {
233
		return "FofoStore [id=" + id + ", code=" + code + ", latitude=" + latitude + ", longitude=" + longitude
272
		return "FofoStore [id=" + id + ", code=" + code + ", latitude=" + latitude + ", longitude=" + longitude
234
				+ ", counterSize=" + counterSize + ", warehouseId=" + warehouseId + ", minimumInvestment="
273
				+ ", counterSize=" + counterSize + ", warehouseId=" + warehouseId + ", minimumInvestment="
235
				+ minimumInvestment + ", graceDate=" + graceDate + ", investmentOk=" + investmentOk + ", graceCount="
274
				+ minimumInvestment + ", graceDate=" + graceDate + ", investmentOk=" + investmentOk + ", graceCount="
236
				+ graceCount + ", active=" + active + ", userAddress=" + userAddress + "]";
275
				+ graceCount + ", active=" + active + ", userAddress=" + userAddress + "]";
237
	}
276
	}
238
	
-
 
239
	
-
 
240
	
277
 
241
        
-
 
242
}
278
}
243
279