Subversion Repositories SmartDukaan

Rev

Rev 35961 | 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;
22418 ashik.ali 2
 
35323 amit 3
import com.fasterxml.jackson.annotation.JsonIgnore;
30046 tejbeer 4
import com.spice.profitmandi.common.enumuration.ActivationType;
29936 amit.gupta 5
import com.spice.profitmandi.common.enumuration.CounterSize;
6
import com.spice.profitmandi.common.enumuration.FofoType;
35323 amit 7
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
29936 amit.gupta 8
import com.spice.profitmandi.dao.entity.user.Address;
9
 
10
import javax.persistence.*;
22418 ashik.ali 11
import java.io.Serializable;
24349 amit.gupta 12
import java.time.LocalDate;
28166 tejbeer 13
import java.time.LocalDateTime;
35079 vikas 14
import java.util.Objects;
22418 ashik.ali 15
 
16
/**
17
 * This class basically contains store code details
32615 raveendra. 18
 *
22418 ashik.ali 19
 * @author ashikali
20
 */
21
@Entity
31730 tejbeer 22
@Table(name = "fofo.fofo_store")
27556 tejbeer 23
 
24
@NamedQueries({
25
 
32615 raveendra. 26
        @NamedQuery(name = "FofoStore.selectAllDtrUserIds", query = "select ua.userId from FofoStore fs join UserAccount ua on fs.id=ua.accountKey "
27
                + "where ua.type='saholic' and fs.internal=false and fs.active=true"),
29926 amit.gupta 28
 
32615 raveendra. 29
        @NamedQuery(name = "FofoStore.selectGroupByBrandWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.BrandWisePartnerSaleModel(foi.brand, "
35463 amit 30
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS integer ) else 0 end),"
31
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
32
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS integer ) else 0 end),"
33
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
34
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
35
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
32615 raveendra. 36
                + " 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 "
37
                + "and foi.createTimestamp >= :lmtdStartDate and i.categoryId = :categoryId and fs.id in :fofoId"
38
                + " group by foi.brand"),
35284 aman 39
        @NamedQuery(name = "FofoStore.selectGroupByBrandWarehousePartnerAccessoriesSale", query = "select new com.spice.profitmandi.dao.model.BrandWisePartnerSaleModel(foi.brand, "
35463 amit 40
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS integer ) else 0 end),"
41
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
42
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS integer ) else 0 end),"
43
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
44
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
45
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
35284 aman 46
                + " 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 "
36242 aman 47
                + "and foi.createTimestamp >= :lmtdStartDate and i.categoryId != :categoryId and fs.id in :fofoId"
48
                + " group by foi.brand"),
27594 tejbeer 49
 
32615 raveendra. 50
        @NamedQuery(name = "FofoStore.selectGroupByWarehouseBrandWisePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel("
51
                + "(case when a.city in ('Noida', 'Ghaziabad')  and foi.brand = 'Vivo' then 7573 else fs.warehouseId end) AS col_0_0_,"
35463 amit 52
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
53
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
54
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
55
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
56
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
57
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
32615 raveendra. 58
                + " 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"
59
                + " join com.spice.profitmandi.dao.entity.user.User u on u.id = fs.id join Address a on a.id = u.addressId"
60
                + " where fo.cancelledTimestamp is null and fs.active = true"
61
                + " and foi.createTimestamp >= :lmtdStartDate and foi.brand = :brand and i.categoryId = :categoryId and fs.id in :fofoId"
62
                + " group by col_0_0_"),
27556 tejbeer 63
 
