Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
23819 govind 1
package com.spice.profitmandi.web.controller;
2
 
23945 amit.gupta 3
import com.fasterxml.jackson.databind.ObjectMapper;
29926 amit.gupta 4
import com.spice.profitmandi.common.enumuration.MessageType;
23819 govind 5
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
29926 amit.gupta 6
import com.spice.profitmandi.common.model.*;
23945 amit.gupta 7
import com.spice.profitmandi.common.services.ReporticoService;
23951 amit.gupta 8
import com.spice.profitmandi.common.util.FileUtil;
23945 amit.gupta 9
import com.spice.profitmandi.common.util.FormattingUtils;
28102 tejbeer 10
import com.spice.profitmandi.common.util.Utils;
23819 govind 11
import com.spice.profitmandi.dao.entity.catalog.Item;
23884 amit.gupta 12
import com.spice.profitmandi.dao.entity.catalog.TagListing;
32905 shampa 13
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
24822 amit.gupta 14
import com.spice.profitmandi.dao.entity.inventory.ItemPricingHistory;
23884 amit.gupta 15
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
23819 govind 16
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
24083 amit.gupta 17
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
31903 amit.gupta 18
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
24083 amit.gupta 19
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
31903 amit.gupta 20
import com.spice.profitmandi.dao.model.AmountModel;
23819 govind 21
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
23884 amit.gupta 22
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
35547 amit 23
import com.spice.profitmandi.dao.event.TagListingEventPublisher;
29926 amit.gupta 24
import com.spice.profitmandi.dao.repository.cs.CsService;
28136 tejbeer 25
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
28102 tejbeer 26
import com.spice.profitmandi.dao.repository.dtr.Mongo;
29926 amit.gupta 27
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
28102 tejbeer 28
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
24822 amit.gupta 29
import com.spice.profitmandi.dao.repository.inventory.ItemPricingHistoryRepository;
23884 amit.gupta 30
import com.spice.profitmandi.dao.repository.inventory.VendorItemPricingRepository;
23983 amit.gupta 31
import com.spice.profitmandi.dao.repository.transaction.LineItemImeisRepository;
24083 amit.gupta 32
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
23819 govind 33
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
29926 amit.gupta 34
import com.spice.profitmandi.service.NotificationService;
29951 amit.gupta 35
import com.spice.profitmandi.service.authentication.RoleManager;
32844 shampa 36
import com.spice.profitmandi.service.catalog.BrandsService;
23819 govind 37
import com.spice.profitmandi.service.inventory.InventoryService;
34651 aman.kumar 38
import com.spice.profitmandi.service.order.OrderService;
31903 amit.gupta 39
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModelNew;
29788 amit.gupta 40
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
41
import com.spice.profitmandi.service.pricecircular.PriceCircularService;
23983 amit.gupta 42
import com.spice.profitmandi.service.pricing.PriceDropService;
37000 amit 43
import com.spice.profitmandi.service.pricing.PriceHikeService;
23968 amit.gupta 44
import com.spice.profitmandi.service.scheme.SchemeService;
23884 amit.gupta 45
import com.spice.profitmandi.service.transaction.TransactionService;
28102 tejbeer 46
import com.spice.profitmandi.service.user.RetailerService;
23819 govind 47
import com.spice.profitmandi.service.wallet.WalletService;
28102 tejbeer 48
import com.spice.profitmandi.web.model.LoginDetails;
49
import com.spice.profitmandi.web.util.CookiesProcessor;
23819 govind 50
import com.spice.profitmandi.web.util.MVCResponseSender;
29926 amit.gupta 51
import org.apache.commons.io.output.ByteArrayOutputStream;
52
import org.apache.logging.log4j.LogManager;
53
import org.apache.logging.log4j.Logger;
54
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.beans.factory.annotation.Qualifier;
56
import org.springframework.core.io.ByteArrayResource;
57
import org.springframework.http.HttpHeaders;
58
import org.springframework.http.HttpStatus;
59
import org.springframework.http.ResponseEntity;
60
import org.springframework.stereotype.Controller;
61
import org.springframework.transaction.annotation.Transactional;
62
import org.springframework.ui.Model;
63
import org.springframework.web.bind.annotation.*;
23819 govind 64
 
29926 amit.gupta 65
import javax.servlet.http.HttpServletRequest;
66
import java.io.Serializable;
67
import java.time.LocalDate;
68
import java.time.LocalDateTime;
69
import java.util.*;
70
import java.util.stream.Collectors;
71
 
