| 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.HashMap;
|
- |
|
| 15 |
import java.util.HashSet;
|
- |
|
| 16 |
import java.util.LinkedHashSet;
|
- |
|
| 17 |
import java.util.List;
|
- |
|
| 18 |
import java.util.Map;
|
- |
|
| 19 |
import java.util.Set;
|
- |
|
| 20 |
import java.util.stream.Collectors;
|
- |
|
| 21 |
|
- |
|
| 22 |
import javax.servlet.http.HttpServletRequest;
|
- |
|
| 23 |
import javax.servlet.http.HttpServletResponse;
|
- |
|
| 24 |
import javax.transaction.Transactional;
|
- |
|
| 25 |
|
- |
|
| 26 |
import org.apache.commons.csv.CSVRecord;
|
- |
|
| 27 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 28 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 29 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 30 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 31 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 32 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 33 |
import org.springframework.http.HttpStatus;
|
- |
|
| 34 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 35 |
import org.springframework.stereotype.Controller;
|
- |
|
| 36 |
import org.springframework.ui.Model;
|
- |
|
| 37 |
import org.springframework.web.bind.annotation.PathVariable;
|
- |
|
| 38 |
import org.springframework.web.bind.annotation.RequestBody;
|
- |
|
| 39 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 40 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 41 |
import org.springframework.web.bind.annotation.RequestParam;
|
- |
|
| 42 |
import org.springframework.web.bind.annotation.RequestPart;
|
- |
|
| 43 |
import org.springframework.web.multipart.MultipartFile;
|
- |
|
| 44 |
|
- |
|
| 45 |
import com.spice.profitmandi.common.enumuration.DateTimePattern;
|
3 |
import com.spice.profitmandi.common.enumuration.DateTimePattern;
|
| 46 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
4 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 47 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 48 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
- |
|
| 49 |
import com.spice.profitmandi.common.model.MapWrapper;
|
6 |
import com.spice.profitmandi.common.model.*;
|
| 50 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 51 |
import com.spice.profitmandi.common.model.SchemeItems;
|
- |
|
| 52 |
import com.spice.profitmandi.common.model.SchemeModel;
|
- |
|
| 53 |
import com.spice.profitmandi.common.services.ReporticoService;
|
7 |
import com.spice.profitmandi.common.services.ReporticoService;
|
| 54 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
- |
|
| 55 |
import com.spice.profitmandi.common.util.FileUtil;
|
- |
|
| 56 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
- |
|
| 57 |
import com.spice.profitmandi.common.util.StringUtils;
|
- |
|
| 58 |
import com.spice.profitmandi.common.util.Utils;
|
8 |
import com.spice.profitmandi.common.util.*;
|
| 59 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
9 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 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;
|
10 |
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;
|
- |
|
| 66 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
- |
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
11 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| 70 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
- |
|
| 71 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
- |
|
| 72 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
- |
|
| 73 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
12 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| 74 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
13 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
| 75 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
14 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 76 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
15 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 77 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
16 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
| 78 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
17 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 79 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
18 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 80 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
- |
|
| 81 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
- |
|
| 82 |
import com.spice.profitmandi.dao.model.ImeiWiseIncomePairAndMapModel;
|
- |
|
| 83 |
import com.spice.profitmandi.dao.model.IncomeImeiDate;
|
19 |
import com.spice.profitmandi.dao.model.*;
|
| 84 |
import com.spice.profitmandi.dao.model.LastMonthBrandWiseIncomeModel;
|
- |
|
| 85 |
import com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel;
|
- |
|
| 86 |
import com.spice.profitmandi.dao.model.LastMonthFrontEndImeiModel;
|
- |
|
| 87 |
import com.spice.profitmandi.dao.model.LastMonthImeiModel;
|
- |
|
| 88 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferItemRepository;
|
- |
|
| 89 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferRepository;
|
- |
|
| 90 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
20 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 91 |
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
|
- |
|
| 92 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
- |
|
| 93 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
- |
|
| 94 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
- |
|
| 95 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
21 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 96 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
22 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 97 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
23 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 98 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 99 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
- |
|
| 100 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
- |
|
| 101 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
- |
|
| 102 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
24 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 103 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
25 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
| 104 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
26 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| 105 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
27 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 106 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
28 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 107 |
import com.spice.profitmandi.service.offers.OfferService;
|
29 |
import com.spice.profitmandi.service.offers.OfferService;
|
| Line 109... |
Line 31... |
| 109 |
import com.spice.profitmandi.service.user.RetailerService;
|
31 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 110 |
import com.spice.profitmandi.service.wallet.WalletService;
|
32 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 111 |
import com.spice.profitmandi.web.model.LoginDetails;
|
33 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 112 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
34 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 113 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
35 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 114 |
|
- |
|
| 115 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
36 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| - |
|
37 |
import org.apache.commons.csv.CSVRecord;
|
| - |
|
38 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
39 |
import org.apache.logging.log4j.Logger;
|
| - |
|
40 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
41 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
42 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
43 |
import org.springframework.http.HttpHeaders;
|
| - |
|
44 |
import org.springframework.http.HttpStatus;
|
| - |
|
45 |
import org.springframework.http.ResponseEntity;
|
| - |
|
46 |
import org.springframework.stereotype.Controller;
|
| - |
|
47 |
import org.springframework.ui.Model;
|
| - |
|
48 |
import org.springframework.web.bind.annotation.*;
|
| - |
|
49 |
import org.springframework.web.multipart.MultipartFile;
|
| - |
|
50 |
|
| - |
|
51 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
52 |
import javax.servlet.http.HttpServletResponse;
|
| - |
|
53 |
import javax.transaction.Transactional;
|
| - |
|
54 |
import java.io.ByteArrayInputStream;
|
| - |
|
55 |
import java.io.ByteArrayOutputStream;
|
| - |
|
56 |
import java.io.InputStream;
|
| - |
|
57 |
import java.time.*;
|
| - |
|
58 |
import java.time.format.DateTimeFormatter;
|
| - |
|
59 |
import java.util.*;
|
| - |
|
60 |
import java.util.stream.Collectors;
|
| 116 |
|
61 |
|
| 117 |
@Controller
|
62 |
@Controller
|
| 118 |
@Transactional(rollbackOn = Throwable.class)
|
63 |
@Transactional(rollbackOn = Throwable.class)
|
| 119 |
public class SchemeController {
|
64 |
public class SchemeController {
|
| 120 |
|
65 |
|
| Line 1346... |
Line 1291... |
| 1346 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
1291 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 1347 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1292 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1348 |
throws ProfitMandiBusinessException {
|
1293 |
throws ProfitMandiBusinessException {
|
| 1349 |
schemeService.activeSchemeById(schemeId);
|
1294 |
schemeService.activeSchemeById(schemeId);
|
| 1350 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
1295 |
List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
|
| - |
|
1296 |
for (Scheme scheme : schemes) {
|
| - |
|
1297 |
if (scheme.getAmountType().equals(AmountType.PERCENTAGE)) {
|
| - |
|
1298 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
| - |
|
1299 |
} else {
|
| - |
|
1300 |
scheme.setAmountModel(scheme.getAmount() + "");
|
| - |
|
1301 |
}
|
| - |
|
1302 |
}
|
| 1351 |
model.addAttribute("schemes", schemes);
|
1303 |
model.addAttribute("schemes", schemes);
|
| 1352 |
return "schemes-paginated";
|
1304 |
return "schemes-paginated";
|
| 1353 |
}
|
1305 |
}
|
| 1354 |
|
1306 |
|
| 1355 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|
1307 |
@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
|