| Line 94... |
Line 94... |
| 94 |
@Autowired
|
94 |
@Autowired
|
| 95 |
private LoanStatementRepository loanStatementRepository;
|
95 |
private LoanStatementRepository loanStatementRepository;
|
| 96 |
@Autowired
|
96 |
@Autowired
|
| 97 |
PositionRepository positionRepository;
|
97 |
PositionRepository positionRepository;
|
| 98 |
|
98 |
|
| - |
|
99 |
@Autowired
|
| - |
|
100 |
UserWalletRepository userWalletRepository;
|
| 99 |
@PostMapping(value = "/reports/{projectName}/{fileName}")
|
101 |
@PostMapping(value = "/reports/{projectName}/{fileName}")
|
| 100 |
public ResponseEntity<?> fetchReport(HttpServletRequest request, @PathVariable String fileName,
|
102 |
public ResponseEntity<?> fetchReport(HttpServletRequest request, @PathVariable String fileName,
|
| 101 |
@PathVariable ReporticoProject projectName, @RequestBody Map<String, String> paramsMap)
|
103 |
@PathVariable ReporticoProject projectName, @RequestBody Map<String, String> paramsMap)
|
| 102 |
throws ProfitMandiBusinessException, UnsupportedOperationException, IOException {
|
104 |
throws ProfitMandiBusinessException, UnsupportedOperationException, IOException {
|
| 103 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
105 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| Line 192... |
Line 194... |
| 192 |
startDate = LocalDate.now().minusDays(30);
|
194 |
startDate = LocalDate.now().minusDays(30);
|
| 193 |
endDate = LocalDate.now();
|
195 |
endDate = LocalDate.now();
|
| 194 |
}
|
196 |
}
|
| 195 |
boolean isRBM = false;
|
197 |
boolean isRBM = false;
|
| 196 |
if (isAdmin) {
|
198 |
if (isAdmin) {
|
| 197 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
199 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
| 198 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
200 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 199 |
isRBM = positions.stream()
|
201 |
isRBM = positions.stream()
|
| 200 |
.anyMatch(position ->
|
202 |
.anyMatch(position ->
|
| 201 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
203 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 202 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
204 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 203 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
205 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 204 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
206 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 205 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
207 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 206 |
try {
|
208 |
try {
|
| 207 |
return retailerService.getFofoRetailers(true).get(x);
|
209 |
return retailerService.getFofoRetailers(true).get(x);
|
| 208 |
} catch (ProfitMandiBusinessException e) {
|
210 |
} catch (ProfitMandiBusinessException e) {
|
| 209 |
// TODO Auto-generated catch block
|
211 |
// TODO Auto-generated catch block
|
| 210 |
return null;
|
212 |
return null;
|
| 211 |
}
|
213 |
}
|
| 212 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
214 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 213 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
215 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 214 |
}
|
216 |
}
|
| 215 |
}
|
217 |
}
|
| 216 |
model.addAttribute("isRBM", isRBM);
|
218 |
model.addAttribute("isRBM", isRBM);
|
| 217 |
model.addAttribute("startDate", startDate);
|
219 |
model.addAttribute("startDate", startDate);
|
| 218 |
model.addAttribute("endDate", endDate);
|
220 |
model.addAttribute("endDate", endDate);
|
| Line 284... |
Line 286... |
| 284 |
|
286 |
|
| 285 |
}
|
287 |
}
|
| 286 |
endDate = LocalDate.now();
|
288 |
endDate = LocalDate.now();
|
| 287 |
boolean isRBM = false;
|
289 |
boolean isRBM = false;
|
| 288 |
if (isAdmin) {
|
290 |
if (isAdmin) {
|
| 289 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
291 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 290 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
292 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 291 |
isRBM = positions.stream()
|
293 |
isRBM = positions.stream()
|
| 292 |
.anyMatch(position ->
|
294 |
.anyMatch(position ->
|
| 293 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
295 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 294 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
296 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 295 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
297 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 296 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
298 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 297 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
299 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 298 |
try {
|
300 |
try {
|
| 299 |
return retailerService.getFofoRetailers(true).get(x);
|
301 |
return retailerService.getFofoRetailers(true).get(x);
|
| 300 |
} catch (ProfitMandiBusinessException e) {
|
302 |
} catch (ProfitMandiBusinessException e) {
|
| 301 |
// TODO Auto-generated catch block
|
303 |
// TODO Auto-generated catch block
|
| 302 |
return null;
|
304 |
return null;
|
| 303 |
}
|
305 |
}
|
| 304 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
306 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 305 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
307 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 306 |
}
|
308 |
}
|
| 307 |
}
|
309 |
}
|
| 308 |
model.addAttribute("isRBM", isRBM);
|
310 |
model.addAttribute("isRBM", isRBM);
|
| 309 |
model.addAttribute("startDate", startDate);
|
311 |
model.addAttribute("startDate", startDate);
|
| 310 |
model.addAttribute("endDate", endDate);
|
312 |
model.addAttribute("endDate", endDate);
|
| Line 342... |
Line 344... |
| 342 |
startDate = LocalDate.now().minusDays(30);
|
344 |
startDate = LocalDate.now().minusDays(30);
|
| 343 |
endDate = LocalDate.now();
|
345 |
endDate = LocalDate.now();
|
| 344 |
}
|
346 |
}
|
| 345 |
boolean isRBM = false;
|
347 |
boolean isRBM = false;
|
| 346 |
if (isAdmin) {
|
348 |
if (isAdmin) {
|
| 347 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
349 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 348 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
350 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 349 |
isRBM = positions.stream()
|
351 |
isRBM = positions.stream()
|
| 350 |
.anyMatch(position ->
|
352 |
.anyMatch(position ->
|
| 351 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
353 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 352 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
354 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 353 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
355 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 354 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
356 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 355 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
357 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 356 |
try {
|
358 |
try {
|
| 357 |
return retailerService.getFofoRetailers(true).get(x);
|
359 |
return retailerService.getFofoRetailers(true).get(x);
|
| 358 |
} catch (ProfitMandiBusinessException e) {
|
360 |
} catch (ProfitMandiBusinessException e) {
|
| 359 |
// TODO Auto-generated catch block
|
361 |
// TODO Auto-generated catch block
|
| 360 |
return null;
|
362 |
return null;
|
| 361 |
}
|
363 |
}
|
| 362 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
364 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 363 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
365 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 364 |
}
|
366 |
}
|
| 365 |
}
|
367 |
}
|
| 366 |
model.addAttribute("isRBM", isRBM);
|
368 |
model.addAttribute("isRBM", isRBM);
|
| 367 |
model.addAttribute("startDate", startDate);
|
369 |
model.addAttribute("startDate", startDate);
|
| 368 |
model.addAttribute("endDate", endDate);
|
370 |
model.addAttribute("endDate", endDate);
|
| Line 458... |
Line 460... |
| 458 |
throws Exception {
|
460 |
throws Exception {
|
| 459 |
|
461 |
|
| 460 |
List<List<?>> rows = new ArrayList<>();
|
462 |
List<List<?>> rows = new ArrayList<>();
|
| 461 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
463 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 462 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
464 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
| 463 |
float openingBalance = 0;
|
- |
|
| 464 |
float openingPendingAmount = 0;
|
- |
|
| 465 |
List<WalletSummaryReportModel> walletSummartList = null;
|
- |
|
| 466 |
if (isAdmin) {
|
- |
|
| 467 |
if (fofoId == 0)
|
- |
|
| 468 |
walletSummartList = new ArrayList<>();
|
- |
|
| 469 |
else
|
- |
|
| 470 |
|
- |
|
| 471 |
walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
|
- |
|
| 472 |
fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
- |
|
| 473 |
openingBalance = walletService.getOpeningTill(fofoId, startDate.atStartOfDay());
|
- |
|
| 474 |
Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate.atStartOfDay(), Optional.of(fofoId));
|
- |
|
| 475 |
openingPendingAmount = openingAmountMap.get(fofoId) == null ? 0 : openingAmountMap.get(fofoId);
|
- |
|
| 476 |
|
- |
|
| 477 |
} else {
|
- |
|
| 478 |
|
465 |
|
| - |
|
466 |
if (!isAdmin) fofoId = fofoDetails.getFofoId();
|
| 479 |
walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
|
467 |
List<WalletSummaryReportModel> walletSummaryList = fofoOrderRepository.selectWalletSummaryReport(
|
| 480 |
fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
468 |
fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
| - |
|
469 |
double openingBalance = walletService.getOpeningTill(fofoId, startDate.atStartOfDay());
|
| 481 |
|
470 |
|
| 482 |
|
- |
|
| 483 |
}
|
- |
|
| 484 |
|
- |
|
| 485 |
LOGGER.info("walletSummartList {}", fofoId);
|
- |
|
| 486 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
|
471 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
|
| 487 |
String partnerDetail = null;
|
472 |
String partnerDetail = null;
|
| 488 |
// Headers for the table data
|
473 |
// Headers for the table data
|
| 489 |
rows.add(Arrays.asList(
|
474 |
rows.add(Arrays.asList(
|
| 490 |
// "Id","Business_timestamp",
|
- |
|
| 491 |
"timestamp", "Reference_type", "Reference", "Amount", "Refundable_amount", "Running Balance", "Description"));
|
475 |
"Timestamp", "Reference_type", "Reference", "Amount", "Running Balance", "Description"));
|
| - |
|
476 |
double runningBalance = openingBalance;
|
| - |
|
477 |
for (
|
| 492 |
for (WalletSummaryReportModel walletSummary : walletSummartList) {
|
478 |
WalletSummaryReportModel walletSummary : walletSummaryList) {
|
| - |
|
479 |
runningBalance += walletSummary.getAmount();
|
| 493 |
partnerDetail = walletSummary.getName() + "(" + walletSummary.getCode() + "-" + walletSummary.getPhone() + ")" + "-" + walletSummary.getEmail();
|
480 |
partnerDetail = walletSummary.getName() + "(" + walletSummary.getCode() + "-" + walletSummary.getPhone() + ")" + "-" + walletSummary.getEmail();
|
| 494 |
|
481 |
|
| 495 |
rows.add(Arrays.asList(
|
482 |
rows.add(Arrays.asList(
|
| 496 |
// walletSummary.getId(),
|
- |
|
| 497 |
// FormattingUtils.format(walletSummary.getBusinessTimestamp() != null ? walletSummary.getBusinessTimestamp() : walletSummary.getTimestamp()),
|
- |
|
| 498 |
walletSummary.getTimestamp(),
|
483 |
FormattingUtils.format(walletSummary.getTimestamp()),
|
| 499 |
walletSummary.getReferenceType(),
|
484 |
walletSummary.getReferenceType(),
|
| 500 |
walletSummary.getReference(),
|
485 |
walletSummary.getReference(),
|
| 501 |
walletSummary.getAmount(),
|
486 |
walletSummary.getAmount(),
|
| 502 |
walletSummary.getRefundableAmount(),
|
- |
|
| 503 |
openingBalance + walletSummary.getAmount(),
|
487 |
runningBalance,
|
| 504 |
walletSummary.getDescription()
|
488 |
walletSummary.getDescription()
|
| 505 |
));
|
489 |
));
|
| 506 |
|
490 |
|
| 507 |
}
|
491 |
}
|
| 508 |
|
492 |
|
| 509 |
|
493 |
|
| 510 |
float openingBalanceWithOpeningPendingAmount = openingPendingAmount + openingBalance;
|
- |
|
| 511 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil
|
494 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil
|
| 512 |
.getCSVByteStream(Arrays.asList("Opening Balance - : " + openingBalanceWithOpeningPendingAmount), rows);
|
495 |
.getCSVByteStream(Arrays.asList("Opening Balance - : " + openingBalance), rows);
|
| 513 |
ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, partnerDetail + " Wallet Statement Report");
|
496 |
ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, partnerDetail + " Wallet Statement Report");
|
| 514 |
|
497 |
|
| 515 |
return responseEntity;
|
498 |
return responseEntity;
|
| 516 |
|
499 |
|
| 517 |
}
|
500 |
}
|
| 518 |
|
- |
|
| 519 |
@RequestMapping(value = "/walletSummaryFetchReportByDate", method = RequestMethod.GET)
|
501 |
@RequestMapping(value = "/walletSummaryFetchReportByDate", method = RequestMethod.GET)
|
| 520 |
public String getwalletSummaryFetchReport(HttpServletRequest request, Model model, @RequestParam(defaultValue = "0") int fofoId,
|
502 |
public String getwalletSummaryFetchReport(HttpServletRequest request, Model model, @RequestParam(defaultValue = "0") int fofoId,
|
| 521 |
@RequestParam(required = false) LocalDate startDate,
|
503 |
@RequestParam(required = false) LocalDate startDate,
|
| 522 |
@RequestParam(required = false) LocalDate endDate)
|
504 |
@RequestParam(required = false) LocalDate endDate)
|
| 523 |
throws Exception {
|
505 |
throws Exception {
|
| 524 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
506 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
507 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoId);
|
| 525 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
508 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 526 |
if (startDate == null) {
|
509 |
if (startDate == null) {
|
| 527 |
startDate = LocalDate.now().minusDays(30);
|
510 |
startDate = LocalDate.now().minusDays(30);
|
| 528 |
}
|
511 |
}
|
| 529 |
if (endDate == null) {
|
512 |
if (endDate == null) {
|
| Line 544... |
Line 527... |
| 544 |
} else {
|
527 |
} else {
|
| 545 |
walletSummartList = fofoOrderRepository.selectWalletSummaryReport(loginDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
528 |
walletSummartList = fofoOrderRepository.selectWalletSummaryReport(loginDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
|
| 546 |
}
|
529 |
}
|
| 547 |
boolean isRBM = false;
|
530 |
boolean isRBM = false;
|
| 548 |
if (isAdmin) {
|
531 |
if (isAdmin) {
|
| 549 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
532 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 550 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
533 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 551 |
isRBM = positions.stream()
|
534 |
isRBM = positions.stream()
|
| 552 |
.anyMatch(position ->
|
535 |
.anyMatch(position ->
|
| 553 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
536 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 554 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
537 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 555 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
538 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 556 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
539 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 557 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
540 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 558 |
try {
|
541 |
try {
|
| 559 |
return retailerService.getFofoRetailers(true).get(x);
|
542 |
return retailerService.getFofoRetailers(true).get(x);
|
| 560 |
} catch (ProfitMandiBusinessException e) {
|
543 |
} catch (ProfitMandiBusinessException e) {
|
| 561 |
// TODO Auto-generated catch block
|
544 |
// TODO Auto-generated catch block
|
| 562 |
return null;
|
545 |
return null;
|
| 563 |
}
|
546 |
}
|
| 564 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
547 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 565 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
548 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 566 |
}
|
549 |
}
|
| 567 |
}
|
550 |
}
|
| 568 |
model.addAttribute("isRBM", isRBM);
|
551 |
model.addAttribute("isRBM", isRBM);
|
| 569 |
|
552 |
|
| 570 |
LOGGER.info("walletSummartList {}", walletSummartList);
|
553 |
LOGGER.info("walletSummartList {}", walletSummartList);
|
| 571 |
model.addAttribute("walletSummartList", walletSummartList);
|
554 |
model.addAttribute("walletSummartList", walletSummartList);
|
| 572 |
model.addAttribute("openingBalance", (openingBalance + openingPendingAmount));
|
555 |
model.addAttribute("openingBalance", (openingBalance + openingPendingAmount));
|
| 573 |
model.addAttribute("startDate", startDate);
|
556 |
model.addAttribute("startDate", startDate);
|
| 574 |
model.addAttribute("endDate", endDate);
|
557 |
model.addAttribute("endDate", endDate);
|
| 575 |
model.addAttribute("isAdmin", isAdmin);
|
558 |
model.addAttribute("isAdmin", isAdmin);
|
| - |
|
559 |
model.addAttribute("userWallet", userWallet);
|
| 576 |
return "wallet-summary-report";
|
560 |
return "wallet-summary-report";
|
| 577 |
}
|
561 |
}
|
| 578 |
|
562 |
|
| 579 |
@RequestMapping(value = "/walletSummaryReport", method = RequestMethod.GET)
|
563 |
@RequestMapping(value = "/walletSummaryReport", method = RequestMethod.GET)
|
| 580 |
public String getWalletSummaryReport(HttpServletRequest request, Model model) throws Exception {
|
564 |
public String getWalletSummaryReport(HttpServletRequest request, Model model) throws Exception {
|
| Line 623... |
Line 607... |
| 623 |
public String getPendingIndentReport(HttpServletRequest request, Model model) throws Exception {
|
607 |
public String getPendingIndentReport(HttpServletRequest request, Model model) throws Exception {
|
| 624 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
608 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 625 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
609 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
| 626 |
boolean isRBM = false;
|
610 |
boolean isRBM = false;
|
| 627 |
if (isAdmin) {
|
611 |
if (isAdmin) {
|
| 628 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
612 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
| 629 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
613 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 630 |
isRBM = positions.stream()
|
614 |
isRBM = positions.stream()
|
| 631 |
.anyMatch(position ->
|
615 |
.anyMatch(position ->
|
| 632 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
616 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 633 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
617 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 634 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
618 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 635 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
619 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 636 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
620 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 637 |
try {
|
621 |
try {
|
| 638 |
return retailerService.getFofoRetailers(true).get(x);
|
622 |
return retailerService.getFofoRetailers(true).get(x);
|
| 639 |
} catch (ProfitMandiBusinessException e) {
|
623 |
} catch (ProfitMandiBusinessException e) {
|
| 640 |
// TODO Auto-generated catch block
|
624 |
// TODO Auto-generated catch block
|
| 641 |
return null;
|
625 |
return null;
|
| 642 |
}
|
626 |
}
|
| 643 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
627 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 644 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
628 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 645 |
}
|
629 |
}
|
| 646 |
}
|
630 |
}
|
| 647 |
model.addAttribute("isRBM", isRBM);
|
631 |
model.addAttribute("isRBM", isRBM);
|
| 648 |
|
632 |
|
| 649 |
LocalDateTime currentDate = LocalDate.now().atStartOfDay();
|
633 |
LocalDateTime currentDate = LocalDate.now().atStartOfDay();
|
| Line 676... |
Line 660... |
| 676 |
startDate = LocalDate.now().minusDays(30);
|
660 |
startDate = LocalDate.now().minusDays(30);
|
| 677 |
endDate = LocalDate.now();
|
661 |
endDate = LocalDate.now();
|
| 678 |
}
|
662 |
}
|
| 679 |
boolean isRBM = false;
|
663 |
boolean isRBM = false;
|
| 680 |
if (isAdmin) {
|
664 |
if (isAdmin) {
|
| 681 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
665 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
| 682 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
666 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 683 |
isRBM = positions.stream()
|
667 |
isRBM = positions.stream()
|
| 684 |
.anyMatch(position ->
|
668 |
.anyMatch(position ->
|
| 685 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
669 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 686 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
670 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 687 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
671 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 688 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
672 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 689 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
673 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 690 |
try {
|
674 |
try {
|
| 691 |
return retailerService.getFofoRetailers(true).get(x);
|
675 |
return retailerService.getFofoRetailers(true).get(x);
|
| 692 |
} catch (ProfitMandiBusinessException e) {
|
676 |
} catch (ProfitMandiBusinessException e) {
|
| 693 |
// TODO Auto-generated catch block
|
677 |
// TODO Auto-generated catch block
|
| 694 |
return null;
|
678 |
return null;
|
| 695 |
}
|
679 |
}
|
| 696 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
680 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 697 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
681 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 698 |
}
|
682 |
}
|
| 699 |
}
|
683 |
}
|
| 700 |
model.addAttribute("isRBM", isRBM);
|
684 |
model.addAttribute("isRBM", isRBM);
|
| 701 |
|
685 |
|
| 702 |
model.addAttribute("startDate", startDate);
|
686 |
model.addAttribute("startDate", startDate);
|
| Line 779... |
Line 763... |
| 779 |
startDate = LocalDate.now().minusDays(30);
|
763 |
startDate = LocalDate.now().minusDays(30);
|
| 780 |
endDate = LocalDate.now();
|
764 |
endDate = LocalDate.now();
|
| 781 |
}
|
765 |
}
|
| 782 |
boolean isRBM = false;
|
766 |
boolean isRBM = false;
|
| 783 |
if (isAdmin) {
|
767 |
if (isAdmin) {
|
| 784 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
768 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 785 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
769 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 786 |
isRBM = positions.stream()
|
770 |
isRBM = positions.stream()
|
| 787 |
.anyMatch(position ->
|
771 |
.anyMatch(position ->
|
| 788 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
772 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 789 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
773 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 790 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
774 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 791 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
775 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 792 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
776 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 793 |
try {
|
777 |
try {
|
| 794 |
return retailerService.getFofoRetailers(true).get(x);
|
778 |
return retailerService.getFofoRetailers(true).get(x);
|
| 795 |
} catch (ProfitMandiBusinessException e) {
|
779 |
} catch (ProfitMandiBusinessException e) {
|
| 796 |
// TODO Auto-generated catch block
|
780 |
// TODO Auto-generated catch block
|
| 797 |
return null;
|
781 |
return null;
|
| 798 |
}
|
782 |
}
|
| 799 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
783 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 800 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
784 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 801 |
}
|
785 |
}
|
| 802 |
}
|
786 |
}
|
| 803 |
model.addAttribute("isRBM", isRBM);
|
787 |
model.addAttribute("isRBM", isRBM);
|
| 804 |
model.addAttribute("startDate", startDate);
|
788 |
model.addAttribute("startDate", startDate);
|
| 805 |
model.addAttribute("endDate", endDate);
|
789 |
model.addAttribute("endDate", endDate);
|
| Line 827... |
Line 811... |
| 827 |
startDate = LocalDate.now().minusDays(30);
|
811 |
startDate = LocalDate.now().minusDays(30);
|
| 828 |
endDate = LocalDate.now();
|
812 |
endDate = LocalDate.now();
|
| 829 |
}
|
813 |
}
|
| 830 |
boolean isRBM = false;
|
814 |
boolean isRBM = false;
|
| 831 |
if (isAdmin) {
|
815 |
if (isAdmin) {
|
| 832 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
816 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 833 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
817 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 834 |
isRBM = positions.stream()
|
818 |
isRBM = positions.stream()
|
| 835 |
.anyMatch(position ->
|
819 |
.anyMatch(position ->
|
| 836 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
820 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 837 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
821 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 838 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
822 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 839 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
823 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
| 840 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
824 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 841 |
try {
|
825 |
try {
|
| 842 |
return retailerService.getFofoRetailers(true).get(x);
|
826 |
return retailerService.getFofoRetailers(true).get(x);
|
| 843 |
} catch (ProfitMandiBusinessException e) {
|
827 |
} catch (ProfitMandiBusinessException e) {
|
| 844 |
// TODO Auto-generated catch block
|
828 |
// TODO Auto-generated catch block
|
| 845 |
return null;
|
829 |
return null;
|
| 846 |
}
|
830 |
}
|
| 847 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
831 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 848 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
832 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 849 |
}
|
833 |
}
|
| 850 |
}
|
834 |
}
|
| 851 |
|
835 |
|
| 852 |
model.addAttribute("isRBM", isRBM);
|
836 |
model.addAttribute("isRBM", isRBM);
|
| 853 |
model.addAttribute("startDate", startDate);
|
837 |
model.addAttribute("startDate", startDate);
|
| Line 884... |
Line 868... |
| 884 |
public String getOfferPayoutReport(HttpServletRequest request, Model model, @RequestParam(required = false) LocalDate startDate, @RequestParam(required = false) LocalDate endDate) throws Exception {
|
868 |
public String getOfferPayoutReport(HttpServletRequest request, Model model, @RequestParam(required = false) LocalDate startDate, @RequestParam(required = false) LocalDate endDate) throws Exception {
|
| 885 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
869 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 886 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
870 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
| 887 |
boolean isRBM = false;
|
871 |
boolean isRBM = false;
|
| 888 |
if (isAdmin) {
|
872 |
if (isAdmin) {
|
| 889 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
873 |
AuthUser authUser = authRepository.selectByEmailOrMobile(fofoDetails.getEmailId());
|
| 890 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
874 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 891 |
isRBM = positions.stream()
|
875 |
isRBM = positions.stream()
|
| 892 |
.anyMatch(position ->
|
876 |
.anyMatch(position ->
|
| 893 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
877 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 894 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
878 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 895 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
879 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 896 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
880 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 897 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
881 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 898 |
try {
|
882 |
try {
|
| 899 |
return retailerService.getFofoRetailers(true).get(x);
|
883 |
return retailerService.getFofoRetailers(true).get(x);
|
| 900 |
} catch (ProfitMandiBusinessException e) {
|
884 |
} catch (ProfitMandiBusinessException e) {
|
| 901 |
// TODO Auto-generated catch block
|
885 |
// TODO Auto-generated catch block
|
| 902 |
return null;
|
886 |
return null;
|
| 903 |
}
|
887 |
}
|
| 904 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
888 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 905 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
889 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 906 |
}
|
890 |
}
|
| 907 |
}
|
891 |
}
|
| 908 |
model.addAttribute("isRBM", isRBM);
|
892 |
model.addAttribute("isRBM", isRBM);
|
| 909 |
if (startDate == null) {
|
893 |
if (startDate == null) {
|
| 910 |
startDate = LocalDate.now().minusDays(30);
|
894 |
startDate = LocalDate.now().minusDays(30);
|
| Line 935... |
Line 919... |
| 935 |
startDate = LocalDate.now().minusDays(30);
|
919 |
startDate = LocalDate.now().minusDays(30);
|
| 936 |
endDate = LocalDate.now();
|
920 |
endDate = LocalDate.now();
|
| 937 |
}
|
921 |
}
|
| 938 |
boolean isRBM = false;
|
922 |
boolean isRBM = false;
|
| 939 |
if (isAdmin) {
|
923 |
if (isAdmin) {
|
| 940 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
924 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 941 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
925 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 942 |
isRBM = positions.stream()
|
926 |
isRBM = positions.stream()
|
| 943 |
.anyMatch(position ->
|
927 |
.anyMatch(position ->
|
| 944 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
928 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 945 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
929 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 946 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
930 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 947 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
931 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 948 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
932 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 949 |
try {
|
933 |
try {
|
| 950 |
return retailerService.getFofoRetailers(true).get(x);
|
934 |
return retailerService.getFofoRetailers(true).get(x);
|
| 951 |
} catch (ProfitMandiBusinessException e) {
|
935 |
} catch (ProfitMandiBusinessException e) {
|
| 952 |
// TODO Auto-generated catch block
|
936 |
// TODO Auto-generated catch block
|
| 953 |
return null;
|
937 |
return null;
|
| 954 |
}
|
938 |
}
|
| 955 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
939 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 956 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
940 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 957 |
}
|
941 |
}
|
| 958 |
}
|
942 |
}
|
| 959 |
model.addAttribute("isRBM", isRBM);
|
943 |
model.addAttribute("isRBM", isRBM);
|
| 960 |
model.addAttribute("startDate", startDate);
|
944 |
model.addAttribute("startDate", startDate);
|
| 961 |
model.addAttribute("endDate", endDate);
|
945 |
model.addAttribute("endDate", endDate);
|
| Line 1383... |
Line 1367... |
| 1383 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1367 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1384 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
1368 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 1385 |
|
1369 |
|
| 1386 |
boolean isRBM = false;
|
1370 |
boolean isRBM = false;
|
| 1387 |
if (isAdmin) {
|
1371 |
if (isAdmin) {
|
| 1388 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
1372 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 1389 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
1373 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 1390 |
isRBM = positions.stream()
|
1374 |
isRBM = positions.stream()
|
| 1391 |
.anyMatch(position ->
|
1375 |
.anyMatch(position ->
|
| 1392 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
1376 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 1393 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
1377 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 1394 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
1378 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 1395 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
1379 |
Set<Integer> fofoIds = new HashSet<>(pp.get(authUser.getId()));
|
| 1396 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
1380 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(x -> {
|
| 1397 |
try {
|
1381 |
try {
|
| 1398 |
return retailerService.getFofoRetailers(true).get(x);
|
1382 |
return retailerService.getFofoRetailers(true).get(x);
|
| 1399 |
} catch (ProfitMandiBusinessException e) {
|
1383 |
} catch (ProfitMandiBusinessException e) {
|
| 1400 |
// TODO Auto-generated catch block
|
1384 |
// TODO Auto-generated catch block
|
| 1401 |
return null;
|
1385 |
return null;
|
| 1402 |
}
|
1386 |
}
|
| 1403 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
1387 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 1404 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
1388 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 1405 |
}
|
1389 |
}
|
| 1406 |
}
|
1390 |
}
|
| 1407 |
|
1391 |
|
| 1408 |
model.addAttribute("isAdmin", isAdmin);
|
1392 |
model.addAttribute("isAdmin", isAdmin);
|
| 1409 |
model.addAttribute("isRBM", isRBM);
|
1393 |
model.addAttribute("isRBM", isRBM);
|
| Line 1479... |
Line 1463... |
| 1479 |
throws Exception {
|
1463 |
throws Exception {
|
| 1480 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1464 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1481 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
1465 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 1482 |
boolean isRBM = false;
|
1466 |
boolean isRBM = false;
|
| 1483 |
if (isAdmin) {
|
1467 |
if (isAdmin) {
|
| 1484 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
1468 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 1485 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
1469 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| 1486 |
isRBM = positions.stream()
|
1470 |
isRBM = positions.stream()
|
| 1487 |
.anyMatch(position ->
|
1471 |
.anyMatch(position ->
|
| 1488 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
1472 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId());
|
| 1489 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
1473 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| 1490 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
1474 |
if (isRBM && pp.containsKey(authUser.getId())) {
|
| 1491 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
1475 |
List<Integer> fofoIds = pp.get(authUser.getId());
|
| 1492 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(fofoId -> {
|
1476 |
Map<Integer, CustomRetailer> customRetailersMap = fofoIds.stream().map(fofoId -> {
|
| 1493 |
try {
|
1477 |
try {
|
| 1494 |
return retailerService.getFofoRetailers(true).get(fofoId);
|
1478 |
return retailerService.getFofoRetailers(true).get(fofoId);
|
| 1495 |
} catch (ProfitMandiBusinessException e) {
|
1479 |
} catch (ProfitMandiBusinessException e) {
|
| 1496 |
// TODO Auto-generated catch block
|
1480 |
// TODO Auto-generated catch block
|
| 1497 |
return null;
|
1481 |
return null;
|
| 1498 |
}
|
1482 |
}
|
| 1499 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
1483 |
}).filter(x -> x != null).collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 1500 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
1484 |
model.addAttribute("customRetailersMap", customRetailersMap);
|
| 1501 |
}
|
1485 |
}
|
| 1502 |
}
|
1486 |
}
|
| 1503 |
model.addAttribute("isRBM", isRBM);
|
1487 |
model.addAttribute("isRBM", isRBM);
|
| 1504 |
model.addAttribute("isAdmin", isAdmin);
|
1488 |
model.addAttribute("isAdmin", isAdmin);
|
| 1505 |
|
1489 |
|