23819 govind 72
@Controller
27071 amit.gupta 73
@Transactional(rollbackFor = Throwable.class)
23819 govind 74
public class PriceDropController {
75
 
31903 amit.gupta 76
    private static final Logger LOGGER = LogManager.getLogger(PriceDropController.class);
34317 amit.gupta 77
    /*private static final List<String> SELLINS = Arrays.asList("Base Payout", "Cash Discount", "Upfront Margin", "Modelwise");
31910 amit.gupta 78
    private static final List<String> SELLOUTS = Arrays.asList("Tertiary Payout", "Hygiene Payout", "Investment Payout", "Category Payout", "Activation Margin", "Special Support", "Sellout Support");
34317 amit.gupta 79
    private static final List<String> ALL_MARGINS = Arrays.asList(SELLINS, SELLOUTS).stream().flatMap(x -> x.stream()).collect(Collectors.toList());*/
31903 amit.gupta 80
    @Autowired
81
    ReporticoService reporticoService;
82
    @Autowired
83
    LineItemImeisRepository lineItemImeisRepository;
84
    @Autowired
85
    PriceCircularService priceCircularService;
86
    @Autowired
87
    private CsService csService;
88
    @Autowired
89
    private UserRepository dtrUserRepository;
90
    @Autowired
91
    private PriceDropRepository priceDropRepository;
92
    @Autowired
93
    private ObjectMapper objectMapper;
94
    @Autowired
95
    private VendorItemPricingRepository vendorItemPricingRepository;
96
    @Autowired
97
    @Qualifier("fofoInventoryService")
98
    private InventoryService inventoryService;
99
    @Autowired
100
    private MVCResponseSender mvcResponseSender;
101
    @Autowired
102
    private PriceDropService priceDropService;
103
    @Autowired
37000 amit 104
    private PriceHikeService priceHikeService;
105
    @Autowired
31903 amit.gupta 106
    private ItemPricingHistoryRepository itemPricingHistoryRepository;
107
    @Autowired
108
    private WalletService walletService;
109
    @Autowired
110
    private TagListingRepository tagListingRepository;
111
    @Autowired
112
    private TransactionService transactionService;
113
    @Autowired
114
    private PriceDropIMEIRepository priceDropIMEIRepository;
115
    @Autowired
116
    private RoleManager roleManager;
117
    @Autowired
118
    @Qualifier("catalogItemRepository")
119
    private ItemRepository itemRepository;
120
    @Autowired
121
    private SchemeService schemeService;
122
    @Autowired
123
    private Mongo mongoClient;
124
    @Autowired
125
    private CookiesProcessor cookiesProcessor;
126
    @Autowired
127
    private PartnerTypeChangeService partnerTypeChangeService;
128
    @Autowired
129
    private RetailerService retailerService;
130
    @Autowired
131
    private NotificationService notificationService;
132
    @Autowired
133
    private FofoStoreRepository fofoStoreRepository;
23819 govind 134
 
34651 aman.kumar 135
    @Autowired
136
    OrderService orderService;
137
 
35547 amit 138
    @Autowired
139
    private TagListingEventPublisher tagListingEventPublisher;
140
 
31903 amit.gupta 141
    @RequestMapping(value = "/getItemDescription", method = RequestMethod.GET)
142
    public String getItemDescription(HttpServletRequest request, Model model) throws Throwable {
143
        List<PriceDrop> priceDrops = priceDropRepository.selectAllIncomplete();
144
        Set<Integer> catalogIds = priceDrops.stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
29926 amit.gupta 145
 
31903 amit.gupta 146
        List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
147
        Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
148
                x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
149
        model.addAttribute("priceDrops", priceDrops);
150
        model.addAttribute("catalogDescription", catalogDescription);
151
        return "price-drop";
152
    }
29926 amit.gupta 153
 
34651 aman.kumar 154
    @RequestMapping(value = "/getPricedropByDate", method = RequestMethod.GET)
155
    public String getItemDescriptionByDate(
156
            HttpServletRequest request,
157
            @RequestParam LocalDateTime startDate,
158
            @RequestParam LocalDateTime endDate,
159
            Model model) throws Throwable {
34657 aman.kumar 160
        if (endDate.isAfter(LocalDateTime.now().plusDays(1)) || startDate.isAfter(LocalDateTime.now().plusDays(1))) {
34651 aman.kumar 161
            throw new ProfitMandiBusinessException("startData and end data must if before the today date ", "", "");
162
        }
163
        try {
164
            List<PriceDrop> priceDrops = priceDropRepository.selectAllByDatesBetweenSortByDate(startDate, endDate);
165
 
166
            Set<Integer> catalogIds = priceDrops.stream()
167
                    .map(PriceDrop::getCatalogItemId)
168
                    .collect(Collectors.toSet());
169
 
170
            List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
171
            Map<Integer, String> catalogDescription = items.stream()
172
                    .collect(Collectors.toMap(
173
                            Item::getCatalogItemId,
174
                            Item::getItemDescriptionNoColor,
175
                            (description1, description2) -> description1));
176
 
177
            model.addAttribute("priceDrops", priceDrops);
178
            model.addAttribute("catalogDescription", catalogDescription);
179
 
180
            return "price-drop-table";
181
 
182
        } catch (Exception e) {
183
            e.printStackTrace();
184
            return "price-drop";
185
        }
186
    }
187
    @RequestMapping(value = "/pricedropByDate/download", method = RequestMethod.GET)
188
    public ResponseEntity<?> dowloadItems(HttpServletRequest request, @PathVariable(name = "tagId") @RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate)
189
            throws Throwable {
190
        List<PriceDrop> priceDrops = priceDropRepository.selectAllByDatesBetweenSortByDate(startDate, endDate);
191
        Set<Integer> catalogIds = priceDrops.stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
192
        List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
193
        Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
194
                x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
195
 
196
        List<List<?>> rows = new ArrayList<>();
197
        for (PriceDrop priceDrop : priceDrops) {
34720 aman.kumar 198
            rows.add(Arrays.asList(priceDrop.getId(), priceDrop.getCatalogItemId(), catalogDescription.get(priceDrop.getCatalogItemId()), priceDrop.getTp(), priceDrop.getOldDp(), priceDrop.getMop(),
34657 aman.kumar 199
                    priceDrop.getAmount(), priceDrop.getNewDp(), FormattingUtils.formatDate(priceDrop.getAffectedOn()), FormattingUtils.formatDate(priceDrop.getCreatedOn())
34651 aman.kumar 200
            ));
201
 
202
        }
203
        org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
34720 aman.kumar 204
                Arrays.asList("Drop Id", "Catalog Id", "Item Name", "TP", "DP", "Mop", "Price Drop",
34651 aman.kumar 205
                        "New DP", "Affected On", "Created On"),
206
                rows);
207
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Price Drop ");
208
        return responseEntity;
209
    }
210
 
31903 amit.gupta 211
    @RequestMapping(value = "/getClosedPricedropItemDescription", method = RequestMethod.GET)
