| 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.util.ArrayList;
|
- |
|
| 12 |
import java.util.Arrays;
|
- |
|
| 13 |
import java.util.HashMap;
|
- |
|
| 14 |
import java.util.HashSet;
|
- |
|
| 15 |
import java.util.List;
|
- |
|
| 16 |
import java.util.Map;
|
- |
|
| 17 |
import java.util.Set;
|
- |
|
| 18 |
import java.util.stream.Collectors;
|
- |
|
| 19 |
|
- |
|
| 20 |
import javax.servlet.http.HttpServletRequest;
|
- |
|
| 21 |
import javax.servlet.http.HttpServletResponse;
|
- |
|
| 22 |
import javax.transaction.Transactional;
|
- |
|
| 23 |
|
- |
|
| 24 |
import org.apache.commons.csv.CSVRecord;
|
- |
|
| 25 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 26 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 27 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 28 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 29 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 30 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 31 |
import org.springframework.http.HttpStatus;
|
- |
|
| 32 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 33 |
import org.springframework.stereotype.Controller;
|
- |
|
| 34 |
import org.springframework.ui.Model;
|
- |
|
| 35 |
import org.springframework.web.bind.annotation.RequestBody;
|
- |
|
| 36 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 37 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 38 |
import org.springframework.web.bind.annotation.RequestParam;
|
- |
|
| 39 |
import org.springframework.web.bind.annotation.RequestPart;
|
- |
|
| 40 |
import org.springframework.web.multipart.MultipartFile;
|
- |
|
| 41 |
|
- |
|
| 42 |
import com.spice.profitmandi.common.enumuration.DateTimePattern;
|
3 |
import com.spice.profitmandi.common.enumuration.DateTimePattern;
|
| 43 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
4 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 44 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
- |
|
| 46 |
import com.spice.profitmandi.common.model.MapWrapper;
|
6 |
import com.spice.profitmandi.common.model.*;
|
| 47 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 48 |
import com.spice.profitmandi.common.model.SchemeItems;
|
- |
|
| 49 |
import com.spice.profitmandi.common.model.SchemeModel;
|
- |
|
| 50 |
import com.spice.profitmandi.common.services.ReporticoService;
|
7 |
import com.spice.profitmandi.common.services.ReporticoService;
|
| 51 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
- |
|
| 52 |
import com.spice.profitmandi.common.util.FileUtil;
|
- |
|
| 53 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
- |
|
| 54 |
import com.spice.profitmandi.common.util.StringUtils;
|
- |
|
| 55 |
import com.spice.profitmandi.common.util.Utils;
|
8 |
import com.spice.profitmandi.common.util.*;
|
| 56 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
9 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 57 |
import com.spice.profitmandi.dao.entity.catalog.CustomerOffer;
|
- |
|
| 58 |
import com.spice.profitmandi.dao.entity.catalog.CustomerOfferItem;
|
- |
|
| 59 |
import com.spice.profitmandi.dao.entity.catalog.EvaluateSchemeInvestmentPayoutModel;
|
- |
|
| 60 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
10 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
| 61 |
import com.spice.profitmandi.dao.entity.catalog.SamsungUpgradeOffer;
|
- |
|
| 62 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
- |
|
| 63 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
- |
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
11 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
- |
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
- |
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
- |
|
| 70 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
12 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| 71 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
13 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
| 72 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
14 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 73 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
15 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 74 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
16 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
| 75 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
17 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 76 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
18 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 77 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
19 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 78 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
20 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
| 79 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferItemRepository;
|
- |
|
| 80 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferRepository;
|
- |
|
| 81 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
21 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 82 |
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
|
- |
|
| 83 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
- |
|
| 84 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
- |
|
| 85 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
- |
|
| 86 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
22 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 87 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
23 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
24 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 89 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 90 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
- |
|
| 91 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
- |
|
| 92 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
- |
|
| 93 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
25 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 94 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
26 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
| 95 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
27 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| 96 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
28 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 97 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
29 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 98 |
import com.spice.profitmandi.service.offers.OfferService;
|
30 |
import com.spice.profitmandi.service.offers.OfferService;
|
| Line 100... |
Line 32... |
| 100 |
import com.spice.profitmandi.service.user.RetailerService;
|
32 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 101 |
import com.spice.profitmandi.service.wallet.WalletService;
|
33 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 102 |
import com.spice.profitmandi.web.model.LoginDetails;
|
34 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 103 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
35 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 104 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
36 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 105 |
|
- |
|
| 106 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
37 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| - |
|
38 |
import org.apache.commons.csv.CSVRecord;
|
| - |
|
39 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
40 |
import org.apache.logging.log4j.Logger;
|
| - |
|
41 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
42 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
43 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
44 |
import org.springframework.http.HttpHeaders;
|
| - |
|
45 |
import org.springframework.http.HttpStatus;
|
| - |
|
46 |
import org.springframework.http.ResponseEntity;
|
| - |
|
47 |
import org.springframework.stereotype.Controller;
|
| - |
|
48 |
import org.springframework.ui.Model;
|
| - |
|
49 |
import org.springframework.web.bind.annotation.*;
|
| - |
|
50 |
import org.springframework.web.multipart.MultipartFile;
|
| - |
|
51 |
|
| - |
|
52 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
53 |
import javax.servlet.http.HttpServletResponse;
|
| - |
|
54 |
import javax.transaction.Transactional;
|
| - |
|
55 |
import java.io.ByteArrayInputStream;
|
| - |
|
56 |
import java.io.ByteArrayOutputStream;
|
| - |
|
57 |
import java.io.InputStream;
|
| - |
|
58 |
import java.time.*;
|
| - |
|
59 |
import java.util.*;
|
| - |
|
60 |
import java.util.stream.Collectors;
|
| 107 |
|
61 |
|
| 108 |
@Controller
|
62 |
@Controller
|
| 109 |
@Transactional(rollbackOn = Throwable.class)
|
63 |
@Transactional(rollbackOn = Throwable.class)
|
| 110 |
public class SchemeController {
|
64 |
public class SchemeController {
|
| 111 |
|
65 |
|
| Line 800... |
Line 754... |
| 800 |
if (tagListing != null) {
|
754 |
if (tagListing != null) {
|
| 801 |
float taxRate = stateGstRateRepository.getIgstTaxRate(Arrays.asList(itemId)).get(itemId);
|
755 |
float taxRate = stateGstRateRepository.getIgstTaxRate(Arrays.asList(itemId)).get(itemId);
|
| 802 |
float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
|
756 |
float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
|
| 803 |
float amount = taxableSellingPrice * scheme.getAmount() / 100;
|
757 |
float amount = taxableSellingPrice * scheme.getAmount() / 100;
|
| 804 |
scheme.setAmountModel(
|
758 |
scheme.setAmountModel(
|
| 805 |
FormattingUtils.formatDecimalTwoDigits(amount) + " (" + scheme.getAmount() + "%)");
|
759 |
FormattingUtils.formatDecimal(amount) + " (" + scheme.getAmount() + "%)");
|
| 806 |
nlc -= amount;
|
760 |
nlc -= amount;
|
| 807 |
}
|
761 |
}
|
| 808 |
|
762 |
|
| 809 |
else {
|
763 |
else {
|
| 810 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
764 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
| Line 841... |
Line 795... |
| 841 |
if (itemId > 0) {
|
795 |
if (itemId > 0) {
|
| 842 |
float taxRate = stateGstRateRepository.getIgstTaxRate(Arrays.asList(itemId)).get(itemId);
|
796 |
float taxRate = stateGstRateRepository.getIgstTaxRate(Arrays.asList(itemId)).get(itemId);
|
| 843 |
float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
|
797 |
float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
|
| 844 |
float amount = taxableSellingPrice * scheme.getAmount() / 100;
|
798 |
float amount = taxableSellingPrice * scheme.getAmount() / 100;
|
| 845 |
scheme.setAmountModel(
|
799 |
scheme.setAmountModel(
|
| 846 |
FormattingUtils.formatDecimalTwoDigits(amount) + " (" + scheme.getAmount() + "%)");
|
800 |
FormattingUtils.formatDecimal(amount) + " (" + scheme.getAmount() + "%)");
|
| 847 |
} else {
|
801 |
} else {
|
| 848 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
802 |
scheme.setAmountModel(scheme.getAmount() + "%");
|
| 849 |
}
|
803 |
}
|
| 850 |
} else {
|
804 |
} else {
|
| 851 |
scheme.setAmountModel("" + scheme.getAmount());
|
805 |
scheme.setAmountModel("" + scheme.getAmount());
|