32615 raveendra. 64
        @NamedQuery(name = "FofoStore.selectWarehouseBrandItemSale", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel(fs.warehouseId,i.id, i.brand, i.modelName, i.modelNumber,i.color,"
35463 amit 65
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
66
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
67
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
68
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
69
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
70
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
32615 raveendra. 71
                + " 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"
72
                + " and  foi.createTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId and i.brand = :brand and i.categoryId = :categoryId and fs.id in :fofoId group by i.id"),
27594 tejbeer 73
 
32615 raveendra. 74
        @NamedQuery(name = "FofoStore.selectGroupByBrandAccesoriesWarehousePartnerSale", query = "select new com.spice.profitmandi.dao.model.BrandWisePartnerSaleModel(foi.brand, "
35463 amit 75
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
76
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
77
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
78
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
79
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
80
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
32615 raveendra. 81
                + " 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 "
82
                + "and foi.createTimestamp >= :lmtdStartDate and i.categoryId != :categoryId and fs.id in :fofoId"
83
                + " group by foi.brand"),
27556 tejbeer 84
 
32615 raveendra. 85
        @NamedQuery(name = "FofoStore.selectGroupByWarehouseAccesoriesBrandWisePartnerSale", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel(fs.warehouseId,"
35463 amit 86
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
87
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
88
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
89
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
90
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
91
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
32615 raveendra. 92
                + " 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"
93
                + " and foi.createTimestamp >= :lmtdStartDate and foi.brand = :brand and i.categoryId != :categoryId and fs.id in :fofoId"
94
                + " group by fs.warehouseId"),
27592 tejbeer 95
 
32615 raveendra. 96
        @NamedQuery(name = "FofoStore.selectWarehouseAccesoriesBrandItemSale", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel(fs.warehouseId,i.id, i.brand, i.modelName, i.modelNumber,i.color,"
35463 amit 97
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
98
                + "sum(case when foi.createTimestamp >= :lmsStartDate AND foi.createTimestamp < :lmsEndDate then foi.quantity  else 0 end),"
99
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end),"
100
                + "sum(case when foi.createTimestamp >= :mtdStartDate AND foi.createTimestamp < :mtdEndDate then foi.quantity else 0 end), "
101
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then CAST(foi.quantity*foi.mop  AS int) else 0 end), "
102
                + "sum(case when foi.createTimestamp >= :lmtdStartDate AND foi.createTimestamp < :lmtdEndDate then foi.quantity else 0 end))"
32615 raveendra. 103
                + " 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"
104
                + " and  foi.createTimestamp >= :lmtdStartDate and fs.warehouseId in :warehouseId and i.brand = :brand and i.categoryId != :categoryId  and fs.id in :fofoId group by i.id"),
27556 tejbeer 105
 
32615 raveendra. 106
        @NamedQuery(name = "FofoStore.selectPartnerPendingIndentItem", query = "select new com.spice.profitmandi.dao.model.PartnerPendingIndentItemModel(o.retailerName,"
107
                + " li.quantity, li.totalPrice)"
108
                + " from FofoStore fs join Order o on fs.id = o.retailerId join  LineItem li on li.orderId = o.id "
109
                + " where li.itemId = :itemId and fs.warehouseId = :warehouseId and o.status = 3"),
27599 tejbeer 110
 
32615 raveendra. 111
        @NamedQuery(name = "FofoStore.selectUnbilledActivateStockGroupByBrand", query = "select new com.spice.profitmandi.dao.model.BrandWiseUnbilledActivateStockModel(i.brand,"
35463 amit 112
                + "  sum(case when ai.activationTimestamp >= :almtdStartDate AND ai.activationTimestamp < :almtdEndDate then 1 else 0 end),"
113
                + "  sum(case when ai.activationTimestamp >= :almtdStartDate AND ai.activationTimestamp < :almtdEndDate then CAST(tl.sellingPrice  AS int) else 0 end))"
32615 raveendra. 114
                + " from FofoStore fs join InventoryItem ii on fs.id = ii.fofoId join ActivatedImei ai on ai.serialNumber = ii.serialNumber join Item i on i.id = ii.itemId join TagListing tl on tl.itemId = i.id"
115
                + " where fs.active = true and ii.goodQuantity >= 1 and fs.id in :fofoId group by i.brand"),
27670 tejbeer 116
 
32615 raveendra. 117
        @NamedQuery(name = "FofoStore.selectUnbilledActivateStockGroupByWarehouse", query = "select new com.spice.profitmandi.dao.model.WarehouseWiseBrandUnbilledActivatedModel(fs.warehouseId,"
35463 amit 118
                + "  sum(case when ai.activationTimestamp >= :almtdStartDate AND ai.activationTimestamp < :almtdEndDate then 1 else 0 end),"
119
                + "  sum(case when ai.activationTimestamp >= :almtdStartDate AND ai.activationTimestamp < :almtdEndDate then CAST(tl.sellingPrice  AS int) else 0 end))"
32615 raveendra. 120
                + " from FofoStore fs join InventoryItem ii on fs.id = ii.fofoId join ActivatedImei ai on ai.serialNumber = ii.serialNumber join Item i on i.id = ii.itemId join TagListing tl on tl.itemId = i.id"
121
                + " where fs.active = true and ii.goodQuantity >= 1 and i.brand = :brand and fs.id in :fofoId group by fs.warehouseId"),
27670 tejbeer 122
 
32615 raveendra. 123
        @NamedQuery(name = "FofoStore.selectWarehouseBrandItemUnbilledActivateStock", query = "select new com.spice.profitmandi.dao.model.WarehouseBrandItemUnbilledActivatedModel(fs.warehouseId,i.id, i.brand, i.modelName, i.modelNumber,i.color,"
35463 amit 124
                + "  sum(case when ai.activationTimestamp >= :almtdStartDate AND ai.activationTimestamp < :almtdEndDate then 1 else 0 end),"
125
                + "  sum(case when ai.activationTimestamp >= :almtdStartDate AND ai.activationTimestamp < :almtdEndDate then CAST(tl.sellingPrice  AS int) else 0 end))"
32615 raveendra. 126
                + " from FofoStore fs join InventoryItem ii on fs.id = ii.fofoId join ActivatedImei ai on ai.serialNumber = ii.serialNumber join Item i on i.id = ii.itemId join TagListing tl on tl.itemId = i.id"
127
                + " where fs.active = true and ii.goodQuantity >= 1 and i.brand = :brand and fs.warehouseId in :warehouseId and fs.id in :fofoId  group by i.id"),
27670 tejbeer 128
 
32615 raveendra. 129
        @NamedQuery(name = "FofoStore.selectGroupByBrandLms", query = "select new com.spice.profitmandi.dao.model.BrandWiseModel(foi.brand, DATE_FORMAT(fo.createTimestamp, :groupParameter),sum(cast(foi.mop*foi.quantity As int)))"
130
                + " 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 "
131
                + " and (foi.createTimestamp between :lmsStartDate and :endDate) and i.categoryId = :categoryId and fs.id in :fofoId and fs.warehouseId in :warehouseId"
132
                + " group by foi.brand,DATE_FORMAT(fo.createTimestamp, :groupParameter)"),})