212
    public String getClosedPricedropItemDescription(HttpServletRequest request, Model model) throws Throwable {
213
        List<PriceDrop> priceDrops = priceDropRepository.selectAllComplete();
214
        int processOn = 1;
23819 govind 215
 
31903 amit.gupta 216
        List<PriceDrop> completePriceDrops = priceDrops.stream().filter(x -> x.getCompleteTimestamp() != null)
217
                .collect(Collectors.toList());
23945 amit.gupta 218
 
31903 amit.gupta 219
        Set<Integer> catalogIds = completePriceDrops.stream().map(x -> x.getCatalogItemId())
220
                .collect(Collectors.toSet());
221
        List<Item> items = itemRepository.selectAllByCatalogIds(catalogIds);
222
        LOGGER.info("catalogIds" + catalogIds);
23819 govind 223
 
31903 amit.gupta 224
        Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
225
                x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
226
        model.addAttribute("priceDrops", completePriceDrops);
227
        model.addAttribute("processOn", processOn);
228
        model.addAttribute("catalogDescription", catalogDescription);
229
        return "price-drop";
230
    }
23945 amit.gupta 231
 
31903 amit.gupta 232
    @RequestMapping(value = "/item-pricing/{itemId}", method = RequestMethod.GET)
233
    public String getItemPricing(HttpServletRequest request, Model model, @PathVariable int itemId) throws Throwable {
23819 govind 234
 
31903 amit.gupta 235
        TagListing tagListing;
236
        PriceDropModel pm = new PriceDropModel();
237
        try {
238
            tagListing = tagListingRepository.selectByItemId(itemId);
239
            if (tagListing != null) {
240
                pm.setMop(tagListing.getMop());
241
                pm.setDp(tagListing.getSellingPrice());
242
                pm.setMrp(tagListing.getMrp());
243
                List<VendorItemPricing> vips = vendorItemPricingRepository.selectAll(itemId);
244
                if (vips.size() > 0) {
245
                    VendorItemPricing vip = vips.get(0);
246
                    pm.setNlc(vip.getNlc());
247
                    pm.setTp(vip.getTp());
248
                } else {
249
                    throw new ProfitMandiBusinessException("Item Id", itemId, "Vendor item pricing does not exist");
250
                }
251
            }
252
        } catch (Exception e) {
253
            LOGGER.info("Chose item that doesn't exist");
254
        }
255
        model.addAttribute("response1", mvcResponseSender.createResponseString(pm));
256
        return "response";
257
    }
27071 amit.gupta 258
 
37564 amit 259
    /**
260
     * Shared partner item typeahead. Feeds price drop, warehouse purchase (PO),
261
     * catalog-item, combo and prebooking.
262
     *
263
     * <p>{@code activeOnly} selects the basis: false (default) is the historical
264
     * whole-catalogue list, kept for screens that inspect or edit existing
265
     * records; true restricts to items with a live tag_listing, which is what
266
     * creation screens send so a delisted SKU cannot be picked.
267
     */
31903 amit.gupta 268
    @RequestMapping(value = "/item", method = RequestMethod.GET)
269
    public String getItemPricing(HttpServletRequest request, Model model, @RequestParam String query,
37564 amit 270
                                 @RequestParam boolean anyColor,
271
                                 @RequestParam(required = false, defaultValue = "false") boolean activeOnly)
272
            throws Throwable {
31903 amit.gupta 273
        String query1 = query.toLowerCase();
24083 amit.gupta 274
 
31903 amit.gupta 275
        List<ItemDescriptionModel> partnersItemDescription = inventoryService
37564 amit 276
                .getAllPartnerItemStringDescription(anyColor, activeOnly).parallelStream()
31903 amit.gupta 277
                .filter(x -> x.getItemDescription().toLowerCase().matches(".*?" + query1 + ".*?"))
278
                .collect(Collectors.toList());
279
        LOGGER.info("partnersItemDescription" + partnersItemDescription);
23819 govind 280
 
31903 amit.gupta 281
        model.addAttribute("response1", mvcResponseSender.createResponseString(partnersItemDescription));
282
        return "response";
283
    }
23945 amit.gupta 284
 
31903 amit.gupta 285
    @RequestMapping(value = "/price-drop/imes/download")
286
    public ResponseEntity<ByteArrayResource> downloadPriceDropImeis(HttpServletRequest request,
287
                                                                    @RequestParam LocalDateTime affectedDate, @RequestParam int itemId) throws Exception {
288
        Item item = itemRepository.selectById(itemId);
33198 amit.gupta 289
        ByteArrayOutputStream baos = getByteArrayOutputStream(affectedDate, item.getCatalogItemId(), null, Optional.empty());
31903 amit.gupta 290
        final HttpHeaders headers = new HttpHeaders();
291
        headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
292
        headers.set("Content-disposition", "inline; filename=\"imei-" + item.getItemDescriptionNoColor() + ".csv\"");
293
        byte[] byteArray = baos.toByteArray();
294
        headers.setContentLength(byteArray.length);
295
        return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
296
    }
23819 govind 297
 
31903 amit.gupta 298
    @RequestMapping(value = "/price-drop/addPayout", method = RequestMethod.POST)
299
    public String updatePriceDrop(HttpServletRequest request, @RequestBody PriceDropProcessModel priceDropProcessModel,
300
                                  Model model) throws Exception {
301
        boolean response = false;
302
        PriceDrop priceDrop = priceDropRepository.selectById(priceDropProcessModel.getPriceDropId());
303
        if (priceDrop.getProcessTimestamp() == null) {
304
            priceDrop.setPartnerPayout(priceDropProcessModel.getPartnerPayout());
305
            priceDrop.setPriceDropIn(priceDropProcessModel.getPriceDropIn());
306
            // priceDrop.setProcessTimestamp(LocalDateTime.now());
307
            priceDropRepository.persist(priceDrop);
308
            response = true;
309
        }
310
        model.addAttribute("response1", mvcResponseSender.createResponseString(response));
311
        return "response";
312
    }
24083 amit.gupta 313
 
31903 amit.gupta 314
    @RequestMapping(value = "/priceDropImeis/{priceDropId}", method = RequestMethod.GET)
315
    public String priceDropStatus(HttpServletRequest request, @PathVariable int priceDropId, Model model)
