| Line 3... |
Line 3... |
| 3 |
import java.io.Serializable;
|
3 |
import java.io.Serializable;
|
| 4 |
import java.time.LocalDate;
|
4 |
import java.time.LocalDate;
|
| 5 |
import java.time.LocalDateTime;
|
5 |
import java.time.LocalDateTime;
|
| 6 |
import java.util.ArrayList;
|
6 |
import java.util.ArrayList;
|
| 7 |
import java.util.Arrays;
|
7 |
import java.util.Arrays;
|
| 8 |
import java.util.HashMap;
|
- |
|
| 9 |
import java.util.List;
|
8 |
import java.util.List;
|
| 10 |
import java.util.Map;
|
9 |
import java.util.Map;
|
| 11 |
import java.util.Map.Entry;
|
- |
|
| 12 |
import java.util.Set;
|
10 |
import java.util.Set;
|
| 13 |
import java.util.stream.Collectors;
|
11 |
import java.util.stream.Collectors;
|
| 14 |
|
12 |
|
| 15 |
import javax.servlet.http.HttpServletRequest;
|
13 |
import javax.servlet.http.HttpServletRequest;
|
| 16 |
|
14 |
|
| Line 32... |
Line 30... |
| 32 |
import org.springframework.web.bind.annotation.RequestMethod;
|
30 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 33 |
import org.springframework.web.bind.annotation.RequestParam;
|
31 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 34 |
|
32 |
|
| 35 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
33 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 36 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
34 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 37 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
- |
|
| 38 |
import com.spice.profitmandi.common.model.ImeiDropSummaryModel;
|
35 |
import com.spice.profitmandi.common.model.ImeiDropSummaryModel;
|
| 39 |
import com.spice.profitmandi.common.model.ItemDescriptionModel;
|
36 |
import com.spice.profitmandi.common.model.ItemDescriptionModel;
|
| 40 |
import com.spice.profitmandi.common.model.PriceDropImeisModel;
|
37 |
import com.spice.profitmandi.common.model.PriceDropImeisModel;
|
| 41 |
import com.spice.profitmandi.common.model.PriceDropModel;
|
38 |
import com.spice.profitmandi.common.model.PriceDropModel;
|
| 42 |
import com.spice.profitmandi.common.model.PriceDropProcessModel;
|
39 |
import com.spice.profitmandi.common.model.PriceDropProcessModel;
|
| Line 156... |
Line 153... |
| 156 |
}
|
153 |
}
|
| 157 |
|
154 |
|
| 158 |
@RequestMapping(value = "/getClosedPricedropItemDescription", method = RequestMethod.GET)
|
155 |
@RequestMapping(value = "/getClosedPricedropItemDescription", method = RequestMethod.GET)
|
| 159 |
public String getClosedPricedropItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
156 |
public String getClosedPricedropItemDescription(HttpServletRequest request, Model model) throws Throwable {
|
| 160 |
List<PriceDrop> priceDrops = priceDropRepository.selectAllComplete();
|
157 |
List<PriceDrop> priceDrops = priceDropRepository.selectAllComplete();
|
| - |
|
158 |
int a =1;
|
| - |
|
159 |
|
| 161 |
|
160 |
|
| 162 |
List<PriceDrop> completePriceDrops = priceDrops.stream().filter(x -> x.getCompleteTimestamp() != null)
|
161 |
List<PriceDrop> completePriceDrops = priceDrops.stream().filter(x -> x.getCompleteTimestamp() != null)
|
| 163 |
.collect(Collectors.toList());
|
162 |
.collect(Collectors.toList());
|
| 164 |
|
163 |
|
| 165 |
Set<Integer> catalogIds = completePriceDrops.stream().map(x -> x.getCatalogItemId())
|
164 |
Set<Integer> catalogIds = completePriceDrops.stream().map(x -> x.getCatalogItemId())
|
| Line 168... |
Line 167... |
| 168 |
LOGGER.info("catalogIds" + catalogIds);
|
167 |
LOGGER.info("catalogIds" + catalogIds);
|
| 169 |
|
168 |
|
| 170 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
|
169 |
Map<Integer, String> catalogDescription = items.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(),
|
| 171 |
x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
|
170 |
x -> x.getItemDescriptionNoColor(), (description1, description2) -> description1));
|
| 172 |
model.addAttribute("priceDrops", completePriceDrops);
|
171 |
model.addAttribute("priceDrops", completePriceDrops);
|
| - |
|
172 |
model.addAttribute("a", a);
|
| 173 |
model.addAttribute("catalogDescription", catalogDescription);
|
173 |
model.addAttribute("catalogDescription", catalogDescription);
|
| 174 |
return "price-drop";
|
174 |
return "price-drop";
|
| 175 |
}
|
175 |
}
|
| 176 |
|
176 |
|
| 177 |
@RequestMapping(value = "/item-pricing/{itemId}", method = RequestMethod.GET)
|
177 |
@RequestMapping(value = "/item-pricing/{itemId}", method = RequestMethod.GET)
|
| Line 406... |
Line 406... |
| 406 |
|
406 |
|
| 407 |
@RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
|
407 |
@RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
|
| 408 |
public String updatePriceDropImeis(HttpServletRequest request, @RequestBody PriceDropImeisModel priceDropImeisModel,
|
408 |
public String updatePriceDropImeis(HttpServletRequest request, @RequestBody PriceDropImeisModel priceDropImeisModel,
|
| 409 |
Model model) throws ProfitMandiBusinessException, Exception {
|
409 |
Model model) throws ProfitMandiBusinessException, Exception {
|
| 410 |
PriceDropImeiStatus status = PriceDropImeiStatus.PENDING;
|
410 |
PriceDropImeiStatus status = PriceDropImeiStatus.PENDING;
|
| - |
|
411 |
|
| - |
|
412 |
List<PriceDropImeiStatus>priceDropImeiStatuses = new ArrayList<>();
|
| - |
|
413 |
|
| 411 |
PriceDropImeiStatus statusHold = PriceDropImeiStatus.HOLD;
|
414 |
priceDropImeiStatuses.add(PriceDropImeiStatus.PENDING);
|
| 412 |
PriceDropImeiStatus statusPriceDrop = PriceDropImeiStatus.PENDING;
|
415 |
priceDropImeiStatuses.add(PriceDropImeiStatus.HOLD);
|
| - |
|
416 |
|
| 413 |
switch (priceDropImeisModel.getUpdatedStatus()) {
|
417 |
switch (priceDropImeisModel.getUpdatedStatus()) {
|
| 414 |
case "approved": {
|
418 |
case "approved": {
|
| 415 |
status = PriceDropImeiStatus.APPROVED;
|
419 |
status = PriceDropImeiStatus.APPROVED;
|
| 416 |
break;
|
420 |
break;
|
| 417 |
}
|
421 |
}
|
| Line 426... |
Line 430... |
| 426 |
}
|
430 |
}
|
| 427 |
|
431 |
|
| 428 |
if (PriceDropImeiStatus.PENDING.equals(status)) {
|
432 |
if (PriceDropImeiStatus.PENDING.equals(status)) {
|
| 429 |
|
433 |
|
| 430 |
List<PriceDropIMEI> priceDropIMEIsToHolds = new ArrayList<>();
|
434 |
List<PriceDropIMEI> priceDropIMEIsToHolds = new ArrayList<>();
|
| 431 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByIdAndStatus(statusHold,
|
435 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByIdAndStatus(PriceDropImeiStatus.HOLD,
|
| 432 |
priceDropImeisModel.getPriceDropId());
|
436 |
priceDropImeisModel.getPriceDropId());
|
| 433 |
LOGGER.info("hello" + priceDropIMEIs);
|
437 |
LOGGER.info("hello" + priceDropIMEIs);
|
| 434 |
for (PriceDropIMEI priceDropHoldIMEI : priceDropIMEIs) {
|
438 |
for (PriceDropIMEI priceDropHoldIMEI : priceDropIMEIs) {
|
| 435 |
if (priceDropHoldIMEI.getStatus().equals(PriceDropImeiStatus.HOLD)) {
|
439 |
if (priceDropHoldIMEI.getStatus().equals(PriceDropImeiStatus.HOLD)) {
|
| 436 |
if (!priceDropImeisModel.getUpdatedImeis().contains(priceDropHoldIMEI.getImei())
|
440 |
if (!priceDropImeisModel.getUpdatedImeis().contains(priceDropHoldIMEI.getImei())
|
| Line 489... |
Line 493... |
| 489 |
|
493 |
|
| 490 |
}
|
494 |
}
|
| 491 |
|
495 |
|
| 492 |
}
|
496 |
}
|
| 493 |
List<PriceDropIMEI> priceDropIMEIHoldAndPending = priceDropIMEIRepository
|
497 |
List<PriceDropIMEI> priceDropIMEIHoldAndPending = priceDropIMEIRepository
|
| 494 |
.selectByIdAndPendingHoldStatus(statusHold, statusPriceDrop, priceDropImeisModel.getPriceDropId());
|
498 |
.selectByIdAndPendingHoldStatus(priceDropImeiStatuses, priceDropImeisModel.getPriceDropId());
|
| 495 |
|
499 |
|
| 496 |
LOGGER.info("priceDropIMEIholdandPending" + priceDropIMEIHoldAndPending);
|
500 |
LOGGER.info("priceDropIMEIholdandPending" + priceDropIMEIHoldAndPending);
|
| 497 |
|
501 |
|
| 498 |
if (priceDropIMEIHoldAndPending == null || priceDropIMEIHoldAndPending.isEmpty()) {
|
502 |
if (priceDropIMEIHoldAndPending == null || priceDropIMEIHoldAndPending.isEmpty()) {
|
| 499 |
|
503 |
|
| 500 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropImeisModel.getPriceDropId());
|
504 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropImeisModel.getPriceDropId());
|
| 501 |
|
505 |
|