| Line 33... |
Line 33... |
| 33 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
33 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
34 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 35 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
35 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
36 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
37 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
| - |
|
38 |
import com.spice.profitmandi.dao.repository.dtr.BrandLimitRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
39 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 39 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
40 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 40 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
41 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 41 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
42 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 42 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
43 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
| Line 91... |
Line 92... |
| 91 |
import java.time.LocalDateTime;
|
92 |
import java.time.LocalDateTime;
|
| 92 |
import java.time.LocalTime;
|
93 |
import java.time.LocalTime;
|
| 93 |
import java.util.*;
|
94 |
import java.util.*;
|
| 94 |
import java.util.Map.Entry;
|
95 |
import java.util.Map.Entry;
|
| 95 |
import java.util.function.Function;
|
96 |
import java.util.function.Function;
|
| - |
|
97 |
import java.util.stream.Collector;
|
| 96 |
import java.util.stream.Collectors;
|
98 |
import java.util.stream.Collectors;
|
| 97 |
|
99 |
|
| 98 |
@Controller
|
100 |
@Controller
|
| 99 |
@Transactional(rollbackFor = Throwable.class)
|
101 |
@Transactional(rollbackFor = Throwable.class)
|
| 100 |
public class IndentController {
|
102 |
public class IndentController {
|
| Line 218... |
Line 220... |
| 218 |
@Autowired
|
220 |
@Autowired
|
| 219 |
private SuggestedPoDetailRepository suggestedPoDetailRepository;
|
221 |
private SuggestedPoDetailRepository suggestedPoDetailRepository;
|
| 220 |
|
222 |
|
| 221 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
223 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
| 222 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
224 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
| 223 |
@RequestParam int itemQty, @RequestParam int fofoId) throws Exception {
|
225 |
@RequestParam int itemQty, @RequestParam int fofoId) throws Exception {
|
| 224 |
if (fofoId == 0) {
|
226 |
if (fofoId == 0) {
|
| 225 |
|
227 |
|
| 226 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
228 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 227 |
fofoId = loginDetails.getFofoId();
|
229 |
fofoId = loginDetails.getFofoId();
|
| 228 |
|
230 |
|
| Line 240... |
Line 242... |
| 240 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
242 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 241 |
return "response";
|
243 |
return "response";
|
| 242 |
}
|
244 |
}
|
| 243 |
|
245 |
|
| 244 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
246 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
| 245 |
int catalogId, int itemQty) {
|
247 |
int catalogId, int itemQty) {
|
| 246 |
if (monthlyPlanned == null) {
|
248 |
if (monthlyPlanned == null) {
|
| 247 |
monthlyPlanned = new MonthlyPlanned();
|
249 |
monthlyPlanned = new MonthlyPlanned();
|
| 248 |
monthlyPlanned.setFofoId(fofoId);
|
250 |
monthlyPlanned.setFofoId(fofoId);
|
| 249 |
monthlyPlanned.setYearMonth(currentMonthDate);
|
251 |
monthlyPlanned.setYearMonth(currentMonthDate);
|
| 250 |
monthlyPlannedRepository.persist(monthlyPlanned);
|
252 |
monthlyPlannedRepository.persist(monthlyPlanned);
|
| Line 278... |
Line 280... |
| 278 |
|
280 |
|
| 279 |
}
|
281 |
}
|
| 280 |
|
282 |
|
| 281 |
@RequestMapping(value = "/open-indent/confirm", method = RequestMethod.POST)
|
283 |
@RequestMapping(value = "/open-indent/confirm", method = RequestMethod.POST)
|
| 282 |
public String confirmOpenIndent(HttpServletRequest request,
|
284 |
public String confirmOpenIndent(HttpServletRequest request,
|
| 283 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
285 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
| 284 |
|
286 |
|
| 285 |
if (fofoId == 0) {
|
287 |
if (fofoId == 0) {
|
| 286 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
288 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 287 |
fofoId = loginDetails.getFofoId();
|
289 |
fofoId = loginDetails.getFofoId();
|
| 288 |
}
|
290 |
}
|
| Line 334... |
Line 336... |
| 334 |
Arrays.asList("Partner Id", "Partner Name", "Model Name", "Qty"),
|
336 |
Arrays.asList("Partner Id", "Partner Name", "Model Name", "Qty"),
|
| 335 |
plannedModel.stream()
|
337 |
plannedModel.stream()
|
| 336 |
.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()))
|
| 337 |
.collect(Collectors.toList()));
|
339 |
.collect(Collectors.toList()));
|
| 338 |
LOGGER.info("baos" + baos);
|
340 |
LOGGER.info("baos" + baos);
|
| 339 |
Utils.sendMailWithAttachments(googleMailSender, new String[]{customRetailer.getEmail()},
|
341 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { customRetailer.getEmail() },
|
| 340 |
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()]),
|
| 341 |
"Planned Indent", "PFA",
|
343 |
"Planned Indent", "PFA",
|
| 342 |
new Attachment[]{new Attachment("PlannedIndent.csv", new ByteArrayResource(baos.toByteArray())),});
|
344 |
new Attachment[] { new Attachment("PlannedIndent.csv", new ByteArrayResource(baos.toByteArray())), });
|
| 343 |
|
345 |
|
| 344 |
}
|
346 |
}
|
| 345 |
|
347 |
|
| 346 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
348 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
| 347 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
349 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
| 348 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 349 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 350 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
352 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 351 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
353 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 352 |
LOGGER.info("Counter size is {}", counterSize);
|
354 |
LOGGER.info("Counter size is {}", counterSize);
|
| 353 |
LOGGER.info("Fofo Id is {}", fofoId);
|
355 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| 354 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId() == fofoId) {
|
356 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId() == fofoId) {
|
| Line 457... |
Line 459... |
| 457 |
|
459 |
|
| 458 |
}
|
460 |
}
|
| 459 |
|
461 |
|
| 460 |
@RequestMapping(value = "/itemsByCatalogId")
|
462 |
@RequestMapping(value = "/itemsByCatalogId")
|
| 461 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
463 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| 462 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
464 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 463 |
throws ProfitMandiBusinessException {
|
465 |
throws ProfitMandiBusinessException {
|
| 464 |
if (catalogId == 0) {
|
466 |
if (catalogId == 0) {
|
| 465 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
467 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| 466 |
}
|
468 |
}
|
| 467 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
469 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| Line 482... |
Line 484... |
| 482 |
|
484 |
|
| 483 |
}
|
485 |
}
|
| 484 |
|
486 |
|
| 485 |
@RequestMapping(value = "/hotdealsitemsByCatalogId")
|
487 |
@RequestMapping(value = "/hotdealsitemsByCatalogId")
|
| 486 |
public String getHotdealsitemsByCatalogId(HttpServletRequest request, Model model,
|
488 |
public String getHotdealsitemsByCatalogId(HttpServletRequest request, Model model,
|
| 487 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
489 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 488 |
throws ProfitMandiBusinessException {
|
490 |
throws ProfitMandiBusinessException {
|
| 489 |
if (catalogId == 0) {
|
491 |
if (catalogId == 0) {
|
| 490 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
492 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| 491 |
}
|
493 |
}
|
| 492 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
494 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| Line 507... |
Line 509... |
| 507 |
|
509 |
|
| 508 |
}
|
510 |
}
|
| 509 |
|
511 |
|
| 510 |
@RequestMapping(value = "/indent/loadIndent")
|
512 |
@RequestMapping(value = "/indent/loadIndent")
|
| 511 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
513 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
| 512 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
514 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 513 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
515 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 514 |
|
516 |
|
| 515 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
517 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 516 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
518 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 517 |
LOGGER.info("Counter size is {}", counterSize);
|
519 |
LOGGER.info("Counter size is {}", counterSize);
|
| 518 |
LOGGER.info("Fofo Id is {}", fofoId);
|
520 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| Line 595... |
Line 597... |
| 595 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
597 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 596 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
598 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 597 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
599 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 598 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
600 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 599 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
601 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 600 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
602 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 601 |
.collect(Collectors.toList());
|
603 |
.collect(Collectors.toList());
|
| 602 |
|
604 |
|
| 603 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
605 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 604 |
} else {
|
606 |
} else {
|
| 605 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
607 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
| Line 607... |
Line 609... |
| 607 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
609 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 608 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
610 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
| 609 |
model.addAttribute("mtd", true);
|
611 |
model.addAttribute("mtd", true);
|
| 610 |
model.addAttribute("freezed", true);
|
612 |
model.addAttribute("freezed", true);
|
| 611 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
613 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 612 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
614 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 613 |
.collect(Collectors.toList());
|
615 |
.collect(Collectors.toList());
|
| 614 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
616 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 615 |
}
|
617 |
}
|
| 616 |
|
618 |
|
| 617 |
Map<Integer, Integer> plannedDetailMap = null;
|
619 |
Map<Integer, Integer> plannedDetailMap = null;
|
| Line 864... |
Line 866... |
| 864 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
866 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
| 865 |
}
|
867 |
}
|
| 866 |
|
868 |
|
| 867 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
869 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
| 868 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
870 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
| 869 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
871 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 870 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
872 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 871 |
LocalDate planMonthStart = null;
|
873 |
LocalDate planMonthStart = null;
|
| 872 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
874 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 873 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
875 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 874 |
} else {
|
876 |
} else {
|
| 875 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
877 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
| Line 1170... |
Line 1172... |
| 1170 |
|
1172 |
|
| 1171 |
}
|
1173 |
}
|
| 1172 |
|
1174 |
|
| 1173 |
@RequestMapping(value = "/getFocusedModel", method = RequestMethod.GET)
|
1175 |
@RequestMapping(value = "/getFocusedModel", method = RequestMethod.GET)
|
| 1174 |
public String getFocusedModel(HttpServletRequest request,
|
1176 |
public String getFocusedModel(HttpServletRequest request,
|
| 1175 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1177 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1176 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1178 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1177 |
throws ProfitMandiBusinessException {
|
1179 |
throws ProfitMandiBusinessException {
|
| 1178 |
|
1180 |
|
| 1179 |
long size = 0;
|
1181 |
long size = 0;
|
| 1180 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1182 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1181 |
|
1183 |
|
| Line 1231... |
Line 1233... |
| 1231 |
return regionMap;
|
1233 |
return regionMap;
|
| 1232 |
}
|
1234 |
}
|
| 1233 |
|
1235 |
|
| 1234 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
1236 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
| 1235 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
1237 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
| 1236 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1238 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1237 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1239 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1238 |
throws ProfitMandiBusinessException {
|
1240 |
throws ProfitMandiBusinessException {
|
| 1239 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
1241 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 1240 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1242 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1241 |
|
1243 |
|
| 1242 |
if (!focusedModels.isEmpty()) {
|
1244 |
if (!focusedModels.isEmpty()) {
|
| Line 1257... |
Line 1259... |
| 1257 |
return "focused-model-paginated";
|
1259 |
return "focused-model-paginated";
|
| 1258 |
}
|
1260 |
}
|
| 1259 |
|
1261 |
|
| 1260 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
1262 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
| 1261 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId,
|
1263 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId,
|
| 1262 |
@RequestParam(name = "recommended", defaultValue = "0") int recommended,
|
1264 |
@RequestParam(name = "recommended", defaultValue = "0") int recommended,
|
| 1263 |
@RequestParam(name = "minimumQty", defaultValue = "0") int minimumQty,
|
1265 |
@RequestParam(name = "minimumQty", defaultValue = "0") int minimumQty,
|
| 1264 |
@RequestParam(name = "obvrecommend", defaultValue = "0") int obvrecommend,
|
1266 |
@RequestParam(name = "obvrecommend", defaultValue = "0") int obvrecommend,
|
| 1265 |
@RequestParam(name = "obvminimum", defaultValue = "0") int obvminimum, @RequestParam int regionId,
|
1267 |
@RequestParam(name = "obvminimum", defaultValue = "0") int obvminimum, @RequestParam int regionId,
|
| 1266 |
Model model) throws ProfitMandiBusinessException {
|
1268 |
Model model) throws ProfitMandiBusinessException {
|
| 1267 |
|
1269 |
|
| 1268 |
FocusedModel fm = new FocusedModel();
|
1270 |
FocusedModel fm = new FocusedModel();
|
| 1269 |
fm.setCatalogId(catalogId);
|
1271 |
fm.setCatalogId(catalogId);
|
| 1270 |
fm.setMinimumQty(minimumQty);
|
1272 |
fm.setMinimumQty(minimumQty);
|
| 1271 |
fm.setRecommendedQty(recommended);
|
1273 |
fm.setRecommendedQty(recommended);
|
| Line 1334... |
Line 1336... |
| 1334 |
|
1336 |
|
| 1335 |
}
|
1337 |
}
|
| 1336 |
|
1338 |
|
| 1337 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
1339 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
| 1338 |
public String removeFocusedModelItem(HttpServletRequest request,
|
1340 |
public String removeFocusedModelItem(HttpServletRequest request,
|
| 1339 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
1341 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 1340 |
|
1342 |
|
| 1341 |
focusedModelRepository.deleteById(id);
|
1343 |
focusedModelRepository.deleteById(id);
|
| 1342 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1344 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1343 |
return "response";
|
1345 |
return "response";
|
| 1344 |
}
|
1346 |
}
|
| 1345 |
|
1347 |
|
| 1346 |
@RequestMapping(value = "/getPartnerloadContent")
|
1348 |
@RequestMapping(value = "/getPartnerloadContent")
|
| 1347 |
public String getPartnerloadContent(HttpServletRequest request, Model model,
|
1349 |
public String getPartnerloadContent(HttpServletRequest request, Model model,
|
| 1348 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
1350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 1349 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
1351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 1350 |
|
1352 |
|
| 1351 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1353 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1352 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
1354 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 1353 |
LOGGER.info("Counter size is {}", counterSize);
|
1355 |
LOGGER.info("Counter size is {}", counterSize);
|
| 1354 |
LOGGER.info("Fofo Id is {}", fofoId);
|
1356 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| Line 1432... |
Line 1434... |
| 1432 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
1434 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 1433 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
1435 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 1434 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1436 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1435 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
1437 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 1436 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1438 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1437 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
1439 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 1438 |
.collect(Collectors.toList());
|
1440 |
.collect(Collectors.toList());
|
| 1439 |
|
1441 |
|
| 1440 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
1442 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 1441 |
} else {
|
1443 |
} else {
|
| 1442 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
1444 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| Line 1444... |
Line 1446... |
| 1444 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1446 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1445 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
1447 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
| 1446 |
model.addAttribute("mtd", true);
|
1448 |
model.addAttribute("mtd", true);
|
| 1447 |
model.addAttribute("freezed", true);
|
1449 |
model.addAttribute("freezed", true);
|
| 1448 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1450 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1449 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
1451 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 1450 |
.collect(Collectors.toList());
|
1452 |
.collect(Collectors.toList());
|
| 1451 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
1453 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 1452 |
}
|
1454 |
}
|
| 1453 |
|
1455 |
|
| 1454 |
Map<Integer, Integer> plannedDetailMap = null;
|
1456 |
Map<Integer, Integer> plannedDetailMap = null;
|
| Line 1669... |
Line 1671... |
| 1669 |
private com.spice.profitmandi.service.transaction.TransactionService transactionService;
|
1671 |
private com.spice.profitmandi.service.transaction.TransactionService transactionService;
|
| 1670 |
|
1672 |
|
| 1671 |
@Autowired
|
1673 |
@Autowired
|
| 1672 |
private CategoryRepository categoryRepository;
|
1674 |
private CategoryRepository categoryRepository;
|
| 1673 |
|
1675 |
|
| - |
|
1676 |
@Autowired
|
| - |
|
1677 |
private BrandLimitRepository brandLimitRepository;
|
| - |
|
1678 |
|
| 1674 |
private List<OrderStatus> orderStatusList = Arrays.asList(OrderStatus.SUBMITTED_FOR_PROCESSING,
|
1679 |
private List<OrderStatus> orderStatusList = Arrays.asList(OrderStatus.SUBMITTED_FOR_PROCESSING,
|
| 1675 |
OrderStatus.ACCEPTED);
|
1680 |
OrderStatus.ACCEPTED);
|
| 1676 |
|
1681 |
|
| 1677 |
public static final Map<String, Double> Brand_Amount_Limit = new HashMap<>();
|
1682 |
public static final Map<String, Double> Brand_Amount_Limit = new HashMap<>();
|
| 1678 |
|
1683 |
|
| 1679 |
static {
|
1684 |
static {
|
| 1680 |
Brand_Amount_Limit.put("Vivo", 250000.00);
|
- |
|
| 1681 |
Brand_Amount_Limit.put("Samsung", 150000.00);
|
- |
|
| 1682 |
Brand_Amount_Limit.put("Realme", 150000.00);
|
- |
|
| 1683 |
Brand_Amount_Limit.put("Tecno", 80000.00);
|
- |
|
| 1684 |
Brand_Amount_Limit.put("Itel", 30000.00);
|
- |
|
| 1685 |
Brand_Amount_Limit.put("Lava", 15000.00);
|
- |
|
| 1686 |
Brand_Amount_Limit.put("OnePlus", 200000.00);
|
- |
|
| 1687 |
Brand_Amount_Limit.put("Oppo", 250000.00);
|
- |
|
| 1688 |
Brand_Amount_Limit.put("Xiaomi", 0.00);
|
- |
|
| 1689 |
Brand_Amount_Limit.put("Nokia", 0.00);
|
- |
|
| - |
|
1685 |
|
| 1690 |
Brand_Amount_Limit.put("accessories", 10000.00);
|
1686 |
Brand_Amount_Limit.put("accessories", 10000.00);
|
| 1691 |
Brand_Amount_Limit.put("TV", 27000.00);
|
1687 |
Brand_Amount_Limit.put("TV", 27000.00);
|
| 1692 |
}
|
1688 |
}
|
| 1693 |
|
1689 |
|
| 1694 |
@RequestMapping(value = "/getPartnersBrandWiseDetail", method = RequestMethod.GET)
|
1690 |
@RequestMapping(value = "/getPartnersBrandWiseDetail", method = RequestMethod.GET)
|
| Line 1733... |
Line 1729... |
| 1733 |
List<Integer> fofoIdList = new ArrayList<>(fofoIds);
|
1729 |
List<Integer> fofoIdList = new ArrayList<>(fofoIds);
|
| 1734 |
|
1730 |
|
| 1735 |
Map<Integer, FofoReportingModel> partnerSalesHeadersMap = csService.getPartnerIdSalesHeaders();
|
1731 |
Map<Integer, FofoReportingModel> partnerSalesHeadersMap = csService.getPartnerIdSalesHeaders();
|
| 1736 |
|
1732 |
|
| 1737 |
model.addAttribute("partnerSalesHeadersMap", partnerSalesHeadersMap);
|
1733 |
model.addAttribute("partnerSalesHeadersMap", partnerSalesHeadersMap);
|
| - |
|
1734 |
|
| - |
|
1735 |
Map<Integer, Map<String, Float>> partnerBrandLimitMap = brandLimitRepository.selectAllPartnerBrandLimit()
|
| - |
|
1736 |
.stream().collect(Collectors.groupingBy(x -> x.getFofoId(),
|
| - |
|
1737 |
Collectors.toMap(x -> x.getBrand(), x -> x.getBrandLimit())));
|
| - |
|
1738 |
|
| - |
|
1739 |
model.addAttribute("partnerBrandLimitMap", partnerBrandLimitMap);
|
| 1738 |
customRetailers = retailerService.getFofoRetailers(fofoIdList);
|
1740 |
customRetailers = retailerService.getFofoRetailers(fofoIdList);
|
| 1739 |
|
1741 |
|
| 1740 |
Map<Integer, Map<String, Double>> inStockBrandModel = new HashMap<>();
|
1742 |
Map<Integer, Map<String, Double>> inStockBrandModel = new HashMap<>();
|
| 1741 |
Map<Integer, Map<String, Double>> pendingIndent = new HashMap<>();
|
1743 |
Map<Integer, Map<String, Double>> pendingIndent = new HashMap<>();
|
| 1742 |
Map<Integer, Map<String, Double>> grnPendingOrders = new HashMap<>();
|
1744 |
Map<Integer, Map<String, Double>> grnPendingOrders = new HashMap<>();
|
| Line 1879... |
Line 1881... |
| 1879 |
return "response";
|
1881 |
return "response";
|
| 1880 |
}
|
1882 |
}
|
| 1881 |
|
1883 |
|
| 1882 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
1884 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
| 1883 |
public String getPartnerShortageStock(HttpServletRequest request,
|
1885 |
public String getPartnerShortageStock(HttpServletRequest request,
|
| 1884 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
1886 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
| 1885 |
throws Exception {
|
1887 |
throws Exception {
|
| 1886 |
|
1888 |
|
| 1887 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap = saholicInventoryService
|
1889 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap = saholicInventoryService
|
| 1888 |
.getSaholicStock();
|
1890 |
.getSaholicStock();
|
| 1889 |
|
1891 |
|
| Line 1894... |
Line 1896... |
| 1894 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
1896 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 1895 |
Map<Integer, Integer> processingOrderMap = null;
|
1897 |
Map<Integer, Integer> processingOrderMap = null;
|
| 1896 |
Map<Integer, Integer> catalogIdAndQtyMap = null;
|
1898 |
Map<Integer, Integer> catalogIdAndQtyMap = null;
|
| 1897 |
Map<Integer, Integer> grnPendingOrdersMap = null;
|
1899 |
Map<Integer, Integer> grnPendingOrdersMap = null;
|
| 1898 |
|
1900 |
|
| - |
|
1901 |
List<PartnerStockDescriptionModel> inStocks = new ArrayList<>();
|
| - |
|
1902 |
|
| - |
|
1903 |
List<PartnerStockDescriptionModel> grnPendings = new ArrayList<>();
|
| - |
|
1904 |
|
| - |
|
1905 |
List<PartnerStockDescriptionModel> pendingIndents = new ArrayList<>();
|
| - |
|
1906 |
|
| 1899 |
Map<Integer, Integer> currentInventorySnapshot = currentInventorySnapshotRepository.selectByFofoId(fofoId)
|
1907 |
Map<Integer, Integer> currentInventorySnapshot = currentInventorySnapshotRepository.selectByFofoId(fofoId)
|
| 1900 |
.stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x.getAvailability()));
|
1908 |
.stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x.getAvailability()));
|
| 1901 |
|
1909 |
|
| 1902 |
if (!currentInventorySnapshot.isEmpty()) {
|
1910 |
if (!currentInventorySnapshot.isEmpty()) {
|
| - |
|
1911 |
if (!brand.equals("undefined") && !brand.equals("accessories") && !brand.equals("TV")) {
|
| 1903 |
catalogIdAndQtyMap = itemRepository.selectByIds(currentInventorySnapshot.keySet()).stream()
|
1912 |
catalogIdAndQtyMap = itemRepository.selectByIds(currentInventorySnapshot.keySet()).stream()
|
| - |
|
1913 |
.filter(x -> x.getBrand().equals(brand))
|
| 1904 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
1914 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
| 1905 |
Collectors.summingInt(x -> currentInventorySnapshot.get(x.getId()))));
|
1915 |
Collectors.summingInt(x -> currentInventorySnapshot.get(x.getId()))));
|
| 1906 |
|
1916 |
|
| - |
|
1917 |
} else {
|
| - |
|
1918 |
catalogIdAndQtyMap = itemRepository.selectByIds(currentInventorySnapshot.keySet()).stream()
|
| - |
|
1919 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
| - |
|
1920 |
Collectors.summingInt(x -> currentInventorySnapshot.get(x.getId()))));
|
| - |
|
1921 |
}
|
| - |
|
1922 |
inStocks.addAll(getBrandItemwiseDescription(brand, catalogIdAndQtyMap));
|
| 1907 |
}
|
1923 |
}
|
| 1908 |
|
1924 |
|
| 1909 |
Map<Integer, Integer> grnPendingOrders = orderRepository.selectPendingGrnOrders(fofoId).stream()
|
1925 |
Map<Integer, Integer> grnPendingOrders = orderRepository.selectPendingGrnOrders(fofoId).stream()
|
| 1910 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItemId(),
|
1926 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItemId(),
|
| 1911 |
Collectors.summingInt(x -> x.getLineItem().getQuantity())));
|
1927 |
Collectors.summingInt(x -> x.getLineItem().getQuantity())));
|
| 1912 |
if (!grnPendingOrders.isEmpty()) {
|
1928 |
if (!grnPendingOrders.isEmpty()) {
|
| - |
|
1929 |
|
| - |
|
1930 |
if (!brand.equals("undefined") && !brand.equals("accessories") && !brand.equals("TV")) {
|
| 1913 |
grnPendingOrdersMap = itemRepository.selectByIds(grnPendingOrders.keySet()).stream()
|
1931 |
grnPendingOrdersMap = itemRepository.selectByIds(grnPendingOrders.keySet()).stream()
|
| - |
|
1932 |
.filter(x -> x.getBrand().equals(brand))
|
| - |
|
1933 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
| - |
|
1934 |
Collectors.summingInt(x -> grnPendingOrders.get(x.getId()))));
|
| - |
|
1935 |
|
| - |
|
1936 |
} else {
|
| - |
|
1937 |
grnPendingOrdersMap = itemRepository.selectByIds(grnPendingOrders.keySet()).stream()
|
| 1914 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
1938 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
| 1915 |
Collectors.summingInt(x -> grnPendingOrders.get(x.getId()))));
|
1939 |
Collectors.summingInt(x -> grnPendingOrders.get(x.getId()))));
|
| - |
|
1940 |
}
|
| - |
|
1941 |
grnPendings.addAll(getBrandItemwiseDescription(brand, grnPendingOrdersMap));
|
| 1916 |
|
1942 |
|
| 1917 |
}
|
1943 |
}
|
| 1918 |
|
1944 |
|
| 1919 |
Map<Integer, Integer> processingOrder = orderRepository.selectOrders(fofoId, orderStatusList).stream()
|
1945 |
Map<Integer, Integer> processingOrder = orderRepository.selectOrders(fofoId, orderStatusList).stream()
|
| 1920 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItemId(),
|
1946 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItemId(),
|
| 1921 |
Collectors.summingInt(x -> x.getLineItem().getQuantity())));
|
1947 |
Collectors.summingInt(x -> x.getLineItem().getQuantity())));
|
| 1922 |
if (!processingOrder.isEmpty()) {
|
1948 |
if (!processingOrder.isEmpty()) {
|
| - |
|
1949 |
if (!brand.equals("undefined") && !brand.equals("accessories") && !brand.equals("TV")) {
|
| 1923 |
processingOrderMap = itemRepository.selectByIds(processingOrder.keySet()).stream().collect(Collectors
|
1950 |
processingOrderMap = itemRepository.selectByIds(processingOrder.keySet()).stream()
|
| - |
|
1951 |
.filter(x -> x.getBrand().equals(brand)).collect(Collectors.groupingBy(
|
| 1924 |
.groupingBy(x -> x.getCatalogItemId(), Collectors.summingInt(x -> processingOrder.get(x.getId()))));
|
1952 |
x -> x.getCatalogItemId(), Collectors.summingInt(x -> processingOrder.get(x.getId()))));
|
| - |
|
1953 |
|
| - |
|
1954 |
} else {
|
| - |
|
1955 |
processingOrderMap = itemRepository.selectByIds(processingOrder.keySet()).stream()
|
| - |
|
1956 |
.collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
|
| - |
|
1957 |
Collectors.summingInt(x -> processingOrder.get(x.getId()))));
|
| - |
|
1958 |
}
|
| - |
|
1959 |
pendingIndents.addAll(getBrandItemwiseDescription(brand, processingOrderMap));
|
| 1925 |
|
1960 |
|
| 1926 |
}
|
1961 |
}
|
| 1927 |
|
1962 |
|
| 1928 |
List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId())
|
1963 |
List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId())
|
| 1929 |
.collect(Collectors.toList());
|
1964 |
.collect(Collectors.toList());
|
| Line 1992... |
Line 2027... |
| 1992 |
|
2027 |
|
| 1993 |
LOGGER.info("focusedModelShortageList" + focusedModelShortageList);
|
2028 |
LOGGER.info("focusedModelShortageList" + focusedModelShortageList);
|
| 1994 |
|
2029 |
|
| 1995 |
model.addAttribute("focusedModelShortageList", focusedModelShortageList);
|
2030 |
model.addAttribute("focusedModelShortageList", focusedModelShortageList);
|
| 1996 |
|
2031 |
|
| - |
|
2032 |
model.addAttribute("inStocks", inStocks);
|
| - |
|
2033 |
|
| - |
|
2034 |
model.addAttribute("grnPendings", grnPendings);
|
| - |
|
2035 |
|
| - |
|
2036 |
model.addAttribute("pendingIndents", pendingIndents);
|
| - |
|
2037 |
|
| 1997 |
model.addAttribute("customRetailer", customRetailer);
|
2038 |
model.addAttribute("customRetailer", customRetailer);
|
| - |
|
2039 |
|
| - |
|
2040 |
model.addAttribute("brand", brand);
|
| - |
|
2041 |
|
| - |
|
2042 |
if (brand.equals("undefined")) {
|
| - |
|
2043 |
|
| - |
|
2044 |
Map<String, List<FocusedModelShortageModel>> focusedModelShortageBrandMap = focusedModelShortageList
|
| - |
|
2045 |
.stream().collect(Collectors.groupingBy(x -> x.getBrandName()));
|
| - |
|
2046 |
|
| - |
|
2047 |
Map<String, List<PartnerStockDescriptionModel>> inStockBrandMap = inStocks.stream()
|
| - |
|
2048 |
.collect(Collectors.groupingBy(x -> x.getBrand()));
|
| - |
|
2049 |
|
| - |
|
2050 |
LOGGER.info("inStockBrandMap" + inStockBrandMap);
|
| - |
|
2051 |
|
| - |
|
2052 |
Map<String, List<PartnerStockDescriptionModel>> grnPendingBrandMap = grnPendings.stream()
|
| - |
|
2053 |
.collect(Collectors.groupingBy(x -> x.getBrand()));
|
| - |
|
2054 |
|
| - |
|
2055 |
LOGGER.info("grnPendingBrandMap" + grnPendingBrandMap);
|
| - |
|
2056 |
|
| - |
|
2057 |
Map<String, List<PartnerStockDescriptionModel>> pendingIndentBrandMap = pendingIndents.stream()
|
| - |
|
2058 |
.collect(Collectors.groupingBy(x -> x.getBrand()));
|
| - |
|
2059 |
|
| - |
|
2060 |
LOGGER.info("pendingIndentBrandMap" + pendingIndentBrandMap);
|
| - |
|
2061 |
|
| - |
|
2062 |
model.addAttribute("inStockBrandMap", inStockBrandMap);
|
| - |
|
2063 |
|
| - |
|
2064 |
model.addAttribute("grnPendingBrandMap", grnPendingBrandMap);
|
| - |
|
2065 |
|
| - |
|
2066 |
model.addAttribute("focusedModelShortageBrandMap", focusedModelShortageBrandMap);
|
| - |
|
2067 |
|
| - |
|
2068 |
model.addAttribute("pendingIndentBrandMap", pendingIndentBrandMap);
|
| - |
|
2069 |
|
| - |
|
2070 |
}
|
| 1998 |
return "partner-stock";
|
2071 |
return "partner-stock";
|
| 1999 |
|
2072 |
|
| 2000 |
}
|
2073 |
}
|
| 2001 |
|
2074 |
|
| - |
|
2075 |
private List<PartnerStockDescriptionModel> getBrandItemwiseDescription(String brand,
|
| - |
|
2076 |
Map<Integer, Integer> catalogIdAndQtyMap) throws ProfitMandiBusinessException {
|
| - |
|
2077 |
List<PartnerStockDescriptionModel> inStocks = new ArrayList<>();
|
| - |
|
2078 |
|
| - |
|
2079 |
for (Entry<Integer, Integer> inStock : catalogIdAndQtyMap.entrySet()) {
|
| - |
|
2080 |
List<Item> items = itemRepository.selectAllByCatalogItemId(inStock.getKey());
|
| - |
|
2081 |
|
| - |
|
2082 |
if (brand.equals("accessories")) {
|
| - |
|
2083 |
if (items.get(0).getCategoryId() != ProfitMandiConstants.MOBILE_CATEGORY_ID) {
|
| - |
|
2084 |
|
| - |
|
2085 |
if (items.get(0).getCategoryId() != 0) {
|
| - |
|
2086 |
Category category = categoryRepository.selectById(items.get(0).getCategoryId());
|
| - |
|
2087 |
|
| - |
|
2088 |
if (category.getParentCategoryId() == 10011) {
|
| - |
|
2089 |
PartnerStockDescriptionModel psdp = new PartnerStockDescriptionModel();
|
| - |
|
2090 |
psdp.setBrand(items.get(0).getBrand());
|
| - |
|
2091 |
psdp.setItemDescription(items.get(0).getBrand() + " " + items.get(0).getModelName() + " "
|
| - |
|
2092 |
+ items.get(0).getModelNumber());
|
| - |
|
2093 |
psdp.setQty(inStock.getValue());
|
| - |
|
2094 |
inStocks.add(psdp);
|
| - |
|
2095 |
}
|
| - |
|
2096 |
}
|
| - |
|
2097 |
|
| - |
|
2098 |
}
|
| - |
|
2099 |
|
| - |
|
2100 |
} else if (brand.equals("TV")) {
|
| - |
|
2101 |
if (items.get(0).getCategoryId() != ProfitMandiConstants.MOBILE_CATEGORY_ID) {
|
| - |
|
2102 |
|
| - |
|
2103 |
if (items.get(0).getCategoryId() != 0) {
|
| - |
|
2104 |
Category category = categoryRepository.selectById(items.get(0).getCategoryId());
|
| - |
|
2105 |
|
| - |
|
2106 |
if (category.getParentCategoryId() == 14200) {
|
| - |
|
2107 |
PartnerStockDescriptionModel psdp = new PartnerStockDescriptionModel();
|
| - |
|
2108 |
psdp.setBrand(items.get(0).getBrand());
|
| - |
|
2109 |
psdp.setItemDescription(items.get(0).getBrand() + " " + items.get(0).getModelName() + " "
|
| - |
|
2110 |
+ items.get(0).getModelNumber());
|
| - |
|
2111 |
psdp.setQty(inStock.getValue());
|
| - |
|
2112 |
inStocks.add(psdp);
|
| - |
|
2113 |
}
|
| - |
|
2114 |
}
|
| - |
|
2115 |
|
| - |
|
2116 |
}
|
| - |
|
2117 |
|
| - |
|
2118 |
} else {
|
| - |
|
2119 |
PartnerStockDescriptionModel psdp = new PartnerStockDescriptionModel();
|
| - |
|
2120 |
psdp.setBrand(items.get(0).getBrand());
|
| - |
|
2121 |
psdp.setItemDescription(items.get(0).getBrand() + " " + items.get(0).getModelName() + " "
|
| - |
|
2122 |
+ items.get(0).getModelNumber());
|
| - |
|
2123 |
psdp.setQty(inStock.getValue());
|
| - |
|
2124 |
inStocks.add(psdp);
|
| - |
|
2125 |
}
|
| - |
|
2126 |
|
| - |
|
2127 |
}
|
| - |
|
2128 |
|
| - |
|
2129 |
return inStocks;
|
| - |
|
2130 |
}
|
| - |
|
2131 |
|
| 2002 |
private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
|
2132 |
private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
|
| 2003 |
Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
|
2133 |
Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
|
| 2004 |
Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
|
2134 |
Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
|
| 2005 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap,
|
2135 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap,
|
| 2006 |
Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
|
2136 |
Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
|
| 2007 |
CustomRetailer customRetailer) throws ProfitMandiBusinessException {
|
2137 |
CustomRetailer customRetailer) throws ProfitMandiBusinessException {
|
| 2008 |
|
2138 |
|
| 2009 |
int minQty = qty;
|
2139 |
int minQty = qty;
|
| 2010 |
int inStockQty = 0;
|
2140 |
int inStockQty = 0;
|
| 2011 |
int processingQty = 0;
|
2141 |
int processingQty = 0;
|
| 2012 |
int grnPendingQty = 0;
|
2142 |
int grnPendingQty = 0;
|
| Line 2081... |
Line 2211... |
| 2081 |
model.addAttribute("warehouses", ProfitMandiConstants.WAREHOUSE_MAP);
|
2211 |
model.addAttribute("warehouses", ProfitMandiConstants.WAREHOUSE_MAP);
|
| 2082 |
return "send-po-notification";
|
2212 |
return "send-po-notification";
|
| 2083 |
}
|
2213 |
}
|
| 2084 |
|
2214 |
|
| 2085 |
@RequestMapping(value = "/indent/send-po-notification", method = RequestMethod.POST)
|
2215 |
@RequestMapping(value = "/indent/send-po-notification", method = RequestMethod.POST)
|
| 2086 |
public String sendPONotification(HttpServletRequest request, @RequestBody POItemWarehouseModel poItemWarehouseModel, Model model) throws Exception {
|
2216 |
public String sendPONotification(HttpServletRequest request, @RequestBody POItemWarehouseModel poItemWarehouseModel,
|
| - |
|
2217 |
Model model) throws Exception {
|
| 2087 |
|
2218 |
|
| 2088 |
Map<Integer, Item> selectedItemsMap = itemRepository.selectByIds(poItemWarehouseModel.getItemIdQuantityList().stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
2219 |
Map<Integer, Item> selectedItemsMap = itemRepository.selectByIds(poItemWarehouseModel.getItemIdQuantityList()
|
| - |
|
2220 |
.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream()
|
| - |
|
2221 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 2089 |
|
2222 |
|
| 2090 |
Set<String> brands = selectedItemsMap.values().stream().map(x -> x.getBrand().toLowerCase()).collect(Collectors.toSet());
|
2223 |
Set<String> brands = selectedItemsMap.values().stream().map(x -> x.getBrand().toLowerCase())
|
| - |
|
2224 |
.collect(Collectors.toSet());
|
| 2091 |
int warehouseId = poItemWarehouseModel.getWarehouseId();
|
2225 |
int warehouseId = poItemWarehouseModel.getWarehouseId();
|
| 2092 |
|
2226 |
|
| 2093 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
2227 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 2094 |
sendNotificationModel.setCampaignName("SendPo");
|
2228 |
sendNotificationModel.setCampaignName("SendPo");
|
| 2095 |
sendNotificationModel.setTitle(String.format(PO_TITLE_STRING));
|
2229 |
sendNotificationModel.setTitle(String.format(PO_TITLE_STRING));
|
| 2096 |
StringBuilder stringBuilder = new StringBuilder();
|
2230 |
StringBuilder stringBuilder = new StringBuilder();
|
| 2097 |
poItemWarehouseModel.getItemIdQuantityList().stream().forEach(itemIdQuantity -> {
|
2231 |
poItemWarehouseModel.getItemIdQuantityList().stream().forEach(itemIdQuantity -> {
|
| 2098 |
stringBuilder.append(selectedItemsMap.get(itemIdQuantity.getItemId()).getItemDescription()).append("-").append(itemIdQuantity.getQuantity()).append("pcs").append("\n");
|
2232 |
stringBuilder.append(selectedItemsMap.get(itemIdQuantity.getItemId()).getItemDescription()).append("-")
|
| - |
|
2233 |
.append(itemIdQuantity.getQuantity()).append("pcs").append("\n");
|
| 2099 |
});
|
2234 |
});
|
| 2100 |
sendNotificationModel.setMessage(stringBuilder.toString());
|
2235 |
sendNotificationModel.setMessage(stringBuilder.toString());
|
| 2101 |
sendNotificationModel.setType("url");
|
2236 |
sendNotificationModel.setType("url");
|
| 2102 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
2237 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| 2103 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
2238 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| 2104 |
sendNotificationModel.setMessageType(MessageType.notification);
|
2239 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 2105 |
|
2240 |
|
| - |
|
2241 |
List<BrandRegionMapping> brandRegionMappings = brandRegionMappingRepository
|
| 2106 |
List<BrandRegionMapping> brandRegionMappings = brandRegionMappingRepository.selectAll().stream().filter(x -> brands.contains(x.getBrand().toLowerCase()) && x.getFromWarehouseId() == warehouseId && x.isAccessory() == false).collect(Collectors.toList());
|
2242 |
.selectAll().stream().filter(x -> brands.contains(x.getBrand().toLowerCase())
|
| - |
|
2243 |
&& x.getFromWarehouseId() == warehouseId && x.isAccessory() == false)
|
| - |
|
2244 |
.collect(Collectors.toList());
|
| 2107 |
List<Integer> toWarehouseIds = brandRegionMappings.stream().map(x -> x.getToWarehouseId()).collect(Collectors.toList());
|
2245 |
List<Integer> toWarehouseIds = brandRegionMappings.stream().map(x -> x.getToWarehouseId())
|
| - |
|
2246 |
.collect(Collectors.toList());
|
| 2108 |
|
2247 |
|
| - |
|
2248 |
List<Integer> fofoIds = fofoStoreRepository.selectByWarehouseIds(toWarehouseIds).stream()
|
| 2109 |
List<Integer> fofoIds = fofoStoreRepository.selectByWarehouseIds(toWarehouseIds).stream().filter(x -> !x.isInternal() && x.isActive()).map(x -> x.getId()).collect(Collectors.toList());
|
2249 |
.filter(x -> !x.isInternal() && x.isActive()).map(x -> x.getId()).collect(Collectors.toList());
|
| 2110 |
|
2250 |
|
| 2111 |
List<Integer> userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
|
2251 |
List<Integer> userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
|
| 2112 |
sendNotificationModel.setUserIds(userIds);
|
2252 |
sendNotificationModel.setUserIds(userIds);
|
| 2113 |
notificationService.sendNotification(sendNotificationModel);
|
2253 |
notificationService.sendNotification(sendNotificationModel);
|
| 2114 |
model.addAttribute("response", true);
|
2254 |
model.addAttribute("response", true);
|