316
            throws Exception {
29951 amit.gupta 317
 
31903 amit.gupta 318
        PriceDropImeisModel priceDropImeisModel = new PriceDropImeisModel();
23819 govind 319
 
31903 amit.gupta 320
        // This call is used to persit imeis to pricedrop imeis in case its not there.
321
        // This should be called while creating price drop.
322
        // priceDropService.priceDropStatus(priceDropId);
24083 amit.gupta 323
 
31903 amit.gupta 324
        List<String> pendingImeis = new ArrayList<>();
325
        List<String> approvedImeis = new ArrayList<>();
326
        List<String> rejectedImeis = new ArrayList<>();
327
        List<String> holdImeis = new ArrayList<>();
328
        List<PriceDropIMEI> priceDropImeis = priceDropIMEIRepository.selectByPriceDropId(priceDropId);
329
        for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
330
            if (priceDropIMEI.getStatus().equals(PriceDropImeiStatus.PENDING)) {
331
                pendingImeis.add(priceDropIMEI.getImei());
332
            } else if (priceDropIMEI.getStatus().equals(PriceDropImeiStatus.APPROVED)) {
333
                approvedImeis.add(priceDropIMEI.getImei());
334
            }
335
            if (priceDropIMEI.getStatus().equals(PriceDropImeiStatus.REJECTED)) {
336
                rejectedImeis.add(priceDropIMEI.getImei());
337
            } else if (priceDropIMEI.getStatus().equals(PriceDropImeiStatus.HOLD)) {
338
                holdImeis.add(priceDropIMEI.getImei());
24083 amit.gupta 339
 
31903 amit.gupta 340
            }
341
        }
342
        LOGGER.info("pendingImeis" + pendingImeis);
343
        LOGGER.info("approvedImeis" + approvedImeis);
344
        LOGGER.info("rejectedImeis" + rejectedImeis);
345
        LOGGER.info("priceDropImeis" + priceDropImeis);
23945 amit.gupta 346
 
31903 amit.gupta 347
        priceDropImeisModel.setPendingImeis(pendingImeis);
348
        priceDropImeisModel.setPriceDropId(priceDropId);
349
        priceDropImeisModel.setApprovedImeis(approvedImeis);
350
        priceDropImeisModel.setHoldImeis(holdImeis);
351
        priceDropImeisModel.setRejectedImeis(rejectedImeis);
352
        model.addAttribute("response1", mvcResponseSender.createResponseString(priceDropImeisModel));
353
        return "response";
354
    }
28102 tejbeer 355
 
31903 amit.gupta 356
    @RequestMapping(value = "/processPriceDrop", method = RequestMethod.POST)
357
    public String processPriceDrop(HttpServletRequest request, @RequestBody PriceDropProcessModel priceDropProcessModel,
358
                                   Model model) throws Exception {
359
        PriceDrop priceDrop = priceDropRepository.selectById(priceDropProcessModel.getPriceDropId());
360
        boolean response = false;
361
        if (priceDrop.getPartnerPayout() == 0) {
362
            priceDrop.setPartnerPayout(priceDropProcessModel.getPartnerPayout());
363
        }
364
        priceDrop.setProcessTimestamp(LocalDateTime.now());
365
        priceDropService.processPriceDrop(priceDrop.getId(), priceDropProcessModel.isActivatedOnly());
366
        response = true;
367
        model.addAttribute("response1", mvcResponseSender.createResponseString(response));
368
        return "response";
369
    }
28102 tejbeer 370
 
37000 amit 371
    // On-demand price-hike deduction for a whole hike: figures out billed partners/IMEIs, then
372
    // debits each partner in the background (one transaction per retailer). Idempotent — re-calling
373
    // skips units already recovered (incl. those already handled by the GRN hook).
374
    @RequestMapping(value = "/priceHike/process/{priceDropId}", method = RequestMethod.GET)
375
    public String processPriceHike(HttpServletRequest request, @PathVariable int priceDropId, Model model)
36983 amit 376
            throws Exception {
37000 amit 377
        priceHikeService.triggerHikeDeduction(priceDropId);
378
        model.addAttribute("response1",
379
                mvcResponseSender.createResponseString("Price hike deduction started for priceDropId " + priceDropId));
36983 amit 380
        return "response";
381
    }
382
 
31903 amit.gupta 383
    @RequestMapping(value = "/priceDrop", method = RequestMethod.POST)
384
    public String addPriceDrop(HttpServletRequest request, Model model, @RequestBody PriceDropModel priceDropModel)
