| Line 114... |
Line 114... |
| 114 |
|
114 |
|
| 115 |
@Autowired
|
115 |
@Autowired
|
| 116 |
private FofoStoreRepository fofoStoreRepository;
|
116 |
private FofoStoreRepository fofoStoreRepository;
|
| 117 |
|
117 |
|
| 118 |
@Autowired
|
118 |
@Autowired
|
| - |
|
119 |
private OfferPayoutRepository offerPayoutRepository;
|
| - |
|
120 |
|
| - |
|
121 |
@Autowired
|
| 119 |
private RetailerService retailerService;
|
122 |
private RetailerService retailerService;
|
| 120 |
|
123 |
|
| 121 |
@Autowired
|
124 |
@Autowired
|
| 122 |
private Mongo mongoClient;
|
125 |
private Mongo mongoClient;
|
| 123 |
|
126 |
|
| Line 210... |
Line 213... |
| 210 |
|
213 |
|
| 211 |
}
|
214 |
}
|
| 212 |
|
215 |
|
| 213 |
@RequestMapping(value = "/getCatalogDescriptionByBrands", method = RequestMethod.GET)
|
216 |
@RequestMapping(value = "/getCatalogDescriptionByBrands", method = RequestMethod.GET)
|
| 214 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId,
|
217 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId,
|
| 215 |
@RequestParam List<String> brands, Model model) throws Exception {
|
218 |
@RequestParam List<String> brands, Model model) throws Exception {
|
| 216 |
Map<Integer, String> catalogIdItemDescriptionMap = inventoryService.getModelDescriptionMap(categoryId, brands);
|
219 |
Map<Integer, String> catalogIdItemDescriptionMap = inventoryService.getModelDescriptionMap(categoryId, brands);
|
| 217 |
model.addAttribute("catalogIdItemDescriptionMap", catalogIdItemDescriptionMap);
|
220 |
model.addAttribute("catalogIdItemDescriptionMap", catalogIdItemDescriptionMap);
|
| 218 |
// model.addAttribute("brands", inventoryService.getAllBrands());
|
221 |
// model.addAttribute("brands", inventoryService.getAllBrands());
|
| 219 |
|
222 |
|
| 220 |
return "tag-listing-items-description";
|
223 |
return "tag-listing-items-description";
|
| Line 479... |
Line 482... |
| 479 |
return "response";
|
482 |
return "response";
|
| 480 |
}
|
483 |
}
|
| 481 |
|
484 |
|
| 482 |
@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
|
485 |
@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
|
| 483 |
public String deleteShcemes(HttpServletRequest request,
|
486 |
public String deleteShcemes(HttpServletRequest request,
|
| 484 |
@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
|
487 |
@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
|
| 485 |
@RequestParam(name = "catalogId", required = false, defaultValue = "0") int catalogId, Model model)
|
488 |
@RequestParam(name = "catalogId", required = false, defaultValue = "0") int catalogId, Model model)
|
| 486 |
throws Exception {
|
489 |
throws Exception {
|
| 487 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
490 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 488 |
if (schemeId > 0 && catalogId > 0) {
|
491 |
if (schemeId > 0 && catalogId > 0) {
|
| 489 |
schemeItemRepository.deleteByCatalogIdsAndSchemeIds(catalogId, schemeId);
|
492 |
schemeItemRepository.deleteByCatalogIdsAndSchemeIds(catalogId, schemeId);
|
| 490 |
|
493 |
|
| Line 515... |
Line 518... |
| 515 |
}
|
518 |
}
|
| 516 |
|
519 |
|
| 517 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
520 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
| 518 |
public String extendSchemeById(HttpServletRequest request,
|
521 |
public String extendSchemeById(HttpServletRequest request,
|
| 519 |
|
522 |
|
| 520 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
523 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 521 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
524 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
| 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);
|
| 526 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
529 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| Line 530... |
Line 533... |
| 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,
|
537 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest,
|
| 535 |
Model model) 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 555... |
Line 558... |
| 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 654... |
Line 657... |
| 654 |
|
657 |
|
| 655 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
658 |
} else if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| 656 |
|
659 |
|
| 657 |
LOGGER.info("searchImei" + searchImei);
|
660 |
LOGGER.info("searchImei" + searchImei);
|
| 658 |
|
661 |
|
| 659 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumber(searchImei);
|
662 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
| - |
|
663 |
loginDetails.getFofoId());
|
| 660 |
Item item = itemRepository.selectById(inventoryItem.getItemId());
|
664 |
Item item = itemRepository.selectById(inventoryItem.getItemId());
|
| 661 |
Map<Integer, Scheme> schemeMap = new HashMap<>();
|
665 |
Map<Integer, Scheme> schemeMap = new HashMap<>();
|
| - |
|
666 |
double netEarnings = 0;
|
| 662 |
if (inventoryItem != null) {
|
667 |
if (inventoryItem != null) {
|
| - |
|
668 |
//Offer payout
|
| - |
|
669 |
List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllBySerialNumber(loginDetails.getFofoId(), searchImei);
|
| - |
|
670 |
Map<Integer, CreateOfferRequest> offerRequestMap = offerPayouts.stream().map(x -> offerService.getOffer(loginDetails.getFofoId(), (int) x.getOfferId())).collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 663 |
|
671 |
|
| 664 |
LOGGER.info("inventoryItem" + inventoryItem);
|
- |
|
| 665 |
|
672 |
|
| 666 |
schemeInOut = schemeInOutRepository
|
- |
|
| 667 |
.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItem.getId())));
|
673 |
schemeInOut = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItem.getId())));
|
| 668 |
|
- |
|
| 669 |
LOGGER.info("schemeInOut" + schemeInOut);
|
- |
|
| 670 |
|
674 |
|
| 671 |
if (!schemeInOut.isEmpty()) {
|
675 |
if (!schemeInOut.isEmpty()) {
|
| 672 |
|
- |
|
| 673 |
List<Integer> schemeIds = schemeInOut.stream().map(x -> x.getSchemeId())
|
676 |
List<Integer> schemeIds = schemeInOut.stream().map(x -> x.getSchemeId()).collect(Collectors.toList());
|
| 674 |
.collect(Collectors.toList());
|
- |
|
| 675 |
|
677 |
|
| 676 |
schemes = schemeRepository.selectBySchemeIds(schemeIds);
|
678 |
schemes = schemeRepository.selectBySchemeIds(schemeIds);
|
| 677 |
for (Scheme scheme : schemes) {
|
679 |
for (Scheme scheme : schemes) {
|
| 678 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
680 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| 679 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
681 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
| Line 682... |
Line 684... |
| 682 |
}
|
684 |
}
|
| 683 |
}
|
685 |
}
|
| 684 |
|
686 |
|
| 685 |
schemeMap = schemes.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
687 |
schemeMap = schemes.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 686 |
}
|
688 |
}
|
| - |
|
689 |
List<PriceDropIMEI> priceDropImeis = priceDropIMEIRepository
|
| - |
|
690 |
.selectByFofoIdImei(loginDetails.getFofoId(), searchImei);
|
| - |
|
691 |
if (priceDropImeis.size() > 0) {
|
| - |
|
692 |
|
| - |
|
693 |
for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
|
| - |
|
694 |
int priceDropId = priceDropIMEI.getPriceDropId();
|
| - |
|
695 |
PriceDrop pd = priceDropRepository.selectById(priceDropId);
|
| - |
|
696 |
priceDropIMEI.setPriceDrop(pd);
|
| - |
|
697 |
}
|
| - |
|
698 |
model.addAttribute("priceDropImeis", priceDropImeis);
|
| - |
|
699 |
}
|
| - |
|
700 |
model.addAttribute("offerPayouts", offerPayouts);
|
| - |
|
701 |
model.addAttribute("offerRequestMap", offerRequestMap);
|
| - |
|
702 |
model.addAttribute("inventoryItem", inventoryItem);
|
| - |
|
703 |
model.addAttribute("inventoryItem", inventoryItem);
|
| - |
|
704 |
|
| 687 |
}
|
705 |
}
|
| - |
|
706 |
model.addAttribute("netEarnings", netEarnings);
|
| 688 |
model.addAttribute("fofoId", loginDetails.getFofoId());
|
707 |
model.addAttribute("fofoId", loginDetails.getFofoId());
|
| 689 |
model.addAttribute("schemeMap", schemeMap);
|
708 |
model.addAttribute("schemeMap", schemeMap);
|
| 690 |
model.addAttribute("item", item);
|
709 |
model.addAttribute("item", item);
|
| 691 |
model.addAttribute("schemeInOut", schemeInOut);
|
710 |
model.addAttribute("schemeInOut", schemeInOut);
|
| 692 |
return "schemes-partner";
|
711 |
return "schemes-partner";
|
| Line 887... |
Line 906... |
| 887 |
return "last-month-credited-income";
|
906 |
return "last-month-credited-income";
|
| 888 |
}
|
907 |
}
|
| 889 |
|
908 |
|
| 890 |
@RequestMapping(value = "/getLastMonthImeiWiseIncome", method = RequestMethod.GET)
|
909 |
@RequestMapping(value = "/getLastMonthImeiWiseIncome", method = RequestMethod.GET)
|
| 891 |
public String getLastMonthImeiWiseIncome(HttpServletRequest request,
|
910 |
public String getLastMonthImeiWiseIncome(HttpServletRequest request,
|
| 892 |
@RequestParam(name = "catalogItemId", required = false, defaultValue = "") int catalogItemId,
|
911 |
@RequestParam(name = "catalogItemId", required = false, defaultValue = "") int catalogItemId,
|
| 893 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
912 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 894 |
throws Exception {
|
913 |
throws Exception {
|
| 895 |
|
914 |
|
| 896 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
915 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 897 |
|
916 |
|
| 898 |
LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
917 |
LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
| Line 1036... |
Line 1055... |
| 1036 |
return "last-month-imei-wise-income";
|
1055 |
return "last-month-imei-wise-income";
|
| 1037 |
}
|
1056 |
}
|
| 1038 |
|
1057 |
|
| 1039 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
1058 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
| 1040 |
public String getBrandWiseIncome(HttpServletRequest request,
|
1059 |
public String getBrandWiseIncome(HttpServletRequest request,
|
| 1041 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
1060 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
| 1042 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
1061 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
| 1043 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
1062 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 1044 |
throws ProfitMandiBusinessException {
|
1063 |
throws ProfitMandiBusinessException {
|
| 1045 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1064 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1046 |
LOGGER.info("loginDetails {}", loginDetails);
|
1065 |
LOGGER.info("loginDetails {}", loginDetails);
|
| 1047 |
LOGGER.info("brand" + brand);
|
1066 |
LOGGER.info("brand" + brand);
|
| 1048 |
LOGGER.info("month {}", month);
|
1067 |
LOGGER.info("month {}", month);
|
| Line 1235... |
Line 1254... |
| 1235 |
return "schemes-download";
|
1254 |
return "schemes-download";
|
| 1236 |
}
|
1255 |
}
|
| 1237 |
|
1256 |
|
| 1238 |
@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
|
1257 |
@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
|
| 1239 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
1258 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
| 1240 |
@RequestParam LocalDateTime startDateTime, @RequestParam LocalDateTime endDateTime)
|
1259 |
@RequestParam LocalDateTime startDateTime, @RequestParam LocalDateTime endDateTime)
|
| 1241 |
throws ProfitMandiBusinessException {
|
1260 |
throws ProfitMandiBusinessException {
|
| 1242 |
|
1261 |
|
| 1243 |
List<SchemeModel> schemeModels = schemeService.getAllSchemeModels(startDateTime, endDateTime);
|
1262 |
List<SchemeModel> schemeModels = schemeService.getAllSchemeModels(startDateTime, endDateTime);
|
| 1244 |
|
1263 |
|
| 1245 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
1264 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| Line 1254... |
Line 1273... |
| 1254 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
1273 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 1255 |
}
|
1274 |
}
|
| 1256 |
|
1275 |
|
| 1257 |
@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
|
1276 |
@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
|
| 1258 |
public String getSchemeById(HttpServletRequest request,
|
1277 |
public String getSchemeById(HttpServletRequest request,
|
| 1259 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
|
1278 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
|
| 1260 |
throws ProfitMandiBusinessException {
|
1279 |
throws ProfitMandiBusinessException {
|
| 1261 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1280 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1262 |
|
1281 |
|
| 1263 |
boolean fullAccess = this.getAccess(loginDetails.getEmailId());
|
1282 |
boolean fullAccess = this.getAccess(loginDetails.getEmailId());
|
| 1264 |
Scheme scheme = schemeService.getSchemeById(schemeId);
|
1283 |
Scheme scheme = schemeService.getSchemeById(schemeId);
|
| Line 1268... |
Line 1287... |
| 1268 |
return "scheme-details";
|
1287 |
return "scheme-details";
|
| 1269 |
}
|
1288 |
}
|
| 1270 |
|
1289 |
|
| 1271 |
@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
|
1290 |
@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
|
| 1272 |
public String activeSchemeById(HttpServletRequest request,
|
1291 |
public String activeSchemeById(HttpServletRequest request,
|
| 1273 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
1292 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 1274 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1293 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1275 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1294 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1276 |
throws ProfitMandiBusinessException {
|
1295 |
throws ProfitMandiBusinessException {
|
| 1277 |
schemeService.activeSchemeById(schemeId);
|
1296 |
schemeService.activeSchemeById(schemeId);
|
| 1278 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
1297 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 1279 |
for (Scheme scheme : schemes) {
|
1298 |
for (Scheme scheme : schemes) {
|
| 1280 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
1299 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| Line 1286... |
Line 1305... |
| 1286 |
return "schemes";
|
1305 |
return "schemes";
|
| 1287 |
}
|
1306 |
}
|
| 1288 |
|
1307 |
|
| 1289 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
1308 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
| 1290 |
public String expireSchemeById(HttpServletRequest request,
|
1309 |
public String expireSchemeById(HttpServletRequest request,
|
| 1291 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
1310 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 1292 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
|
1311 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
|
| 1293 |
throws ProfitMandiBusinessException {
|
1312 |
throws ProfitMandiBusinessException {
|
| 1294 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
1313 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
| 1295 |
return getDefaultSchemes(request, model);
|
1314 |
return getDefaultSchemes(request, model);
|
| 1296 |
}
|
1315 |
}
|
| 1297 |
|
1316 |
|
| 1298 |
@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
|
1317 |
@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
|
| 1299 |
public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
|
1318 |
public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
|
| 1300 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1319 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1301 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1320 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1302 |
throws ProfitMandiBusinessException {
|
1321 |
throws ProfitMandiBusinessException {
|
| 1303 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1322 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1304 |
return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
|
1323 |
return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
|
| 1305 |
}
|
1324 |
}
|
| 1306 |
|
1325 |
|
| Line 1314... |
Line 1333... |
| 1314 |
|
1333 |
|
| 1315 |
}
|
1334 |
}
|
| 1316 |
|
1335 |
|
| 1317 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
1336 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
| 1318 |
public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
|
1337 |
public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
|
| 1319 |
@RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
|
1338 |
@RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
|
| 1320 |
|
1339 |
|
| 1321 |
CustomerOffer co = new CustomerOffer();
|
1340 |
CustomerOffer co = new CustomerOffer();
|
| 1322 |
co.setOfferName(offerName);
|
1341 |
co.setOfferName(offerName);
|
| 1323 |
co.setStartDate(startDate);
|
1342 |
co.setStartDate(startDate);
|
| 1324 |
co.setEndDate(endDate);
|
1343 |
co.setEndDate(endDate);
|
| Line 1350... |
Line 1369... |
| 1350 |
|
1369 |
|
| 1351 |
}
|
1370 |
}
|
| 1352 |
|
1371 |
|
| 1353 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
1372 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
| 1354 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
1373 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
| 1355 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
1374 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
| 1356 |
|
1375 |
|
| 1357 |
List<CSVRecord> records = FileUtil.readFile(file);
|
1376 |
List<CSVRecord> records = FileUtil.readFile(file);
|
| 1358 |
|
1377 |
|
| 1359 |
for (CSVRecord record : records) {
|
1378 |
for (CSVRecord record : records) {
|
| 1360 |
if (Integer.parseInt(record.get(0)) == 0) {
|
1379 |
if (Integer.parseInt(record.get(0)) == 0) {
|
| Line 1407... |
Line 1426... |
| 1407 |
|
1426 |
|
| 1408 |
}
|
1427 |
}
|
| 1409 |
|
1428 |
|
| 1410 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
1429 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
| 1411 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
1430 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
| 1412 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
1431 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| 1413 |
|
1432 |
|
| 1414 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
1433 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
| 1415 |
co.setEndDate(endDate);
|
1434 |
co.setEndDate(endDate);
|
| 1416 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
1435 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
| 1417 |
|
1436 |
|