| Line 93... |
Line 93... |
| 93 |
import java.time.LocalDateTime;
|
93 |
import java.time.LocalDateTime;
|
| 94 |
import java.time.LocalTime;
|
94 |
import java.time.LocalTime;
|
| 95 |
import java.util.*;
|
95 |
import java.util.*;
|
| 96 |
import java.util.Map.Entry;
|
96 |
import java.util.Map.Entry;
|
| 97 |
import java.util.function.Function;
|
97 |
import java.util.function.Function;
|
| 98 |
import java.util.stream.Collector;
|
- |
|
| 99 |
import java.util.stream.Collectors;
|
98 |
import java.util.stream.Collectors;
|
| 100 |
|
99 |
|
| 101 |
@Controller
|
100 |
@Controller
|
| 102 |
@Transactional(rollbackFor = Throwable.class)
|
101 |
@Transactional(rollbackFor = Throwable.class)
|
| 103 |
public class IndentController {
|
102 |
public class IndentController {
|
| Line 221... |
Line 220... |
| 221 |
@Autowired
|
220 |
@Autowired
|
| 222 |
private SuggestedPoDetailRepository suggestedPoDetailRepository;
|
221 |
private SuggestedPoDetailRepository suggestedPoDetailRepository;
|
| 223 |
|
222 |
|
| 224 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
223 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
| 225 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
224 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
| 226 |
@RequestParam int itemQty, @RequestParam int fofoId) throws Exception {
|
225 |
@RequestParam int itemQty, @RequestParam int fofoId) throws Exception {
|
| 227 |
if (fofoId == 0) {
|
226 |
if (fofoId == 0) {
|
| 228 |
|
227 |
|
| 229 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
228 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 230 |
fofoId = loginDetails.getFofoId();
|
229 |
fofoId = loginDetails.getFofoId();
|
| 231 |
|
230 |
|
| Line 243... |
Line 242... |
| 243 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
242 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 244 |
return "response";
|
243 |
return "response";
|
| 245 |
}
|
244 |
}
|
| 246 |
|
245 |
|
| 247 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
246 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
| 248 |
int catalogId, int itemQty) {
|
247 |
int catalogId, int itemQty) {
|
| 249 |
if (monthlyPlanned == null) {
|
248 |
if (monthlyPlanned == null) {
|
| 250 |
monthlyPlanned = new MonthlyPlanned();
|
249 |
monthlyPlanned = new MonthlyPlanned();
|
| 251 |
monthlyPlanned.setFofoId(fofoId);
|
250 |
monthlyPlanned.setFofoId(fofoId);
|
| 252 |
monthlyPlanned.setYearMonth(currentMonthDate);
|
251 |
monthlyPlanned.setYearMonth(currentMonthDate);
|
| 253 |
monthlyPlannedRepository.persist(monthlyPlanned);
|
252 |
monthlyPlannedRepository.persist(monthlyPlanned);
|
| Line 281... |
Line 280... |
| 281 |
|
280 |
|
| 282 |
}
|
281 |
}
|
| 283 |
|
282 |
|
| 284 |
@RequestMapping(value = "/open-indent/confirm", method = RequestMethod.POST)
|
283 |
@RequestMapping(value = "/open-indent/confirm", method = RequestMethod.POST)
|
| 285 |
public String confirmOpenIndent(HttpServletRequest request,
|
284 |
public String confirmOpenIndent(HttpServletRequest request,
|
| 286 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
285 |
@RequestParam(required = false, defaultValue = "0") int fofoId, Model model) throws Exception {
|
| 287 |
|
286 |
|
| 288 |
if (fofoId == 0) {
|
287 |
if (fofoId == 0) {
|
| 289 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
288 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 290 |
fofoId = loginDetails.getFofoId();
|
289 |
fofoId = loginDetails.getFofoId();
|
| 291 |
}
|
290 |
}
|
| Line 337... |
Line 336... |
| 337 |
Arrays.asList("Partner Id", "Partner Name", "Model Name", "Qty"),
|
336 |
Arrays.asList("Partner Id", "Partner Name", "Model Name", "Qty"),
|
| 338 |
plannedModel.stream()
|
337 |
plannedModel.stream()
|
| 339 |
.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()))
|
| 340 |
.collect(Collectors.toList()));
|
339 |
.collect(Collectors.toList()));
|
| 341 |
LOGGER.info("baos" + baos);
|
340 |
LOGGER.info("baos" + baos);
|
| 342 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { customRetailer.getEmail() },
|
341 |
Utils.sendMailWithAttachments(googleMailSender, new String[]{customRetailer.getEmail()},
|
| 343 |
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()]),
|
| 344 |
"Planned Indent", "PFA",
|
343 |
"Planned Indent", "PFA",
|
| 345 |
new Attachment[] { new Attachment("PlannedIndent.csv", new ByteArrayResource(baos.toByteArray())), });
|
344 |
new Attachment[]{new Attachment("PlannedIndent.csv", new ByteArrayResource(baos.toByteArray())),});
|
| 346 |
|
345 |
|
| 347 |
}
|
346 |
}
|
| 348 |
|
347 |
|
| 349 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
348 |
@RequestMapping(value = "/indent/download", method = RequestMethod.GET)
|
| 350 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
349 |
public ResponseEntity<ByteArrayResource> downloadIndent(HttpServletRequest request, Model model,
|
| 351 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 352 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 353 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
352 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 354 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
353 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 355 |
LOGGER.info("Counter size is {}", counterSize);
|
354 |
LOGGER.info("Counter size is {}", counterSize);
|
| 356 |
LOGGER.info("Fofo Id is {}", fofoId);
|
355 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| 357 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId() == fofoId) {
|
356 |
if (roleManager.isAdmin(roleIds) || loginDetails.getFofoId() == fofoId) {
|
| Line 460... |
Line 459... |
| 460 |
|
459 |
|
| 461 |
}
|
460 |
}
|
| 462 |
|
461 |
|
| 463 |
@RequestMapping(value = "/itemsByCatalogId")
|
462 |
@RequestMapping(value = "/itemsByCatalogId")
|
| 464 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
463 |
public String getItemsByCatalogId(HttpServletRequest request, Model model,
|
| 465 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
464 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 466 |
throws ProfitMandiBusinessException {
|
465 |
throws ProfitMandiBusinessException {
|
| 467 |
if (catalogId == 0) {
|
466 |
if (catalogId == 0) {
|
| 468 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
467 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| 469 |
}
|
468 |
}
|
| 470 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
469 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| Line 485... |
Line 484... |
| 485 |
|
484 |
|
| 486 |
}
|
485 |
}
|
| 487 |
|
486 |
|
| 488 |
@RequestMapping(value = "/hotdealsitemsByCatalogId")
|
487 |
@RequestMapping(value = "/hotdealsitemsByCatalogId")
|
| 489 |
public String getHotdealsitemsByCatalogId(HttpServletRequest request, Model model,
|
488 |
public String getHotdealsitemsByCatalogId(HttpServletRequest request, Model model,
|
| 490 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
489 |
@RequestParam(required = false) int catalogId, @RequestParam(required = false) int itemId)
|
| 491 |
throws ProfitMandiBusinessException {
|
490 |
throws ProfitMandiBusinessException {
|
| 492 |
if (catalogId == 0) {
|
491 |
if (catalogId == 0) {
|
| 493 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
492 |
catalogId = itemRepository.selectById(itemId).getCatalogItemId();
|
| 494 |
}
|
493 |
}
|
| 495 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
494 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogId);
|
| Line 510... |
Line 509... |
| 510 |
|
509 |
|
| 511 |
}
|
510 |
}
|
| 512 |
|
511 |
|
| 513 |
@RequestMapping(value = "/indent/loadIndent")
|
512 |
@RequestMapping(value = "/indent/loadIndent")
|
| 514 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
513 |
public String loadOpenIndent(HttpServletRequest request, Model model,
|
| 515 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
514 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 516 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
515 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 517 |
|
516 |
|
| 518 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
517 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 519 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
518 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 520 |
LOGGER.info("Counter size is {}", counterSize);
|
519 |
LOGGER.info("Counter size is {}", counterSize);
|
| 521 |
LOGGER.info("Fofo Id is {}", fofoId);
|
520 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| Line 598... |
Line 597... |
| 598 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
597 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 599 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
598 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 600 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
599 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 601 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
600 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 602 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
601 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 603 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
602 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 604 |
.collect(Collectors.toList());
|
603 |
.collect(Collectors.toList());
|
| 605 |
|
604 |
|
| 606 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
605 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 607 |
} else {
|
606 |
} else {
|
| 608 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
607 |
planningMonthDate = LocalDate.now().withDayOfMonth(1);
|
| Line 610... |
Line 609... |
| 610 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
609 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 611 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
610 |
model.addAttribute("planningMonth", planningMonthDate.getMonth());
|
| 612 |
model.addAttribute("mtd", true);
|
611 |
model.addAttribute("mtd", true);
|
| 613 |
model.addAttribute("freezed", true);
|
612 |
model.addAttribute("freezed", true);
|
| 614 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
613 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 615 |
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())
|
| 616 |
.collect(Collectors.toList());
|
615 |
.collect(Collectors.toList());
|
| 617 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
616 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 618 |
}
|
617 |
}
|
| 619 |
|
618 |
|
| 620 |
Map<Integer, Integer> plannedDetailMap = null;
|
619 |
Map<Integer, Integer> plannedDetailMap = null;
|
| Line 867... |
Line 866... |
| 867 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
866 |
PaymentStatus.SUCCESS, null, paymentAttributes);
|
| 868 |
}
|
867 |
}
|
| 869 |
|
868 |
|
| 870 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
869 |
@RequestMapping(value = "/indent/loadIndentPreviousMonth")
|
| 871 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
870 |
public String previousMonthLoadOpenIndent(HttpServletRequest request, Model model,
|
| 872 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
871 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 873 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
872 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 874 |
LocalDate planMonthStart = null;
|
873 |
LocalDate planMonthStart = null;
|
| 875 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
874 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 876 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
875 |
planMonthStart = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 877 |
} else {
|
876 |
} else {
|
| 878 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
877 |
planMonthStart = LocalDate.now().withDayOfMonth(1);
|
| Line 1173... |
Line 1172... |
| 1173 |
|
1172 |
|
| 1174 |
}
|
1173 |
}
|
| 1175 |
|
1174 |
|
| 1176 |
@RequestMapping(value = "/getFocusedModel", method = RequestMethod.GET)
|
1175 |
@RequestMapping(value = "/getFocusedModel", method = RequestMethod.GET)
|
| 1177 |
public String getFocusedModel(HttpServletRequest request,
|
1176 |
public String getFocusedModel(HttpServletRequest request,
|
| 1178 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1177 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1179 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1178 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1180 |
throws ProfitMandiBusinessException {
|
1179 |
throws ProfitMandiBusinessException {
|
| 1181 |
|
1180 |
|
| 1182 |
long size = 0;
|
1181 |
long size = 0;
|
| 1183 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1182 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1184 |
|
1183 |
|
| Line 1234... |
Line 1233... |
| 1234 |
return regionMap;
|
1233 |
return regionMap;
|
| 1235 |
}
|
1234 |
}
|
| 1236 |
|
1235 |
|
| 1237 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
1236 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
| 1238 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
1237 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
| 1239 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1238 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1240 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1239 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1241 |
throws ProfitMandiBusinessException {
|
1240 |
throws ProfitMandiBusinessException {
|
| 1242 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
1241 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 1243 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1242 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1244 |
|
1243 |
|
| 1245 |
if (!focusedModels.isEmpty()) {
|
1244 |
if (!focusedModels.isEmpty()) {
|
| Line 1260... |
Line 1259... |
| 1260 |
return "focused-model-paginated";
|
1259 |
return "focused-model-paginated";
|
| 1261 |
}
|
1260 |
}
|
| 1262 |
|
1261 |
|
| 1263 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
1262 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
| 1264 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId,
|
1263 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId,
|
| 1265 |
@RequestParam(name = "recommended", defaultValue = "0") int recommended,
|
1264 |
@RequestParam(name = "recommended", defaultValue = "0") int recommended,
|
| 1266 |
@RequestParam(name = "minimumQty", defaultValue = "0") int minimumQty,
|
1265 |
@RequestParam(name = "minimumQty", defaultValue = "0") int minimumQty,
|
| 1267 |
@RequestParam(name = "obvrecommend", defaultValue = "0") int obvrecommend,
|
1266 |
@RequestParam(name = "obvrecommend", defaultValue = "0") int obvrecommend,
|
| 1268 |
@RequestParam(name = "obvminimum", defaultValue = "0") int obvminimum, @RequestParam int regionId,
|
1267 |
@RequestParam(name = "obvminimum", defaultValue = "0") int obvminimum, @RequestParam int regionId,
|
| 1269 |
Model model) throws ProfitMandiBusinessException {
|
1268 |
Model model) throws ProfitMandiBusinessException {
|
| 1270 |
|
1269 |
|
| 1271 |
FocusedModel fm = new FocusedModel();
|
1270 |
FocusedModel fm = new FocusedModel();
|
| 1272 |
fm.setCatalogId(catalogId);
|
1271 |
fm.setCatalogId(catalogId);
|
| 1273 |
fm.setMinimumQty(minimumQty);
|
1272 |
fm.setMinimumQty(minimumQty);
|
| 1274 |
fm.setRecommendedQty(recommended);
|
1273 |
fm.setRecommendedQty(recommended);
|
| Line 1337... |
Line 1336... |
| 1337 |
|
1336 |
|
| 1338 |
}
|
1337 |
}
|
| 1339 |
|
1338 |
|
| 1340 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
1339 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
| 1341 |
public String removeFocusedModelItem(HttpServletRequest request,
|
1340 |
public String removeFocusedModelItem(HttpServletRequest request,
|
| 1342 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
1341 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 1343 |
|
1342 |
|
| 1344 |
focusedModelRepository.deleteById(id);
|
1343 |
focusedModelRepository.deleteById(id);
|
| 1345 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1344 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1346 |
return "response";
|
1345 |
return "response";
|
| 1347 |
}
|
1346 |
}
|
| 1348 |
|
1347 |
|
| 1349 |
@RequestMapping(value = "/getPartnerloadContent")
|
1348 |
@RequestMapping(value = "/getPartnerloadContent")
|
| 1350 |
public String getPartnerloadContent(HttpServletRequest request, Model model,
|
1349 |
public String getPartnerloadContent(HttpServletRequest request, Model model,
|
| 1351 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
1350 |
@RequestParam(required = false, defaultValue = "0") int fofoId,
|
| 1352 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
1351 |
@RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws Exception {
|
| 1353 |
|
1352 |
|
| 1354 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1353 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1355 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
1354 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 1356 |
LOGGER.info("Counter size is {}", counterSize);
|
1355 |
LOGGER.info("Counter size is {}", counterSize);
|
| 1357 |
LOGGER.info("Fofo Id is {}", fofoId);
|
1356 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| Line 1435... |
Line 1434... |
| 1435 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
1434 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 1436 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
1435 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 1437 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1436 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1438 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
1437 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 1439 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1438 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1440 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
1439 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 1441 |
.collect(Collectors.toList());
|
1440 |
.collect(Collectors.toList());
|
| 1442 |
|
1441 |
|
| 1443 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
1442 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 1444 |
} else {
|
1443 |
} else {
|
| 1445 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
1444 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| Line 1447... |
Line 1446... |
| 1447 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1446 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1448 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
1447 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
| 1449 |
model.addAttribute("mtd", true);
|
1448 |
model.addAttribute("mtd", true);
|
| 1450 |
model.addAttribute("freezed", true);
|
1449 |
model.addAttribute("freezed", true);
|
| 1451 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1450 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1452 |
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())
|
| 1453 |
.collect(Collectors.toList());
|
1452 |
.collect(Collectors.toList());
|
| 1454 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
1453 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 1455 |
}
|
1454 |
}
|
| 1456 |
|
1455 |
|
| 1457 |
Map<Integer, Integer> plannedDetailMap = null;
|
1456 |
Map<Integer, Integer> plannedDetailMap = null;
|
| Line 1851... |
Line 1850... |
| 1851 |
return "partner-brandwise-detail";
|
1850 |
return "partner-brandwise-detail";
|
| 1852 |
}
|
1851 |
}
|
| 1853 |
|
1852 |
|
| 1854 |
@RequestMapping(value = "/changeActivationType", method = RequestMethod.POST)
|
1853 |
@RequestMapping(value = "/changeActivationType", method = RequestMethod.POST)
|
| 1855 |
public String changeActivationType(HttpServletRequest request, @RequestParam String code,
|
1854 |
public String changeActivationType(HttpServletRequest request, @RequestParam String code,
|
| 1856 |
@RequestParam ActivationType activationType, Model model) throws Exception {
|
1855 |
@RequestParam ActivationType activationType, Model model) throws Exception {
|
| 1857 |
|
1856 |
|
| 1858 |
FofoStore fofoStore = fofoStoreRepository.selectByStoreCode(code);
|
1857 |
FofoStore fofoStore = fofoStoreRepository.selectByStoreCode(code);
|
| 1859 |
|
1858 |
|
| 1860 |
fofoStore.setActivationType(activationType);
|
1859 |
fofoStore.setActivationType(activationType);
|
| 1861 |
|
1860 |
|
| Line 1901... |
Line 1900... |
| 1901 |
return "response";
|
1900 |
return "response";
|
| 1902 |
}
|
1901 |
}
|
| 1903 |
|
1902 |
|
| 1904 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
1903 |
@RequestMapping(value = "/getPartnerShortageStock", method = RequestMethod.GET)
|
| 1905 |
public String getPartnerShortageStock(HttpServletRequest request,
|
1904 |
public String getPartnerShortageStock(HttpServletRequest request,
|
| 1906 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
1905 |
@RequestParam(required = false, defaultValue = "") String brand, @RequestParam int fofoId, Model model)
|
| 1907 |
throws Exception {
|
1906 |
throws Exception {
|
| 1908 |
|
1907 |
|
| 1909 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap = saholicInventoryService
|
1908 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap = saholicInventoryService
|
| 1910 |
.getSaholicStock();
|
1909 |
.getSaholicStock();
|
| 1911 |
|
1910 |
|
| Line 2091... |
Line 2090... |
| 2091 |
return "partner-stock";
|
2090 |
return "partner-stock";
|
| 2092 |
|
2091 |
|
| 2093 |
}
|
2092 |
}
|
| 2094 |
|
2093 |
|
| 2095 |
private List<PartnerStockDescriptionModel> getBrandItemwiseDescription(String brand,
|
2094 |
private List<PartnerStockDescriptionModel> getBrandItemwiseDescription(String brand,
|
| 2096 |
Map<Integer, Integer> catalogIdAndQtyMap) throws ProfitMandiBusinessException {
|
2095 |
Map<Integer, Integer> catalogIdAndQtyMap) throws ProfitMandiBusinessException {
|
| 2097 |
List<PartnerStockDescriptionModel> inStocks = new ArrayList<>();
|
2096 |
List<PartnerStockDescriptionModel> inStocks = new ArrayList<>();
|
| 2098 |
|
2097 |
|
| 2099 |
for (Entry<Integer, Integer> inStock : catalogIdAndQtyMap.entrySet()) {
|
2098 |
for (Entry<Integer, Integer> inStock : catalogIdAndQtyMap.entrySet()) {
|
| 2100 |
List<Item> items = itemRepository.selectAllByCatalogItemId(inStock.getKey());
|
2099 |
List<Item> items = itemRepository.selectAllByCatalogItemId(inStock.getKey());
|
| 2101 |
|
2100 |
|
| Line 2148... |
Line 2147... |
| 2148 |
|
2147 |
|
| 2149 |
return inStocks;
|
2148 |
return inStocks;
|
| 2150 |
}
|
2149 |
}
|
| 2151 |
|
2150 |
|
| 2152 |
private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
|
2151 |
private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
|
| 2153 |
Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
|
2152 |
Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
|
| 2154 |
Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
|
2153 |
Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
|
| 2155 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap,
|
2154 |
Map<Integer, Map<Integer, List<SaholicCIS>>> warehouseItemAvailabilityMap,
|
| 2156 |
Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
|
2155 |
Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
|
| 2157 |
CustomRetailer customRetailer) throws ProfitMandiBusinessException {
|
2156 |
CustomRetailer customRetailer) throws ProfitMandiBusinessException {
|
| 2158 |
|
2157 |
|
| 2159 |
int minQty = qty;
|
2158 |
int minQty = qty;
|
| 2160 |
int inStockQty = 0;
|
2159 |
int inStockQty = 0;
|
| 2161 |
int processingQty = 0;
|
2160 |
int processingQty = 0;
|
| 2162 |
int grnPendingQty = 0;
|
2161 |
int grnPendingQty = 0;
|
| Line 2232... |
Line 2231... |
| 2232 |
return "send-po-notification";
|
2231 |
return "send-po-notification";
|
| 2233 |
}
|
2232 |
}
|
| 2234 |
|
2233 |
|
| 2235 |
@RequestMapping(value = "/indent/send-po-notification", method = RequestMethod.POST)
|
2234 |
@RequestMapping(value = "/indent/send-po-notification", method = RequestMethod.POST)
|
| 2236 |
public String sendPONotification(HttpServletRequest request, @RequestBody POItemWarehouseModel poItemWarehouseModel,
|
2235 |
public String sendPONotification(HttpServletRequest request, @RequestBody POItemWarehouseModel poItemWarehouseModel,
|
| 2237 |
Model model) throws Exception {
|
2236 |
Model model) throws Exception {
|
| 2238 |
|
2237 |
|
| 2239 |
Map<Integer, Item> selectedItemsMap = itemRepository.selectByIds(poItemWarehouseModel.getItemIdQuantityList()
|
2238 |
Map<Integer, Item> selectedCatalogItemMap = itemRepository.selectAllByCatalogIds(new HashSet<>(poItemWarehouseModel.getCatalogIds()))
|
| 2240 |
.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream()
|
- |
|
| 2241 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
2239 |
.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x, (existing, replacement) -> existing));
|
| 2242 |
|
2240 |
|
| 2243 |
Set<String> brands = selectedItemsMap.values().stream().map(x -> x.getBrand().toLowerCase())
|
2241 |
Set<String> brands = selectedCatalogItemMap.values().stream().map(x -> x.getBrand().toLowerCase())
|
| 2244 |
.collect(Collectors.toSet());
|
2242 |
.collect(Collectors.toSet());
|
| 2245 |
int warehouseId = poItemWarehouseModel.getWarehouseId();
|
- |
|
| 2246 |
|
- |
|
| 2247 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
- |
|
| 2248 |
sendNotificationModel.setCampaignName("SendPo");
|
- |
|
| 2249 |
sendNotificationModel.setTitle(String.format(PO_TITLE_STRING));
|
- |
|
| 2250 |
StringBuilder stringBuilder = new StringBuilder();
|
- |
|
| 2251 |
poItemWarehouseModel.getItemIdQuantityList().stream().forEach(itemIdQuantity -> {
|
- |
|
| 2252 |
stringBuilder.append(selectedItemsMap.get(itemIdQuantity.getItemId()).getItemDescription()).append("-")
|
- |
|
| 2253 |
.append(itemIdQuantity.getQuantity()).append("pcs").append("\n");
|
- |
|
| 2254 |
});
|
- |
|
| 2255 |
sendNotificationModel.setMessage(stringBuilder.toString());
|
- |
|
| 2256 |
sendNotificationModel.setType("url");
|
- |
|
| 2257 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
- |
|
| 2258 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
- |
|
| 2259 |
sendNotificationModel.setMessageType(MessageType.notification);
|
- |
|
| 2260 |
|
2243 |
|
| - |
|
2244 |
int warehouseId = poItemWarehouseModel.getWarehouseId();
|
| - |
|
2245 |
for (String brand : brands) {
|
| - |
|
2246 |
Map<Integer, Item> brandSpecificCatalogItemMap = selectedCatalogItemMap.entrySet().stream()
|
| - |
|
2247 |
.filter(x -> x.getValue().getBrand().equals(brand)).collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
| - |
|
2248 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| - |
|
2249 |
sendNotificationModel.setCampaignName("SendPo");
|
| - |
|
2250 |
sendNotificationModel.setTitle(String.format(PO_TITLE_STRING));
|
| - |
|
2251 |
StringBuilder stringBuilder = new StringBuilder();
|
| - |
|
2252 |
/*poItemWarehouseModel.getCatalogIds().stream().forEach(catalogId -> {
|
| - |
|
2253 |
stringBuilder.append(selectedCatalogItemMap.get(catalogId).getItemDescription()).append("\n");
|
| - |
|
2254 |
});*/
|
| - |
|
2255 |
sendNotificationModel.setMessage(stringBuilder.toString());
|
| - |
|
2256 |
sendNotificationModel.setType("url");
|
| - |
|
2257 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| - |
|
2258 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| - |
|
2259 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| - |
|
2260 |
|
| 2261 |
List<BrandRegionMapping> brandRegionMappings = brandRegionMappingRepository
|
2261 |
List<BrandRegionMapping> brandRegionMappings = brandRegionMappingRepository
|
| 2262 |
.selectAll().stream().filter(x -> brands.contains(x.getBrand().toLowerCase())
|
2262 |
.selectAll().stream().filter(x -> brand.equals(x.getBrand().toLowerCase())
|
| 2263 |
&& x.getFromWarehouseId() == warehouseId && x.isAccessory() == false)
|
2263 |
&& x.getFromWarehouseId() == warehouseId && !x.isAccessory())
|
| 2264 |
.collect(Collectors.toList());
|
2264 |
.collect(Collectors.toList());
|
| 2265 |
List<Integer> toWarehouseIds = brandRegionMappings.stream().map(x -> x.getToWarehouseId())
|
2265 |
List<Integer> toWarehouseIds = brandRegionMappings.stream().map(x -> x.getToWarehouseId())
|
| 2266 |
.collect(Collectors.toList());
|
2266 |
.collect(Collectors.toList());
|
| 2267 |
|
2267 |
|
| 2268 |
List<Integer> fofoIds = fofoStoreRepository.selectByWarehouseIds(toWarehouseIds).stream()
|
2268 |
List<Integer> fofoIds = fofoStoreRepository.selectByWarehouseIds(toWarehouseIds).stream()
|
| 2269 |
.filter(x -> !x.isInternal() && x.isActive()).map(x -> x.getId()).collect(Collectors.toList());
|
2269 |
.filter(x -> !x.isInternal() && x.isActive()).map(x -> x.getId()).collect(Collectors.toList());
|
| 2270 |
|
2270 |
|
| 2271 |
List<Integer> userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
|
2271 |
List<Integer> userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
|
| 2272 |
sendNotificationModel.setUserIds(userIds);
|
2272 |
sendNotificationModel.setUserIds(userIds);
|
| 2273 |
notificationService.sendNotification(sendNotificationModel);
|
2273 |
notificationService.sendNotification(sendNotificationModel);
|
| - |
|
2274 |
}
|
| 2274 |
model.addAttribute("response", true);
|
2275 |
model.addAttribute("response", true);
|
| 2275 |
return "response";
|
2276 |
return "response";
|
| 2276 |
}
|
2277 |
}
|
| 2277 |
|
2278 |
|
| 2278 |
}
|
2279 |
}
|
| 2279 |
|
2280 |
|