385
            throws Exception {
386
        boolean response = false;
387
        priceDropModel.setAllColors(true);
388
        if (this.validatePriceDrop(priceDropModel)) {
389
            TagListing tagListing = tagListingRepository.selectByItemId(priceDropModel.getItemId());
390
            float oldDp = tagListing.getSellingPrice();
391
            float oldMop = tagListing.getMop();
392
            float oldTp = 0;
393
            float newDp = priceDropModel.getDp();
28102 tejbeer 394
 
31903 amit.gupta 395
            if (newDp != oldDp) {
396
                List<Item> allItems = null;
397
                Item currentItem = itemRepository.selectById(priceDropModel.getItemId());
398
                if (priceDropModel.isAllColors()) {
399
                    allItems = itemRepository.selectAllByCatalogItemId(currentItem.getCatalogItemId());
28102 tejbeer 400
 
31903 amit.gupta 401
                } else {
402
                    allItems = Arrays.asList(currentItem);
403
                }
404
                for (Item item : allItems) {
405
                    TagListing itemTagListing = tagListingRepository.selectByItemId(item.getId());
406
                    if (itemTagListing == null)
407
                        continue;
408
                    itemTagListing.setSellingPrice(newDp);
409
                    itemTagListing.setMop(priceDropModel.getMop());
410
                    List<VendorItemPricing> vipList = vendorItemPricingRepository.selectAll(item.getId());
411
                    for (VendorItemPricing vip : vipList) {
412
                        oldTp = vip.getNlc();
413
                        vip.setDp(newDp);
414
                        vip.setMop(priceDropModel.getMop());
415
                        //Lets not update NLC/TP as it has to be managed by Category Tea,
416
                        //vip.setNlc(priceDropModel.getTp());
417
                        //vip.setTp(priceDropModel.getTp());
418
                        vendorItemPricingRepository.persist(vip);
419
                    }
420
                    transactionService.updatePriceDrop(item.getId(), newDp);
421
                }
29926 amit.gupta 422
 
31903 amit.gupta 423
                // Add to itemPricing history
424
                ItemPricingHistory iph = new ItemPricingHistory();
425
                iph.setCatalogId(currentItem.getCatalogItemId());
426
                iph.setTp(priceDropModel.getTp());
427
                iph.setDp(priceDropModel.getDp());
428
                iph.setMop(priceDropModel.getMop());
429
                // TODO: changedBy
430
                iph.setChangedBy("me");
431
                iph.setCreateTimestamp(LocalDateTime.now());
432
                itemPricingHistoryRepository.persist(iph);
28136 tejbeer 433
 
31903 amit.gupta 434
                PriceDrop priceDrop = new PriceDrop();
435
                priceDrop.setAffectedOn(priceDropModel.getAffectedDate());
436
                priceDrop.setTp(oldTp);
437
                priceDrop.setNlc(oldTp);
438
                priceDrop.setMop(oldMop);
439
                priceDrop.setOldDp(oldDp);
440
                priceDrop.setAmount(oldDp - newDp);
441
                priceDrop.setNewDp(newDp);
442
                priceDrop.setCreatedOn(LocalDateTime.now());
443
                priceDrop.setCatalogItemId(currentItem.getCatalogItemId());
444
                priceDropRepository.persist(priceDrop);
445
                priceDropService.priceDropStatus(priceDrop.getId());
446
                response = true;
30471 amit.gupta 447
 
31903 amit.gupta 448
                this.sendPriceChangeNotification(priceDrop);
35547 amit 449
 
450
                // Publish event for real-time Solr update
451
                try {
452
                    tagListingEventPublisher.publishPriceChange(0, currentItem.getCatalogItemId());
453
                } catch (Exception e) {
454
                    LOGGER.error("Failed to publish price change event for catalogId: {}", currentItem.getCatalogItemId(), e);
455
                }
31903 amit.gupta 456
            } else {
457
                throw new ProfitMandiBusinessException("Price Drop", priceDropModel.getPd(),
458
                        "Price Drop Should be greater than 0");
459
            }
460
        }
461
        model.addAttribute("response1", mvcResponseSender.createResponseString(response));
462
        return "response";
463
    }
29654 tejbeer 464
 
31903 amit.gupta 465
    private void sendPriceChangeNotification(PriceDrop priceDrop) throws ProfitMandiBusinessException {
466
        List<Item> items = itemRepository.selectAllByCatalogItemId(priceDrop.getCatalogItemId());
467
        String title = "Price has been %s for %s";
24083 amit.gupta 468
 
28568 amit.gupta 469
 
31903 amit.gupta 470
        SendNotificationModel sendNotificationModel = new SendNotificationModel();
471
        sendNotificationModel.setCampaignName("pricechange");
472
        sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
473
        sendNotificationModel.setTitle("");
474
        StringBuffer sb = new StringBuffer();
475
        String message = null;
476
        if (priceDrop.getDropAmount() > 0) {
477
            title = String.format(title, "dropped", items.get(0).getItemDescriptionNoColor());
478
            message = String.format("Price has been dropped from Rs.%s. Old DP - Rs.%s, New DP - Rs.%s", FormattingUtils.formatDecimal(priceDrop.getDropAmount()),
479
                    FormattingUtils.formatDecimal(priceDrop.getOldDp()), FormattingUtils.formatDecimal(priceDrop.getNewDp()));
480
        } else {
481
            title = String.format(title, "increased", items.get(0).getItemDescriptionNoColor());
482
            message = String.format("Price has been increased from Rs.%s. Old DP - Rs.%s, New DP - Rs.%s", FormattingUtils.formatDecimal(-priceDrop.getDropAmount()),
483
                    FormattingUtils.formatDecimal(priceDrop.getOldDp()), FormattingUtils.formatDecimal(priceDrop.getNewDp()));
484
        }
485
        sendNotificationModel.setTitle(title);
486
        sendNotificationModel.setMessage(message);
487
        sendNotificationModel.setMessageType(MessageType.pricechange);
488
        notificationService.sendNotificationToAll(sendNotificationModel);
489
    }
28568 amit.gupta 490
 
31903 amit.gupta 491
    @RequestMapping(value = "/downloadtotalPriceDropIMEI/{priceDropId}", method = RequestMethod.GET)
492
    public ResponseEntity<?> downloadTotalPriceDropIMEI(HttpServletRequest request, @PathVariable int priceDropId,
493
                                                        Model model) throws ProfitMandiBusinessException, Exception {
28568 amit.gupta 494
 
31903 amit.gupta 495
        PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
496
        Map<String, PriceDropIMEI> priceDropIMEIsMap = priceDropIMEIRepository.selectByPriceDropId(priceDropId).stream()
497
                .collect(Collectors.toMap(x -> x.getImei(), x -> x));
498
        LOGGER.info("PriceDropImeis {}, priceDropId {}", priceDropIMEIsMap, priceDropId);
499
        Item item = itemRepository.selectAllByCatalogItemId(priceDrop.getCatalogItemId()).get(0);
500
        final HttpHeaders headers = new HttpHeaders();
501
        headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
502
        headers.set("Content-disposition",
503
                "inline; filename=pricedrop-" + item.getItemDescriptionNoColor().replaceAll("\\s?,\\s?", " ") + "-"
504
                        + FormattingUtils.formatDate(priceDrop.getAffectedOn()) + ".csv");
505
        ByteArrayOutputStream baos = null;
506
        if (priceDropIMEIsMap.size() == 0) {
507
            priceDropService.priceDropStatus(priceDrop.getId());
508
            baos = FileUtil.getCSVByteStream(Arrays.asList("IMEI Number", "Store Name", "Store Code", "Item ID", "Brand",
509
                    "Model Name", "Model Number", "Color", "Status", "Rejection Reason", "Last Scanned", "Vendor Name",
510
                    "Grn On", "Activation Timestamp", "Activation Added On"), new ArrayList<>());
511
        } else {
28568 amit.gupta 512
 
31903 amit.gupta 513
            LOGGER.info("In else block");
33198 amit.gupta 514
            baos = getByteArrayOutputStream(priceDrop.getAffectedOn(), priceDrop.getCatalogItemId(), priceDropIMEIsMap, Optional.of(priceDrop.getCreatedOn()));
31903 amit.gupta 515
        }
516
        byte[] byteArray = baos.toByteArray();
517
        headers.setContentLength(byteArray.length);
518
        return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
24083 amit.gupta 519
 
31903 amit.gupta 520
    }
