| 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.IOException;
|
- |
|
| 6 |
import java.io.InputStream;
|
- |
|
| 7 |
import java.io.InputStreamReader;
|
- |
|
| 8 |
import java.net.URISyntaxException;
|
- |
|
| 9 |
import java.nio.charset.StandardCharsets;
|
- |
|
| 10 |
import java.security.Key;
|
- |
|
| 11 |
import java.time.LocalDate;
|
- |
|
| 12 |
import java.time.LocalDateTime;
|
- |
|
| 13 |
import java.time.YearMonth;
|
- |
|
| 14 |
import java.time.ZoneId;
|
- |
|
| 15 |
import java.time.format.DateTimeFormatter;
|
- |
|
| 16 |
import java.time.temporal.ChronoUnit;
|
- |
|
| 17 |
import java.util.ArrayList;
|
- |
|
| 18 |
import java.util.Arrays;
|
- |
|
| 19 |
import java.util.Base64;
|
- |
|
| 20 |
import java.util.Collection;
|
- |
|
| 21 |
import java.util.Comparator;
|
- |
|
| 22 |
import java.util.HashMap;
|
- |
|
| 23 |
import java.util.HashSet;
|
- |
|
| 24 |
import java.util.Iterator;
|
- |
|
| 25 |
import java.util.List;
|
- |
|
| 26 |
import java.util.Map;
|
- |
|
| 27 |
import java.util.Optional;
|
- |
|
| 28 |
import java.util.Set;
|
- |
|
| 29 |
import java.util.stream.Collectors;
|
- |
|
| 30 |
import java.util.stream.Stream;
|
- |
|
| 31 |
|
- |
|
| 32 |
import javax.servlet.http.HttpServletRequest;
|
- |
|
| 33 |
import javax.servlet.http.HttpServletResponse;
|
- |
|
| 34 |
|
- |
|
| 35 |
import org.apache.commons.csv.CSVFormat;
|
- |
|
| 36 |
import org.apache.commons.csv.CSVParser;
|
- |
|
| 37 |
import org.apache.commons.csv.CSVRecord;
|
- |
|
| 38 |
import org.apache.commons.io.FileUtils;
|
- |
|
| 39 |
import org.apache.commons.lang3.StringUtils;
|
- |
|
| 40 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 41 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 42 |
import org.apache.thrift.TException;
|
- |
|
| 43 |
import org.json.JSONObject;
|
- |
|
| 44 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 45 |
import org.springframework.beans.factory.annotation.Qualifier;
|
- |
|
| 46 |
import org.springframework.beans.factory.annotation.Value;
|
- |
|
| 47 |
import org.springframework.core.io.ByteArrayResource;
|
- |
|
| 48 |
import org.springframework.core.io.ClassPathResource;
|
- |
|
| 49 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 50 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 51 |
import org.springframework.http.HttpStatus;
|
- |
|
| 52 |
import org.springframework.http.MediaType;
|
- |
|
| 53 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 54 |
import org.springframework.mail.javamail.JavaMailSender;
|
- |
|
| 55 |
import org.springframework.stereotype.Controller;
|
- |
|
| 56 |
import org.springframework.transaction.annotation.Transactional;
|
- |
|
| 57 |
import org.springframework.ui.Model;
|
- |
|
| 58 |
import org.springframework.web.bind.annotation.GetMapping;
|
- |
|
| 59 |
import org.springframework.web.bind.annotation.PostMapping;
|
- |
|
| 60 |
import org.springframework.web.bind.annotation.RequestBody;
|
- |
|
| 61 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 62 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 63 |
import org.springframework.web.bind.annotation.RequestParam;
|
- |
|
| 64 |
import org.springframework.web.bind.annotation.RequestPart;
|
- |
|
| 65 |
import org.springframework.web.multipart.MultipartFile;
|
- |
|
| 66 |
|
- |
|
| 67 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
3 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 68 |
import com.google.gson.Gson;
|
4 |
import com.google.gson.Gson;
|
| 69 |
import com.google.gson.JsonObject;
|
- |
|
| 70 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
5 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 71 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
6 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 72 |
import com.spice.profitmandi.common.model.CustomCurrentInventorySnapshot;
|
- |
|
| 73 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
7 |
import com.spice.profitmandi.common.model.*;
|
| 74 |
import com.spice.profitmandi.common.model.InventoryItemAgingModel;
|
- |
|
| 75 |
import com.spice.profitmandi.common.model.InvoicePdfModel;
|
- |
|
| 76 |
import com.spice.profitmandi.common.model.ItemFeatureDataModel;
|
- |
|
| 77 |
import com.spice.profitmandi.common.model.NotifyItemIdModel;
|
- |
|
| 78 |
import com.spice.profitmandi.common.model.NotifyOrderIdModel;
|
- |
|
| 79 |
import com.spice.profitmandi.common.model.NotifyOrderModel;
|
- |
|
| 80 |
import com.spice.profitmandi.common.model.OrderCancellationModel;
|
- |
|
| 81 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 82 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
- |
|
| 83 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
8 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 84 |
import com.spice.profitmandi.common.util.PdfUtils;
|
9 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 85 |
import com.spice.profitmandi.common.util.Utils;
|
10 |
import com.spice.profitmandi.common.util.Utils;
|
| 86 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
11 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 87 |
import com.spice.profitmandi.common.web.client.RestClient;
|
12 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 88 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
13 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 89 |
import com.spice.profitmandi.dao.entity.catalog.ComboMappedModel;
|
- |
|
| 90 |
import com.spice.profitmandi.dao.entity.catalog.ComboModel;
|
- |
|
| 91 |
import com.spice.profitmandi.dao.entity.catalog.ComboOption;
|
- |
|
| 92 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModelByPassRequest;
|
- |
|
| 93 |
import com.spice.profitmandi.dao.entity.catalog.HighDemandItem;
|
- |
|
| 94 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
14 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
| 95 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
- |
|
| 96 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
- |
|
| 97 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
15 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 98 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
16 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
| 99 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
- |
|
| 100 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
17 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 101 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
18 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 102 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
19 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 103 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
20 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| 104 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
- |
|
| 105 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
- |
|
| 106 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
- |
|
| 107 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
- |
|
| 108 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
21 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| 109 |
import com.spice.profitmandi.dao.entity.user.Address;
|
22 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 110 |
import com.spice.profitmandi.dao.enumuration.catalog.ByPassRequestStatus;
|
23 |
import com.spice.profitmandi.dao.enumuration.catalog.ByPassRequestStatus;
|
| 111 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
24 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 112 |
import com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel;
|
- |
|
| 113 |
import com.spice.profitmandi.dao.model.BrandRegionModel;
|
- |
|
| 114 |
import com.spice.profitmandi.dao.model.BrandWiseTertiaryModel;
|
- |
|
| 115 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
25 |
import com.spice.profitmandi.dao.model.*;
|
| 116 |
import com.spice.profitmandi.dao.model.ImeiActivationTimestampModel;
|
- |
|
| 117 |
import com.spice.profitmandi.dao.model.OpenPoItemModel;
|
- |
|
| 118 |
import com.spice.profitmandi.dao.model.OpenPoModel;
|
- |
|
| 119 |
import com.spice.profitmandi.dao.model.OurPurchaseItemModel;
|
- |
|
| 120 |
import com.spice.profitmandi.dao.model.OurPurchaseModel;
|
- |
|
| 121 |
import com.spice.profitmandi.dao.model.SecondaeryOrderDateRange;
|
- |
|
| 122 |
import com.spice.profitmandi.dao.model.SecondaryOrderBillingModel;
|
- |
|
| 123 |
import com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel;
|
- |
|
| 124 |
import com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel;
|
- |
|
| 125 |
import com.spice.profitmandi.dao.model.Specification;
|
- |
|
| 126 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
- |
|
| 127 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
26 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 128 |
import com.spice.profitmandi.dao.repository.catalog.ComboMappedModelRepository;
|
- |
|
| 129 |
import com.spice.profitmandi.dao.repository.catalog.ComboModelRepository;
|
- |
|
| 130 |
import com.spice.profitmandi.dao.repository.catalog.ComboOptionRepository;
|
- |
|
| 131 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelByPassRepository;
|
- |
|
| 132 |
import com.spice.profitmandi.dao.repository.catalog.HighDemandItemsRepository;
|
- |
|
| 133 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
27 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 134 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
- |
|
| 135 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
- |
|
| 136 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
28 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 137 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
29 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 138 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
30 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 139 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 140 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
32 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 141 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
33 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
| 142 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
- |
|
| 143 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
- |
|
| 144 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
34 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 145 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
- |
|
| 146 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 147 |
import com.spice.profitmandi.dao.repository.fofo.LiveDemoBillingRespository;
|
- |
|
| 148 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
35 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
| 149 |
import com.spice.profitmandi.dao.repository.transaction.NotifyCancelOrderRepository;
|
- |
|
| 150 |
import com.spice.profitmandi.dao.repository.transaction.NotifyColorChangeRepository;
|
- |
|
| 151 |
import com.spice.profitmandi.dao.repository.transaction.NotifyItemRepository;
|
- |
|
| 152 |
import com.spice.profitmandi.dao.repository.transaction.NotifyMessageRepository;
|
- |
|
| 153 |
import com.spice.profitmandi.dao.repository.transaction.NotifyOrderRespository;
|
- |
|
| 154 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
36 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
| 155 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
37 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 156 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
38 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 157 |
import com.spice.profitmandi.dao.repository.warehouse.WarehousePurchaseOrderRepository;
|
39 |
import com.spice.profitmandi.dao.repository.warehouse.WarehousePurchaseOrderRepository;
|
| 158 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
40 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
| 159 |
import com.spice.profitmandi.service.NotificationService;
|
41 |
import com.spice.profitmandi.service.NotificationService;
|
| Line 164... |
Line 46... |
| 164 |
import com.spice.profitmandi.service.order.OrderService;
|
46 |
import com.spice.profitmandi.service.order.OrderService;
|
| 165 |
import com.spice.profitmandi.service.user.RetailerService;
|
47 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 166 |
import com.spice.profitmandi.web.model.LoginDetails;
|
48 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 167 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
49 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 168 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
50 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 169 |
|
- |
|
| 170 |
import in.shop2020.model.v1.order.OrderStatus;
|
51 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 171 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
52 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| - |
|
53 |
import org.apache.commons.csv.CSVFormat;
|
| - |
|
54 |
import org.apache.commons.csv.CSVParser;
|
| - |
|
55 |
import org.apache.commons.csv.CSVRecord;
|
| - |
|
56 |
import org.apache.commons.io.FileUtils;
|
| - |
|
57 |
import org.apache.commons.lang3.StringUtils;
|
| - |
|
58 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
59 |
import org.apache.logging.log4j.Logger;
|
| - |
|
60 |
import org.apache.thrift.TException;
|
| - |
|
61 |
import org.json.JSONObject;
|
| - |
|
62 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
63 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
64 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
65 |
import org.springframework.core.io.ByteArrayResource;
|
| - |
|
66 |
import org.springframework.core.io.ClassPathResource;
|
| - |
|
67 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
68 |
import org.springframework.http.HttpHeaders;
|
| - |
|
69 |
import org.springframework.http.HttpStatus;
|
| - |
|
70 |
import org.springframework.http.MediaType;
|
| - |
|
71 |
import org.springframework.http.ResponseEntity;
|
| - |
|
72 |
import org.springframework.mail.javamail.JavaMailSender;
|
| - |
|
73 |
import org.springframework.stereotype.Controller;
|
| - |
|
74 |
import org.springframework.transaction.annotation.Transactional;
|
| - |
|
75 |
import org.springframework.ui.Model;
|
| - |
|
76 |
import org.springframework.web.bind.annotation.*;
|
| - |
|
77 |
import org.springframework.web.multipart.MultipartFile;
|
| - |
|
78 |
|
| - |
|
79 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
80 |
import javax.servlet.http.HttpServletResponse;
|
| - |
|
81 |
import java.io.*;
|
| - |
|
82 |
import java.net.URISyntaxException;
|
| - |
|
83 |
import java.time.LocalDate;
|
| - |
|
84 |
import java.time.LocalDateTime;
|
| - |
|
85 |
import java.time.YearMonth;
|
| - |
|
86 |
import java.time.format.DateTimeFormatter;
|
| - |
|
87 |
import java.time.temporal.ChronoUnit;
|
| - |
|
88 |
import java.util.*;
|
| - |
|
89 |
import java.util.stream.Collectors;
|
| - |
|
90 |
import java.util.stream.Stream;
|
| 172 |
|
91 |
|
| 173 |
|
92 |
|
| 174 |
@Controller
|
93 |
@Controller
|
| 175 |
@Transactional(rollbackFor = Throwable.class)
|
94 |
@Transactional(rollbackFor = Throwable.class)
|
| 176 |
public class InventoryController {
|
95 |
public class InventoryController {
|
| Line 1538... |
Line 1457... |
| 1538 |
|
1457 |
|
| 1539 |
} else {
|
1458 |
} else {
|
| 1540 |
sr = getSecondaryModel(brand, curDate, curDate.plusDays(1));
|
1459 |
sr = getSecondaryModel(brand, curDate, curDate.plusDays(1));
|
| 1541 |
}
|
1460 |
}
|
| 1542 |
|
1461 |
|
| 1543 |
Map<BrandRegionModel, Map<LocalDate, SecondaryWarehouseWiseOrderBilllingModel>> brandWarehouseOrderMap = sr.getSecondaryModel().stream().collect(Collectors.groupingBy(x -> new BrandRegionModel(x.getWarehouseId(), x.getBrand()), Collectors.collectingAndThen(Collectors.toList(), x -> x.stream().collect(Collectors.toMap(y -> y.getBillingTimestamp(), y -> y)))));
|
1462 |
Map<BrandRegionModel, Map<LocalDate, SecondaryWarehouseWiseOrderBilllingModel>> brandWarehouseOrderMap = sr.getSecondaryModel().stream().collect(Collectors.groupingBy(x -> new BrandRegionModel(x.getWarehouseId(), x.getBrand()),
|
| - |
|
1463 |
Collectors.collectingAndThen(Collectors.toList(), x -> x.stream().collect(Collectors.toMap(y -> y.getBillingTimestamp(), y -> y)))));
|
| 1544 |
|
1464 |
|
| 1545 |
Map<LocalDate, Integer> dateWiseTotal = sr.getSecondaryModel().stream().collect(
|
1465 |
Map<LocalDate, Integer> dateWiseTotal = sr.getSecondaryModel().stream().collect(
|
| 1546 |
Collectors.groupingBy(x -> x.getBillingTimestamp(), Collectors.summingInt(x -> (int) x.getValue())));
|
1466 |
Collectors.groupingBy(x -> x.getBillingTimestamp(), Collectors.summingInt(x -> (int) x.getValue())));
|
| 1547 |
|
1467 |
|
| 1548 |
Map<LocalDate, Integer> dateWiseQtyTotal = sr.getSecondaryModel().stream().collect(
|
1468 |
Map<LocalDate, Integer> dateWiseQtyTotal = sr.getSecondaryModel().stream().collect(
|