| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.io.ByteArrayInputStream;
|
- |
|
| 4 |
import java.io.ByteArrayOutputStream;
|
- |
|
| 5 |
import java.io.InputStream;
|
- |
|
| 6 |
import java.time.LocalDate;
|
- |
|
| 7 |
import java.time.LocalDateTime;
|
- |
|
| 8 |
import java.time.LocalTime;
|
- |
|
| 9 |
import java.time.Month;
|
- |
|
| 10 |
import java.time.YearMonth;
|
- |
|
| 11 |
import java.time.format.DateTimeFormatter;
|
- |
|
| 12 |
import java.util.ArrayList;
|
- |
|
| 13 |
import java.util.Arrays;
|
- |
|
| 14 |
import java.util.Comparator;
|
- |
|
| 15 |
import java.util.HashMap;
|
- |
|
| 16 |
import java.util.HashSet;
|
- |
|
| 17 |
import java.util.LinkedHashSet;
|
- |
|
| 18 |
import java.util.List;
|
- |
|
| 19 |
import java.util.Map;
|
- |
|
| 20 |
import java.util.Set;
|
- |
|
| 21 |
import java.util.stream.Collectors;
|
- |
|
| 22 |
|
- |
|
| 23 |
import javax.servlet.http.HttpServletRequest;
|
- |
|
| 24 |
import javax.servlet.http.HttpServletResponse;
|
- |
|
| 25 |
import javax.transaction.Transactional;
|
- |
|
| 26 |
|
- |
|
| 27 |
import org.apache.commons.csv.CSVRecord;
|
- |
|
| 28 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 29 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 30 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 31 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 32 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 33 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 34 |
import org.springframework.http.HttpStatus;
|
- |
|
| 35 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 36 |
import org.springframework.stereotype.Controller;
|
- |
|
| 37 |
import org.springframework.ui.Model;
|
- |
|
| 38 |
import org.springframework.web.bind.annotation.PathVariable;
|
- |
|
| 39 |
import org.springframework.web.bind.annotation.RequestBody;
|
- |
|
| 40 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 41 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 42 |
import org.springframework.web.bind.annotation.RequestParam;
|
- |
|
| 43 |
import org.springframework.web.bind.annotation.RequestPart;
|
- |
|
| 44 |
import org.springframework.web.multipart.MultipartFile;
|
- |
|
| 45 |
|
- |
|
| 46 |
import com.google.gson.Gson;
|
3 |
import com.google.gson.Gson;
|
| 47 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
4 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 48 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 49 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
6 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 50 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
7 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| Line 52... |
Line 9... |
| 52 |
import com.spice.profitmandi.common.model.SchemeModel;
|
9 |
import com.spice.profitmandi.common.model.SchemeModel;
|
| 53 |
import com.spice.profitmandi.common.services.ReporticoService;
|
10 |
import com.spice.profitmandi.common.services.ReporticoService;
|
| 54 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
11 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 55 |
import com.spice.profitmandi.common.util.FileUtil;
|
12 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 56 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
13 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 57 |
|
- |
|
| 58 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
14 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 59 |
import com.spice.profitmandi.dao.entity.catalog.Category;
|
- |
|
| 60 |
import com.spice.profitmandi.dao.entity.catalog.CustomerOffer;
|
- |
|
| 61 |
import com.spice.profitmandi.dao.entity.catalog.CustomerOfferItem;
|
- |
|
| 62 |
import com.spice.profitmandi.dao.entity.catalog.EvaluateSchemeInvestmentPayoutModel;
|
- |
|
| 63 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
15 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
| 64 |
import com.spice.profitmandi.dao.entity.catalog.SamsungUpgradeOffer;
|
- |
|
| 65 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
16 |
import com.spice.profitmandi.dao.entity.cs.Region;
|
| 66 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
- |
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
17 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.OfferPayout;
|
- |
|
| 70 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| 71 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
- |
|
| 72 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
- |
|
| 73 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
- |
|
| 74 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
18 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| 75 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
19 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
| 76 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
20 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 77 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
21 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 78 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
22 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
| 79 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
23 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 80 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
24 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 81 |
import com.spice.profitmandi.dao.model.CustomerOfferModel;
|
- |
|
| 82 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
- |
|
| 83 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
- |
|
| 84 |
import com.spice.profitmandi.dao.model.CustomerOfferItemModel;
|
- |
|
| 85 |
import com.spice.profitmandi.dao.model.ImeiWiseIncomePairAndMapModel;
|
- |
|
| 86 |
import com.spice.profitmandi.dao.model.IncomeImeiDate;
|
25 |
import com.spice.profitmandi.dao.model.*;
|
| 87 |
import com.spice.profitmandi.dao.model.LastMonthBrandWiseIncomeModel;
|
- |
|
| 88 |
import com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel;
|
- |
|
| 89 |
import com.spice.profitmandi.dao.model.LastMonthFrontEndBrandWiseIncome;
|
- |
|
| 90 |
import com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel;
|
- |
|
| 91 |
import com.spice.profitmandi.dao.model.LastMonthImeiModel;
|
- |
|
| 92 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
- |
|
| 93 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferItemRepository;
|
- |
|
| 94 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferRepository;
|
- |
|
| 95 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
26 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 96 |
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
|
- |
|
| 97 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
- |
|
| 98 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
- |
|
| 99 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
- |
|
| 100 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
27 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| - |
|
28 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
| 101 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
29 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 102 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
30 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 103 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 104 |
import com.spice.profitmandi.dao.repository.fofo.OfferPayoutRepository;
|
- |
|
| 105 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
- |
|
| 106 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
- |
|
| 107 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
- |
|
| 108 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
31 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 109 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
32 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
| 110 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
33 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| 111 |
import com.spice.profitmandi.dao.repository.transaction.TransactionRepository;
|
34 |
import com.spice.profitmandi.dao.repository.transaction.TransactionRepository;
|
| 112 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
35 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 113 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
36 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| Line 117... |
Line 40... |
| 117 |
import com.spice.profitmandi.service.user.RetailerService;
|
40 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 118 |
import com.spice.profitmandi.service.wallet.WalletService;
|
41 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 119 |
import com.spice.profitmandi.web.model.LoginDetails;
|
42 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 120 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
43 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 121 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
44 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 122 |
import org.springframework.util.StringUtils;
|
- |
|
| 123 |
|
- |
|
| 124 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
45 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| - |
|
46 |
import org.apache.commons.csv.CSVRecord;
|
| - |
|
47 |
import org.apache.commons.lang.StringUtils;
|
| - |
|
48 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
49 |
import org.apache.logging.log4j.Logger;
|
| - |
|
50 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
51 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
52 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
53 |
import org.springframework.http.HttpHeaders;
|
| - |
|
54 |
import org.springframework.http.HttpStatus;
|
| - |
|
55 |
import org.springframework.http.ResponseEntity;
|
| - |
|
56 |
import org.springframework.stereotype.Controller;
|
| - |
|
57 |
import org.springframework.ui.Model;
|
| - |
|
58 |
import org.springframework.web.bind.annotation.*;
|
| - |
|
59 |
import org.springframework.web.multipart.MultipartFile;
|
| - |
|
60 |
|
| - |
|
61 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
62 |
import javax.servlet.http.HttpServletResponse;
|
| - |
|
63 |
import javax.transaction.Transactional;
|
| - |
|
64 |
import java.io.ByteArrayInputStream;
|
| - |
|
65 |
import java.io.ByteArrayOutputStream;
|
| - |
|
66 |
import java.io.InputStream;
|
| - |
|
67 |
import java.time.*;
|
| - |
|
68 |
import java.time.format.DateTimeFormatter;
|
| - |
|
69 |
import java.util.*;
|
| - |
|
70 |
import java.util.stream.Collectors;
|
| 125 |
|
71 |
|
| 126 |
@Controller
|
72 |
@Controller
|
| 127 |
@Transactional(rollbackOn = Throwable.class)
|
73 |
@Transactional(rollbackOn = Throwable.class)
|
| 128 |
public class SchemeController {
|
74 |
public class SchemeController {
|
| 129 |
// LED TV
|
75 |
// LED TV
|
| Line 224... |
Line 170... |
| 224 |
private Gson gson;
|
170 |
private Gson gson;
|
| 225 |
|
171 |
|
| 226 |
List<String> adminEmail = Arrays.asList("tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
172 |
List<String> adminEmail = Arrays.asList("tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
| 227 |
"amit.gupta@smartdukaan.com", "tejbeer.kaur@smartdukaan.com", "raksha.vyas@smartdukaan.com");
|
173 |
"amit.gupta@smartdukaan.com", "tejbeer.kaur@smartdukaan.com", "raksha.vyas@smartdukaan.com");
|
| 228 |
|
174 |
|
| 229 |
@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
|
- |
|
| 230 |
public String createScheme(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
- |
|
| 231 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
- |
|
| 232 |
|
- |
|
| 233 |
LocalDate currentdate = LocalDate.now();
|
- |
|
| 234 |
Month month = currentdate.getMonth().minus(1);
|
- |
|
| 235 |
model.addAttribute("month", month);
|
- |
|
| 236 |
|
- |
|
| 237 |
// Map<Integer, String> itemIdItemDescriptionMap =
|
- |
|
| 238 |
// inventoryService.getAllItemIdItemDescriptionMap();
|
- |
|
| 239 |
// model.addAttribute("itemIdItemDescriptionMap", itemIdItemDescriptionMap);
|
- |
|
| 240 |
// List<Category> categories = inventoryService.getAllCategories();
|
- |
|
| 241 |
List<Category> categories = categoryRepository.selectByIds(categoryIds);
|
- |
|
| 242 |
categories = categories.stream().sorted(Comparator.comparing(Category::getId)).collect(Collectors.toList());
|
- |
|
| 243 |
// Set<String> brands =
|
175 |
@Autowired
|
| 244 |
// inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
|
- |
|
| 245 |
// brands.addAll(inventoryService.getAllTagListingBrands(14206));
|
- |
|
| 246 |
|
- |
|
| 247 |
boolean fullAccesss = this.getAccess(loginDetails.getEmailId());
|
- |
|
| 248 |
|
- |
|
| 249 |
model.addAttribute("fullAccesss", fullAccesss);
|
- |
|
| 250 |
|
- |
|
| 251 |
model.addAttribute("categories", categories);
|
176 |
SchemeRegionRepository schemeRegionRepository;
|
| 252 |
model.addAttribute("retailerTypes", PartnerType.values());
|
- |
|
| 253 |
return "create-scheme";
|
- |
|
| 254 |
}
|
- |
|
| 255 |
|
177 |
|
| 256 |
private boolean getAccess(String emailId) {
|
178 |
private boolean getAccess(String emailId) {
|
| 257 |
|
179 |
|
| 258 |
boolean fullAccesss = false;
|
180 |
boolean fullAccesss = false;
|
| 259 |
List<String> emails = csService
|
181 |
List<String> emails = csService
|
| Line 274... |
Line 196... |
| 274 |
|
196 |
|
| 275 |
return fullAccesss;
|
197 |
return fullAccesss;
|
| 276 |
|
198 |
|
| 277 |
}
|
199 |
}
|
| 278 |
|
200 |
|
| 279 |
@RequestMapping(value = "/getCatalogDescriptionByBrands", method = RequestMethod.GET)
|
- |
|
| 280 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId,
|
- |
|
| 281 |
@RequestParam List<String> brands, Model model) throws Exception {
|
- |
|
| 282 |
Map<Integer, String> catalogIdItemDescriptionMap = inventoryService.getModelDescriptionMap(categoryId, brands);
|
- |
|
| 283 |
model.addAttribute("catalogIdItemDescriptionMap", catalogIdItemDescriptionMap);
|
- |
|
| 284 |
// model.addAttribute("brands", inventoryService.getAllBrands());
|
201 |
@Autowired
|
| 285 |
|
- |
|
| 286 |
return "tag-listing-items-description";
|
202 |
RegionRepository regionRepository;
|
| 287 |
}
|
- |
|
| 288 |
|
203 |
|
| 289 |
@RequestMapping(value = "/getBrandsByCategory", method = RequestMethod.GET)
|
204 |
@RequestMapping(value = "/getBrandsByCategory", method = RequestMethod.GET)
|
| 290 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId, Model model)
|
205 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId, Model model)
|
| 291 |
throws Exception {
|
206 |
throws Exception {
|
| 292 |
Set<String> brands = inventoryService.getAllTagListingBrands(categoryId);
|
207 |
Set<String> brands = inventoryService.getAllTagListingBrands(categoryId);
|
| Line 561... |
Line 476... |
| 561 |
}
|
476 |
}
|
| 562 |
}
|
477 |
}
|
| 563 |
return "response";
|
478 |
return "response";
|
| 564 |
}
|
479 |
}
|
| 565 |
|
480 |
|
| 566 |
@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
|
481 |
@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
|
| 567 |
public String deleteShcemes(HttpServletRequest request,
|
482 |
public String createScheme(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 568 |
@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
|
- |
|
| 569 |
@RequestParam(name = "catalogId", required = false, defaultValue = "0") int catalogId, Model model)
|
- |
|
| 570 |
throws Exception {
|
- |
|
| 571 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
483 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 572 |
if (schemeId > 0 && catalogId > 0) {
|
- |
|
| 573 |
schemeItemRepository.deleteByCatalogIdsAndSchemeIds(catalogId, schemeId);
|
- |
|
| 574 |
|
484 |
|
| - |
|
485 |
LocalDate currentdate = LocalDate.now();
|
| - |
|
486 |
Month month = currentdate.getMonth().minus(1);
|
| 575 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
487 |
model.addAttribute("month", month);
|
| 576 |
|
488 |
|
| - |
|
489 |
// Map<Integer, String> itemIdItemDescriptionMap =
|
| - |
|
490 |
// inventoryService.getAllItemIdItemDescriptionMap();
|
| 577 |
model.addAttribute("roleType", roleManager.isAdmin(loginDetails.getRoleIds()));
|
491 |
// model.addAttribute("itemIdItemDescriptionMap", itemIdItemDescriptionMap);
|
| - |
|
492 |
// List<Category> categories = inventoryService.getAllCategories();
|
| - |
|
493 |
List<Category> categories = categoryRepository.selectByIds(categoryIds);
|
| - |
|
494 |
categories = categories.stream().sorted(Comparator.comparing(Category::getId)).collect(Collectors.toList());
|
| - |
|
495 |
// Set<String> brands =
|
| - |
|
496 |
// inventoryService.getAllTagListingBrands(ProfitMandiConstants.MOBILE_CATEGORY_ID);
|
| - |
|
497 |
// brands.addAll(inventoryService.getAllTagListingBrands(14206));
|
| 578 |
|
498 |
|
| - |
|
499 |
boolean fullAccesss = this.getAccess(loginDetails.getEmailId());
|
| - |
|
500 |
|
| - |
|
501 |
List<Region> regionList = regionRepository.selectAll();
|
| - |
|
502 |
|
| - |
|
503 |
model.addAttribute("fullAccesss", fullAccesss);
|
| - |
|
504 |
model.addAttribute("regionList", regionList);
|
| 579 |
}
|
505 |
|
| - |
|
506 |
model.addAttribute("categories", categories);
|
| - |
|
507 |
model.addAttribute("retailerTypes", PartnerType.values());
|
| 580 |
return "response";
|
508 |
return "create-scheme";
|
| 581 |
}
|
509 |
}
|
| 582 |
|
510 |
|
| 583 |
@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
|
511 |
@RequestMapping(value = "/extendAllSchemes", method = RequestMethod.POST)
|
| 584 |
public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
|
512 |
public String extendAllScheme(HttpServletRequest request, @RequestBody LocalDateTime extendDatetime, Model model)
|
| 585 |
throws Exception {
|
513 |
throws Exception {
|
| Line 596... |
Line 524... |
| 596 |
}
|
524 |
}
|
| 597 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
525 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 598 |
return "response";
|
526 |
return "response";
|
| 599 |
}
|
527 |
}
|
| 600 |
|
528 |
|
| 601 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
529 |
@RequestMapping(value = "/getCatalogDescriptionByBrands", method = RequestMethod.GET)
|
| 602 |
public String extendSchemeById(HttpServletRequest request,
|
530 |
public String getTagListingItemsByBrand(HttpServletRequest request, @RequestParam int categoryId,
|
| - |
|
531 |
@RequestParam List<String> brands, Model model) throws Exception {
|
| - |
|
532 |
Map<Integer, String> catalogIdItemDescriptionMap = inventoryService.getModelDescriptionMap(categoryId, brands);
|
| - |
|
533 |
model.addAttribute("catalogIdItemDescriptionMap", catalogIdItemDescriptionMap);
|
| - |
|
534 |
// model.addAttribute("brands", inventoryService.getAllBrands());
|
| 603 |
|
535 |
|
| 604 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
- |
|
| 605 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
- |
|
| 606 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
- |
|
| 607 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
- |
|
| 608 |
scheme.setEndDateTime(extendDatetime);
|
- |
|
| 609 |
schemeRepository.persist(scheme);
|
- |
|
| 610 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
- |
|
| 611 |
return "response";
|
- |
|
| 612 |
}
|
- |
|
| 613 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
- |
|
| 614 |
return "response";
|
536 |
return "tag-listing-items-description";
|
| 615 |
}
|
537 |
}
|
| 616 |
|
538 |
|
| 617 |
@RequestMapping(value = "/createScheme", method = RequestMethod.POST)
|
539 |
@RequestMapping(value = "/createScheme", method = RequestMethod.POST)
|
| 618 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest,
|
540 |
public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest,
|
| 619 |
Model model) throws ProfitMandiBusinessException {
|
541 |
Model model) throws ProfitMandiBusinessException {
|
| 620 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
542 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 621 |
LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
|
543 |
LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
|
| 622 |
schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
|
544 |
schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
|
| 623 |
return getDefaultSchemes(request, model);
|
545 |
return getDefaultSchemes(request, model);
|
| 624 |
}
|
546 |
}
|
| Line 637... |
Line 559... |
| 637 |
}
|
559 |
}
|
| 638 |
return schemes;
|
560 |
return schemes;
|
| 639 |
}
|
561 |
}
|
| 640 |
|
562 |
|
| 641 |
// Show 20 recents
|
563 |
// Show 20 recents
|
| - |
|
564 |
|
| - |
|
565 |
@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
|
| - |
|
566 |
public String deleteShcemes(HttpServletRequest request,
|
| - |
|
567 |
@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
|
| - |
|
568 |
@RequestParam(name = "catalogId", required = false, defaultValue = "0") int catalogId, Model model)
|
| - |
|
569 |
throws Exception {
|
| - |
|
570 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
571 |
if (schemeId > 0 && catalogId > 0) {
|
| - |
|
572 |
schemeItemRepository.deleteByCatalogIdsAndSchemeIds(catalogId, schemeId);
|
| - |
|
573 |
|
| - |
|
574 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
575 |
|
| - |
|
576 |
model.addAttribute("roleType", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| - |
|
577 |
|
| - |
|
578 |
}
|
| - |
|
579 |
return "response";
|
| - |
|
580 |
}
|
| - |
|
581 |
|
| - |
|
582 |
@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
|
| - |
|
583 |
public String extendSchemeById(HttpServletRequest request,
|
| - |
|
584 |
|
| - |
|
585 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| - |
|
586 |
@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
|
| - |
|
587 |
Scheme scheme = schemeRepository.selectById(schemeId);
|
| - |
|
588 |
if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
|
| - |
|
589 |
scheme.setEndDateTime(extendDatetime);
|
| - |
|
590 |
schemeRepository.persist(scheme);
|
| - |
|
591 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
592 |
return "response";
|
| - |
|
593 |
}
|
| - |
|
594 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| - |
|
595 |
return "response";
|
| - |
|
596 |
}
|
| - |
|
597 |
|
| 642 |
@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
|
598 |
@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
|
| 643 |
public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
599 |
public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 644 |
@RequestParam(required = false) LocalDate date,
|
600 |
@RequestParam(required = false) LocalDate date,
|
| 645 |
@RequestParam(name = "limit", required = false, defaultValue = "30") int limit,
|
601 |
@RequestParam(name = "limit", required = false, defaultValue = "30") int limit,
|
| 646 |
@RequestParam(name = "searchModel", required = false, defaultValue = "0") int searchModel,
|
602 |
@RequestParam(name = "searchModel", required = false, defaultValue = "0") int searchModel,
|
| 647 |
@RequestParam(name = "searchScheme", required = false, defaultValue = "0") int searchScheme,
|
603 |
@RequestParam(name = "searchScheme", required = false, defaultValue = "0") int searchScheme,
|
| 648 |
@RequestParam(name = "partnerType", required = false, defaultValue = "ALL") PartnerType partnerType,
|
604 |
@RequestParam(name = "partnerType", required = false, defaultValue = "ALL") PartnerType partnerType,
|
| 649 |
@RequestParam(name = "searchImei", required = false, defaultValue = "") String searchImei, Model model)
|
605 |
@RequestParam(name = "searchImei", required = false, defaultValue = "") String searchImei, Model model)
|
| 650 |
throws ProfitMandiBusinessException {
|
606 |
throws ProfitMandiBusinessException {
|
| 651 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
607 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 652 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
608 |
boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
|
| 653 |
if (date != null) {
|
609 |
if (date != null) {
|
| 654 |
date = date.isAfter(LocalDate.now()) ? LocalDate.now() : date;
|
610 |
date = date.isAfter(LocalDate.now()) ? LocalDate.now() : date;
|
| Line 673... |
Line 629... |
| 673 |
if (searchScheme > 0) {
|
629 |
if (searchScheme > 0) {
|
| 674 |
schemes = Arrays.asList(schemeRepository.selectById(searchScheme));
|
630 |
schemes = Arrays.asList(schemeRepository.selectById(searchScheme));
|
| 675 |
this.setSchemeAmountModel(schemes);
|
631 |
this.setSchemeAmountModel(schemes);
|
| 676 |
if (schemes.size() > 0) {
|
632 |
if (schemes.size() > 0) {
|
| 677 |
model.addAttribute("schemes", schemes);
|
633 |
model.addAttribute("schemes", schemes);
|
| - |
|
634 |
List<SchemeRegion> schemeRegionList = schemeRegionRepository.selectAllBySchemeIds(schemes.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| - |
|
635 |
Map<Integer, String> schemeRegionMap = schemeRegionList.stream().collect(Collectors.groupingBy(x -> x.getSchemeId(), Collectors.mapping(y -> regionRepository.selectById(y.getRegionId()).getName(), Collectors.joining(","))));
|
| - |
|
636 |
model.addAttribute("schemeRegionMap", schemeRegionMap);
|
| 678 |
return "schemes";
|
637 |
return "schemes";
|
| 679 |
} else {
|
638 |
} else {
|
| 680 |
throw new ProfitMandiBusinessException("SchemeId", searchScheme, "SchemeId Not Found");
|
639 |
throw new ProfitMandiBusinessException("SchemeId", searchScheme, "SchemeId Not Found");
|
| 681 |
}
|
640 |
}
|
| 682 |
} else if (searchModel > 0) {
|
641 |
} else if (searchModel > 0) {
|
| Line 689... |
Line 648... |
| 689 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
648 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
| 690 |
if (isAdmin) {
|
649 |
if (isAdmin) {
|
| 691 |
schemes = schemeService
|
650 |
schemes = schemeService
|
| 692 |
.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit).stream()
|
651 |
.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit).stream()
|
| 693 |
.filter(x -> x.getId() != 411 && x.getId() != 612).collect(Collectors.toList());
|
652 |
.filter(x -> x.getId() != 411 && x.getId() != 612).collect(Collectors.toList());
|
| 694 |
// Remove 411 and 612
|
- |
|
| 695 |
this.setSchemeAmountModel(schemes);
|
653 |
this.setSchemeAmountModel(schemes);
|
| 696 |
model.addAttribute("schemes", schemes);
|
654 |
model.addAttribute("schemes", schemes);
|
| 697 |
// For 7720(HR) remove investment
|
655 |
List<SchemeRegion> schemeRegionList = schemeRegionRepository.selectAllBySchemeIds(schemes.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| 698 |
// int nlc = this.getNlc(item, loginDetails.getFofoId(), schemes, tagListing,
|
656 |
Map<Integer, String> schemeRegionMap = schemeRegionList.stream().collect(Collectors.groupingBy(x -> x.getSchemeId(), Collectors.mapping(y -> regionRepository.selectById(y.getRegionId()).getName(), Collectors.joining(","))));
|
| 699 |
// searchModel);
|
- |
|
| 700 |
// model.addAttribute("nlc", Math.round(nlc));
|
657 |
model.addAttribute("schemeRegionMap", schemeRegionMap);
|
| 701 |
return "schemes";
|
658 |
return "schemes";
|
| 702 |
} else {
|
659 |
} else {
|
| 703 |
partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), date);
|
660 |
partnerType = partnerTypeChangeService.getTypeOnDate(loginDetails.getFofoId(), date);
|
| 704 |
schemes = schemeService
|
661 |
schemes = schemeService
|
| 705 |
.selectSchemeByPartnerType(partnerType, date, searchModel, isAdmin, offset, limit).stream()
|
662 |
.selectSchemeByPartnerTypeFofoId(partnerType, date, searchModel, loginDetails.getFofoId(), offset, limit).stream()
|
| 706 |
.filter(x -> {
|
663 |
.filter(x -> {
|
| 707 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
664 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
| 708 |
}).collect(Collectors.toList());
|
665 |
}).collect(Collectors.toList());
|
| 709 |
// Remove 411 and 612
|
666 |
// Remove 411 and 612
|
| 710 |
// this.setSchemeAmountModel(schemes);
|
667 |
// this.setSchemeAmountModel(schemes);
|
| Line 800... |
Line 757... |
| 800 |
}
|
757 |
}
|
| 801 |
|
758 |
|
| 802 |
if (isAdmin) {
|
759 |
if (isAdmin) {
|
| 803 |
schemes = schemeRepository.selectAll(0, 100);
|
760 |
schemes = schemeRepository.selectAll(0, 100);
|
| 804 |
this.setSchemeAmountModel(schemes);
|
761 |
this.setSchemeAmountModel(schemes);
|
| - |
|
762 |
List<SchemeRegion> schemeRegionList = schemeRegionRepository.selectAllBySchemeIds(schemes.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| - |
|
763 |
Map<Integer, String> schemeRegionMap = schemeRegionList.stream().collect(Collectors.groupingBy(x -> x.getSchemeId(), Collectors.mapping(y -> regionRepository.selectById(y.getRegionId()).getName(), Collectors.joining(","))));
|
| 805 |
model.addAttribute("schemes", schemes);
|
764 |
model.addAttribute("schemes", schemes);
|
| - |
|
765 |
model.addAttribute("schemeRegionMap", schemeRegionMap);
|
| - |
|
766 |
|
| 806 |
return "schemes";
|
767 |
return "schemes";
|
| 807 |
} else {
|
768 |
} else {
|
| 808 |
if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
769 |
if (org.apache.commons.lang3.StringUtils.isNotEmpty(searchImei)) {
|
| 809 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
770 |
InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
|
| 810 |
loginDetails.getFofoId());
|
771 |
loginDetails.getFofoId());
|
| Line 990... |
Line 951... |
| 990 |
return "last-month-credited-income";
|
951 |
return "last-month-credited-income";
|
| 991 |
}
|
952 |
}
|
| 992 |
|
953 |
|
| 993 |
@RequestMapping(value = "/getLastMonthImeiWiseIncome", method = RequestMethod.GET)
|
954 |
@RequestMapping(value = "/getLastMonthImeiWiseIncome", method = RequestMethod.GET)
|
| 994 |
public String getLastMonthImeiWiseIncome(HttpServletRequest request,
|
955 |
public String getLastMonthImeiWiseIncome(HttpServletRequest request,
|
| 995 |
@RequestParam(name = "catalogItemId", required = false, defaultValue = "") int catalogItemId,
|
956 |
@RequestParam(name = "catalogItemId", required = false, defaultValue = "") int catalogItemId,
|
| 996 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
957 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 997 |
throws Exception {
|
958 |
throws Exception {
|
| 998 |
|
959 |
|
| 999 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
960 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1000 |
|
961 |
|
| 1001 |
LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
962 |
LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
|
| Line 1139... |
Line 1100... |
| 1139 |
return "last-month-imei-wise-income";
|
1100 |
return "last-month-imei-wise-income";
|
| 1140 |
}
|
1101 |
}
|
| 1141 |
|
1102 |
|
| 1142 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
1103 |
@RequestMapping(value = "/brandWiseIncome", method = RequestMethod.GET)
|
| 1143 |
public String getBrandWiseIncome(HttpServletRequest request,
|
1104 |
public String getBrandWiseIncome(HttpServletRequest request,
|
| 1144 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
1105 |
@RequestParam(name = "brand", required = false, defaultValue = "") String brand,
|
| 1145 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
1106 |
@RequestParam(name = "status", required = false, defaultValue = "") String status,
|
| 1146 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
1107 |
@RequestParam(name = "month", required = false, defaultValue = "") int month, Model model)
|
| 1147 |
throws ProfitMandiBusinessException {
|
1108 |
throws ProfitMandiBusinessException {
|
| 1148 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1109 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1149 |
LOGGER.info("loginDetails {}", loginDetails);
|
1110 |
LOGGER.info("loginDetails {}", loginDetails);
|
| 1150 |
LOGGER.info("brand" + brand);
|
1111 |
LOGGER.info("brand" + brand);
|
| 1151 |
LOGGER.info("month {}", month);
|
1112 |
LOGGER.info("month {}", month);
|
| Line 1338... |
Line 1299... |
| 1338 |
return "schemes-download";
|
1299 |
return "schemes-download";
|
| 1339 |
}
|
1300 |
}
|
| 1340 |
|
1301 |
|
| 1341 |
@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
|
1302 |
@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
|
| 1342 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
1303 |
public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
|
| 1343 |
@RequestParam LocalDateTime startDateTime, @RequestParam LocalDateTime endDateTime)
|
1304 |
@RequestParam LocalDateTime startDateTime, @RequestParam LocalDateTime endDateTime)
|
| 1344 |
throws ProfitMandiBusinessException {
|
1305 |
throws ProfitMandiBusinessException {
|
| 1345 |
|
1306 |
|
| 1346 |
List<SchemeModel> schemeModels = schemeService.getAllSchemeModels(startDateTime, endDateTime);
|
1307 |
List<SchemeModel> schemeModels = schemeService.getAllSchemeModels(startDateTime, endDateTime);
|
| 1347 |
|
1308 |
|
| 1348 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
1309 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| Line 1357... |
Line 1318... |
| 1357 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
1318 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 1358 |
}
|
1319 |
}
|
| 1359 |
|
1320 |
|
| 1360 |
@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
|
1321 |
@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
|
| 1361 |
public String getSchemeById(HttpServletRequest request,
|
1322 |
public String getSchemeById(HttpServletRequest request,
|
| 1362 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
|
1323 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
|
| 1363 |
throws ProfitMandiBusinessException {
|
1324 |
throws ProfitMandiBusinessException {
|
| 1364 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1325 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1365 |
|
1326 |
|
| 1366 |
boolean fullAccess = this.getAccess(loginDetails.getEmailId());
|
1327 |
boolean fullAccess = this.getAccess(loginDetails.getEmailId());
|
| 1367 |
Scheme scheme = schemeService.getSchemeById(schemeId);
|
1328 |
Scheme scheme = schemeService.getSchemeById(schemeId);
|
| Line 1370... |
Line 1331... |
| 1370 |
model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
|
1331 |
model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 1371 |
return "scheme-details";
|
1332 |
return "scheme-details";
|
| 1372 |
}
|
1333 |
}
|
| 1373 |
|
1334 |
|
| 1374 |
@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
|
1335 |
@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
|
| 1375 |
public String activeSchemeById(HttpServletRequest request,
|
- |
|
| 1376 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
1336 |
public String activeSchemeById(@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 1377 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1337 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1378 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1338 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1379 |
throws ProfitMandiBusinessException {
|
1339 |
throws ProfitMandiBusinessException {
|
| 1380 |
schemeService.activeSchemeById(schemeId);
|
1340 |
schemeService.activeSchemeById(schemeId);
|
| 1381 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
1341 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| 1382 |
for (Scheme scheme : schemes) {
|
1342 |
for (Scheme scheme : schemes) {
|
| 1383 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
1343 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| Line 1389... |
Line 1349... |
| 1389 |
return "schemes";
|
1349 |
return "schemes";
|
| 1390 |
}
|
1350 |
}
|
| 1391 |
|
1351 |
|
| 1392 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
1352 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
| 1393 |
public String expireSchemeById(HttpServletRequest request,
|
1353 |
public String expireSchemeById(HttpServletRequest request,
|
| 1394 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
1354 |
@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
|
| 1395 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
|
1355 |
@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp, Model model)
|
| 1396 |
throws ProfitMandiBusinessException {
|
1356 |
throws ProfitMandiBusinessException {
|
| 1397 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
1357 |
schemeService.expireSchemeById(schemeId, expiryTimestamp);
|
| 1398 |
return getDefaultSchemes(request, model);
|
1358 |
return getDefaultSchemes(request, model);
|
| 1399 |
}
|
1359 |
}
|
| 1400 |
|
1360 |
|
| 1401 |
@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
|
1361 |
@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
|
| 1402 |
public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
|
1362 |
public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
|
| 1403 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1363 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1404 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1364 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1405 |
throws ProfitMandiBusinessException {
|
1365 |
throws ProfitMandiBusinessException {
|
| 1406 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1366 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1407 |
return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
|
1367 |
return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
|
| 1408 |
}
|
1368 |
}
|
| 1409 |
|
1369 |
|
| 1410 |
@RequestMapping(value = "/getCustomerOffer", method = RequestMethod.GET)
|
1370 |
@RequestMapping(value = "/getCustomerOffer", method = RequestMethod.GET)
|
| 1411 |
public String getCustomerOffer(HttpServletRequest request,
|
1371 |
public String getCustomerOffer(HttpServletRequest request,
|
| 1412 |
@RequestParam(name = "searchModel", required = false, defaultValue = "0") int searchModel, Model model)
|
1372 |
@RequestParam(name = "searchModel", required = false, defaultValue = "0") int searchModel, Model model)
|
| 1413 |
throws ProfitMandiBusinessException {
|
1373 |
throws ProfitMandiBusinessException {
|
| 1414 |
List<CustomerOffer> customerOffers = new ArrayList<>();
|
1374 |
List<CustomerOffer> customerOffers = null;
|
| 1415 |
if (searchModel > 0) {
|
1375 |
if (searchModel > 0) {
|
| 1416 |
|
1376 |
|
| 1417 |
Item item = itemRepository.selectAllByCatalogItemId(searchModel).get(0);
|
1377 |
Item item = itemRepository.selectAllByCatalogItemId(searchModel).get(0);
|
| 1418 |
customerOffers = customerOfferRepository.selectActiveOfferByModel(searchModel, LocalDate.now());
|
1378 |
customerOffers = customerOfferRepository.selectActiveOfferByModel(searchModel, LocalDate.now());
|
| 1419 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
1379 |
model.addAttribute("modelName", item.getItemDescriptionNoColor());
|
| Line 1453... |
Line 1413... |
| 1453 |
|
1413 |
|
| 1454 |
}
|
1414 |
}
|
| 1455 |
|
1415 |
|
| 1456 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
1416 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
| 1457 |
public String createCustomerOffer(HttpServletRequest request, @RequestBody CustomerOfferModel customerOfferModel,
|
1417 |
public String createCustomerOffer(HttpServletRequest request, @RequestBody CustomerOfferModel customerOfferModel,
|
| 1458 |
Model model) throws Exception {
|
1418 |
Model model) throws Exception {
|
| 1459 |
|
1419 |
|
| 1460 |
CustomerOffer co = new CustomerOffer();
|
1420 |
CustomerOffer co = new CustomerOffer();
|
| 1461 |
co.setOfferName(customerOfferModel.getOfferName());
|
1421 |
co.setOfferName(customerOfferModel.getOfferName());
|
| 1462 |
co.setStartDate(customerOfferModel.getStartDate());
|
1422 |
co.setStartDate(customerOfferModel.getStartDate());
|
| 1463 |
co.setEndDate(customerOfferModel.getEndDate());
|
1423 |
co.setEndDate(customerOfferModel.getEndDate());
|
| Line 1491... |
Line 1451... |
| 1491 |
|
1451 |
|
| 1492 |
}
|
1452 |
}
|
| 1493 |
|
1453 |
|
| 1494 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
1454 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
| 1495 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
1455 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
| 1496 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
1456 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
| 1497 |
|
1457 |
|
| 1498 |
List<CSVRecord> records = FileUtil.readFile(file);
|
1458 |
List<CSVRecord> records = FileUtil.readFile(file);
|
| 1499 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
1459 |
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
| 1500 |
|
1460 |
|
| 1501 |
CustomerOffer customerOffer = customerOfferRepository.selectById(offerId);
|
1461 |
CustomerOffer customerOffer = customerOfferRepository.selectById(offerId);
|
| Line 1706... |
Line 1666... |
| 1706 |
|
1666 |
|
| 1707 |
}
|
1667 |
}
|
| 1708 |
|
1668 |
|
| 1709 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
1669 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
| 1710 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
1670 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
| 1711 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
1671 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| 1712 |
|
1672 |
|
| 1713 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
1673 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
| 1714 |
co.setEndDate(endDate);
|
1674 |
co.setEndDate(endDate);
|
| 1715 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
1675 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
| 1716 |
|
1676 |
|