| Line 65... |
Line 65... |
| 65 |
import java.util.stream.Collectors;
|
65 |
import java.util.stream.Collectors;
|
| 66 |
|
66 |
|
| 67 |
@Controller
|
67 |
@Controller
|
| 68 |
@Transactional(rollbackOn = Throwable.class)
|
68 |
@Transactional(rollbackOn = Throwable.class)
|
| 69 |
public class SchemeController {
|
69 |
public class SchemeController {
|
| 70 |
//LED TV
|
70 |
// LED TV
|
| 71 |
private static final List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.MOBILE_CATEGORY_ID, ProfitMandiConstants.TABLET_CATEGORY_ID, 14202);
|
71 |
private static final List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.MOBILE_CATEGORY_ID,
|
| - |
|
72 |
ProfitMandiConstants.TABLET_CATEGORY_ID, 14202);
|
| 72 |
|
73 |
|
| 73 |
private static final Logger LOGGER = LogManager.getLogger(SchemeController.class);
|
74 |
private static final Logger LOGGER = LogManager.getLogger(SchemeController.class);
|
| 74 |
|
75 |
|
| 75 |
@Autowired
|
76 |
@Autowired
|
| 76 |
private SchemeService schemeService;
|
77 |
private SchemeService schemeService;
|
| Line 156... |
Line 157... |
| 156 |
|
157 |
|
| 157 |
@Autowired
|
158 |
@Autowired
|
| 158 |
private CategoryRepository categoryRepository;
|
159 |
private CategoryRepository categoryRepository;
|
| 159 |
|
160 |
|
| 160 |
List<String> adminEmail = Arrays.asList("tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
161 |
List<String> adminEmail = Arrays.asList("tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
| 161 |
"amit.gupta@shop2020.in", "manish.tiwari@smartdukaan.com", "tejbeer.kaur@shop2020.in");
|
162 |
"amit.gupta@smartdukaan.com", "tejbeer.kaur@smartdukaan.com");
|
| 162 |
|
163 |
|
| 163 |
@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
|
164 |
@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
|
| 164 |
public String createScheme(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
165 |
public String createScheme(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 165 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
166 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 166 |
|
167 |
|
| Line 169... |
Line 170... |
| 169 |
model.addAttribute("month", month);
|
170 |
model.addAttribute("month", month);
|
| 170 |
|
171 |
|
| 171 |
// Map<Integer, String> itemIdItemDescriptionMap =
|
172 |
// Map<Integer, String> itemIdItemDescriptionMap =
|
| 172 |
// inventoryService.getAllItemIdItemDescriptionMap();
|
173 |
// inventoryService.getAllItemIdItemDescriptionMap();
|
| 173 |
// model.addAttribute("itemIdItemDescriptionMap", itemIdItemDescriptionMap);
|
174 |
// model.addAttribute("itemIdItemDescriptionMap", itemIdItemDescriptionMap);
|
| 174 |
//List<Category> categories = inventoryService.getAllCategories();
|
175 |
// List<Category> categories = inventoryService.getAllCategories();
|
| 175 |
List<Category> categories = categoryRepository.selectByIds(categoryIds);
|
176 |
List<Category> categories = categoryRepository.selectByIds(categoryIds);
|
| 176 |
categories = categories.stream().sorted(Comparator.comparing(Category::getId)).collect(Collectors.toList());
|
177 |
categories = categories.stream().sorted(Comparator.comparing(Category::getId)).collect(Collectors.toList());
|
| - |
|
178 |
// Set<String> brands =
|
| 177 |
//Set<String> brands = inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
|
179 |
// inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
|
| 178 |
//brands.addAll(inventoryService.getAllTagListingBrands(14206));
|
180 |
// brands.addAll(inventoryService.getAllTagListingBrands(14206));
|
| 179 |
|
181 |
|
| 180 |
boolean fullAccesss = this.getAccess(loginDetails.getEmailId());
|
182 |
boolean fullAccesss = this.getAccess(loginDetails.getEmailId());
|
| 181 |
|
183 |
|
| 182 |
model.addAttribute("fullAccesss", fullAccesss);
|
184 |
model.addAttribute("fullAccesss", fullAccesss);
|
| 183 |
|
185 |
|
| Line 208... |
Line 210... |
| 208 |
return fullAccesss;
|
210 |
return fullAccesss;
|
| 209 |
|
211 |
|
| 210 |
}
|
212 |
}
|
| 211 |
|
213 |
|
| 212 |
@RequestMapping(value = "/getCatalogDescriptionByBrands", method = RequestMethod.GET)
|
214 |
@RequestMapping(value = "/getCatalogDescriptionByBrands", method = RequestMethod.GET)
|
| 213 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId, @RequestParam List<String> brands, Model model) throws Exception {
|
215 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId,
|
| 214 |
Map<Integer, String> catalogIdItemDescriptionMap = inventoryService
|
216 |
@RequestParam List<String> brands, Model model) throws Exception {
|
| 215 |
.getModelDescriptionMap(categoryId, brands);
|
217 |
Map<Integer, String> catalogIdItemDescriptionMap = inventoryService.getModelDescriptionMap(categoryId, brands);
|
| 216 |
model.addAttribute("catalogIdItemDescriptionMap", catalogIdItemDescriptionMap);
|
218 |
model.addAttribute("catalogIdItemDescriptionMap", catalogIdItemDescriptionMap);
|
| 217 |
// model.addAttribute("brands", inventoryService.getAllBrands());
|
219 |
// model.addAttribute("brands", inventoryService.getAllBrands());
|
| 218 |
|
220 |
|
| 219 |
return "tag-listing-items-description";
|
221 |
return "tag-listing-items-description";
|
| 220 |
}
|
222 |
}
|
| 221 |
|
223 |
|
| 222 |
@RequestMapping(value = "/getBrandsByCategory", method = RequestMethod.GET)
|
224 |
@RequestMapping(value = "/getBrandsByCategory", method = RequestMethod.GET)
|
| 223 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId, Model model) throws Exception {
|
225 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId, Model model)
|
| 224 |
Set<String> brands = inventoryService
|
226 |
throws Exception {
|
| 225 |
.getAllTagListingBrands(categoryId);
|
227 |
Set<String> brands = inventoryService.getAllTagListingBrands(categoryId);
|
| 226 |
model.addAttribute("brands", brands);
|
228 |
model.addAttribute("brands", brands);
|
| 227 |
model.addAttribute("categoryId", categoryId);
|
229 |
model.addAttribute("categoryId", categoryId);
|
| 228 |
|
230 |
|
| 229 |
return "tag-listing-brands";
|
231 |
return "tag-listing-brands";
|
| 230 |
}
|
232 |
}
|
| Line 468... |
Line 470... |
| 468 |
} catch (Exception e) {
|
470 |
} catch (Exception e) {
|
| 469 |
LOGGER.info("Scheme already exist");
|
471 |
LOGGER.info("Scheme already exist");
|
| 470 |
}
|
472 |
}
|
| 471 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
473 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 472 |
} else {
|
474 |
} else {
|
| - |
|
475 |
throw new ProfitMandiBusinessException("Catalog exist for scheme",
|
| 473 |
throw new ProfitMandiBusinessException("Catalog exist for scheme", "SchemeId= " + schemeId + ", CatalogId= " + catalogId, "Catalog exist for scheme");
|
476 |
"SchemeId= " + schemeId + ", CatalogId= " + catalogId, "Catalog exist for scheme");
|
| 474 |
}
|
477 |
}
|
| 475 |
}
|
478 |
}
|
| 476 |
}
|
479 |
}
|
| 477 |
return "response";
|
480 |
return "response";
|
| 478 |
}
|
481 |
}
|
| 479 |
|
482 |
|
| 480 |
@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
|
483 |
@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
|
| 481 |
public String deleteShcemes(HttpServletRequest request,
|
484 |
public String deleteShcemes(HttpServletRequest request,
|
| 482 |
@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
|
485 |
@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
|
| 483 |
@RequestParam(name = "catalogId", required = false, defaultValue = "0") int catalogId, Model model)
|
486 |
@RequestParam(name = "catalogId", required = false, defaultValue = "0") int catalogId, Model model)
|
| 484 |
throws Exception {
|
487 |
throws Exception {
|
| 485 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
488 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 486 |
if (schemeId > 0 && catalogId > 0) {
|
489 |
if (schemeId > 0 && catalogId > 0) {
|
| 487 |
schemeItemRepository.deleteByCatalogIdsAndSchemeIds(catalogId, schemeId);
|
490 |
schemeItemRepository.deleteByCatalogIdsAndSchemeIds(catalogId, schemeId);
|
| 488 |
|
491 |
|
| Line 514... |
Line 517... |
| 514 |
}
|
517 |
}
|
| 515 |
|
518 |
|
| 516 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
519 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
| 517 |
public String extendSchemeById(HttpServletRequest request,
|
520 |
public String extendSchemeById(HttpServletRequest request,
|
| 518 |
|
521 |
|
| 519 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
522 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 520 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
523 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
| 521 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
|
524 |
extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
|
| 522 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
525 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
| 523 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
526 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
| 524 |
scheme.setEndDateTime(extendDatetime);
|
527 |
scheme.setEndDateTime(extendDatetime);
|
| 525 |
schemeRepository.persist(scheme);
|
528 |
schemeRepository.persist(scheme);
|
| Line 529... |
Line 532... |
| 529 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
532 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 530 |
return "response";
|
533 |
return "response";
|
| 531 |
}
|
534 |
}
|
| 532 |
|
535 |
|
| 533 |
@RequestMapping(value = "/createScheme", method = RequestMethod.POST)
|
536 |
@RequestMapping(value = "/createScheme", method = RequestMethod.POST)
|
| 534 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest, Model model)
|
537 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest,
|
| 535 |
throws ProfitMandiBusinessException {
|
538 |
Model model) throws ProfitMandiBusinessException {
|
| 536 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
539 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 537 |
LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
|
540 |
LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
|
| 538 |
schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
|
541 |
schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
|
| 539 |
return getDefaultSchemes(request, model);
|
542 |
return getDefaultSchemes(request, model);
|
| 540 |
}
|
543 |
}
|
| Line 552... |
Line 555... |
| 552 |
}
|
555 |
}
|
| 553 |
}
|
556 |
}
|
| 554 |
return schemes;
|
557 |
return schemes;
|
| 555 |
}
|
558 |
}
|
| 556 |
|
559 |
|
| 557 |
//Show 20 recents
|
560 |
// Show 20 recents
|
| 558 |
@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
|
561 |
@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
|
| 559 |
public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
562 |
public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 560 |
@RequestParam(required = false) LocalDate date,
|
563 |
@RequestParam(required = false) LocalDate date,
|
| 561 |
@RequestParam(name = "limit", required = false, defaultValue = "30") int limit,
|
564 |
@RequestParam(name = "limit", required = false, defaultValue = "30") int limit,
|
| 562 |
@RequestParam(name = "searchModel", required = false, defaultValue = "0") int searchModel,
|
565 |
@RequestParam(name = "searchModel", required = false, defaultValue = "0") int searchModel,
|
| 563 |
@RequestParam(name = "searchScheme", required = false, defaultValue = "0") int searchScheme,
|
566 |
@RequestParam(name = "searchScheme", required = false, defaultValue = "0") int searchScheme,
|
| 564 |
@RequestParam(name = "partnerType", required = false, defaultValue = "ALL") PartnerType partnerType,
|
567 |
@RequestParam(name = "partnerType", required = false, defaultValue = "ALL") PartnerType partnerType,
|
| 565 |
@RequestParam(name = "searchImei", required = false, defaultValue = "") String searchImei, Model model)
|
568 |
@RequestParam(name = "searchImei", required = false, defaultValue = "") String searchImei, Model model)
|
| 566 |
throws ProfitMandiBusinessException {
|
569 |
throws ProfitMandiBusinessException {
|
| 567 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
570 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 568 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
571 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 569 |
if (date != null) {
|
572 |
if (date != null) {
|
| 570 |
date = date.isAfter(LocalDate.now()) ? LocalDate.now() : date;
|
573 |
date = date.isAfter(LocalDate.now()) ? LocalDate.now() : date;
|
| Line 602... |
Line 605... |
| 602 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
605 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
| 603 |
model.addAttribute("mop", tagListing.getMop());
|
606 |
model.addAttribute("mop", tagListing.getMop());
|
| 604 |
}
|
607 |
}
|
| 605 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
608 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
| 606 |
if (isAdmin) {
|
609 |
if (isAdmin) {
|
| - |
|
610 |
schemes = schemeService
|
| 607 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit)
|
611 |
.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit).stream()
|
| 608 |
.stream().filter(x -> x.getId() != 411 && x.getId() != 612).collect(Collectors.toList());
|
612 |
.filter(x -> x.getId() != 411 && x.getId() != 612).collect(Collectors.toList());
|
| 609 |
// Remove 411 and 612
|
613 |
// Remove 411 and 612
|
| 610 |
this.setSchemeAmountModel(schemes);
|
614 |
this.setSchemeAmountModel(schemes);
|
| 611 |
model.addAttribute("schemes", schemes);
|
615 |
model.addAttribute("schemes", schemes);
|
| 612 |
// For 7720(HR) remove investment
|
616 |
// For 7720(HR) remove investment
|
| 613 |
//int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing, searchModel);
|
617 |
// int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing,
|
| - |
|
618 |
// searchModel);
|
| 614 |
//model.addAttribute("nlc", Math.round(nlc));
|
619 |
// model.addAttribute("nlc", Math.round(nlc));
|
| 615 |
return "schemes";
|
620 |
return "schemes";
|
| 616 |
} else {
|
621 |
} else {
|
| 617 |
partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), date);
|
622 |
partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), date);
|
| - |
|
623 |
schemes = schemeService
|
| 618 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit)
|
624 |
.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit).stream()
|
| 619 |
.stream().filter(x -> {
|
625 |
.filter(x -> {
|
| 620 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
626 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
| 621 |
}).collect(Collectors.toList());
|
627 |
}).collect(Collectors.toList());
|
| 622 |
// Remove 411 and 612
|
628 |
// Remove 411 and 612
|
| 623 |
//this.setSchemeAmountModel(schemes);
|
629 |
// this.setSchemeAmountModel(schemes);
|
| 624 |
int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing);
|
630 |
int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing);
|
| 625 |
// For 7720(HR) remove investment
|
631 |
// For 7720(HR) remove investment
|
| 626 |
model.addAttribute("schemes", schemes);
|
632 |
model.addAttribute("schemes", schemes);
|
| 627 |
model.addAttribute("nlc", Math.round(nlc));
|
633 |
model.addAttribute("nlc", Math.round(nlc));
|
| 628 |
|
634 |
|
| 629 |
Map<Integer, Map<Integer, Long>> offerSlabPayoutMap = new HashMap<>();
|
635 |
Map<Integer, Map<Integer, Long>> offerSlabPayoutMap = new HashMap<>();
|
| 630 |
List<CreateOfferRequest> offers = offerService.getPublishedOffers(date, loginDetails.getFofoId(), searchModel);
|
636 |
List<CreateOfferRequest> offers = offerService.getPublishedOffers(date, loginDetails.getFofoId(),
|
| - |
|
637 |
searchModel);
|
| 631 |
if (offers.size() > 0) {
|
638 |
if (offers.size() > 0) {
|
| 632 |
for (CreateOfferRequest createOfferRequest : offers) {
|
639 |
for (CreateOfferRequest createOfferRequest : offers) {
|
| 633 |
Map<Integer, Map<Integer, Long>> catalogSlabPayoutMap = offerService
|
640 |
Map<Integer, Map<Integer, Long>> catalogSlabPayoutMap = offerService
|
| 634 |
.getSlabPayoutMap(createOfferRequest);
|
641 |
.getSlabPayoutMap(createOfferRequest);
|
| 635 |
Map<Integer, Long> slabPayoutMap = catalogSlabPayoutMap.get(searchModel);
|
642 |
Map<Integer, Long> slabPayoutMap = catalogSlabPayoutMap.get(searchModel);
|
| Line 695... |
Line 702... |
| 695 |
return "schemes";
|
702 |
return "schemes";
|
| 696 |
} else {
|
703 |
} else {
|
| 697 |
if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
704 |
if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| 698 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
705 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
| 699 |
loginDetails.getFofoId());
|
706 |
loginDetails.getFofoId());
|
| 700 |
List<PriceDropIMEI> priceDropImeis = priceDropIMEIRepository.selectByFofoIdImei(loginDetails.getFofoId(), searchImei);
|
707 |
List<PriceDropIMEI> priceDropImeis = priceDropIMEIRepository
|
| - |
|
708 |
.selectByFofoIdImei(loginDetails.getFofoId(), searchImei);
|
| 701 |
if (priceDropImeis.size() > 0) {
|
709 |
if (priceDropImeis.size() > 0) {
|
| 702 |
|
710 |
|
| 703 |
for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
|
711 |
for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
|
| 704 |
int priceDropId = priceDropIMEI.getPriceDropId();
|
712 |
int priceDropId = priceDropIMEI.getPriceDropId();
|
| 705 |
PriceDrop pd = priceDropRepository.selectById(priceDropId);
|
713 |
PriceDrop pd = priceDropRepository.selectById(priceDropId);
|
| Line 777... |
Line 785... |
| 777 |
.selectLastMonthPurchaseInMarginByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
785 |
.selectLastMonthPurchaseInMarginByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
| 778 |
|
786 |
|
| 779 |
List<LastMonthCreditedIncomeModel> lastMonthFrontEndIncomes = schemeInOutRepository
|
787 |
List<LastMonthCreditedIncomeModel> lastMonthFrontEndIncomes = schemeInOutRepository
|
| 780 |
.selectFrontIncomeByBrand(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
788 |
.selectFrontIncomeByBrand(loginDetails.getFofoId(), currentStartMonth, currentDate);
|
| 781 |
|
789 |
|
| 782 |
|
- |
|
| 783 |
Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = schemeInOutRepository
|
790 |
Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = schemeInOutRepository
|
| 784 |
.selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate).stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
791 |
.selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate).stream()
|
| 785 |
|
- |
|
| - |
|
792 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
| 786 |
|
793 |
|
| 787 |
LOGGER.info("lastMonthCreditedIncomeModels" + lastMonthCreditedIncomeModels);
|
794 |
LOGGER.info("lastMonthCreditedIncomeModels" + lastMonthCreditedIncomeModels);
|
| 788 |
LOGGER.info("lastMonthFrontEndIncomes" + lastMonthFrontEndIncomes);
|
795 |
LOGGER.info("lastMonthFrontEndIncomes" + lastMonthFrontEndIncomes);
|
| 789 |
LOGGER.info("lastMonthPurchaseInMargins" + lastMonthPurchaseInMargins);
|
796 |
LOGGER.info("lastMonthPurchaseInMargins" + lastMonthPurchaseInMargins);
|
| 790 |
LOGGER.info("lastMonthCategoryUpgradeMarginMap" + lastMonthCategoryUpgradeMarginMap);
|
797 |
LOGGER.info("lastMonthCategoryUpgradeMarginMap" + lastMonthCategoryUpgradeMarginMap);
|
| 791 |
|
798 |
|
| 792 |
Map<String, LastMonthCreditedIncomeModel> lastMonthPurchaseInMarginMap = new HashMap<>();
|
799 |
Map<String, LastMonthCreditedIncomeModel> lastMonthPurchaseInMarginMap = new HashMap<>();
|
| 793 |
|
800 |
|
| 794 |
|
- |
|
| 795 |
lastMonthPurchaseInMarginMap = lastMonthPurchaseInMargins.stream()
|
801 |
lastMonthPurchaseInMarginMap = lastMonthPurchaseInMargins.stream()
|
| 796 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
802 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
| 797 |
|
803 |
|
| 798 |
Map<String, LastMonthCreditedIncomeModel> lastMonthSaleMarginMap = lastMonthCreditedIncomeModels.stream()
|
804 |
Map<String, LastMonthCreditedIncomeModel> lastMonthSaleMarginMap = lastMonthCreditedIncomeModels.stream()
|
| 799 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
805 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
| Line 884... |
Line 890... |
| 884 |
return "last-month-credited-income";
|
890 |
return "last-month-credited-income";
|
| 885 |
}
|
891 |
}
|
| 886 |
|
892 |
|
| 887 |
@RequestMapping(value = "/getLastMonthImeiWiseIncome", method = RequestMethod.GET)
|
893 |
@RequestMapping(value = "/getLastMonthImeiWiseIncome", method = RequestMethod.GET)
|
| 888 |
public String getLastMonthImeiWiseIncome(HttpServletRequest request,
|
894 |
public String getLastMonthImeiWiseIncome(HttpServletRequest request,
|
| 889 |
@RequestParam(name = "catalogItemId", required = false, defaultValue = "") int catalogItemId,
|
895 |
@RequestParam(name = "catalogItemId", required = false, defaultValue = "") int catalogItemId,
|
| 890 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
896 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 891 |
throws Exception {
|
897 |
throws Exception {
|
| 892 |
|
898 |
|
| 893 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
899 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 894 |
|
900 |
|
| 895 |
LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
901 |
LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
| Line 927... |
Line 933... |
| 927 |
List<LastMonthImeiModel> lastMonthPurchaseInImeis = schemeInOutRepository
|
933 |
List<LastMonthImeiModel> lastMonthPurchaseInImeis = schemeInOutRepository
|
| 928 |
.selectLastMonthPurchaseInByImei(loginDetails.getFofoId(), allImeiList);
|
934 |
.selectLastMonthPurchaseInByImei(loginDetails.getFofoId(), allImeiList);
|
| 929 |
List<LastMonthImeiModel> lastMonthCreditedImeis = schemeInOutRepository
|
935 |
List<LastMonthImeiModel> lastMonthCreditedImeis = schemeInOutRepository
|
| 930 |
.selectLastMonthCreditedByImei(loginDetails.getFofoId(), allImeiList);
|
936 |
.selectLastMonthCreditedByImei(loginDetails.getFofoId(), allImeiList);
|
| 931 |
|
937 |
|
| 932 |
|
- |
|
| 933 |
LOGGER.info("lastMonthFrontEndImei {}", lastMonthFrontEndImeis);
|
938 |
LOGGER.info("lastMonthFrontEndImei {}", lastMonthFrontEndImeis);
|
| 934 |
LOGGER.info("lastMonthPurchaseInImei {}", lastMonthPurchaseInImeis);
|
939 |
LOGGER.info("lastMonthPurchaseInImei {}", lastMonthPurchaseInImeis);
|
| 935 |
LOGGER.info("lastMonthCreditedImei {}", lastMonthCreditedImeis);
|
940 |
LOGGER.info("lastMonthCreditedImei {}", lastMonthCreditedImeis);
|
| 936 |
|
941 |
|
| 937 |
Map<String, Float> imeiWisePendingSaleAmount = lastMonthCreditedImeis.stream().filter(x -> x.getStatus().equals(SchemePayoutStatus.PENDING)).collect(Collectors.toMap(x -> x.getImei(), x -> x.getPendingSaleAmount()));
|
942 |
Map<String, Float> imeiWisePendingSaleAmount = lastMonthCreditedImeis.stream()
|
| 938 |
|
- |
|
| - |
|
943 |
.filter(x -> x.getStatus().equals(SchemePayoutStatus.PENDING))
|
| - |
|
944 |
.collect(Collectors.toMap(x -> x.getImei(), x -> x.getPendingSaleAmount()));
|
| 939 |
|
945 |
|
| 940 |
Map<IncomeImeiDate, Map<String, Double>> lastMonthPurchaseInMapPairMap = lastMonthPurchaseInImeis.stream()
|
946 |
Map<IncomeImeiDate, Map<String, Double>> lastMonthPurchaseInMapPairMap = lastMonthPurchaseInImeis.stream()
|
| 941 |
.collect(Collectors.groupingBy(x -> new IncomeImeiDate(x.getImei(), x.getCreateTimeStamp()),
|
947 |
.collect(Collectors.groupingBy(x -> new IncomeImeiDate(x.getImei(), x.getCreateTimeStamp()),
|
| 942 |
Collectors.groupingBy(x -> x.getDescription(), Collectors.summingDouble(x -> x.getAmount()))));
|
948 |
Collectors.groupingBy(x -> x.getDescription(), Collectors.summingDouble(x -> x.getAmount()))));
|
| 943 |
|
949 |
|
| Line 1033... |
Line 1039... |
| 1033 |
return "last-month-imei-wise-income";
|
1039 |
return "last-month-imei-wise-income";
|
| 1034 |
}
|
1040 |
}
|
| 1035 |
|
1041 |
|
| 1036 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
1042 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
| 1037 |
public String getBrandWiseIncome(HttpServletRequest request,
|
1043 |
public String getBrandWiseIncome(HttpServletRequest request,
|
| 1038 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
1044 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
| 1039 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
1045 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
| 1040 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
1046 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 1041 |
throws ProfitMandiBusinessException {
|
1047 |
throws ProfitMandiBusinessException {
|
| 1042 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1048 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1043 |
LOGGER.info("loginDetails {}", loginDetails);
|
1049 |
LOGGER.info("loginDetails {}", loginDetails);
|
| 1044 |
LOGGER.info("brand" + brand);
|
1050 |
LOGGER.info("brand" + brand);
|
| 1045 |
LOGGER.info("month {}", month);
|
1051 |
LOGGER.info("month {}", month);
|
| 1046 |
|
1052 |
|
| 1047 |
LocalDateTime monthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
1053 |
LocalDateTime monthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
| 1048 |
LocalDateTime monthEnd = monthStart.plusMonths(1);
|
1054 |
LocalDateTime monthEnd = monthStart.plusMonths(1);
|
| 1049 |
|
1055 |
|
| 1050 |
boolean partnerTypeUpgraded = partnerTypeChangeService.isPartnerTypeUpgraded(loginDetails.getFofoId(), YearMonth.now());
|
1056 |
boolean partnerTypeUpgraded = partnerTypeChangeService.isPartnerTypeUpgraded(loginDetails.getFofoId(),
|
| - |
|
1057 |
YearMonth.now());
|
| 1051 |
|
1058 |
|
| 1052 |
LOGGER.info("partnerType" + partnerTypeUpgraded);
|
1059 |
LOGGER.info("partnerType" + partnerTypeUpgraded);
|
| 1053 |
|
1060 |
|
| 1054 |
Map<String, Double> categoryUpgradeBrandModelMap = null;
|
1061 |
Map<String, Double> categoryUpgradeBrandModelMap = null;
|
| 1055 |
if (partnerTypeUpgraded) {
|
1062 |
if (partnerTypeUpgraded) {
|
| Line 1057... |
Line 1064... |
| 1057 |
.selectLastMonthCategoryUpgradeMarginByBrandModel(loginDetails.getFofoId(), brand, monthStart,
|
1064 |
.selectLastMonthCategoryUpgradeMarginByBrandModel(loginDetails.getFofoId(), brand, monthStart,
|
| 1058 |
monthEnd)
|
1065 |
monthEnd)
|
| 1059 |
.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getAmount()));
|
1066 |
.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getAmount()));
|
| 1060 |
}
|
1067 |
}
|
| 1061 |
|
1068 |
|
| 1062 |
List<LastMonthFrontEndBrandWiseIncome> modelWiseSalesMargins = schemeInOutRepository.selectFrontIncomeBrandWise(loginDetails.getFofoId(), brand,
|
1069 |
List<LastMonthFrontEndBrandWiseIncome> modelWiseSalesMargins = schemeInOutRepository
|
| 1063 |
monthStart, monthEnd);
|
- |
|
| 1064 |
|
- |
|
| 1065 |
List<LastMonthBrandWiseIncomeModel> modelWiseSchemeOutMargins = schemeInOutRepository.selectLastMonthBrandWiseIncome(loginDetails.getFofoId(),
|
- |
|
| 1066 |
brand, monthStart, monthEnd);
|
1070 |
.selectFrontIncomeBrandWise(loginDetails.getFofoId(), brand, monthStart, monthEnd);
|
| 1067 |
Map<Integer, LastMonthBrandWiseIncomeModel> modelWiseSchemeOutMarginsMap = modelWiseSchemeOutMargins.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x));
|
- |
|
| 1068 |
|
- |
|
| 1069 |
|
1071 |
|
| 1070 |
List<LastMonthBrandWiseIncomeModel> modelWiseSchemeInMargins = schemeInOutRepository.selectLastMonthPurchaseBrandWiseIncome(
|
1072 |
List<LastMonthBrandWiseIncomeModel> modelWiseSchemeOutMargins = schemeInOutRepository
|
| 1071 |
loginDetails.getFofoId(), brand, monthStart, monthEnd);
|
1073 |
.selectLastMonthBrandWiseIncome(loginDetails.getFofoId(), brand, monthStart, monthEnd);
|
| - |
|
1074 |
Map<Integer, LastMonthBrandWiseIncomeModel> modelWiseSchemeOutMarginsMap = modelWiseSchemeOutMargins.stream()
|
| - |
|
1075 |
.collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x));
|
| - |
|
1076 |
|
| - |
|
1077 |
List<LastMonthBrandWiseIncomeModel> modelWiseSchemeInMargins = schemeInOutRepository
|
| - |
|
1078 |
.selectLastMonthPurchaseBrandWiseIncome(loginDetails.getFofoId(), brand, monthStart, monthEnd);
|
| 1072 |
Map<Integer, LastMonthBrandWiseIncomeModel> modelWiseSchemeInMarginsMap = modelWiseSchemeInMargins.stream().collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x));
|
1079 |
Map<Integer, LastMonthBrandWiseIncomeModel> modelWiseSchemeInMarginsMap = modelWiseSchemeInMargins.stream()
|
| - |
|
1080 |
.collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x));
|
| 1073 |
|
1081 |
|
| 1074 |
Map<Integer, Double> modelTotalIncomeMap = new HashMap<>();
|
1082 |
Map<Integer, Double> modelTotalIncomeMap = new HashMap<>();
|
| 1075 |
Map<Integer, String> modelNameMap = new HashMap<>();
|
1083 |
Map<Integer, String> modelNameMap = new HashMap<>();
|
| 1076 |
|
1084 |
|
| 1077 |
modelWiseSchemeOutMargins.stream().forEach(x -> {
|
1085 |
modelWiseSchemeOutMargins.stream().forEach(x -> {
|
| Line 1096... |
Line 1104... |
| 1096 |
|
1104 |
|
| 1097 |
}
|
1105 |
}
|
| 1098 |
LastMonthBrandWiseIncomeModel lmbwIncomeModel = modelWiseSchemeOutMarginsMap.get(x.getCatalogItemId());
|
1106 |
LastMonthBrandWiseIncomeModel lmbwIncomeModel = modelWiseSchemeOutMarginsMap.get(x.getCatalogItemId());
|
| 1099 |
lmbwIncomeModel.setQty(x.getQty());
|
1107 |
lmbwIncomeModel.setQty(x.getQty());
|
| 1100 |
lmbwIncomeModel.setAmount(lmbwIncomeModel.getAmount() + x.getAmount());
|
1108 |
lmbwIncomeModel.setAmount(lmbwIncomeModel.getAmount() + x.getAmount());
|
| - |
|
1109 |
modelTotalIncomeMap.put(x.getCatalogItemId(),
|
| 1101 |
modelTotalIncomeMap.put(x.getCatalogItemId(), modelTotalIncomeMap.get(x.getCatalogItemId()) + x.getAmount());
|
1110 |
modelTotalIncomeMap.get(x.getCatalogItemId()) + x.getAmount());
|
| 1102 |
modelNameMap.put(x.getCatalogItemId(), (x.getModelNumber() + x.getModelName()).trim());
|
1111 |
modelNameMap.put(x.getCatalogItemId(), (x.getModelNumber() + x.getModelName()).trim());
|
| 1103 |
totalModel.setQty(totalModel.getQty() + x.getQty());
|
1112 |
totalModel.setQty(totalModel.getQty() + x.getQty());
|
| 1104 |
totalModel.setAmount(totalModel.getAmount() + lmbwIncomeModel.getAmount());
|
1113 |
totalModel.setAmount(totalModel.getAmount() + lmbwIncomeModel.getAmount());
|
| 1105 |
totalModel.setPendingSaleAmount(totalModel.getPendingSaleAmount());
|
1114 |
totalModel.setPendingSaleAmount(totalModel.getPendingSaleAmount());
|
| 1106 |
|
1115 |
|
| 1107 |
});
|
1116 |
});
|
| 1108 |
modelWiseSchemeInMargins.stream().forEach(x -> {
|
1117 |
modelWiseSchemeInMargins.stream().forEach(x -> {
|
| 1109 |
if (!modelTotalIncomeMap.containsKey(x.getCatalogItemId())) {
|
1118 |
if (!modelTotalIncomeMap.containsKey(x.getCatalogItemId())) {
|
| 1110 |
modelTotalIncomeMap.put(x.getCatalogItemId(), 0d);
|
1119 |
modelTotalIncomeMap.put(x.getCatalogItemId(), 0d);
|
| 1111 |
}
|
1120 |
}
|
| - |
|
1121 |
modelTotalIncomeMap.put(x.getCatalogItemId(),
|
| 1112 |
modelTotalIncomeMap.put(x.getCatalogItemId(), modelTotalIncomeMap.get(x.getCatalogItemId()) + x.getAmount());
|
1122 |
modelTotalIncomeMap.get(x.getCatalogItemId()) + x.getAmount());
|
| 1113 |
modelNameMap.put(x.getCatalogItemId(), (x.getModelNumber() + x.getModelName()).trim());
|
1123 |
modelNameMap.put(x.getCatalogItemId(), (x.getModelNumber() + x.getModelName()).trim());
|
| 1114 |
totalModel.setQty(totalModel.getQty() + x.getQty());
|
1124 |
totalModel.setQty(totalModel.getQty() + x.getQty());
|
| 1115 |
totalModel.setAmount(totalModel.getAmount() + x.getAmount());
|
1125 |
totalModel.setAmount(totalModel.getAmount() + x.getAmount());
|
| 1116 |
|
1126 |
|
| 1117 |
});
|
1127 |
});
|
| Line 1221... |
Line 1231... |
| 1221 |
LOGGER.info("lastMonthSaleMarginMap {}", lastMonthSaleMarginMap);
|
1231 |
LOGGER.info("lastMonthSaleMarginMap {}", lastMonthSaleMarginMap);
|
| 1222 |
|
1232 |
|
| 1223 |
return "last-month-credited-income";
|
1233 |
return "last-month-credited-income";
|
| 1224 |
}
|
1234 |
}
|
| 1225 |
|
1235 |
|
| 1226 |
|
- |
|
| 1227 |
@RequestMapping(value = "/schemes/downloadPage", method = RequestMethod.GET)
|
1236 |
@RequestMapping(value = "/schemes/downloadPage", method = RequestMethod.GET)
|
| 1228 |
public String downloadPage(HttpServletRequest request, Model model) {
|
1237 |
public String downloadPage(HttpServletRequest request, Model model) {
|
| 1229 |
return "schemes-download";
|
1238 |
return "schemes-download";
|
| 1230 |
}
|
1239 |
}
|
| 1231 |
|
1240 |
|
| 1232 |
@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
|
1241 |
@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
|
| 1233 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
1242 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
| 1234 |
@RequestParam LocalDateTime startDateTime,
|
- |
|
| 1235 |
@RequestParam LocalDateTime endDateTime)
|
1243 |
@RequestParam LocalDateTime startDateTime, @RequestParam LocalDateTime endDateTime)
|
| 1236 |
throws ProfitMandiBusinessException {
|
1244 |
throws ProfitMandiBusinessException {
|
| 1237 |
|
1245 |
|
| 1238 |
List<SchemeModel> schemeModels = schemeService.getAllSchemeModels(startDateTime, endDateTime);
|
1246 |
List<SchemeModel> schemeModels = schemeService.getAllSchemeModels(startDateTime, endDateTime);
|
| 1239 |
|
1247 |
|
| 1240 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
1248 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| Line 1249... |
Line 1257... |
| 1249 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
1257 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 1250 |
}
|
1258 |
}
|
| 1251 |
|
1259 |
|
| 1252 |
@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
|
1260 |
@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
|
| 1253 |
public String getSchemeById(HttpServletRequest request,
|
1261 |
public String getSchemeById(HttpServletRequest request,
|
| 1254 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
|
1262 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
|
| 1255 |
throws ProfitMandiBusinessException {
|
1263 |
throws ProfitMandiBusinessException {
|
| 1256 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1264 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1257 |
|
1265 |
|
| 1258 |
boolean fullAccess = this.getAccess(loginDetails.getEmailId());
|
1266 |
boolean fullAccess = this.getAccess(loginDetails.getEmailId());
|
| 1259 |
Scheme scheme = schemeService.getSchemeById(schemeId);
|
1267 |
Scheme scheme = schemeService.getSchemeById(schemeId);
|
| Line 1263... |
Line 1271... |
| 1263 |
return "scheme-details";
|
1271 |
return "scheme-details";
|
| 1264 |
}
|
1272 |
}
|
| 1265 |
|
1273 |
|
| 1266 |
@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
|
1274 |
@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
|
| 1267 |
public String activeSchemeById(HttpServletRequest request,
|
1275 |
public String activeSchemeById(HttpServletRequest request,
|
| 1268 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
1276 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 1269 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1277 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1270 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1278 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1271 |
throws ProfitMandiBusinessException {
|
1279 |
throws ProfitMandiBusinessException {
|
| 1272 |
schemeService.activeSchemeById(schemeId);
|
1280 |
schemeService.activeSchemeById(schemeId);
|
| 1273 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
1281 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 1274 |
for (Scheme scheme : schemes) {
|
1282 |
for (Scheme scheme : schemes) {
|
| 1275 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
1283 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| Line 1281... |
Line 1289... |
| 1281 |
return "schemes";
|
1289 |
return "schemes";
|
| 1282 |
}
|
1290 |
}
|
| 1283 |
|
1291 |
|
| 1284 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
1292 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
| 1285 |
public String expireSchemeById(HttpServletRequest request,
|
1293 |
public String expireSchemeById(HttpServletRequest request,
|
| 1286 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
1294 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 1287 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
|
1295 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
|
| 1288 |
Model model)
|
- |
|
| 1289 |
throws ProfitMandiBusinessException {
|
1296 |
throws ProfitMandiBusinessException {
|
| 1290 |
expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), Utils.MAX_TIME);
|
1297 |
expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), Utils.MAX_TIME);
|
| 1291 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
1298 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
| 1292 |
return getDefaultSchemes(request, model);
|
1299 |
return getDefaultSchemes(request, model);
|
| 1293 |
}
|
1300 |
}
|
| 1294 |
|
1301 |
|
| 1295 |
@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
|
1302 |
@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
|
| 1296 |
public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
|
1303 |
public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
|
| 1297 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1304 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1298 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1305 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1299 |
throws ProfitMandiBusinessException {
|
1306 |
throws ProfitMandiBusinessException {
|
| 1300 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1307 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1301 |
return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
|
1308 |
return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
|
| 1302 |
}
|
1309 |
}
|
| 1303 |
|
1310 |
|
| 1304 |
|
- |
|
| 1305 |
@RequestMapping(value = "/getCustomerOffer", method = RequestMethod.GET)
|
1311 |
@RequestMapping(value = "/getCustomerOffer", method = RequestMethod.GET)
|
| 1306 |
public String getCustomerOffer(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
1312 |
public String getCustomerOffer(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 1307 |
|
1313 |
|
| 1308 |
List<CustomerOffer> customerOffers = customerOfferRepository.selectAll();
|
1314 |
List<CustomerOffer> customerOffers = customerOfferRepository.selectAll();
|
| 1309 |
|
1315 |
|
| Line 1312... |
Line 1318... |
| 1312 |
|
1318 |
|
| 1313 |
}
|
1319 |
}
|
| 1314 |
|
1320 |
|
| 1315 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
1321 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
| 1316 |
public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
|
1322 |
public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
|
| 1317 |
@RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
|
1323 |
@RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
|
| 1318 |
|
1324 |
|
| 1319 |
CustomerOffer co = new CustomerOffer();
|
1325 |
CustomerOffer co = new CustomerOffer();
|
| 1320 |
co.setOfferName(offerName);
|
1326 |
co.setOfferName(offerName);
|
| 1321 |
co.setStartDate(startDate);
|
1327 |
co.setStartDate(startDate);
|
| 1322 |
co.setEndDate(endDate);
|
1328 |
co.setEndDate(endDate);
|
| Line 1348... |
Line 1354... |
| 1348 |
|
1354 |
|
| 1349 |
}
|
1355 |
}
|
| 1350 |
|
1356 |
|
| 1351 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
1357 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
| 1352 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
1358 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
| 1353 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
1359 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
| 1354 |
|
1360 |
|
| 1355 |
List<CSVRecord> records = FileUtil.readFile(file);
|
1361 |
List<CSVRecord> records = FileUtil.readFile(file);
|
| 1356 |
|
1362 |
|
| 1357 |
for (CSVRecord record : records) {
|
1363 |
for (CSVRecord record : records) {
|
| 1358 |
if (Integer.parseInt(record.get(0)) == 0) {
|
1364 |
if (Integer.parseInt(record.get(0)) == 0) {
|
| Line 1406... |
Line 1412... |
| 1406 |
|
1412 |
|
| 1407 |
}
|
1413 |
}
|
| 1408 |
|
1414 |
|
| 1409 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
1415 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
| 1410 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
1416 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
| 1411 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
1417 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| 1412 |
|
1418 |
|
| 1413 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
1419 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
| 1414 |
co.setEndDate(endDate);
|
1420 |
co.setEndDate(endDate);
|
| 1415 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
1421 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
| 1416 |
|
1422 |
|
| Line 1454... |
Line 1460... |
| 1454 |
model.addAttribute("suo", suo);
|
1460 |
model.addAttribute("suo", suo);
|
| 1455 |
return "samsung-upgrade-offer-index";
|
1461 |
return "samsung-upgrade-offer-index";
|
| 1456 |
|
1462 |
|
| 1457 |
}
|
1463 |
}
|
| 1458 |
|
1464 |
|
| 1459 |
|
- |
|
| 1460 |
}
|
1465 |
}
|
| 1461 |
|
1466 |
|