| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| - |
|
3 |
import static in.shop2020.model.v1.order.OrderStatus.BILLED;
|
| - |
|
4 |
import static in.shop2020.model.v1.order.OrderStatus.DELIVERY_SUCCESS;
|
| - |
|
5 |
import static in.shop2020.model.v1.order.OrderStatus.SHIPPED_FROM_WH;
|
| - |
|
6 |
import static in.shop2020.model.v1.order.OrderStatus.SUBMITTED_FOR_PROCESSING;
|
| - |
|
7 |
|
| - |
|
8 |
import java.io.File;
|
| - |
|
9 |
import java.io.FileInputStream;
|
| - |
|
10 |
import java.io.FileNotFoundException;
|
| - |
|
11 |
import java.time.LocalDate;
|
| - |
|
12 |
import java.time.LocalDateTime;
|
| - |
|
13 |
import java.time.LocalTime;
|
| - |
|
14 |
import java.time.YearMonth;
|
| - |
|
15 |
import java.time.format.DateTimeFormatter;
|
| - |
|
16 |
import java.util.ArrayList;
|
| - |
|
17 |
import java.util.Arrays;
|
| - |
|
18 |
import java.util.Collections;
|
| - |
|
19 |
import java.util.HashMap;
|
| - |
|
20 |
import java.util.HashSet;
|
| - |
|
21 |
import java.util.LinkedHashMap;
|
| - |
|
22 |
import java.util.List;
|
| - |
|
23 |
import java.util.Map;
|
| - |
|
24 |
import java.util.Map.Entry;
|
| - |
|
25 |
import java.util.NoSuchElementException;
|
| - |
|
26 |
import java.util.Optional;
|
| - |
|
27 |
import java.util.Set;
|
| - |
|
28 |
import java.util.TreeMap;
|
| - |
|
29 |
import java.util.stream.Collectors;
|
| - |
|
30 |
|
| - |
|
31 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
32 |
import javax.transaction.Transactional;
|
| - |
|
33 |
|
| - |
|
34 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
35 |
import org.apache.logging.log4j.Logger;
|
| - |
|
36 |
import org.json.JSONObject;
|
| - |
|
37 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
38 |
import org.springframework.beans.factory.annotation.Value;
|
| - |
|
39 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
40 |
import org.springframework.http.HttpHeaders;
|
| - |
|
41 |
import org.springframework.http.HttpStatus;
|
| - |
|
42 |
import org.springframework.http.ResponseEntity;
|
| - |
|
43 |
import org.springframework.stereotype.Controller;
|
| - |
|
44 |
import org.springframework.ui.Model;
|
| - |
|
45 |
import org.springframework.web.bind.annotation.PathVariable;
|
| - |
|
46 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| - |
|
47 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| - |
|
48 |
import org.springframework.web.bind.annotation.RequestParam;
|
| - |
|
49 |
|
| 3 |
import com.google.gson.Gson;
|
50 |
import com.google.gson.Gson;
|
| 4 |
import com.mongodb.DBObject;
|
51 |
import com.mongodb.DBObject;
|
| 5 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
52 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 6 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
53 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
54 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
55 |
import com.spice.profitmandi.common.model.ActivateItemModel;
|
| - |
|
56 |
import com.spice.profitmandi.common.model.ChartInvestmentModel;
|
| 8 |
import com.spice.profitmandi.common.model.*;
|
57 |
import com.spice.profitmandi.common.model.ChartModel;
|
| - |
|
58 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| - |
|
59 |
import com.spice.profitmandi.common.model.Notification;
|
| - |
|
60 |
import com.spice.profitmandi.common.model.OnlineDeliveredOrderSum;
|
| - |
|
61 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 9 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
62 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 10 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
63 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 11 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
64 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 12 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
65 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 13 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
66 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 14 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
67 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
| 15 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
68 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 16 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
69 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| - |
|
70 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| - |
|
71 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| - |
|
72 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 17 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
73 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| - |
|
74 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| - |
|
75 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyTarget;
|
| - |
|
76 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 18 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
77 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
| 19 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
78 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 20 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
79 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
| 21 |
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
|
80 |
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
|
| 22 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
81 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| - |
|
82 |
import com.spice.profitmandi.dao.model.ActivationBrandModel;
|
| - |
|
83 |
import com.spice.profitmandi.dao.model.ActivationImeiUpdationModel;
|
| - |
|
84 |
import com.spice.profitmandi.dao.model.ActivationItemDetailModel;
|
| - |
|
85 |
import com.spice.profitmandi.dao.model.ActivationYearMonthModel;
|
| - |
|
86 |
import com.spice.profitmandi.dao.model.AllPurchaseInventoryModel;
|
| - |
|
87 |
import com.spice.profitmandi.dao.model.BrandAmountModel;
|
| - |
|
88 |
import com.spice.profitmandi.dao.model.BrandWiseActivatedModel;
|
| - |
|
89 |
import com.spice.profitmandi.dao.model.BrandWisePartnerSaleModel;
|
| - |
|
90 |
import com.spice.profitmandi.dao.model.BrandWiseUnbilledActivateStockModel;
|
| - |
|
91 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| - |
|
92 |
import com.spice.profitmandi.dao.model.ImeiActivationTimestampModel;
|
| - |
|
93 |
import com.spice.profitmandi.dao.model.InStockBrandItemModel;
|
| - |
|
94 |
import com.spice.profitmandi.dao.model.InStockBrandModel;
|
| - |
|
95 |
import com.spice.profitmandi.dao.model.ItemWiseTertiaryModel;
|
| - |
|
96 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
| - |
|
97 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| - |
|
98 |
import com.spice.profitmandi.dao.model.PartnerMonthlySaleModel;
|
| - |
|
99 |
import com.spice.profitmandi.dao.model.PartnerPendingIndentItemModel;
|
| - |
|
100 |
import com.spice.profitmandi.dao.model.PriceDropBrandModel;
|
| - |
|
101 |
import com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel;
|
| - |
|
102 |
import com.spice.profitmandi.dao.model.PriceDropYearMonthModel;
|
| 23 |
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
|
103 |
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
|
| - |
|
104 |
import com.spice.profitmandi.dao.model.UpgradeOfferItemDetailModel;
|
| - |
|
105 |
import com.spice.profitmandi.dao.model.WarehouseBrandItemUnbilledActivatedModel;
|
| - |
|
106 |
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemActivatedModel;
|
| - |
|
107 |
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel;
|
| 24 |
import com.spice.profitmandi.dao.model.*;
|
108 |
import com.spice.profitmandi.dao.model.WarehouseWiseActivatedModel;
|
| - |
|
109 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel;
|
| - |
|
110 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandStockModel;
|
| - |
|
111 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandUnbilledActivatedModel;
|
| - |
|
112 |
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
|
| 25 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
113 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 26 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
114 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 27 |
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
|
115 |
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
116 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 29 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
117 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 30 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
118 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
|
119 |
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
120 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
| - |
|
121 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| - |
|
122 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
123 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| - |
|
124 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
| - |
|
125 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| - |
|
126 |
import com.spice.profitmandi.dao.repository.fofo.ActivatedImeiRepository;
|
| - |
|
127 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| - |
|
128 |
import com.spice.profitmandi.dao.repository.fofo.FofoLineItemRepository;
|
| - |
|
129 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
130 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| - |
|
131 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
| - |
|
132 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| - |
|
133 |
import com.spice.profitmandi.dao.repository.fofo.MonthlyTargetRepository;
|
| - |
|
134 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| - |
|
135 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
| - |
|
136 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
| - |
|
137 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
138 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
139 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
|
140 |
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
141 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 39 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
142 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| Line 47... |
Line 150... |
| 47 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
150 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 48 |
import com.spice.profitmandi.service.user.RetailerService;
|
151 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 49 |
import com.spice.profitmandi.web.model.LoginDetails;
|
152 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 50 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
153 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 51 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
154 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 52 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 53 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 54 |
import org.json.JSONObject;
|
- |
|
| 55 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 56 |
import org.springframework.beans.factory.annotation.Value;
|
- |
|
| 57 |
import org.springframework.core.io.InputStreamResource;
|
- |
|
| 58 |
import org.springframework.http.HttpHeaders;
|
- |
|
| 59 |
import org.springframework.http.HttpStatus;
|
- |
|
| 60 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 61 |
import org.springframework.stereotype.Controller;
|
- |
|
| 62 |
import org.springframework.ui.Model;
|
- |
|
| 63 |
import org.springframework.web.bind.annotation.PathVariable;
|
- |
|
| 64 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 65 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 66 |
import org.springframework.web.bind.annotation.RequestParam;
|
- |
|
| 67 |
|
- |
|
| 68 |
import javax.servlet.http.HttpServletRequest;
|
- |
|
| 69 |
import javax.transaction.Transactional;
|
- |
|
| 70 |
import java.io.File;
|
- |
|
| 71 |
import java.io.FileInputStream;
|
- |
|
| 72 |
import java.io.FileNotFoundException;
|
- |
|
| 73 |
import java.time.LocalDate;
|
- |
|
| 74 |
import java.time.LocalDateTime;
|
- |
|
| 75 |
import java.time.LocalTime;
|
- |
|
| 76 |
import java.time.YearMonth;
|
- |
|
| 77 |
import java.time.format.DateTimeFormatter;
|
- |
|
| 78 |
import java.util.*;
|
- |
|
| 79 |
import java.util.Map.Entry;
|
- |
|
| 80 |
import java.util.stream.Collectors;
|
- |
|
| 81 |
|
- |
|
| 82 |
import static in.shop2020.model.v1.order.OrderStatus.*;
|
- |
|
| 83 |
|
155 |
|
| 84 |
@Controller
|
156 |
@Controller
|
| 85 |
@Transactional(rollbackOn = Throwable.class)
|
157 |
@Transactional(rollbackOn = Throwable.class)
|
| 86 |
public class DashboardController {
|
158 |
public class DashboardController {
|
| 87 |
|
159 |
|
| Line 223... |
Line 295... |
| 223 |
@Autowired
|
295 |
@Autowired
|
| 224 |
private PositionRepository positionRepository;
|
296 |
private PositionRepository positionRepository;
|
| 225 |
|
297 |
|
| 226 |
@Autowired
|
298 |
@Autowired
|
| 227 |
private MonthlyTargetRepository monthlyTargetRepository;
|
299 |
private MonthlyTargetRepository monthlyTargetRepository;
|
| - |
|
300 |
|
| 228 |
@Autowired
|
301 |
@Autowired
|
| 229 |
private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
|
302 |
private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
|
| 230 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
303 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 231 |
|
304 |
|
| 232 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
305 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
| Line 1953... |
Line 2026... |
| 1953 |
.collect(Collectors.groupingBy(x -> Milestone.get(x.getLmtd()), Collectors.counting()));
|
2026 |
.collect(Collectors.groupingBy(x -> Milestone.get(x.getLmtd()), Collectors.counting()));
|
| 1954 |
|
2027 |
|
| 1955 |
Map<Milestone, Long> lmsMap = partnerDetails.stream()
|
2028 |
Map<Milestone, Long> lmsMap = partnerDetails.stream()
|
| 1956 |
.collect(Collectors.groupingBy(x -> Milestone.get(x.getLms()), Collectors.counting()));
|
2029 |
.collect(Collectors.groupingBy(x -> Milestone.get(x.getLms()), Collectors.counting()));
|
| 1957 |
|
2030 |
|
| - |
|
2031 |
Map<Milestone, List<Integer>> partnerIdsMap = partnerDetails.stream()
|
| - |
|
2032 |
.collect(Collectors.groupingBy(x -> Milestone.get(x.getMtd()),
|
| - |
|
2033 |
Collectors.mapping(x -> x.getFofoId(), Collectors.toList())));
|
| - |
|
2034 |
|
| 1958 |
model.addAttribute("mtdMap", mtdMap);
|
2035 |
model.addAttribute("mtdMap", mtdMap);
|
| 1959 |
model.addAttribute("lmtdMap", lmtdMap);
|
2036 |
model.addAttribute("lmtdMap", lmtdMap);
|
| 1960 |
model.addAttribute("avg3Monthlms", avg3Monthlms);
|
2037 |
model.addAttribute("avg3Monthlms", avg3Monthlms);
|
| 1961 |
model.addAttribute("lmsMap", lmsMap);
|
2038 |
model.addAttribute("lmsMap", lmsMap);
|
| 1962 |
|
- |
|
| - |
|
2039 |
model.addAttribute("partnerIdsMap", partnerIdsMap);
|
| 1963 |
}
|
2040 |
}
|
| 1964 |
|
2041 |
|
| 1965 |
}
|
2042 |
}
|
| 1966 |
}
|
2043 |
}
|
| 1967 |
|
2044 |
|
| Line 2126... |
Line 2203... |
| 2126 |
}
|
2203 |
}
|
| 2127 |
}
|
2204 |
}
|
| 2128 |
return new ArrayList<>(fofoIds);
|
2205 |
return new ArrayList<>(fofoIds);
|
| 2129 |
}
|
2206 |
}
|
| 2130 |
|
2207 |
|
| - |
|
2208 |
@RequestMapping(value = "/getMonthWiseSale", method = RequestMethod.GET)
|
| - |
|
2209 |
public String getPartnerSaleByMonth(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model model)
|
| - |
|
2210 |
throws Exception {
|
| - |
|
2211 |
|
| - |
|
2212 |
List<PartnerMonthlySaleModel> partnerMonthlySaleModels = fofoOrderItemRepository
|
| - |
|
2213 |
.selectPartnerMonthlySale(fofoIds, LocalDateTime.now().minusMonths(12));
|
| - |
|
2214 |
LOGGER.info("partnerMonthlySaleModels" + partnerMonthlySaleModels);
|
| - |
|
2215 |
return "response";
|
| - |
|
2216 |
|
| - |
|
2217 |
}
|
| 2131 |
}
|
2218 |
}
|