| Line 548... |
Line 548... |
| 548 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
548 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| 549 |
|
549 |
|
| 550 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
550 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
| 551 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
551 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 552 |
|
552 |
|
| 553 |
LocalDate currentMonthDate = LocalDate.now();
|
553 |
LocalDate planningMonthDate = null;
|
| 554 |
MonthlyPlanned monthlyPlanned = null;
|
554 |
MonthlyPlanned monthlyPlanned = null;
|
| 555 |
List<Integer> fofoOrderIds = null;
|
555 |
List<Integer> fofoOrderIds = null;
|
| 556 |
LOGGER.info("localDate" + LocalDate.now());
|
556 |
LOGGER.info("localDate" + LocalDate.now());
|
| 557 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
557 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 558 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
558 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 559 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
559 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 560 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
560 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 561 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
561 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 562 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
562 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 563 |
.collect(Collectors.toList());
|
563 |
.collect(Collectors.toList());
|
| 564 |
|
564 |
|
| 565 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
565 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 566 |
} else {
|
566 |
} else {
|
| 567 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
567 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
| 568 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
568 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 569 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
569 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 570 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
570 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
| 571 |
model.addAttribute("mtd", true);
|
571 |
model.addAttribute("mtd", true);
|
| 572 |
model.addAttribute("freezed", true);
|
572 |
model.addAttribute("freezed", true);
|
| 573 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
573 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 574 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
574 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 575 |
.collect(Collectors.toList());
|
575 |
.collect(Collectors.toList());
|
| Line 706... |
Line 706... |
| 706 |
LOGGER.info("monthlyPlanned" + monthlyPlanned);
|
706 |
LOGGER.info("monthlyPlanned" + monthlyPlanned);
|
| 707 |
model.addAttribute("catalogTagListings",
|
707 |
model.addAttribute("catalogTagListings",
|
| 708 |
catalogModelList.stream().sorted(firstCmp).collect(Collectors.toList()));
|
708 |
catalogModelList.stream().sorted(firstCmp).collect(Collectors.toList()));
|
| 709 |
model.addAttribute("isAdmin", roleManager.isAdmin(roleIds));
|
709 |
model.addAttribute("isAdmin", roleManager.isAdmin(roleIds));
|
| 710 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
|
710 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
|
| 711 |
model.addAttribute("previousPlanningMonth", LocalDate.now().getMonth());
|
711 |
model.addAttribute("previousPlanningMonth", planningMonthDate.minusMonths(1).getMonth());
|
| 712 |
model.addAttribute("currentPlanningMonth", LocalDate.now().plusMonths(1).getMonth());
|
712 |
model.addAttribute("currentPlanningMonth", planningMonthDate.getMonth());
|
| 713 |
|
713 |
|
| 714 |
model.addAttribute("customRetailers", customRetailers);
|
714 |
model.addAttribute("customRetailers", customRetailers);
|
| 715 |
model.addAttribute("totalAmount", totalAmount);
|
715 |
model.addAttribute("totalAmount", totalAmount);
|
| 716 |
model.addAttribute("monthlyPlanned", monthlyPlanned);
|
716 |
model.addAttribute("monthlyPlanned", monthlyPlanned);
|
| 717 |
model.addAttribute("totalPcs", totalPcs);
|
717 |
model.addAttribute("totalPcs", totalPcs);
|
| Line 721... |
Line 721... |
| 721 |
|
721 |
|
| 722 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
722 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
| 723 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
723 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
| 724 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
724 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 725 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
725 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| - |
|
726 |
LocalDate planMonthStart = null;
|
| - |
|
727 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| - |
|
728 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| - |
|
729 |
} else {
|
| - |
|
730 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
| 726 |
|
731 |
}
|
| 727 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
732 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 728 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
733 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 729 |
LOGGER.info("Counter size is {}", counterSize);
|
734 |
LOGGER.info("Counter size is {}", counterSize);
|
| 730 |
LOGGER.info("Fofo Id is {}", fofoId);
|
735 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| 731 |
boolean isAdmin = roleManager.isAdmin(roleIds);
|
736 |
boolean isAdmin = roleManager.isAdmin(roleIds);
|
| Line 794... |
Line 799... |
| 794 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
799 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| 795 |
|
800 |
|
| 796 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
801 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
| 797 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
802 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 798 |
|
803 |
|
| 799 |
LocalDate currentMonthDate = LocalDate.now().minusMonths(1).withDayOfMonth(1);
|
- |
|
| 800 |
MonthlyPlanned monthlyPlanned = null;
|
- |
|
| 801 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
804 |
MonthlyPlanned monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planMonthStart.minusMonths(1));
|
| 802 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
- |
|
| 803 |
model.addAttribute("planningMonth", LocalDate.now().minusMonths(1).getMonth());
|
805 |
model.addAttribute("planningMonth", planMonthStart.minusMonths(1).getMonth());
|
| 804 |
model.addAttribute("previousPlanningMonth", LocalDate.now().minusMonths(1).getMonth());
|
806 |
model.addAttribute("previousPlanningMonth", planMonthStart.minusMonths(1).getMonth());
|
| 805 |
model.addAttribute("currentPlanningMonth", LocalDate.now().getMonth());
|
807 |
model.addAttribute("currentPlanningMonth", planMonthStart.getMonth());
|
| 806 |
|
808 |
|
| 807 |
Map<Integer, Integer> plannedDetailMap = null;
|
809 |
Map<Integer, Integer> plannedDetailMap = null;
|
| 808 |
if (monthlyPlanned != null) {
|
810 |
if (monthlyPlanned != null) {
|
| 809 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
811 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
| 810 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
812 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
| 811 |
|
813 |
|
| 812 |
}
|
814 |
}
|
| 813 |
|
815 |
|
| 814 |
LOGGER.info("plannedDetailMap" + plannedDetailMap);
|
816 |
LOGGER.info("plannedDetailMap" + plannedDetailMap);
|
| 815 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 816 |
List<Integer> fofoOrderIds = fofoOrderRepository
|
817 |
List<Integer> fofoOrderIds = fofoOrderRepository
|
| 817 |
.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
818 |
.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 818 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1))
|
819 |
planMonthStart.minusMonths(1).atStartOfDay(),
|
| - |
|
820 |
planMonthStart.atStartOfDay())
|
| 819 |
.stream().map(x -> x.getId()).collect(Collectors.toList());
|
821 |
.stream().map(x -> x.getId()).collect(Collectors.toList());
|
| 820 |
|
822 |
|
| 821 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
823 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
| 822 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
824 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
| 823 |
equalsJoinMap.put("orderId", fofoOrderIds);
|
825 |
equalsJoinMap.put("orderId", fofoOrderIds);
|