| Line 220... |
Line 220... |
| 220 |
@Autowired
|
220 |
@Autowired
|
| 221 |
private SuggestedPoDetailRepository suggestedPoDetailRepository;
|
221 |
private SuggestedPoDetailRepository suggestedPoDetailRepository;
|
| 222 |
|
222 |
|
| 223 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
223 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
| 224 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
224 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
| 225 |
@RequestParam int itemQty, @RequestParam int fofoId) throws Exception {
|
225 |
@RequestParam int itemQty, @RequestParam int fofoId) throws Exception {
|
| 226 |
if (fofoId == 0) {
|
226 |
if (fofoId == 0) {
|
| 227 |
|
227 |
|
| 228 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
228 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 229 |
fofoId = loginDetails.getFofoId();
|
229 |
fofoId = loginDetails.getFofoId();
|
| 230 |
|
230 |
|
| Line 242... |
Line 242... |
| 242 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
242 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 243 |
return "response";
|
243 |
return "response";
|
| 244 |
}
|
244 |
}
|
| 245 |
|
245 |
|
| 246 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
246 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
| 247 |
int catalogId, int itemQty) {
|
247 |
int catalogId, int itemQty) {
|
| 248 |
if (monthlyPlanned == null) {
|
248 |
if (monthlyPlanned == null) {
|
| 249 |
monthlyPlanned = new MonthlyPlanned();
|
249 |
monthlyPlanned = new MonthlyPlanned();
|
| 250 |
monthlyPlanned.setFofoId(fofoId);
|
250 |
monthlyPlanned.setFofoId(fofoId);
|
| 251 |
monthlyPlanned.setYearMonth(currentMonthDate);
|
251 |
monthlyPlanned.setYearMonth(currentMonthDate);
|
| 252 |
monthlyPlannedRepository.persist(monthlyPlanned);
|
252 |
monthlyPlannedRepository.persist(monthlyPlanned);
|
| Line 280... |
Line 280... |
| 280 |
|
280 |
|
| 281 |
}
|
281 |
}
|
| 282 |
|
282 |
|
| 283 |
@RequestMapping(value = "/open-indent/confirm", method = RequestMethod.POST)
|
283 |
@RequestMapping(value = "/open-indent/confirm", method = RequestMethod.POST)
|
| 284 |
public String confirmOpenIndent(HttpServletRequest request,
|
284 |
public String confirmOpenIndent(HttpServletRequest request,
|
| 285 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
285 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
| 286 |
|
286 |
|
| 287 |
if (fofoId == 0) {
|
287 |
if (fofoId == 0) {
|
| 288 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
288 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 289 |
fofoId = loginDetails.getFofoId();
|
289 |
fofoId = loginDetails.getFofoId();
|
| 290 |
}
|
290 |
}
|
| Line 336... |
Line 336... |
| 336 |
Arrays.asList("Partner Id", "Partner Name", "Model Name", "Qty"),
|
336 |
Arrays.asList("Partner Id", "Partner Name", "Model Name", "Qty"),
|
| 337 |
plannedModel.stream()
|
337 |
plannedModel.stream()
|
| 338 |
.map(x -> Arrays.asList(x.getFofoId(), x.getStoreName(), x.getItemDescription(), x.getQty()))
|
338 |
.map(x -> Arrays.asList(x.getFofoId(), x.getStoreName(), x.getItemDescription(), x.getQty()))
|
| 339 |
.collect(Collectors.toList()));
|
339 |
.collect(Collectors.toList()));
|
| 340 |
LOGGER.info("baos" + baos);
|
340 |
LOGGER.info("baos" + baos);
|
| 341 |
Utils.sendMailWithAttachments(googleMailSender, new String[]{customRetailer.getEmail()},
|
341 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { customRetailer.getEmail() },
|
| 342 |
ccemails.toArray(new String[ccemails.size()]), bccemails.toArray(new String[bccemails.size()]),
|
342 |
ccemails.toArray(new String[ccemails.size()]), bccemails.toArray(new String[bccemails.size()]),
|
| 343 |
"Planned Indent", "PFA",
|
343 |
"Planned Indent", "PFA",
|
| 344 |
new Attachment[]{new Attachment("PlannedIndent.csv", new ByteArrayResource(baos.toByteArray())),});
|
344 |
new Attachment[] { new Attachment("PlannedIndent.csv", new ByteArrayResource(baos.toByteArray())), });
|
| 345 |
|
345 |
|
| 346 |
}
|
346 |
}
|
| 347 |
|
347 |
|
| 348 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
348 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
| 349 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
349 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
| 350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 352 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
352 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 353 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
353 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 354 |
LOGGER.info("Counter size is {}", counterSize);
|
354 |
LOGGER.info("Counter size is {}", counterSize);
|
| 355 |
LOGGER.info("Fofo Id is {}", fofoId);
|
355 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| - |
|
356 |
|
| 356 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId() == fofoId) {
|
357 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId() == fofoId) {
|
| 357 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
358 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
| 358 |
.collect(Collectors.toList());
|
359 |
.collect(Collectors.toList());
|
| 359 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
360 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 360 |
|
- |
|
| - |
|
361 |
Map<Integer, CustomRetailer> crm = fofoIds.stream().map(x -> customRetailerMap.get(x))
|
| - |
|
362 |
.filter(x -> x != null).collect(Collectors.toList()).stream()
|
| - |
|
363 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 361 |
List<StockAllocationModel> stockAllocationList = stockAllocationService.getStockAllocation(counterSize,
|
364 |
List<StockAllocationModel> stockAllocationList = stockAllocationService.getStockAllocation(counterSize,
|
| 362 |
true);
|
365 |
true);
|
| 363 |
Map<Integer, Integer> modelStockAllocationMap = stockAllocationList.stream()
|
366 |
Map<Integer, Integer> modelStockAllocationMap = stockAllocationList.stream()
|
| 364 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
367 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
| 365 |
|
368 |
|
| Line 436... |
Line 439... |
| 436 |
catalogListingMap.put(key, catalogListingModel);
|
439 |
catalogListingMap.put(key, catalogListingModel);
|
| 437 |
}
|
440 |
}
|
| 438 |
}
|
441 |
}
|
| 439 |
List<List<?>> listOfRows = new ArrayList<>();
|
442 |
List<List<?>> listOfRows = new ArrayList<>();
|
| 440 |
for (CatalogListingModel clm : catalogListingMap.values()) {
|
443 |
for (CatalogListingModel clm : catalogListingMap.values()) {
|
| 441 |
CustomRetailer cr = customRetailersMap.get(clm.getFofoId());
|
444 |
CustomRetailer cr = crm.get(clm.getFofoId());
|
| 442 |
listOfRows.add(Arrays.asList(cr.getPartnerId(), cr.getBusinessName(), clm.getCatalogId(),
|
445 |
listOfRows.add(Arrays.asList(cr.getPartnerId(), cr.getBusinessName(), clm.getCatalogId(),
|
| 443 |
clm.getBrand(), clm.getModelName(), clm.getModelNumber(), clm.getDp(), clm.getMop(),
|
446 |
clm.getBrand(), clm.getModelName(), clm.getModelNumber(), clm.getDp(), clm.getMop(),
|
| 444 |
clm.getAllocatedQuantity(), clm.getInTransitQuantity(), clm.getStockInHand(),
|
447 |
clm.getAllocatedQuantity(), clm.getInTransitQuantity(), clm.getStockInHand(),
|
| 445 |
clm.getToBeOrdered()));
|
448 |
clm.getToBeOrdered()));
|
| 446 |
}
|
449 |
}
|
| Line 459... |
Line 462... |
| 459 |
|
462 |
|
| 460 |
}
|
463 |
}
|
| 461 |
|
464 |
|
| 462 |
@RequestMapping(value = "/itemsByCatalogId")
|
465 |
@RequestMapping(value = "/itemsByCatalogId")
|
| 463 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
466 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| 464 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
467 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 465 |
throws ProfitMandiBusinessException {
|
468 |
throws ProfitMandiBusinessException {
|
| 466 |
if (catalogId == 0) {
|
469 |
if (catalogId == 0) {
|
| 467 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
470 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| 468 |
}
|
471 |
}
|
| 469 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
472 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| Line 484... |
Line 487... |
| 484 |
|
487 |
|
| 485 |
}
|
488 |
}
|
| 486 |
|
489 |
|
| 487 |
@RequestMapping(value = "/hotdealsitemsByCatalogId")
|
490 |
@RequestMapping(value = "/hotdealsitemsByCatalogId")
|
| 488 |
public String getHotdealsitemsByCatalogId(HttpServletRequest request, Model model,
|
491 |
public String getHotdealsitemsByCatalogId(HttpServletRequest request, Model model,
|
| 489 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
492 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 490 |
throws ProfitMandiBusinessException {
|
493 |
throws ProfitMandiBusinessException {
|
| 491 |
if (catalogId == 0) {
|
494 |
if (catalogId == 0) {
|
| 492 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
495 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| 493 |
}
|
496 |
}
|
| 494 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
497 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| Line 509... |
Line 512... |
| 509 |
|
512 |
|
| 510 |
}
|
513 |
}
|
| 511 |
|
514 |
|
| 512 |
@RequestMapping(value = "/indent/loadIndent")
|
515 |
@RequestMapping(value = "/indent/loadIndent")
|
| 513 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
516 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
| 514 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
517 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 515 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
518 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 516 |
|
519 |
|
| 517 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
520 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 518 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
521 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 519 |
LOGGER.info("Counter size is {}", counterSize);
|
522 |
LOGGER.info("Counter size is {}", counterSize);
|
| 520 |
LOGGER.info("Fofo Id is {}", fofoId);
|
523 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| Line 597... |
Line 600... |
| 597 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
600 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 598 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
601 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 599 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
602 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 600 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
603 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 601 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
604 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 602 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
605 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 603 |
.collect(Collectors.toList());
|
606 |
.collect(Collectors.toList());
|
| 604 |
|
607 |
|
| 605 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
608 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 606 |
} else {
|
609 |
} else {
|
| 607 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
610 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
| Line 609... |
Line 612... |
| 609 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
612 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 610 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
613 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
| 611 |
model.addAttribute("mtd", true);
|
614 |
model.addAttribute("mtd", true);
|
| 612 |
model.addAttribute("freezed", true);
|
615 |
model.addAttribute("freezed", true);
|
| 613 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
616 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 614 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
617 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 615 |
.collect(Collectors.toList());
|
618 |
.collect(Collectors.toList());
|
| 616 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
619 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 617 |
}
|
620 |
}
|
| 618 |
|
621 |
|
| 619 |
Map<Integer, Integer> plannedDetailMap = null;
|
622 |
Map<Integer, Integer> plannedDetailMap = null;
|
| Line 820... |
Line 823... |
| 820 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|
823 |
public String raisePO(HttpServletRequest request, Model model) throws Exception {
|
| 821 |
boolean success = false;
|
824 |
boolean success = false;
|
| 822 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
825 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 823 |
int fofoId = loginDetails.getFofoId();
|
826 |
int fofoId = loginDetails.getFofoId();
|
| 824 |
List<ItemPriceQuantity> itemQuantities = this.getItemQuantities(fofoId);
|
827 |
List<ItemPriceQuantity> itemQuantities = this.getItemQuantities(fofoId);
|
| 825 |
CustomRetailer customRetailer = retailerService.getFofoRetailers(Arrays.asList(fofoId)).get(fofoId);
|
828 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 826 |
Client userClient = new UserClient().getClient();
|
829 |
Client userClient = new UserClient().getClient();
|
| 827 |
double totalAmount = itemQuantities.stream().mapToDouble(x -> x.getQty() * x.getPrice()).sum();
|
830 |
double totalAmount = itemQuantities.stream().mapToDouble(x -> x.getQty() * x.getPrice()).sum();
|
| 828 |
|
831 |
|
| 829 |
if (totalAmount > 0) {
|
832 |
if (totalAmount > 0) {
|
| 830 |
userClient.addItemPricingToCart(customRetailer.getCartId(), itemQuantities);
|
833 |
userClient.addItemPricingToCart(customRetailer.getCartId(), itemQuantities);
|
| Line 866... |
Line 869... |
| 866 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
869 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
| 867 |
}
|
870 |
}
|
| 868 |
|
871 |
|
| 869 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
872 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
| 870 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
873 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
| 871 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
874 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 872 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
875 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 873 |
LocalDate planMonthStart = null;
|
876 |
LocalDate planMonthStart = null;
|
| 874 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
877 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 875 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
878 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 876 |
} else {
|
879 |
} else {
|
| 877 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
880 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
| Line 1172... |
Line 1175... |
| 1172 |
|
1175 |
|
| 1173 |
}
|
1176 |
}
|
| 1174 |
|
1177 |
|
| 1175 |
@RequestMapping(value = "/getFocusedModel", method = RequestMethod.GET)
|
1178 |
@RequestMapping(value = "/getFocusedModel", method = RequestMethod.GET)
|
| 1176 |
public String getFocusedModel(HttpServletRequest request,
|
1179 |
public String getFocusedModel(HttpServletRequest request,
|
| 1177 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1180 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1178 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1181 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1179 |
throws ProfitMandiBusinessException {
|
1182 |
throws ProfitMandiBusinessException {
|
| 1180 |
|
1183 |
|
| 1181 |
long size = 0;
|
1184 |
long size = 0;
|
| 1182 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1185 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1183 |
|
1186 |
|
| Line 1233... |
Line 1236... |
| 1233 |
return regionMap;
|
1236 |
return regionMap;
|
| 1234 |
}
|
1237 |
}
|
| 1235 |
|
1238 |
|
| 1236 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
1239 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
| 1237 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
1240 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
| 1238 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1241 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1239 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1242 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1240 |
throws ProfitMandiBusinessException {
|
1243 |
throws ProfitMandiBusinessException {
|
| 1241 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
1244 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 1242 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1245 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1243 |
|
1246 |
|
| 1244 |
if (!focusedModels.isEmpty()) {
|
1247 |
if (!focusedModels.isEmpty()) {
|
| Line 1259... |
Line 1262... |
| 1259 |
return "focused-model-paginated";
|
1262 |
return "focused-model-paginated";
|
| 1260 |
}
|
1263 |
}
|
| 1261 |
|
1264 |
|
| 1262 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
1265 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
| 1263 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId,
|
1266 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId,
|
| 1264 |
@RequestParam(name = "recommended", defaultValue = "0") int recommended,
|
1267 |
@RequestParam(name = "recommended", defaultValue = "0") int recommended,
|
| 1265 |
@RequestParam(name = "minimumQty", defaultValue = "0") int minimumQty,
|
1268 |
@RequestParam(name = "minimumQty", defaultValue = "0") int minimumQty,
|
| 1266 |
@RequestParam(name = "obvrecommend", defaultValue = "0") int obvrecommend,
|
1269 |
@RequestParam(name = "obvrecommend", defaultValue = "0") int obvrecommend,
|
| 1267 |
@RequestParam(name = "obvminimum", defaultValue = "0") int obvminimum, @RequestParam int regionId,
|
1270 |
@RequestParam(name = "obvminimum", defaultValue = "0") int obvminimum, @RequestParam int regionId,
|
| 1268 |
Model model) throws ProfitMandiBusinessException {
|
1271 |
Model model) throws ProfitMandiBusinessException {
|
| 1269 |
|
1272 |
|
| 1270 |
FocusedModel fm = new FocusedModel();
|
1273 |
FocusedModel fm = new FocusedModel();
|
| 1271 |
fm.setCatalogId(catalogId);
|
1274 |
fm.setCatalogId(catalogId);
|
| 1272 |
fm.setMinimumQty(minimumQty);
|
1275 |
fm.setMinimumQty(minimumQty);
|
| 1273 |
fm.setRecommendedQty(recommended);
|
1276 |
fm.setRecommendedQty(recommended);
|
| Line 1307... |
Line 1310... |
| 1307 |
|
1310 |
|
| 1308 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
1311 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 1309 |
|
1312 |
|
| 1310 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
1313 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
| 1311 |
|
1314 |
|
| 1312 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
1315 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| - |
|
1316 |
Map<Integer, CustomRetailer> crm = fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null)
|
| - |
|
1317 |
.collect(Collectors.toList()).stream().collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 1313 |
Map<Integer, FofoStore> fofoStoreMap = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
1318 |
Map<Integer, FofoStore> fofoStoreMap = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
| 1314 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
1319 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 1315 |
|
1320 |
|
| 1316 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
1321 |
model.addAttribute("customRetailersMap", crm);
|
| 1317 |
model.addAttribute("fofoStoreMap", fofoStoreMap);
|
1322 |
model.addAttribute("fofoStoreMap", fofoStoreMap);
|
| 1318 |
return "partners_allocation";
|
1323 |
return "partners_allocation";
|
| 1319 |
|
1324 |
|
| 1320 |
}
|
1325 |
}
|
| 1321 |
|
1326 |
|
| Line 1325... |
Line 1330... |
| 1325 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
1330 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 1326 |
|
1331 |
|
| 1327 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
1332 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 1328 |
|
1333 |
|
| 1329 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
1334 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
| - |
|
1335 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| - |
|
1336 |
Map<Integer, CustomRetailer> crm = fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null)
|
| - |
|
1337 |
.collect(Collectors.toList()).stream().collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 1330 |
|
1338 |
|
| 1331 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers(fofoIds);
|
- |
|
| 1332 |
|
- |
|
| 1333 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
1339 |
model.addAttribute("customRetailersMap", crm);
|
| 1334 |
|
1340 |
|
| 1335 |
return "partner-po";
|
1341 |
return "partner-po";
|
| 1336 |
|
1342 |
|
| 1337 |
}
|
1343 |
}
|
| 1338 |
|
1344 |
|
| 1339 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
1345 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
| 1340 |
public String removeFocusedModelItem(HttpServletRequest request,
|
1346 |
public String removeFocusedModelItem(HttpServletRequest request,
|
| 1341 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
1347 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 1342 |
|
1348 |
|
| 1343 |
focusedModelRepository.deleteById(id);
|
1349 |
focusedModelRepository.deleteById(id);
|
| 1344 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1350 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1345 |
return "response";
|
1351 |
return "response";
|
| 1346 |
}
|
1352 |
}
|
| 1347 |
|
1353 |
|
| 1348 |
@RequestMapping(value = "/getPartnerloadContent")
|
1354 |
@RequestMapping(value = "/getPartnerloadContent")
|
| 1349 |
public String getPartnerloadContent(HttpServletRequest request, Model model,
|
1355 |
public String getPartnerloadContent(HttpServletRequest request, Model model,
|
| 1350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
1356 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 1351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
1357 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 1352 |
|
1358 |
|
| 1353 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1359 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1354 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
1360 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 1355 |
LOGGER.info("Counter size is {}", counterSize);
|
1361 |
LOGGER.info("Counter size is {}", counterSize);
|
| 1356 |
LOGGER.info("Fofo Id is {}", fofoId);
|
1362 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| Line 1434... |
Line 1440... |
| 1434 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
1440 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 1435 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
1441 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 1436 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1442 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1437 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
1443 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 1438 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1444 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1439 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
1445 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 1440 |
.collect(Collectors.toList());
|
1446 |
.collect(Collectors.toList());
|
| 1441 |
|
1447 |
|
| 1442 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
1448 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 1443 |
} else {
|
1449 |
} else {
|
| 1444 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
1450 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| Line 1446... |
Line 1452... |
| 1446 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1452 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1447 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
1453 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
| 1448 |
model.addAttribute("mtd", true);
|
1454 |
model.addAttribute("mtd", true);
|
| 1449 |
model.addAttribute("freezed", true);
|
1455 |
model.addAttribute("freezed", true);
|
| 1450 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1456 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1451 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
1457 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 1452 |
.collect(Collectors.toList());
|
1458 |
.collect(Collectors.toList());
|
| 1453 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
1459 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 1454 |
}
|
1460 |
}
|
| 1455 |
|
1461 |
|
| 1456 |
Map<Integer, Integer> plannedDetailMap = null;
|
1462 |
Map<Integer, Integer> plannedDetailMap = null;
|
| Line 1703... |
Line 1709... |
| 1703 |
|
1709 |
|
| 1704 |
if (emails.contains(authUser.getEmailId())) {
|
1710 |
if (emails.contains(authUser.getEmailId())) {
|
| 1705 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
1711 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
| 1706 |
LOGGER.info("fofoIds" + fofoIds);
|
1712 |
LOGGER.info("fofoIds" + fofoIds);
|
| 1707 |
}
|
1713 |
}
|
| 1708 |
if (fofoIds == null) {
|
- |
|
| 1709 |
List<Position> positions1 = positionRepository.selectAll(authUser.getId());
|
- |
|
| 1710 |
if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
|
- |
|
| 1711 |
.count() > 0) {
|
- |
|
| 1712 |
fofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream().flatMap(x -> x.stream())
|
- |
|
| 1713 |
.map(x -> x.getPartnerId()).collect(Collectors.toSet());
|
- |
|
| 1714 |
}
|
- |
|
| 1715 |
}
|
- |
|
| 1716 |
|
1714 |
|
| 1717 |
Map<Integer, PartnerDailyInvestment> partnerDailyInvestmentMap = new HashMap<>();
|
1715 |
Map<Integer, PartnerDailyInvestment> partnerDailyInvestmentMap = new HashMap<>();
|
| 1718 |
|
1716 |
|
| 1719 |
Map<Integer, Map<String, Double>> fofoIdBrandAmountMap = new HashMap<>();
|
1717 |
Map<Integer, Map<String, Double>> fofoIdBrandAmountMap = new HashMap<>();
|
| 1720 |
|
1718 |
|
| 1721 |
Map<Integer, InStockAccessoriesTvFofoIdModel> inStockAccessTv = new HashMap<>();
|
1719 |
Map<Integer, InStockAccessoriesTvFofoIdModel> inStockAccessTv = new HashMap<>();
|
| 1722 |
Map<Integer, InStockAccessoriesTvFofoIdModel> pendingIndentAccessTv = new HashMap<>();
|
1720 |
Map<Integer, InStockAccessoriesTvFofoIdModel> pendingIndentAccessTv = new HashMap<>();
|
| 1723 |
Map<Integer, InStockAccessoriesTvFofoIdModel> grnPendingAccessTvOrders = new HashMap<>();
|
1721 |
Map<Integer, InStockAccessoriesTvFofoIdModel> grnPendingAccessTvOrders = new HashMap<>();
|
| 1724 |
|
- |
|
| - |
|
1722 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 1725 |
Map<Integer, CustomRetailer> customRetailers = new HashMap<>();
|
1723 |
Map<Integer, CustomRetailer> customRetailers = new HashMap<>();
|
| 1726 |
Map<Integer, PartnerType> fofoIdPartnerTypeMap = new HashMap<>();
|
1724 |
Map<Integer, PartnerType> fofoIdPartnerTypeMap = new HashMap<>();
|
| 1727 |
|
1725 |
|
| 1728 |
if (fofoIds.size() > 0 && fofoIds != null) {
|
1726 |
if (fofoIds.size() > 0 && fofoIds != null) {
|
| 1729 |
List<Integer> fofoIdList = new ArrayList<>(fofoIds);
|
1727 |
List<Integer> fofoIdList = new ArrayList<>(fofoIds);
|
| Line 1741... |
Line 1739... |
| 1741 |
Map<Integer, Map<String, Float>> partnerBrandLimitMap = brandLimitRepository.selectAllPartnerBrandLimit()
|
1739 |
Map<Integer, Map<String, Float>> partnerBrandLimitMap = brandLimitRepository.selectAllPartnerBrandLimit()
|
| 1742 |
.stream().collect(Collectors.groupingBy(x -> x.getFofoId(),
|
1740 |
.stream().collect(Collectors.groupingBy(x -> x.getFofoId(),
|
| 1743 |
Collectors.toMap(x -> x.getBrand(), x -> x.getBrandLimit())));
|
1741 |
Collectors.toMap(x -> x.getBrand(), x -> x.getBrandLimit())));
|
| 1744 |
|
1742 |
|
| 1745 |
model.addAttribute("partnerBrandLimitMap", partnerBrandLimitMap);
|
1743 |
model.addAttribute("partnerBrandLimitMap", partnerBrandLimitMap);
|
| 1746 |
customRetailers = retailerService.getFofoRetailers(fofoIdList);
|
1744 |
customRetailers = fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null)
|
| 1747 |
|
- |
|
| - |
|
1745 |
.collect(Collectors.toList()).stream().collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 1748 |
Map<Integer, Map<String, Double>> inStockBrandModel = new HashMap<>();
|
1746 |
Map<Integer, Map<String, Double>> inStockBrandModel = new HashMap<>();
|
| 1749 |
Map<Integer, Map<String, Double>> pendingIndent = new HashMap<>();
|
1747 |
Map<Integer, Map<String, Double>> pendingIndent = new HashMap<>();
|
| 1750 |
Map<Integer, Map<String, Double>> grnPendingOrders = new HashMap<>();
|
1748 |
Map<Integer, Map<String, Double>> grnPendingOrders = new HashMap<>();
|
| 1751 |
|
1749 |
|
| 1752 |
// mobile
|
1750 |
// mobile
|
| Line 1850... |
Line 1848... |
| 1850 |
return "partner-brandwise-detail";
|
1848 |
return "partner-brandwise-detail";
|
| 1851 |
}
|
1849 |
}
|
| 1852 |
|
1850 |
|
| 1853 |
@RequestMapping(value = "/changeActivationType", method = RequestMethod.POST)
|
1851 |
@RequestMapping(value = "/changeActivationType", method = RequestMethod.POST)
|
| 1854 |
public String changeActivationType(HttpServletRequest request, @RequestParam String code,
|
1852 |
public String changeActivationType(HttpServletRequest request, @RequestParam String code,
|
| 1855 |
@RequestParam ActivationType activationType, Model model) throws Exception {
|
1853 |
@RequestParam ActivationType activationType, Model model) throws Exception {
|
| 1856 |
|
1854 |
|
| 1857 |
FofoStore fofoStore = fofoStoreRepository.selectByStoreCode(code);
|
1855 |
FofoStore fofoStore = fofoStoreRepository.selectByStoreCode(code);
|
| 1858 |
|
1856 |
|
| 1859 |
fofoStore.setActivationType(activationType);
|
1857 |
fofoStore.setActivationType(activationType);
|
| 1860 |
|
1858 |
|
| Line 1900... |
Line 1898... |
| 1900 |
return "response";
|
1898 |
return "response";
|
| 1901 |
}
|
1899 |
}
|
| 1902 |
|
1900 |
|
| 1903 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
1901 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
| 1904 |
public String getPartnerShortageStock(HttpServletRequest request,
|
1902 |
public String getPartnerShortageStock(HttpServletRequest request,
|
| 1905 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
1903 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
| 1906 |
throws Exception {
|
1904 |
throws Exception {
|
| 1907 |
|
1905 |
|
| 1908 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap = saholicInventoryService
|
1906 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap = saholicInventoryService
|
| 1909 |
.getSaholicStock();
|
1907 |
.getSaholicStock();
|
| 1910 |
|
1908 |
|
| Line 2090... |
Line 2088... |
| 2090 |
return "partner-stock";
|
2088 |
return "partner-stock";
|
| 2091 |
|
2089 |
|
| 2092 |
}
|
2090 |
}
|
| 2093 |
|
2091 |
|
| 2094 |
private List<PartnerStockDescriptionModel> getBrandItemwiseDescription(String brand,
|
2092 |
private List<PartnerStockDescriptionModel> getBrandItemwiseDescription(String brand,
|
| 2095 |
Map<Integer, Integer> catalogIdAndQtyMap) throws ProfitMandiBusinessException {
|
2093 |
Map<Integer, Integer> catalogIdAndQtyMap) throws ProfitMandiBusinessException {
|
| 2096 |
List<PartnerStockDescriptionModel> inStocks = new ArrayList<>();
|
2094 |
List<PartnerStockDescriptionModel> inStocks = new ArrayList<>();
|
| 2097 |
|
2095 |
|
| 2098 |
for (Entry<Integer, Integer> inStock : catalogIdAndQtyMap.entrySet()) {
|
2096 |
for (Entry<Integer, Integer> inStock : catalogIdAndQtyMap.entrySet()) {
|
| 2099 |
List<Item> items = itemRepository.selectAllByCatalogItemId(inStock.getKey());
|
2097 |
List<Item> items = itemRepository.selectAllByCatalogItemId(inStock.getKey());
|
| 2100 |
|
2098 |
|
| Line 2147... |
Line 2145... |
| 2147 |
|
2145 |
|
| 2148 |
return inStocks;
|
2146 |
return inStocks;
|
| 2149 |
}
|
2147 |
}
|
| 2150 |
|
2148 |
|
| 2151 |
private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
|
2149 |
private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
|
| 2152 |
Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
|
2150 |
Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
|
| 2153 |
Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
|
2151 |
Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
|
| 2154 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap,
|
2152 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap,
|
| 2155 |
Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
|
2153 |
Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
|
| 2156 |
CustomRetailer customRetailer) throws ProfitMandiBusinessException {
|
2154 |
CustomRetailer customRetailer) throws ProfitMandiBusinessException {
|
| 2157 |
|
2155 |
|
| 2158 |
int minQty = qty;
|
2156 |
int minQty = qty;
|
| 2159 |
int inStockQty = 0;
|
2157 |
int inStockQty = 0;
|
| 2160 |
int processingQty = 0;
|
2158 |
int processingQty = 0;
|
| 2161 |
int grnPendingQty = 0;
|
2159 |
int grnPendingQty = 0;
|
| Line 2231... |
Line 2229... |
| 2231 |
return "send-po-notification";
|
2229 |
return "send-po-notification";
|
| 2232 |
}
|
2230 |
}
|
| 2233 |
|
2231 |
|
| 2234 |
@RequestMapping(value = "/indent/send-po-notification", method = RequestMethod.POST)
|
2232 |
@RequestMapping(value = "/indent/send-po-notification", method = RequestMethod.POST)
|
| 2235 |
public String sendPONotification(HttpServletRequest request, @RequestBody POItemWarehouseModel poItemWarehouseModel,
|
2233 |
public String sendPONotification(HttpServletRequest request, @RequestBody POItemWarehouseModel poItemWarehouseModel,
|
| 2236 |
Model model) throws Exception {
|
2234 |
Model model) throws Exception {
|
| 2237 |
|
2235 |
|
| - |
|
2236 |
Map<Integer, Item> selectedCatalogItemMap = itemRepository
|
| 2238 |
Map<Integer, Item> selectedCatalogItemMap = itemRepository.selectAllByCatalogIds(new HashSet<>(poItemWarehouseModel.getCatalogIds()))
|
2237 |
.selectAllByCatalogIds(new HashSet<>(poItemWarehouseModel.getCatalogIds())).stream()
|
| 2239 |
.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x, (existing, replacement) -> existing));
|
2238 |
.collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x, (existing, replacement) -> existing));
|
| 2240 |
|
2239 |
|
| 2241 |
Set<String> brands = selectedCatalogItemMap.values().stream().map(x -> x.getBrand().toLowerCase())
|
2240 |
Set<String> brands = selectedCatalogItemMap.values().stream().map(x -> x.getBrand().toLowerCase())
|
| 2242 |
.collect(Collectors.toSet());
|
2241 |
.collect(Collectors.toSet());
|
| 2243 |
|
2242 |
|
| 2244 |
int warehouseId = poItemWarehouseModel.getWarehouseId();
|
2243 |
int warehouseId = poItemWarehouseModel.getWarehouseId();
|
| 2245 |
for (String brand : brands) {
|
2244 |
for (String brand : brands) {
|
| 2246 |
List<String> modelNames = selectedCatalogItemMap.entrySet().stream()
|
2245 |
List<String> modelNames = selectedCatalogItemMap.entrySet().stream()
|
| - |
|
2246 |
.filter(x -> x.getValue().getBrand().toLowerCase().equals(brand))
|
| 2247 |
.filter(x -> x.getValue().getBrand().toLowerCase().equals(brand)).map(x -> x.getValue().getItemDescriptionNoColor()).collect(Collectors.toList());
|
2247 |
.map(x -> x.getValue().getItemDescriptionNoColor()).collect(Collectors.toList());
|
| 2248 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
2248 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 2249 |
sendNotificationModel.setCampaignName("SendPo");
|
2249 |
sendNotificationModel.setCampaignName("SendPo");
|
| 2250 |
sendNotificationModel.setTitle(String.format(PO_TITLE_STRING));
|
2250 |
sendNotificationModel.setTitle(String.format(PO_TITLE_STRING));
|
| 2251 |
sendNotificationModel.setMessage(String.join(", ", modelNames));
|
2251 |
sendNotificationModel.setMessage(String.join(", ", modelNames));
|
| 2252 |
sendNotificationModel.setType("url");
|
2252 |
sendNotificationModel.setType("url");
|
| 2253 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
2253 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| 2254 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
2254 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| 2255 |
sendNotificationModel.setMessageType(MessageType.notification);
|
2255 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 2256 |
|
2256 |
|
| 2257 |
List<BrandRegionMapping> brandRegionMappings = brandRegionMappingRepository
|
2257 |
List<BrandRegionMapping> brandRegionMappings = brandRegionMappingRepository.selectAll().stream()
|
| 2258 |
.selectAll().stream().filter(x -> brand.equals(x.getBrand().toLowerCase())
|
2258 |
.filter(x -> brand.equals(x.getBrand().toLowerCase()) && x.getFromWarehouseId() == warehouseId
|
| 2259 |
&& x.getFromWarehouseId() == warehouseId && !x.isAccessory())
|
2259 |
&& !x.isAccessory())
|
| 2260 |
.collect(Collectors.toList());
|
2260 |
.collect(Collectors.toList());
|
| 2261 |
List<Integer> toWarehouseIds = brandRegionMappings.stream().map(x -> x.getToWarehouseId())
|
2261 |
List<Integer> toWarehouseIds = brandRegionMappings.stream().map(x -> x.getToWarehouseId())
|
| 2262 |
.collect(Collectors.toList());
|
2262 |
.collect(Collectors.toList());
|
| 2263 |
|
2263 |
|
| 2264 |
List<Integer> fofoIds = fofoStoreRepository.selectByWarehouseIds(toWarehouseIds).stream()
|
2264 |
List<Integer> fofoIds = fofoStoreRepository.selectByWarehouseIds(toWarehouseIds).stream()
|