24083 amit.gupta 521
 
31903 amit.gupta 522
    @RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
33470 amit.gupta 523
    public String updatePriceDropImeis(@RequestBody PriceDropImeisModel priceDropImeisModel,
524
                                       Model model) throws Exception {
32012 amit.gupta 525
        final PriceDropImeiStatus status;
28102 tejbeer 526
 
31903 amit.gupta 527
        switch (priceDropImeisModel.getUpdatedStatus()) {
528
            case "approved": {
529
                status = PriceDropImeiStatus.APPROVED;
530
                break;
531
            }
32012 amit.gupta 532
            case "pending": {
533
                status = PriceDropImeiStatus.PENDING;
31903 amit.gupta 534
                break;
535
            }
536
            case "rejected": {
537
                status = PriceDropImeiStatus.REJECTED;
538
                break;
539
            }
32012 amit.gupta 540
            case "hold": {
541
                status = PriceDropImeiStatus.HOLD;
542
                break;
543
            }
544
            default:
545
                throw new IllegalStateException("Unexpected value: " + priceDropImeisModel.getUpdatedStatus());
31903 amit.gupta 546
        }
24168 amit.gupta 547
 
31903 amit.gupta 548
        if (PriceDropImeiStatus.PENDING.equals(status)) {
32012 amit.gupta 549
            List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByStatuses(Arrays.asList(PriceDropImeiStatus.REJECTED, PriceDropImeiStatus.HOLD),
31903 amit.gupta 550
                    priceDropImeisModel.getPriceDropId());
551
            LOGGER.info("hello" + priceDropIMEIs);
32012 amit.gupta 552
            for (PriceDropIMEI priceDropIMEI : priceDropIMEIs) {
553
                if (priceDropIMEI.getStatus().equals(status) || !priceDropImeisModel.getUpdatedImeis().contains(priceDropIMEI.getImei())) {
554
                    continue;
31903 amit.gupta 555
                }
32012 amit.gupta 556
                priceDropIMEI.setStatus(PriceDropImeiStatus.PENDING);
31903 amit.gupta 557
            }
558
            model.addAttribute("response1", mvcResponseSender.createResponseString(true));
559
            return "response";
560
        }
23951 amit.gupta 561
 
32012 amit.gupta 562
        if (status.equals(PriceDropImeiStatus.APPROVED)) {
563
            priceDropService.processPriceDrop(priceDropImeisModel.getPriceDropId(),
564
                    priceDropImeisModel.getUpdatedImeis());
565
        }
566
 
31903 amit.gupta 567
        List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository
568
                .selectByPriceDropId(priceDropImeisModel.getPriceDropId());
569
        List<PriceDropIMEI> priceDropIMEIsToProcess = priceDropIMEIs.stream()
570
                .filter(x -> priceDropImeisModel.getUpdatedImeis().contains(x.getImei()))
32012 amit.gupta 571
                .filter(x -> !x.getStatus().equals(status)).collect(Collectors.toList());
31903 amit.gupta 572
        for (PriceDropIMEI priceDropImei : priceDropIMEIsToProcess) {
573
            if (status.equals(PriceDropImeiStatus.REJECTED)
574
                    && priceDropImei.getStatus().equals(PriceDropImeiStatus.PENDING)) {
575
                priceDropImei.setStatus(PriceDropImeiStatus.REJECTED);
576
                priceDropImei.setRejectionReason(priceDropImeisModel.getRejectionReason());
577
                priceDropImei.setRejectTimestamp(LocalDateTime.now());
578
            } else if (status.equals(PriceDropImeiStatus.HOLD)) {
579
                if (priceDropImei.getStatus().equals(PriceDropImeiStatus.PENDING)) {
580
                    priceDropImei.setStatus(PriceDropImeiStatus.HOLD);
581
                } else {
582
                    throw new ProfitMandiBusinessException("INVALID STATUS", status, "only  allowed For PENDING IMEIs");
583
                }
28568 amit.gupta 584
 
31903 amit.gupta 585
            }
28568 amit.gupta 586
 
31903 amit.gupta 587
        }
28568 amit.gupta 588
 
31903 amit.gupta 589
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
590
        return "response";
24083 amit.gupta 591
 
31903 amit.gupta 592
    }
24083 amit.gupta 593
 
31903 amit.gupta 594
    private ByteArrayOutputStream getByteArrayOutputStream(LocalDateTime affectedOn, Integer catalogItemId,
33198 amit.gupta 595
                                                           Map<String, PriceDropIMEI> priceDropImeis, Optional<LocalDateTime> createdOn) throws Exception {
596
 
31903 amit.gupta 597
        List<ImeiDropSummaryModel> imeiDropSummaryModelList = priceDropService
33198 amit.gupta 598
                .getAllSerialNumbersByAffectedDate(affectedOn, catalogItemId, createdOn);
31903 amit.gupta 599
        List<List<?>> rows = new ArrayList<>();
600
        for (ImeiDropSummaryModel imeiDropSummaryModel : imeiDropSummaryModelList) {
601
            if (priceDropImeis == null) {
602
                rows.add(this.getRow(imeiDropSummaryModel, null));
603
            } else if (priceDropImeis.get(imeiDropSummaryModel.getSerialNumber()) != null) {
604
                rows.add(this.getRow(imeiDropSummaryModel, priceDropImeis.get(imeiDropSummaryModel.getSerialNumber())));
605
            }
606
        }
607
        return FileUtil.getCSVByteStream(Arrays.asList("IMEI Number", "Store Name", "Store Code", "Item ID", "Brand",
608
                "Model Name", "Model Number", "Color", "Status", "Rejection Reason", "Last Scanned", "Vendor Name",
609
                "Grn On", "Activation Timestamp", "Activation Added On"), rows);
610
    }