27599 tejbeer 133
 
27556 tejbeer 134
public class FofoStore implements Serializable {
135
 
32615 raveendra. 136
    private static final long serialVersionUID = 1L;
137
    @Id
138
    @Column(name = "id", unique = true, updatable = false)
139
    private int id;
140
    private int codeInt;
141
    @Column(name = "code", unique = true)
142
    private String code;
143
    @Column(name = "latitude")
144
    private String latitude;
145
    @Column(name = "longitude")
146
    private String longitude;
147
    @Column(name = "counter_size")
148
    @Enumerated(EnumType.STRING)
149
    private CounterSize counterSize = CounterSize.TEN_LAC;
150
    @Column(name = "counter_potential")
151
    private float counterPotential;
152
    @Column(name = "warehouse_id")
153
    private int warehouseId;
154
    @Column(name = "minimum_investment")
155
    private float minimumInvestment;
156
    @Column(name = "grace_date")
157
    private LocalDate graceDate;
158
    @Column(name = "investment_ok")
159
    private boolean investmentOk;
160
    @Column
161
    private boolean active = true;
162
    @Column
163
    private String pan;
164
    @Transient
165
    private Address userAddress;
166
    @Column(name = "internal")
167
    private boolean internal;
168
    @Column(name = "bags_last_credited")
169
    private LocalDateTime bagsLastCredited;
170
    @Column(name = "fofo_type")
171
    @Enumerated(EnumType.STRING)
172
    private FofoType fofoType;
173
    @Column(name = "activation_type")
174
    @Enumerated(EnumType.STRING)
175
    private ActivationType activationType = ActivationType.BILLING_PENDING;
176
    @Column(name = "active_timestamp")
177
    private LocalDateTime activeTimeStamp;
178
    @Column(name = "target")
179
    private int target;
180
    @Column(name = "grace_count")
181
    private int graceCount;
33124 ranu 182
    @Column(name = "astId")
183
    private int astId;
35297 amit 184
 
35079 vikas 185
    @Column(name = "gst_number")
186
    private String gstNumber;
27556 tejbeer 187
 
35961 amit 188
    @Column(name = "closed")
189
    private boolean closed = false;
190
 
191
    @Column(name = "closed_timestamp")
192
    private LocalDateTime closedTimestamp;
193
 
35289 amit 194
    @Column(name = "trial")
195
    private boolean trial = false;
196
 
197
    @Column(name = "trial_start")
198
    private LocalDate trialStart;
199
 
200
    @Column(name = "trial_end")
201
    private LocalDate trialEnd;
202
 
32615 raveendra. 203
    public FofoStore() {
204
    }
27556 tejbeer 205
 
33124 ranu 206
    public int getAstId() {
207
        return astId;
208
    }
209
 
210
    public void setAstId(int astId) {
211
        this.astId = astId;
212
    }
213
 
32615 raveendra. 214
    public int getCodeInt() {
215
        return codeInt;
216
    }
27556 tejbeer 217
 
32615 raveendra. 218
    public void setCodeInt(int codeInt) {
219
        this.codeInt = codeInt;
220
    }
27556 tejbeer 221
 
32615 raveendra. 222
    public int getTarget() {
223
        return target;
224
    }
27556 tejbeer 225
 
32615 raveendra. 226
    public void setTarget(int target) {
227
        this.target = target;
228
    }
27556 tejbeer 229
 
32615 raveendra. 230
    public ActivationType getActivationType() {
231
        return activationType;
232
    }
27556 tejbeer 233
 
32615 raveendra. 234
    public void setActivationType(ActivationType activationType) {
235
        this.activationType = activationType;
236
    }
31730 tejbeer 237
 
32615 raveendra. 238
    public float getCounterPotential() {
239
        return counterPotential;
240
    }
27556 tejbeer 241
 
32615 raveendra. 242
    public void setCounterPotential(float counterPotential) {
243
        this.counterPotential = counterPotential;
244
    }
27556 tejbeer 245
 
32615 raveendra. 246
    public LocalDateTime getBagsLastCredited() {
247
        return bagsLastCredited;
248
    }
27556 tejbeer 249
 
32615 raveendra. 250
    public void setBagsLastCredited(LocalDateTime bagsLastCredited) {
251
        this.bagsLastCredited = bagsLastCredited;
252
    }
27556 tejbeer 253
 
32615 raveendra. 254
    public boolean isInternal() {
255
        return internal;
256
    }
27903 tejbeer 257
 
32615 raveendra. 258
    public void setInternal(boolean internal) {
259
        this.internal = internal;
260
    }
29497 amit.gupta 261
 
32615 raveendra. 262
    public int getWarehouseId() {
263
        return warehouseId;
264
    }
30046 tejbeer 265
 
32615 raveendra. 266
    public void setWarehouseId(int warehouseId) {
267
        this.warehouseId = warehouseId;
268
    }
27903 tejbeer 269
 
32615 raveendra. 270
    public boolean isInvestmentOk() {
271
        return investmentOk;
272
    }
28825 tejbeer 273
 
32615 raveendra. 274
    public void setInvestmentOk(boolean investmentOk) {
275
        this.investmentOk = investmentOk;
276
    }
28825 tejbeer 277
 
32615 raveendra. 278
    public String getPan() {
279
        return pan;
280
    }
30046 tejbeer 281
 
32615 raveendra. 282
    public void setPan(String pan) {
283
        this.pan = pan;
284
    }
28166 tejbeer 285
 
32615 raveendra. 286
    public int getGraceCount() {
287
        return graceCount;
288
    }
32308 amit.gupta 289
 
32615 raveendra. 290
    public void setGraceCount(int graceCount) {
291
        this.graceCount = graceCount;
292
    }
32308 amit.gupta 293
 
32615 raveendra. 294
    public boolean isActive() {
295
        return active;
296
    }
32308 amit.gupta 297
 
32615 raveendra. 298
    public void setActive(boolean active) {
299
        this.active = active;
300
    }
30046 tejbeer 301
 
32615 raveendra. 302
    public LocalDate getGraceDate() {
303
        return graceDate;
304
    }
31730 tejbeer 305
 
32615 raveendra. 306
    public void setGraceDate(LocalDate graceDate) {
307
        this.graceDate = graceDate;
308
    }
31730 tejbeer 309
 
32615 raveendra. 310
    public float getMinimumInvestment() {
311
        return minimumInvestment;
312
    }
30046 tejbeer 313
 
32615 raveendra. 314
    public void setMinimumInvestment(float minimumInvestment) {
315
        this.minimumInvestment = minimumInvestment;
316
    }
28166 tejbeer 317
 
32615 raveendra. 318
    /*
319
     * public int getCreditCycle() { return creditCycle; } public void
320
     * setCreditCycle(int creditCycle) { this.creditCycle = creditCycle; }
321
     */
322
    public CounterSize getCounterSize() {
323
        return counterSize;
324
    }
28166 tejbeer 325
 
32615 raveendra. 326
    public void setCounterSize(CounterSize counterSize) {
327
        this.counterSize = counterSize;
328
    }
27903 tejbeer 329
 
32615 raveendra. 330
    public int getId() {
331
        return id;
332
    }
27903 tejbeer 333
 
32615 raveendra. 334
    public void setId(int id) {
335
        this.id = id;
336
    }
27903 tejbeer 337
 
32615 raveendra. 338
    public String getCode() {
339
        return code;
340
    }
27903 tejbeer 341
 
32615 raveendra. 342
    public void setCode(String code) {
343
        this.code = code;
344
    }
27556 tejbeer 345
 
32615 raveendra. 346
    public String getLatitude() {
347
        return latitude;
348
    }
25276 amit.gupta 349
 
32615 raveendra. 350
    public void setLatitude(String latitude) {
351
        this.latitude = latitude;
352
    }
24843 govind 353
 
32615 raveendra. 354
    public String getLongitude() {
355
        return longitude;
356
    }
29497 amit.gupta 357
 
32615 raveendra. 358
    public void setLongitude(String longitude) {
359
        this.longitude = longitude;
360
    }
29497 amit.gupta 361
 
32615 raveendra. 362
    public Address getUserAddress() {
363
        return userAddress;
364
    }
27556 tejbeer 365
 
32615 raveendra. 366
    public void setUserAddress(Address userAddress) {
367
        this.userAddress = userAddress;
368
    }
27556 tejbeer 369
 
32615 raveendra. 370
    public LocalDateTime getActiveTimeStamp() {
371
        return activeTimeStamp;
372
    }
27556 tejbeer 373
 
32615 raveendra. 374
    public void setActiveTimeStamp(LocalDateTime activeTimeStamp) {
375
        this.activeTimeStamp = activeTimeStamp;
376
    }
27556 tejbeer 377
 
32615 raveendra. 378
    public FofoType getFofoType() {
379
        return fofoType;
380
    }
27556 tejbeer 381
 
32615 raveendra. 382
    public void setFofoType(FofoType fofoType) {
383
        this.fofoType = fofoType;
384
    }
27556 tejbeer 385
 
35079 vikas 386
    public String getGstNumber() {
387
        return gstNumber;
388
    }
389
 
390
    public void setGstNumber(String gstNumber) {
391
        this.gstNumber = gstNumber;
392
    }
393
 
35961 amit 394
    public boolean isClosed() {
395
        return closed;
396
    }
397
 
398
    public void setClosed(boolean closed) {
399
        this.closed = closed;
400
    }
401
 
402
    public LocalDateTime getClosedTimestamp() {
403
        return closedTimestamp;
404
    }
405
 
406
    public void setClosedTimestamp(LocalDateTime closedTimestamp) {
407
        this.closedTimestamp = closedTimestamp;
408
    }
409
 
35289 amit 410
    public boolean isTrial() {
411
        return trial;
412
    }
413
 
414
    public void setTrial(boolean trial) {
415
        this.trial = trial;
416
    }
417
 
418
    public LocalDate getTrialStart() {
419
        return trialStart;
420
    }
421
 
422
    public void setTrialStart(LocalDate trialStart) {
423
        this.trialStart = trialStart;
424
    }
425
 
426
    public LocalDate getTrialEnd() {
427
        return trialEnd;
428
    }
429
 
430
    public void setTrialEnd(LocalDate trialEnd) {
431
        this.trialEnd = trialEnd;
432
    }
433
 
32615 raveendra. 434
    @Override
35079 vikas 435
    public boolean equals(Object o) {
35297 amit 436
        if (o == null || getClass() != o.getClass()) return false;
35079 vikas 437
        FofoStore fofoStore = (FofoStore) o;
35961 amit 438
        return id == fofoStore.id && codeInt == fofoStore.codeInt && Float.compare(counterPotential, fofoStore.counterPotential) == 0 && warehouseId == fofoStore.warehouseId && Float.compare(minimumInvestment, fofoStore.minimumInvestment) == 0 && investmentOk == fofoStore.investmentOk && active == fofoStore.active && internal == fofoStore.internal && target == fofoStore.target && graceCount == fofoStore.graceCount && astId == fofoStore.astId && closed == fofoStore.closed && trial == fofoStore.trial && Objects.equals(code, fofoStore.code) && Objects.equals(latitude, fofoStore.latitude) && Objects.equals(longitude, fofoStore.longitude) && counterSize == fofoStore.counterSize && Objects.equals(graceDate, fofoStore.graceDate) && Objects.equals(pan, fofoStore.pan) && Objects.equals(userAddress, fofoStore.userAddress) && Objects.equals(bagsLastCredited, fofoStore.bagsLastCredited) && fofoType == fofoStore.fofoType && activationType == fofoStore.activationType && Objects.equals(activeTimeStamp, fofoStore.activeTimeStamp) && Objects.equals(gstNumber, fofoStore.gstNumber) && Objects.equals(closedTimestamp, fofoStore.closedTimestamp) && Objects.equals(trialStart, fofoStore.trialStart) && Objects.equals(trialEnd, fofoStore.trialEnd);
32615 raveendra. 439
    }
27556 tejbeer 440
 
32615 raveendra. 441
    @Override
35079 vikas 442
    public int hashCode() {
35961 amit 443
        return Objects.hash(id, codeInt, code, latitude, longitude, counterSize, counterPotential, warehouseId, minimumInvestment, graceDate, investmentOk, active, pan, userAddress, internal, bagsLastCredited, fofoType, activationType, activeTimeStamp, target, graceCount, astId, gstNumber, closed, closedTimestamp, trial, trialStart, trialEnd);
32615 raveendra. 444
    }
23884 amit.gupta 445
 
32615 raveendra. 446
    @Override
447
    public String toString() {
35079 vikas 448
        return "FofoStore{" +
449
                "id=" + id +
450
                ", codeInt=" + codeInt +
451
                ", code='" + code + '\'' +
452
                ", latitude='" + latitude + '\'' +
453
                ", longitude='" + longitude + '\'' +
454
                ", counterSize=" + counterSize +
455
                ", counterPotential=" + counterPotential +
456
                ", warehouseId=" + warehouseId +
457
                ", minimumInvestment=" + minimumInvestment +
458
                ", graceDate=" + graceDate +
459
                ", investmentOk=" + investmentOk +
460
                ", active=" + active +
461
                ", pan='" + pan + '\'' +
462
                ", userAddress=" + userAddress +
463
                ", internal=" + internal +
464
                ", bagsLastCredited=" + bagsLastCredited +
465
                ", fofoType=" + fofoType +
466
                ", activationType=" + activationType +
467
                ", activeTimeStamp=" + activeTimeStamp +
468
                ", target=" + target +
469
                ", graceCount=" + graceCount +
470
                ", astId=" + astId +
471
                ", gstNumber='" + gstNumber + '\'' +
35961 amit 472
                ", closed=" + closed +
473
                ", closedTimestamp=" + closedTimestamp +
35297 amit 474
                ", trial=" + trial +
475
                ", trialStart=" + trialStart +
476
                ", trialEnd=" + trialEnd +
35079 vikas 477
                '}';
32615 raveendra. 478
    }
35297 amit 479
 
35323 amit 480
    @JsonIgnore
481
    public boolean isExpired() throws ProfitMandiBusinessException{
482
        if(isTrial()) return LocalDate.now().isAfter(trialEnd);
483
        else throw new ProfitMandiBusinessException("Not a trial user", "Not a trial user", "Not a trial user");
35297 amit 484
    }
22418 ashik.ali 485
}