24083 amit.gupta 611
 
31903 amit.gupta 612
    private List<? extends Serializable> getRow(ImeiDropSummaryModel imeiDropSummaryModel,
613
                                                PriceDropIMEI priceDropIMEI) {
614
        List<Serializable> row = new ArrayList<>();
615
        row.add(imeiDropSummaryModel.getSerialNumber());
616
        row.add(imeiDropSummaryModel.getStoreName());
617
        row.add(imeiDropSummaryModel.getPartnerCode());
618
        row.add(imeiDropSummaryModel.getItemId());
619
        row.add(imeiDropSummaryModel.getBrand());
620
        row.add(imeiDropSummaryModel.getModelName());
621
        row.add(imeiDropSummaryModel.getModelNumber());
622
        row.add(imeiDropSummaryModel.getColor());
623
        if (priceDropIMEI != null) {
624
            row.add(priceDropIMEI.getStatus());
625
            row.add(priceDropIMEI.getRejectionReason());
626
        } else {
627
            row.add(PriceDropImeiStatus.PENDING);
628
            row.add("");
629
        }
630
        row.add(FormattingUtils.formatReporitcoDate(imeiDropSummaryModel.getLastScanned()));
631
        row.add(imeiDropSummaryModel.getVendorName());
632
        row.add(FormattingUtils.formatReporitcoDate(imeiDropSummaryModel.getGrnOn()));
633
        row.add(imeiDropSummaryModel.getActivationTimestamp());
634
        row.add(imeiDropSummaryModel.getActivationAddedOn());
635
        return row;
636
    }
23819 govind 637
 
31903 amit.gupta 638
    private boolean validatePriceDrop(PriceDropModel priceDropModel) throws ProfitMandiBusinessException {
639
        if (priceDropModel.getMop() > 0 && priceDropModel.getDp() > 0 && priceDropModel.getTp() > 0) {
640
            return true;
641
        }
642
        return false;
643
    }
23945 amit.gupta 644
 
32844 shampa 645
    @Autowired
646
    BrandsService brandsService;
33470 amit.gupta 647
 
31903 amit.gupta 648
    @RequestMapping(value = "/priceCircular")
649
    public String priceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
650
        int fofoId = Utils.SYSTEM_PARTNER_ID;
32844 shampa 651
        List<String> brands = brandsService.getBrandsToDisplay(3).stream().map(x -> x.getName()).collect(Collectors.toList());
31903 amit.gupta 652
        model.addAttribute("brands", brands);
653
        model.addAttribute("isAdmin", true);
654
        model.addAttribute("date", FormattingUtils.format(LocalDateTime.now()));
28102 tejbeer 655
 
31903 amit.gupta 656
        return "partner-price-circular";
657
    }
28102 tejbeer 658
 
31903 amit.gupta 659
    @RequestMapping(value = "/partnerPriceCircular")
660
    public String partnerPriceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
661
        int fofoId = Utils.SYSTEM_PARTNER_ID;
32844 shampa 662
        Set<String> brands = brandsService.getBrandsToDisplay(3).stream().map(x -> x.getName()).collect(Collectors.toSet());
663
        brands.addAll(brandsService.getBrandsToDisplay(6).stream().map(x -> (String) x.getName())
31903 amit.gupta 664
                .collect(Collectors.toSet()));
665
        model.addAttribute("brands", brands);
666
        model.addAttribute("isAdmin", false);
28102 tejbeer 667
 
31903 amit.gupta 668
        return "partner-price-circular";
669
    }
28102 tejbeer 670
 
31903 amit.gupta 671
    @RequestMapping(value = "/priceCircularByBrand")
672
    public String priceCircularByBrand(HttpServletRequest request, @RequestParam String brand, Model model, @RequestParam(defaultValue = "0", required = false) int fofoId)
673
            throws ProfitMandiBusinessException {
674
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
675
        if (fofoId > 0 && roleManager.isAdmin(loginDetails.getRoleIds())) {
676
        } else {
677
            fofoId = loginDetails.getFofoId();
678
        }
32905 shampa 679
        FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
680
 
31903 amit.gupta 681
        //.minusDays(2)
34317 amit.gupta 682
        PriceCircularModel priceCircularModel = priceCircularService.getPriceCircularByOffer(fofoId, brand, LocalDate.now());
35395 amit 683
        //Get slowmong/missign category for that brand
684
        //get stock with us missing as well as with partner missing
685
        //filter that stock
34317 amit.gupta 686
        return this.getPriceCircularView(priceCircularModel, model, fs.getCode());
32331 amit.gupta 687
    }
688
 
34317 amit.gupta 689
    public String getPriceCircularView(PriceCircularModel priceCircularModel, Model model, String partnerCode) {
690
        List<String> allMarginsSet = new ArrayList<>(this.getSchemeHeaders(priceCircularModel));
691
        List<String> sellins = SchemeType.IN_TYPES.stream().map(x -> x.getValue()).filter(x -> allMarginsSet.contains(x)).collect(Collectors.toList());
692
        List<String> sellouts = SchemeType.OUT_TYPES.stream().map(x -> x.getValue()).filter(x -> allMarginsSet.contains(x)).collect(Collectors.toList());
693
        List<String> allMargins = new ArrayList<>();
694
        allMargins.addAll(sellins);
695
        allMargins.addAll(sellouts);
31903 amit.gupta 696
        LOGGER.info("Sellins - {}", sellins);
697
        LOGGER.info("Sellouts - {}", sellouts);
34317 amit.gupta 698
        model.addAttribute("priceCircularItemModels", priceCircularModel.getPriceCircularItemModelNews());
31903 amit.gupta 699
        model.addAttribute("allMargins", allMargins);
700
        model.addAttribute("sellins", sellins);
701
        model.addAttribute("sellouts", sellouts);
34317 amit.gupta 702
        model.addAttribute("offers", priceCircularModel.getOffers());
703
        model.addAttribute("upgradeOffer", priceCircularModel.isUpgradeOffer());
31903 amit.gupta 704
        model.addAttribute("mvcResponseSender", mvcResponseSender);
32905 shampa 705
        model.addAttribute("partnerCode", partnerCode);
32331 amit.gupta 706
        return "price-circular-table";
31903 amit.gupta 707
    }
29951 amit.gupta 708
 
31903 amit.gupta 709
    private Set<String> getSchemeHeaders(PriceCircularModel priceCircular) {
710
        Set<String> schemeHeaders = new HashSet<>();
711
        priceCircular.getPriceCircularItemModelNews().stream().forEach(priceCircularItemModelNew -> {
712
            Map<String, AmountModel> headerMap = new HashMap<>();
713
            priceCircularItemModelNew.setHeaderSchemeModelsMap(headerMap);
714
            priceCircularItemModelNew.getSchemeSummaryModels().stream().forEach(schemeSummaryModel -> {
715
                if (schemeSummaryModel == null) return;
34317 amit.gupta 716
                schemeSummaryModel.setHeader(schemeSummaryModel.getSchemeType().getValue());
31903 amit.gupta 717
                if (!headerMap.containsKey(schemeSummaryModel.getHeader())) {
718
                    headerMap.put(schemeSummaryModel.getHeader(), new AmountModel(schemeSummaryModel.getAmount(), schemeSummaryModel.getAmountType()));
719
                } else {
720
                    AmountModel model = headerMap.get(schemeSummaryModel.getHeader());
721
                    model.setAmount(model.getAmount() + schemeSummaryModel.getAmount());
722
                }
723
                schemeHeaders.add(schemeSummaryModel.getHeader());
724
            });
725
        });
28102 tejbeer 726
 
31903 amit.gupta 727
        LOGGER.info("Scheme headers - {}", schemeHeaders);
728
        return schemeHeaders;
729
    }
30250 amit.gupta 730
 
31903 amit.gupta 731
    //private static final List<String> SELLINS = Arrays.asList("Base Payout", "Cash Discount", "Upfront Margin");
732
    //private static final List<String> SELLOUTS = Arrays.asList("Tertiary Payout", "Hygiene Payout", "Investment Payout", "Category Payout", "Activation Margin", "Special Support");
30471 amit.gupta 733
 
30562 amit.gupta 734
 
31903 amit.gupta 735
    @RequestMapping(value = "/downloadNlcByBrand")
736
    public ResponseEntity<ByteArrayResource> downloadNlcByBrand(HttpServletRequest request,
737
                                                                @RequestParam String brand, Model model, @RequestParam(defaultValue = "0", required = false) int fofoId) throws Exception {
738
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
739
        if (fofoId > 0 && roleManager.isAdmin(loginDetails.getRoleIds())) {
740
        } else {
741
            fofoId = loginDetails.getFofoId();
742
        }
743
        PriceCircularModel priceCircular = priceCircularService.getPriceCircularByOffer(fofoId, brand, LocalDate.now());
744
        /*List<Integer> catalogIds = priceCircular.getPriceCircularItemModelNews().stream().limit(10).map(x->x.getCatalogId()).collect(Collectors.toList());
745
        priceCircular = priceCircularService.getPriceCircularByOffer(fofoId, catalogIds, LocalDate.now());*/
746
        ByteArrayOutputStream baos = getNlcBaos(brand, priceCircular);
747
        final HttpHeaders headers = new HttpHeaders();
748
        headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
749
        headers.set("Content-disposition", "inline; filename=\"" + brand + ".csv\"");
750
        byte[] byteArray = baos.toByteArray();
751
        headers.setContentLength(byteArray.length);
752
        return new ResponseEntity<>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
753
    }
30471 amit.gupta 754
 
31903 amit.gupta 755
    private ByteArrayOutputStream getNlcBaos(String brand, PriceCircularModel priceCircular) throws Exception {
756
        List<List<?>> rows = new ArrayList<>();
757
        for (PriceCircularItemModelNew priceCircularItemModel : priceCircular.getPriceCircularItemModelNews()) {
758
            List<Serializable> row = new ArrayList<>();
759
            row.add(priceCircularItemModel.getCatalogId());
760
            row.add(brand);
761
            row.add(priceCircularItemModel.getCatalogSummaryModel().getModelName());
762
            row.add(priceCircularItemModel.getCatalogSummaryModel().getModelNumber());
763
            //TODO: fix nlc
764
            //row.add(priceCircularItemModel.getNetPrice());
765
            rows.add(row);
766
        }
767
        return FileUtil.getCSVByteStream(Arrays.asList("Model Id", "Brand", "Model Name", "Model Number", "Partner Landing"), rows);
768
    }
30471 amit.gupta 769
 
31903 amit.gupta 770
    @RequestMapping(value = "/selectPriceDropStatus", method = RequestMethod.GET)
771
    public String selectPriceDropStatus(HttpServletRequest request,
772
                                        @RequestParam(name = "selectedStatus", required = true, defaultValue = "") String selectedStatus,
773
                                        Model model) throws Exception {
30250 amit.gupta 774
 
31903 amit.gupta 775
        model.addAttribute("selectedStatus", selectedStatus);
776
        return "pricedrop-status-change";
777
    }
30250 amit.gupta 778
 
23819 govind 779
}