| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.io.File;
|
3 |
import java.io.File;
|
| 4 |
import java.io.FileInputStream;
|
4 |
import java.io.FileInputStream;
|
| 5 |
import java.io.FileNotFoundException;
|
5 |
import java.io.FileNotFoundException;
|
| 6 |
import java.io.FileOutputStream;
|
6 |
import java.io.FileOutputStream;
|
| 7 |
import java.io.ObjectInputStream;
|
- |
|
| 8 |
import java.io.ObjectOutputStream;
|
7 |
import java.io.ObjectOutputStream;
|
| 9 |
import java.text.DateFormat;
|
- |
|
| 10 |
import java.text.SimpleDateFormat;
|
- |
|
| 11 |
import java.time.LocalDate;
|
8 |
import java.time.LocalDate;
|
| 12 |
import java.time.LocalDateTime;
|
9 |
import java.time.LocalDateTime;
|
| 13 |
import java.time.LocalTime;
|
10 |
import java.time.LocalTime;
|
| 14 |
import java.time.Month;
|
- |
|
| 15 |
import java.time.Period;
|
- |
|
| 16 |
import java.time.YearMonth;
|
11 |
import java.time.YearMonth;
|
| 17 |
import java.time.ZoneOffset;
|
- |
|
| 18 |
import java.time.format.DateTimeFormatter;
|
12 |
import java.time.format.DateTimeFormatter;
|
| 19 |
import java.util.ArrayList;
|
13 |
import java.util.ArrayList;
|
| 20 |
import java.util.Arrays;
|
14 |
import java.util.Arrays;
|
| 21 |
import java.util.Collection;
|
- |
|
| 22 |
import java.util.Collections;
|
15 |
import java.util.Collections;
|
| 23 |
import java.util.Comparator;
|
- |
|
| 24 |
import java.util.Date;
|
- |
|
| 25 |
import java.util.HashMap;
|
16 |
import java.util.HashMap;
|
| 26 |
import java.util.HashSet;
|
- |
|
| 27 |
import java.util.LinkedHashMap;
|
17 |
import java.util.LinkedHashMap;
|
| 28 |
import java.util.LinkedHashSet;
|
- |
|
| 29 |
import java.util.List;
|
18 |
import java.util.List;
|
| 30 |
import java.util.Locale;
|
- |
|
| 31 |
import java.util.Map;
|
19 |
import java.util.Map;
|
| 32 |
import java.util.Map.Entry;
|
20 |
import java.util.Map.Entry;
|
| 33 |
import java.util.Optional;
|
21 |
import java.util.Optional;
|
| 34 |
import java.util.Set;
|
22 |
import java.util.Set;
|
| 35 |
import java.util.TreeMap;
|
23 |
import java.util.TreeMap;
|
| 36 |
import java.util.stream.Collector;
|
- |
|
| 37 |
import java.util.stream.Collectors;
|
24 |
import java.util.stream.Collectors;
|
| 38 |
|
25 |
|
| 39 |
import javax.servlet.http.HttpServletRequest;
|
26 |
import javax.servlet.http.HttpServletRequest;
|
| 40 |
import javax.transaction.Transactional;
|
27 |
import javax.transaction.Transactional;
|
| 41 |
|
28 |
|
| 42 |
import org.apache.commons.collections4.OrderedMap;
|
- |
|
| 43 |
import org.apache.logging.log4j.LogManager;
|
29 |
import org.apache.logging.log4j.LogManager;
|
| 44 |
import org.apache.logging.log4j.Logger;
|
30 |
import org.apache.logging.log4j.Logger;
|
| 45 |
|
- |
|
| 46 |
import org.json.JSONObject;
|
31 |
import org.json.JSONObject;
|
| 47 |
import org.springframework.beans.factory.annotation.Autowired;
|
32 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 48 |
import org.springframework.beans.factory.annotation.Value;
|
33 |
import org.springframework.beans.factory.annotation.Value;
|
| 49 |
import org.springframework.core.io.InputStreamResource;
|
34 |
import org.springframework.core.io.InputStreamResource;
|
| 50 |
import org.springframework.http.HttpHeaders;
|
35 |
import org.springframework.http.HttpHeaders;
|
| Line 54... |
Line 39... |
| 54 |
import org.springframework.ui.Model;
|
39 |
import org.springframework.ui.Model;
|
| 55 |
import org.springframework.web.bind.annotation.RequestMapping;
|
40 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 56 |
import org.springframework.web.bind.annotation.RequestMethod;
|
41 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 57 |
import org.springframework.web.bind.annotation.RequestParam;
|
42 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 58 |
|
43 |
|
| 59 |
import com.google.common.collect.ArrayListMultimap;
|
- |
|
| 60 |
import com.google.common.collect.Multimap;
|
- |
|
| 61 |
import com.google.gson.Gson;
|
44 |
import com.google.gson.Gson;
|
| 62 |
import com.mongodb.DBObject;
|
- |
|
| 63 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
45 |
import com.spice.profitmandi.common.enumuration.ContentType;
|
| 64 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
46 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 65 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
- |
|
| 66 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
47 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 67 |
import com.spice.profitmandi.common.model.ActivateItemModel;
|
48 |
import com.spice.profitmandi.common.model.ActivateItemModel;
|
| 68 |
import com.spice.profitmandi.common.model.Axis;
|
- |
|
| 69 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
- |
|
| 70 |
import com.spice.profitmandi.common.model.ChartInvestmentModel;
|
49 |
import com.spice.profitmandi.common.model.ChartInvestmentModel;
|
| 71 |
import com.spice.profitmandi.common.model.ChartModel;
|
50 |
import com.spice.profitmandi.common.model.ChartModel;
|
| 72 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
51 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 73 |
import com.spice.profitmandi.common.model.Data;
|
- |
|
| 74 |
import com.spice.profitmandi.common.model.DataInvestmentModel;
|
- |
|
| 75 |
import com.spice.profitmandi.common.model.DataModel;
|
- |
|
| 76 |
|
- |
|
| 77 |
import com.spice.profitmandi.common.model.DatasetModel;
|
- |
|
| 78 |
import com.spice.profitmandi.common.model.HoverModel;
|
- |
|
| 79 |
import com.spice.profitmandi.common.model.Legend;
|
- |
|
| 80 |
import com.spice.profitmandi.common.model.LegendModel;
|
- |
|
| 81 |
import com.spice.profitmandi.common.model.Notification;
|
52 |
import com.spice.profitmandi.common.model.Notification;
|
| 82 |
import com.spice.profitmandi.common.model.OnlineDeliveredOrderSum;
|
53 |
import com.spice.profitmandi.common.model.OnlineDeliveredOrderSum;
|
| 83 |
import com.spice.profitmandi.common.model.OptionModel;
|
- |
|
| 84 |
import com.spice.profitmandi.common.model.OptionsModel;
|
- |
|
| 85 |
import com.spice.profitmandi.common.model.PieLables;
|
- |
|
| 86 |
import com.spice.profitmandi.common.model.PluginsModel;
|
- |
|
| 87 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
54 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 88 |
import com.spice.profitmandi.common.model.ScalesModel;
|
- |
|
| 89 |
import com.spice.profitmandi.common.model.TitleModel;
|
- |
|
| 90 |
import com.spice.profitmandi.common.model.Tooltips;
|
- |
|
| 91 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
55 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 92 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
- |
|
| 93 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
56 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 94 |
import com.spice.profitmandi.dao.entity.auth.Menu;
|
- |
|
| 95 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
57 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 96 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
58 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 97 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
- |
|
| 98 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
59 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
| 99 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
60 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 100 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
61 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 101 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 102 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 103 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| 104 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
- |
|
| 105 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 106 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
- |
|
| 107 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
- |
|
| 108 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
65 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
| 109 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
66 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 110 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
- |
|
| 111 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
- |
|
| 112 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
- |
|
| 113 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
67 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| 114 |
import com.spice.profitmandi.dao.model.BrandWiseModel;
|
- |
|
| 115 |
import com.spice.profitmandi.dao.model.BrandWisePartnerSaleModel;
|
68 |
import com.spice.profitmandi.dao.model.BrandWisePartnerSaleModel;
|
| 116 |
import com.spice.profitmandi.dao.model.BrandWiseUnbilledActivateStockModel;
|
69 |
import com.spice.profitmandi.dao.model.BrandWiseUnbilledActivateStockModel;
|
| 117 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
70 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 118 |
import com.spice.profitmandi.dao.model.InStockBrandItemModel;
|
71 |
import com.spice.profitmandi.dao.model.InStockBrandItemModel;
|
| 119 |
import com.spice.profitmandi.dao.model.InStockBrandModel;
|
72 |
import com.spice.profitmandi.dao.model.InStockBrandModel;
|
| Line 121... |
Line 74... |
| 121 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
74 |
import com.spice.profitmandi.dao.model.MonthSaleModel;
|
| 122 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
75 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| 123 |
import com.spice.profitmandi.dao.model.PartnerPendingIndentItemModel;
|
76 |
import com.spice.profitmandi.dao.model.PartnerPendingIndentItemModel;
|
| 124 |
import com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel;
|
77 |
import com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel;
|
| 125 |
import com.spice.profitmandi.dao.model.PriceDropYearMonthModel;
|
78 |
import com.spice.profitmandi.dao.model.PriceDropYearMonthModel;
|
| 126 |
import com.spice.profitmandi.dao.model.SecondaryOrderBilledLmsModel;
|
- |
|
| 127 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
- |
|
| 128 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
- |
|
| 129 |
import com.spice.profitmandi.dao.model.WarehouseBrandItemUnbilledActivatedModel;
|
79 |
import com.spice.profitmandi.dao.model.WarehouseBrandItemUnbilledActivatedModel;
|
| 130 |
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel;
|
80 |
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel;
|
| 131 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel;
|
81 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel;
|
| 132 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandStockModel;
|
82 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandStockModel;
|
| 133 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandUnbilledActivatedModel;
|
83 |
import com.spice.profitmandi.dao.model.WarehouseWiseBrandUnbilledActivatedModel;
|
| 134 |
import com.spice.profitmandi.dao.model.WarehouseWiseStockModel;
|
- |
|
| 135 |
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
|
84 |
import com.spice.profitmandi.dao.model.WarehouseWiseitemStockModel;
|
| 136 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
85 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 137 |
import com.spice.profitmandi.dao.repository.auth.MenuCategoryRepository;
|
- |
|
| 138 |
import com.spice.profitmandi.dao.repository.auth.MenuRepository;
|
- |
|
| 139 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
86 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 140 |
import com.spice.profitmandi.dao.repository.catalog.OfferMarginRepository;
|
- |
|
| 141 |
import com.spice.profitmandi.dao.repository.catalog.OfferPartnerRepository;
|
- |
|
| 142 |
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
|
- |
|
| 143 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
87 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 144 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
88 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 145 |
import com.spice.profitmandi.dao.repository.cs.PartnersPositionRepository;
|
- |
|
| 146 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
- |
|
| 147 |
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
|
89 |
import com.spice.profitmandi.dao.repository.cs.TicketAssignedRepository;
|
| 148 |
import com.spice.profitmandi.dao.repository.cs.TicketCategoryRepository;
|
- |
|
| 149 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
90 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
| 150 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
91 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 151 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
92 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 152 |
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
|
- |
|
| 153 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
- |
|
| 154 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
93 |
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
|
| 155 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
94 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 156 |
import com.spice.profitmandi.dao.repository.dtr.UserCampaignRepository;
|
- |
|
| 157 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
95 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 158 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
96 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 159 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
97 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 160 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
98 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
| 161 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
99 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 162 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
- |
|
| 163 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
- |
|
| 164 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
- |
|
| 165 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
100 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 166 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
101 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
| 167 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
102 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
| 168 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
103 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
| 169 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
104 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
|
| 170 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventorySnapshotRepository;
|
- |
|
| 171 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
105 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 172 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
106 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| - |
|
107 |
import com.spice.profitmandi.service.AdminUser;
|
| - |
|
108 |
import com.spice.profitmandi.service.FofoUser;
|
| 173 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
109 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 174 |
import com.spice.profitmandi.service.PartnerStatsService;
|
110 |
import com.spice.profitmandi.service.PartnerStatsService;
|
| 175 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
111 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 176 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
112 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 177 |
import com.spice.profitmandi.service.offers.OfferService;
|
113 |
import com.spice.profitmandi.service.offers.OfferService;
|
| Line 183... |
Line 119... |
| 183 |
|
119 |
|
| 184 |
@Controller
|
120 |
@Controller
|
| 185 |
@Transactional(rollbackOn = Throwable.class)
|
121 |
@Transactional(rollbackOn = Throwable.class)
|
| 186 |
public class DashboardController {
|
122 |
public class DashboardController {
|
| 187 |
|
123 |
|
| 188 |
private static final double ONE_LAC = 1 * 1000 * 100;
|
- |
|
| 189 |
private static final double TWO_LAC = 2 * 1000 * 100;
|
- |
|
| 190 |
private static final double FOUR_LAC = 4 * 1000 * 100;
|
- |
|
| 191 |
|
- |
|
| 192 |
List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
124 |
List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
| 193 |
"niranjan.kala@smartdukaan.com", "hemant.kaura@smartdukaan.com", "amit.gupta@shop2020.in",
|
125 |
"niranjan.kala@smartdukaan.com", "hemant.kaura@smartdukaan.com", "amit.gupta@shop2020.in",
|
| 194 |
"tejbeer.kaur@shop2020.in");
|
126 |
"tejbeer.kaur@shop2020.in");
|
| 195 |
|
127 |
|
| 196 |
@Value("${web.api.host}")
|
128 |
@Value("${web.api.host}")
|
| Line 216... |
Line 148... |
| 216 |
|
148 |
|
| 217 |
@Autowired
|
149 |
@Autowired
|
| 218 |
private PartnerStatsService partnerStatsService;
|
150 |
private PartnerStatsService partnerStatsService;
|
| 219 |
|
151 |
|
| 220 |
@Autowired
|
152 |
@Autowired
|
| 221 |
private MenuRepository menuRepository;
|
- |
|
| 222 |
|
- |
|
| 223 |
@Autowired
|
- |
|
| 224 |
private MenuCategoryRepository menuCategoryRepository;
|
- |
|
| 225 |
|
- |
|
| 226 |
@Autowired
|
- |
|
| 227 |
private CsService csService;
|
153 |
private CsService csService;
|
| 228 |
|
154 |
|
| 229 |
@Autowired
|
155 |
@Autowired
|
| 230 |
private PartnerTargetRepository partnerTargetRepository;
|
- |
|
| 231 |
|
- |
|
| 232 |
@Autowired
|
- |
|
| 233 |
private ResponseSender<?> responseSender;
|
156 |
private ResponseSender<?> responseSender;
|
| 234 |
|
157 |
|
| 235 |
@Autowired
|
158 |
@Autowired
|
| 236 |
RetailerService retailerService;
|
159 |
RetailerService retailerService;
|
| 237 |
|
160 |
|
| 238 |
@Autowired
|
161 |
@Autowired
|
| 239 |
private RoleManager roleManager;
|
162 |
private AdminUser adminUser;
|
| 240 |
|
163 |
|
| 241 |
@Autowired
|
164 |
@Autowired
|
| 242 |
private FofoStoreRepository fofoStoreRepository;
|
165 |
private RoleManager roleManager;
|
| 243 |
|
166 |
|
| 244 |
@Autowired
|
167 |
@Autowired
|
| 245 |
private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
168 |
private FofoStoreRepository fofoStoreRepository;
|
| 246 |
|
169 |
|
| 247 |
@Autowired
|
170 |
@Autowired
|
| 248 |
private PartnerInvestmentService partnerInvestmentService;
|
171 |
private PartnerInvestmentService partnerInvestmentService;
|
| 249 |
|
172 |
|
| 250 |
@Autowired
|
173 |
@Autowired
|
| Line 264... |
Line 187... |
| 264 |
|
187 |
|
| 265 |
@Autowired
|
188 |
@Autowired
|
| 266 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
189 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
| 267 |
|
190 |
|
| 268 |
@Autowired
|
191 |
@Autowired
|
| 269 |
private TicketCategoryRepository ticketCategoryRepository;
|
- |
|
| 270 |
|
- |
|
| 271 |
@Autowired
|
- |
|
| 272 |
private PartnerTypeChangeService partnerTypeChangeService;
|
192 |
private PartnerTypeChangeService partnerTypeChangeService;
|
| 273 |
|
193 |
|
| 274 |
@Autowired
|
194 |
@Autowired
|
| 275 |
private HygieneDataRepository hygieneDataRepository;
|
195 |
private HygieneDataRepository hygieneDataRepository;
|
| 276 |
|
196 |
|
| 277 |
@Autowired
|
197 |
@Autowired
|
| 278 |
private UserCampaignRepository userCampaignRepository;
|
- |
|
| 279 |
|
- |
|
| 280 |
@Autowired
|
- |
|
| 281 |
private PositionRepository positionRepository;
|
- |
|
| 282 |
@Autowired
|
- |
|
| 283 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
- |
|
| 284 |
|
- |
|
| 285 |
@Autowired
|
- |
|
| 286 |
private PartnersPositionRepository partnerPositionRepository;
|
- |
|
| 287 |
|
- |
|
| 288 |
@Autowired
|
- |
|
| 289 |
private UserAccountRepository userAccountRepository;
|
198 |
private UserAccountRepository userAccountRepository;
|
| 290 |
|
199 |
|
| 291 |
@Autowired
|
200 |
@Autowired
|
| 292 |
private NotificationCampaignRepository notificationCampaignRepository;
|
201 |
private NotificationCampaignRepository notificationCampaignRepository;
|
| 293 |
|
202 |
|
| 294 |
@Autowired
|
203 |
@Autowired
|
| 295 |
private Mongo mongoClient;
|
- |
|
| 296 |
|
- |
|
| 297 |
@Autowired
|
- |
|
| 298 |
private AuthRepository authRepository;
|
204 |
private AuthRepository authRepository;
|
| 299 |
|
205 |
|
| 300 |
@Autowired
|
206 |
@Autowired
|
| 301 |
private FofoOrderRepository fofoOrderRepository;
|
207 |
private FofoOrderRepository fofoOrderRepository;
|
| 302 |
|
208 |
|
| Line 305... |
Line 211... |
| 305 |
|
211 |
|
| 306 |
@Autowired
|
212 |
@Autowired
|
| 307 |
TicketRepository ticketRepository;
|
213 |
TicketRepository ticketRepository;
|
| 308 |
|
214 |
|
| 309 |
@Autowired
|
215 |
@Autowired
|
| 310 |
private LeadRepository leadRepository;
|
- |
|
| 311 |
|
- |
|
| 312 |
@Autowired
|
- |
|
| 313 |
private OfferRepository offerRepository;
|
- |
|
| 314 |
|
- |
|
| 315 |
@Autowired
|
- |
|
| 316 |
private OfferPartnerRepository offerPartnerRepository;
|
- |
|
| 317 |
|
- |
|
| 318 |
@Autowired
|
- |
|
| 319 |
private OfferService offerService;
|
216 |
private OfferService offerService;
|
| 320 |
|
217 |
|
| 321 |
@Autowired
|
218 |
@Autowired
|
| 322 |
private OfferMarginRepository offerMarginRepository;
|
- |
|
| 323 |
|
- |
|
| 324 |
@Autowired
|
- |
|
| 325 |
private ItemRepository itemRepository;
|
219 |
private ItemRepository itemRepository;
|
| 326 |
|
220 |
|
| 327 |
@Autowired
|
221 |
@Autowired
|
| 328 |
private SaholicInventorySnapshotRepository saholicInventorySnapshotRepository;
|
- |
|
| 329 |
|
- |
|
| 330 |
@Autowired
|
- |
|
| 331 |
private SaholicInventoryCISRepository saholicInventoryCISRepository;
|
222 |
private SaholicInventoryCISRepository saholicInventoryCISRepository;
|
| 332 |
|
223 |
|
| 333 |
@Autowired
|
224 |
@Autowired
|
| 334 |
private MVCResponseSender mvcResponseSender;
|
225 |
private MVCResponseSender mvcResponseSender;
|
| 335 |
|
226 |
|
| Line 345... |
Line 236... |
| 345 |
@Autowired
|
236 |
@Autowired
|
| 346 |
private TicketAssignedRepository ticketAssignedRepository;
|
237 |
private TicketAssignedRepository ticketAssignedRepository;
|
| 347 |
|
238 |
|
| 348 |
@Autowired
|
239 |
@Autowired
|
| 349 |
private OrderRepository orderRepository;
|
240 |
private OrderRepository orderRepository;
|
| - |
|
241 |
|
| - |
|
242 |
@Autowired
|
| - |
|
243 |
private FofoUser fofoUser;
|
| 350 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
244 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 351 |
|
245 |
|
| 352 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
246 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
| 353 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
247 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
| 354 |
boolean isAdmin = false;
|
248 |
boolean isAdmin = false;
|
| Line 373... |
Line 267... |
| 373 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
267 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
| 374 |
model.addAttribute("partnerType", partnerType);
|
268 |
model.addAttribute("partnerType", partnerType);
|
| 375 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
269 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
| 376 |
model.addAttribute("fofoStore", customRetailer);
|
270 |
model.addAttribute("fofoStore", customRetailer);
|
| 377 |
model.addAttribute("partnerType", partnerType);
|
271 |
model.addAttribute("partnerType", partnerType);
|
| 378 |
model.addAttribute("hasGift", hasGift(fofoId));
|
272 |
model.addAttribute("hasGift", fofoUser.hasGift(fofoId));
|
| 379 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
273 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
| 380 |
|
274 |
|
| 381 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(fofoId));
|
275 |
model.addAttribute("brandStockPrices", fofoUser.getBrandStockPrices(fofoId));
|
| 382 |
model.addAttribute("salesMap", this.getSales(fofoId));
|
276 |
model.addAttribute("salesMap", fofoUser.getSales(fofoId));
|
| 383 |
model.addAttribute("activatedImeis", inventoryItemRepository.selectCountByActivatedNotSold(fofoId));
|
277 |
model.addAttribute("activatedImeis", inventoryItemRepository.selectCountByActivatedNotSold(fofoId));
|
| 384 |
// this.setInvestments
|
278 |
// this.setInvestments
|
| 385 |
//
|
279 |
//
|
| 386 |
Map<Integer, String> monthValueMap = new HashMap<>();
|
280 |
Map<Integer, String> monthValueMap = new HashMap<>();
|
| 387 |
for (int i = 0; i <= 5; i++) {
|
281 |
for (int i = 0; i <= 5; i++) {
|
| 388 |
LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
|
282 |
LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
|
| 389 |
monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
|
283 |
monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
|
| 390 |
}
|
284 |
}
|
| 391 |
LOGGER.info("monthValueMap" + monthValueMap);
|
285 |
LOGGER.info("monthValueMap" + monthValueMap);
|
| 392 |
model.addAttribute("monthValueMap", monthValueMap);
|
286 |
model.addAttribute("monthValueMap", monthValueMap);
|
| 393 |
model.addAttribute("investments", this.getInvestments(fofoId));
|
287 |
model.addAttribute("investments", fofoUser.getInvestments(fofoId));
|
| 394 |
model.addAttribute("isInvestmentOk",
|
288 |
model.addAttribute("isInvestmentOk",
|
| 395 |
partnerInvestmentService.isInvestmentOk(fofoId, 10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
289 |
partnerInvestmentService.isInvestmentOk(fofoId, 10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
| 396 |
} catch (ProfitMandiBusinessException e) {
|
290 |
} catch (ProfitMandiBusinessException e) {
|
| 397 |
LOGGER.error("FofoStore Code not found of fofoId {}", fofoId);
|
291 |
LOGGER.error("FofoStore Code not found of fofoId {}", fofoId);
|
| 398 |
|
292 |
|
| 399 |
}
|
293 |
}
|
| 400 |
|
294 |
|
| 401 |
return "12dashboard34";
|
295 |
return "12dashboard34";
|
| 402 |
}
|
296 |
}
|
| 403 |
|
297 |
|
| 404 |
private Map<String, Object> getInvestments(int fofoId) throws Exception {
|
- |
|
| 405 |
Map<String, Object> investments = new LinkedHashMap<>();
|
- |
|
| 406 |
PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
|
- |
|
| 407 |
LocalDate currentMonthStart = LocalDate.now().withDayOfMonth(1);
|
- |
|
| 408 |
LocalDate yesterDate = LocalDate.now().minusDays(1);
|
- |
|
| 409 |
PartnerDailyInvestment yesterdayInvestment = partnerDailyInvestmentRepository.select(fofoId, yesterDate);
|
- |
|
| 410 |
if (yesterdayInvestment == null) {
|
- |
|
| 411 |
yesterdayInvestment = new PartnerDailyInvestment();
|
- |
|
| 412 |
}
|
- |
|
| 413 |
|
- |
|
| 414 |
List<PartnerDailyInvestment> currentMonthInvestments = partnerDailyInvestmentRepository.selectAll(fofoId,
|
- |
|
| 415 |
currentMonthStart, currentMonthStart.withDayOfMonth(currentMonthStart.lengthOfMonth()));
|
- |
|
| 416 |
|
- |
|
| 417 |
long okInvestmentDays = currentMonthInvestments.stream().filter(x -> x.getShortPercentage() <= 10)
|
- |
|
| 418 |
.collect(Collectors.counting());
|
- |
|
| 419 |
investments.put("today", investment.getTotalInvestment());
|
- |
|
| 420 |
investments.put("investment", investment);
|
- |
|
| 421 |
investments.put("inStock", investment.getInStockAmount());
|
- |
|
| 422 |
investments.put("minimum", investment.getMinInvestmentString());
|
- |
|
| 423 |
investments.put("short", investment.getShortPercentage());
|
- |
|
| 424 |
investments.put("activated_stock", investment.getActivatedStockAmount());
|
- |
|
| 425 |
investments.put("okDays", okInvestmentDays);
|
- |
|
| 426 |
return investments;
|
- |
|
| 427 |
}
|
- |
|
| 428 |
|
- |
|
| 429 |
private Map<String, Object> getInvestmentsMonths(int fofoId, int month) throws Exception {
|
- |
|
| 430 |
Map<String, Object> investments = new LinkedHashMap<>();
|
- |
|
| 431 |
PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
|
- |
|
| 432 |
LocalDate currentMonthStart = LocalDate.now().withDayOfMonth(1).minusMonths(month);
|
- |
|
| 433 |
|
- |
|
| 434 |
LocalDate yesterDate = LocalDate.now().minusDays(1);
|
- |
|
| 435 |
PartnerDailyInvestment yesterdayInvestment = partnerDailyInvestmentRepository.select(fofoId, yesterDate);
|
- |
|
| 436 |
if (yesterdayInvestment == null) {
|
- |
|
| 437 |
yesterdayInvestment = new PartnerDailyInvestment();
|
- |
|
| 438 |
}
|
- |
|
| 439 |
|
- |
|
| 440 |
List<PartnerDailyInvestment> currentMonthInvestments = partnerDailyInvestmentRepository.selectAll(fofoId,
|
- |
|
| 441 |
currentMonthStart, currentMonthStart.withDayOfMonth(currentMonthStart.lengthOfMonth()));
|
- |
|
| 442 |
|
- |
|
| 443 |
long okInvestmentDays = currentMonthInvestments.stream().filter(x -> x.getShortPercentage() <= 10)
|
- |
|
| 444 |
.collect(Collectors.counting());
|
- |
|
| 445 |
investments.put("today", investment.getTotalInvestment());
|
- |
|
| 446 |
investments.put("investment", investment);
|
- |
|
| 447 |
investments.put("inStock", investment.getInStockAmount());
|
- |
|
| 448 |
investments.put("minimum", investment.getMinInvestmentString());
|
- |
|
| 449 |
investments.put("short", investment.getShortPercentage());
|
- |
|
| 450 |
investments.put("activated_stock", investment.getActivatedStockAmount());
|
- |
|
| 451 |
investments.put("okDays", okInvestmentDays);
|
- |
|
| 452 |
return investments;
|
- |
|
| 453 |
}
|
- |
|
| 454 |
|
- |
|
| 455 |
private Map<String, Object> getSales(int fofoId) {
|
- |
|
| 456 |
|
- |
|
| 457 |
Map<String, Object> salesMap = new LinkedHashMap<>();
|
- |
|
| 458 |
LocalDateTime now = LocalDateTime.now();
|
- |
|
| 459 |
LocalDateTime startOfToday = LocalDate.now().atStartOfDay();
|
- |
|
| 460 |
int monthLength = LocalDate.now().lengthOfMonth();
|
- |
|
| 461 |
int daysGone = now.getDayOfMonth() - 1;
|
- |
|
| 462 |
int daysRemaining = monthLength - daysGone;
|
- |
|
| 463 |
Double todaySale = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfToday, now, fofoId, false)
|
- |
|
| 464 |
.get(fofoId);
|
- |
|
| 465 |
Double mtdSaleTillYesterDay = fofoOrderItemRepository
|
- |
|
| 466 |
.selectSumMopGroupByRetailer(startOfToday.withDayOfMonth(1), startOfToday, fofoId, false).get(fofoId);
|
- |
|
| 467 |
Double mtdSale = mtdSaleTillYesterDay + todaySale;
|
- |
|
| 468 |
Double lmtdSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(
|
- |
|
| 469 |
startOfToday.withDayOfMonth(1).minusMonths(1), now.minusMonths(1), fofoId, false).get(fofoId);
|
- |
|
| 470 |
|
- |
|
| 471 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
- |
|
| 472 |
.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
|
- |
|
| 473 |
if (partnerTargetDetails.isEmpty()) {
|
- |
|
| 474 |
partnerTargetDetails = partnerTargetRepository
|
- |
|
| 475 |
.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now().minusMonths(3));
|
- |
|
| 476 |
}
|
- |
|
| 477 |
|
- |
|
| 478 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, LocalDate.now());
|
- |
|
| 479 |
|
- |
|
| 480 |
int currentRate = 0;
|
- |
|
| 481 |
if (mtdSaleTillYesterDay > 0) {
|
- |
|
| 482 |
currentRate = (int) (mtdSaleTillYesterDay / daysGone);
|
- |
|
| 483 |
}
|
- |
|
| 484 |
|
- |
|
| 485 |
salesMap.put("requiredType", partnerType.next());
|
- |
|
| 486 |
float reqdAmount = partnerTypeChangeService.getMinimumAmount(partnerType.next());
|
- |
|
| 487 |
int requiredRate = (int) ((reqdAmount - mtdSaleTillYesterDay) / daysRemaining);
|
- |
|
| 488 |
if (partnerType.equals(PartnerType.PLATINUM) && requiredRate < currentRate) {
|
- |
|
| 489 |
requiredRate = currentRate;
|
- |
|
| 490 |
}
|
- |
|
| 491 |
salesMap.put("requiredRate", requiredRate);
|
- |
|
| 492 |
salesMap.put("requiredTypeImage", PartnerType.imageMap.get(partnerType.next()));
|
- |
|
| 493 |
|
- |
|
| 494 |
salesMap.put("todaySale", todaySale == null ? 0 : todaySale);
|
- |
|
| 495 |
salesMap.put("mtdSale", mtdSale == null ? 0 : mtdSale);
|
- |
|
| 496 |
salesMap.put("lmtdSale", lmtdSale == null ? 0 : lmtdSale);
|
- |
|
| 497 |
|
- |
|
| 498 |
PartnerType currentType = partnerTypeChangeService.getPartnerTypeByAmount(currentRate * monthLength);
|
- |
|
| 499 |
salesMap.put("currentRate", currentRate);
|
- |
|
| 500 |
salesMap.put("currentType", currentType);
|
- |
|
| 501 |
salesMap.put("currentTypeImage", PartnerType.imageMap.get(currentType));
|
- |
|
| 502 |
return salesMap;
|
- |
|
| 503 |
}
|
- |
|
| 504 |
|
- |
|
| 505 |
@RequestMapping(value = "/getMonthSale", method = RequestMethod.GET)
|
298 |
@RequestMapping(value = "/getMonthSale", method = RequestMethod.GET)
|
| 506 |
public String getMonthsale(HttpServletRequest request, Model model) throws Exception {
|
299 |
public String getMonthsale(HttpServletRequest request, Model model) throws Exception {
|
| 507 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
300 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 508 |
int fofoId = loginDetails.getFofoId();
|
301 |
int fofoId = loginDetails.getFofoId();
|
| 509 |
Map<Integer, MonthSaleModel> monthSaleMap = new HashMap<>();
|
302 |
Map<Integer, MonthSaleModel> monthSaleMap = new HashMap<>();
|
| Line 521... |
Line 314... |
| 521 |
.get(fofoId);
|
314 |
.get(fofoId);
|
| 522 |
|
315 |
|
| 523 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfMonth.toLocalDate());
|
316 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfMonth.toLocalDate());
|
| 524 |
|
317 |
|
| 525 |
MonthSaleModel ms = new MonthSaleModel();
|
318 |
MonthSaleModel ms = new MonthSaleModel();
|
| 526 |
ms.setMtdSales(this.format((long) mtdSales));
|
319 |
ms.setMtdSales(fofoUser.format((long) mtdSales));
|
| 527 |
ms.setMonthlySales(this.format(((long) monthSales)));
|
320 |
ms.setMonthlySales(fofoUser.format(((long) monthSales)));
|
| 528 |
ms.setPartnerType(partnerType);
|
321 |
ms.setPartnerType(partnerType);
|
| 529 |
ms.setMonth(startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
|
322 |
ms.setMonth(startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
|
| 530 |
monthSaleMap.put(i, ms);
|
323 |
monthSaleMap.put(i, ms);
|
| 531 |
|
324 |
|
| 532 |
}
|
325 |
}
|
| 533 |
model.addAttribute("monthSales", monthSaleMap);
|
326 |
model.addAttribute("monthSales", monthSaleMap);
|
| 534 |
return "monthSales";
|
327 |
return "monthSales";
|
| 535 |
}
|
328 |
}
|
| 536 |
|
329 |
|
| 537 |
private String format(long value) {
|
- |
|
| 538 |
String finalval = null;
|
- |
|
| 539 |
|
- |
|
| 540 |
if (value >= 100000 && value < 10000000) {
|
- |
|
| 541 |
long reminder = value / 100000;
|
- |
|
| 542 |
long quitonent = value % 100000;
|
- |
|
| 543 |
finalval = reminder + "." + quitonent;
|
- |
|
| 544 |
String secondval = String.valueOf(quitonent);
|
- |
|
| 545 |
if (secondval.length() >= 2) {
|
- |
|
| 546 |
secondval = secondval.substring(0, 2);
|
- |
|
| 547 |
finalval = reminder + "." + secondval;
|
- |
|
| 548 |
}
|
- |
|
| 549 |
return String.valueOf(finalval) + " Lacs";
|
- |
|
| 550 |
} else if (value >= 1000 && value < 100000) {
|
- |
|
| 551 |
long reminder = value / 1000;
|
- |
|
| 552 |
long quitonent = value % 1000;
|
- |
|
| 553 |
finalval = reminder + "." + quitonent;
|
- |
|
| 554 |
String secondval = String.valueOf(quitonent);
|
- |
|
| 555 |
if (secondval.length() >= 2) {
|
- |
|
| 556 |
secondval = secondval.substring(0, 2);
|
- |
|
| 557 |
finalval = reminder + "." + secondval;
|
- |
|
| 558 |
}
|
- |
|
| 559 |
return String.valueOf(finalval) + " K";
|
- |
|
| 560 |
} else if (value >= 10000000 && value < 1000000000) {
|
- |
|
| 561 |
long reminder = value / 10000000;
|
- |
|
| 562 |
long quitonent = value % 10000000;
|
- |
|
| 563 |
finalval = reminder + "." + quitonent;
|
- |
|
| 564 |
String secondval = String.valueOf(quitonent);
|
- |
|
| 565 |
if (secondval.length() >= 2) {
|
- |
|
| 566 |
secondval = secondval.substring(0, 2);
|
- |
|
| 567 |
finalval = reminder + "." + secondval;
|
- |
|
| 568 |
}
|
- |
|
| 569 |
return String.valueOf(finalval) + " Cr";
|
- |
|
| 570 |
}
|
- |
|
| 571 |
return String.valueOf(finalval);
|
- |
|
| 572 |
|
- |
|
| 573 |
}
|
- |
|
| 574 |
|
- |
|
| 575 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
- |
|
| 576 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
- |
|
| 577 |
|
- |
|
| 578 |
List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
|
- |
|
| 579 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
- |
|
| 580 |
|
- |
|
| 581 |
mobileBrands.stream().forEach(x -> {
|
- |
|
| 582 |
String brand = (String) x.get("name");
|
- |
|
| 583 |
if (brandStockPricesMap.containsKey(brand)) {
|
- |
|
| 584 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
- |
|
| 585 |
brandStockPrice.setBrandUrl((String) x.get("url"));
|
- |
|
| 586 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
- |
|
| 587 |
brandStockPrices.add(brandStockPrice);
|
- |
|
| 588 |
}
|
- |
|
| 589 |
});
|
- |
|
| 590 |
|
- |
|
| 591 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
- |
|
| 592 |
.collect(Collectors.toList());
|
- |
|
| 593 |
}
|
- |
|
| 594 |
|
- |
|
| 595 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
330 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 596 |
public String dashboard(HttpServletRequest request, Model model) throws Exception {
|
331 |
public String dashboard(HttpServletRequest request, Model model) throws Exception {
|
| 597 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
332 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 598 |
String email = loginDetails.getEmailId();
|
333 |
String email = loginDetails.getEmailId();
|
| 599 |
int fofoId = loginDetails.getFofoId();
|
334 |
int fofoId = loginDetails.getFofoId();
|
| Line 616... |
Line 351... |
| 616 |
model.addAttribute("webApiHost", webApiHost);
|
351 |
model.addAttribute("webApiHost", webApiHost);
|
| 617 |
model.addAttribute("webApiPort", webApiPort);
|
352 |
model.addAttribute("webApiPort", webApiPort);
|
| 618 |
model.addAttribute("webApiScheme", webApiScheme);
|
353 |
model.addAttribute("webApiScheme", webApiScheme);
|
| 619 |
model.addAttribute("webApiRoot", webApiRoot);
|
354 |
model.addAttribute("webApiRoot", webApiRoot);
|
| 620 |
if (isAdmin) {
|
355 |
if (isAdmin) {
|
| 621 |
return adminPanel(loginDetails.getFofoId(), email, model);
|
356 |
return adminUser.adminPanel(loginDetails.getFofoId(), email, model);
|
| 622 |
} else {
|
357 |
} else {
|
| 623 |
FofoStore fofoStore = null;
|
358 |
FofoStore fofoStore = null;
|
| 624 |
try {
|
359 |
try {
|
| 625 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
360 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 626 |
if (!fofoStore.isActive()) {
|
361 |
if (!fofoStore.isActive()) {
|
| Line 630... |
Line 365... |
| 630 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
365 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
| 631 |
model.addAttribute("partnerType", partnerType);
|
366 |
model.addAttribute("partnerType", partnerType);
|
| 632 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
367 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
| 633 |
model.addAttribute("fofoStore", fofoStore);
|
368 |
model.addAttribute("fofoStore", fofoStore);
|
| 634 |
model.addAttribute("partnerType", partnerType);
|
369 |
model.addAttribute("partnerType", partnerType);
|
| 635 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
370 |
model.addAttribute("hasGift", fofoUser.hasGift(loginDetails.getFofoId()));
|
| 636 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
371 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
| 637 |
model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
|
372 |
model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
|
| 638 |
.append("partnerId", fofoStore.getId()).toString());
|
373 |
.append("partnerId", fofoStore.getId()).toString());
|
| 639 |
model.addAttribute("activatedImeis",
|
374 |
model.addAttribute("activatedImeis",
|
| 640 |
inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
|
375 |
inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
|
| Line 647... |
Line 382... |
| 647 |
.selectSumStockGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
|
382 |
.selectSumStockGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
|
| 648 |
Optional.of(false))
|
383 |
Optional.of(false))
|
| 649 |
.get(loginDetails.getFofoId());
|
384 |
.get(loginDetails.getFofoId());
|
| 650 |
|
385 |
|
| 651 |
model.addAttribute("accesoriesStock", String.format("%.0f", accesoriesStock));
|
386 |
model.addAttribute("accesoriesStock", String.format("%.0f", accesoriesStock));
|
| 652 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
|
387 |
model.addAttribute("brandStockPrices", fofoUser.getBrandStockPrices(loginDetails.getFofoId()));
|
| 653 |
model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
|
388 |
model.addAttribute("salesMap", fofoUser.getSales(loginDetails.getFofoId()));
|
| 654 |
ChartModel cm = this.getBrandChart(loginDetails.getFofoId());
|
389 |
ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId());
|
| 655 |
|
390 |
|
| 656 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
391 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 657 |
model.addAttribute("chartMap", gson.toJson(cm));
|
392 |
model.addAttribute("chartMap", gson.toJson(cm));
|
| 658 |
|
393 |
|
| 659 |
List<CreateOfferRequest> publishedOffers = offerService.getPublishedOffers(loginDetails.getFofoId(),
|
394 |
List<CreateOfferRequest> publishedOffers = offerService.getPublishedOffers(loginDetails.getFofoId(),
|
| 660 |
YearMonth.from(LocalDateTime.now()));
|
395 |
YearMonth.from(LocalDateTime.now()));
|
| 661 |
model.addAttribute("publishedOffers", publishedOffers);
|
396 |
model.addAttribute("publishedOffers", publishedOffers);
|
| 662 |
model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
|
397 |
model.addAttribute("investments", fofoUser.getInvestments(loginDetails.getFofoId()));
|
| 663 |
model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
|
398 |
model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
|
| 664 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
399 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
| 665 |
|
400 |
|
| 666 |
} catch (ProfitMandiBusinessException e) {
|
401 |
} catch (ProfitMandiBusinessException e) {
|
| 667 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
402 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| Line 715... |
Line 450... |
| 715 |
public String getMonthsInvestment(HttpServletRequest request,
|
450 |
public String getMonthsInvestment(HttpServletRequest request,
|
| 716 |
@RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
|
451 |
@RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
|
| 717 |
throws Exception {
|
452 |
throws Exception {
|
| 718 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
453 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 719 |
int fofoId = loginDetails.getFofoId();
|
454 |
int fofoId = loginDetails.getFofoId();
|
| 720 |
Map<String, Object> investment = getInvestmentsMonths(fofoId, month);
|
455 |
Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
|
| 721 |
|
456 |
|
| 722 |
LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
|
457 |
LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
|
| 723 |
LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
|
458 |
LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
|
| 724 |
LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
|
459 |
LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
|
| 725 |
double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
|
460 |
double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
|
| Line 756... |
Line 491... |
| 756 |
|
491 |
|
| 757 |
@RequestMapping(value = "/investmentDetails", method = RequestMethod.GET)
|
492 |
@RequestMapping(value = "/investmentDetails", method = RequestMethod.GET)
|
| 758 |
public String getInvestmentDetails(HttpServletRequest request, Model model) throws Exception {
|
493 |
public String getInvestmentDetails(HttpServletRequest request, Model model) throws Exception {
|
| 759 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
494 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 760 |
int fofoId = loginDetails.getFofoId();
|
495 |
int fofoId = loginDetails.getFofoId();
|
| 761 |
ChartInvestmentModel cm = this.getInvestmentChart(fofoId);
|
496 |
ChartInvestmentModel cm = fofoUser.getInvestmentChart(fofoId);
|
| 762 |
model.addAttribute("chartPieMap", gson.toJson(cm));
|
497 |
model.addAttribute("chartPieMap", gson.toJson(cm));
|
| 763 |
|
498 |
|
| 764 |
LOGGER.info("InvestmentChart" + gson.toJson(cm));
|
499 |
LOGGER.info("InvestmentChart" + gson.toJson(cm));
|
| 765 |
LOGGER.info("InvestmentChart" + cm);
|
500 |
LOGGER.info("InvestmentChart" + cm);
|
| 766 |
return "investmentdetails";
|
501 |
return "investmentdetails";
|
| Line 768... |
Line 503... |
| 768 |
|
503 |
|
| 769 |
@RequestMapping(value = "/getlmsLineChart", method = RequestMethod.GET)
|
504 |
@RequestMapping(value = "/getlmsLineChart", method = RequestMethod.GET)
|
| 770 |
public String getlmsLineChart(HttpServletRequest request, Model model) throws Exception {
|
505 |
public String getlmsLineChart(HttpServletRequest request, Model model) throws Exception {
|
| 771 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
506 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 772 |
int fofoId = loginDetails.getFofoId();
|
507 |
int fofoId = loginDetails.getFofoId();
|
| 773 |
ChartModel cm = this.getLmsLineChart(loginDetails.getFofoId());
|
508 |
ChartModel cm = fofoUser.getLmsLineChart(loginDetails.getFofoId());
|
| 774 |
|
509 |
|
| 775 |
LOGGER.info("linechartMap" + gson.toJson(cm));
|
510 |
LOGGER.info("linechartMap" + gson.toJson(cm));
|
| 776 |
model.addAttribute("linechartMap", gson.toJson(cm));
|
511 |
model.addAttribute("linechartMap", gson.toJson(cm));
|
| 777 |
return "lmsLineChart";
|
512 |
return "lmsLineChart";
|
| 778 |
}
|
513 |
}
|
| 779 |
|
514 |
|
| 780 |
@RequestMapping(value = "/getMonthlyPurchaseLineChart", method = RequestMethod.GET)
|
515 |
@RequestMapping(value = "/getMonthlyPurchaseLineChart", method = RequestMethod.GET)
|
| 781 |
public String getMonthlyPurchaseLineChart(HttpServletRequest request, Model model) throws Exception {
|
516 |
public String getMonthlyPurchaseLineChart(HttpServletRequest request, Model model) throws Exception {
|
| 782 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
517 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 783 |
int fofoId = loginDetails.getFofoId();
|
518 |
int fofoId = loginDetails.getFofoId();
|
| 784 |
ChartModel cm = this.getPurchaseOrderChart(fofoId);
|
519 |
ChartModel cm = fofoUser.getPurchaseOrderChart(fofoId);
|
| 785 |
|
520 |
|
| 786 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
521 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 787 |
model.addAttribute("chartMap", gson.toJson(cm));
|
522 |
model.addAttribute("chartMap", gson.toJson(cm));
|
| 788 |
|
523 |
|
| 789 |
return "purchase_chart";
|
524 |
return "purchase_chart";
|
| Line 791... |
Line 526... |
| 791 |
|
526 |
|
| 792 |
@RequestMapping(value = "/getBarChart", method = RequestMethod.GET)
|
527 |
@RequestMapping(value = "/getBarChart", method = RequestMethod.GET)
|
| 793 |
public String getBarChart(HttpServletRequest request, Model model) throws Exception {
|
528 |
public String getBarChart(HttpServletRequest request, Model model) throws Exception {
|
| 794 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
529 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 795 |
int fofoId = loginDetails.getFofoId();
|
530 |
int fofoId = loginDetails.getFofoId();
|
| 796 |
ChartModel cm = this.getBrandChart(fofoId);
|
531 |
ChartModel cm = fofoUser.getBrandChart(fofoId);
|
| 797 |
|
532 |
|
| 798 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
533 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 799 |
model.addAttribute("chartMap", gson.toJson(cm));
|
534 |
model.addAttribute("chartMap", gson.toJson(cm));
|
| 800 |
|
535 |
|
| 801 |
return "bar_chart";
|
536 |
return "bar_chart";
|
| 802 |
}
|
537 |
}
|
| 803 |
|
538 |
|
| 804 |
@RequestMapping(value = "/getMonthlyPriceDropTab", method = RequestMethod.GET)
|
- |
|
| 805 |
public String getMonthlyPriceDrop(HttpServletRequest request, Model model) throws Exception {
|
- |
|
| 806 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
- |
|
| 807 |
int fofoId = loginDetails.getFofoId();
|
- |
|
| 808 |
ChartModel cm = this.getMonthlyPriceDrop(fofoId);
|
- |
|
| 809 |
|
- |
|
| 810 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
- |
|
| 811 |
model.addAttribute("chartMap", gson.toJson(cm));
|
- |
|
| 812 |
|
- |
|
| 813 |
return "price_drop_chart";
|
- |
|
| 814 |
}
|
- |
|
| 815 |
|
- |
|
| 816 |
@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
|
539 |
@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
|
| 817 |
public String getPriceDropDetails(HttpServletRequest request,
|
540 |
public String getPriceDropDetails(HttpServletRequest request,
|
| 818 |
@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
|
541 |
@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
|
| 819 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
542 |
@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
|
| 820 |
@RequestParam(name = "yearMonth", required = true, defaultValue = "0") String yearMonth, Model model)
|
543 |
@RequestParam(name = "yearMonth", required = true, defaultValue = "0") String yearMonth, Model model)
|
| 821 |
throws Exception {
|
544 |
throws Exception {
|
| 822 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
- |
|
| 823 |
|
545 |
|
| 824 |
LOGGER.info("params" + fofoId + brand + yearMonth);
|
546 |
LOGGER.info("params" + fofoId + brand + yearMonth);
|
| 825 |
|
547 |
|
| 826 |
List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
|
548 |
List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
|
| 827 |
.selectBrandPendingPriceDropWithDetailsByYearMonth(fofoId, brand, yearMonth);
|
549 |
.selectBrandPendingPriceDropWithDetailsByYearMonth(fofoId, brand, yearMonth);
|
| Line 927... |
Line 649... |
| 927 |
model.addAttribute("sortedBrandValue", brandValues);
|
649 |
model.addAttribute("sortedBrandValue", brandValues);
|
| 928 |
|
650 |
|
| 929 |
return "price-drop-tabular";
|
651 |
return "price-drop-tabular";
|
| 930 |
}
|
652 |
}
|
| 931 |
|
653 |
|
| 932 |
private ChartModel getMonthlyPriceDrop(int fofoId) throws ProfitMandiBusinessException {
|
- |
|
| 933 |
|
- |
|
| 934 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 935 |
|
- |
|
| 936 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
|
- |
|
| 937 |
|
- |
|
| 938 |
List<PriceDropYearMonthModel> priceDropYearMonthModels = priceDropRepository
|
- |
|
| 939 |
.selectBrandPendingPriceDropByYearMonth(fofoId, startOfMonth);
|
- |
|
| 940 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
- |
|
| 941 |
|
- |
|
| 942 |
Map<YearMonth, Map<String, Double>> monthBrandValue = new HashMap<>();
|
- |
|
| 943 |
LOGGER.info("priceDropYearMonthModels" + priceDropYearMonthModels);
|
- |
|
| 944 |
for (PriceDropYearMonthModel priceDropYearMonthModel : priceDropYearMonthModels) {
|
- |
|
| 945 |
|
- |
|
| 946 |
Map<String, Double> brandValue = new HashMap<>();
|
- |
|
| 947 |
brandValue.put(priceDropYearMonthModel.getBrand(), (double) priceDropYearMonthModel.getAmount());
|
- |
|
| 948 |
monthBrandValue.put(YearMonth.parse(priceDropYearMonthModel.getYearMonth(), dateTimeFormatter), brandValue);
|
- |
|
| 949 |
}
|
- |
|
| 950 |
Map<YearMonth, Map<String, Double>> sortedMonthBrandValue = new TreeMap<>(monthBrandValue);
|
- |
|
| 951 |
|
- |
|
| 952 |
LOGGER.info("sortedMonthBrandValue" + sortedMonthBrandValue);
|
- |
|
| 953 |
List<String> brands = new ArrayList<>();
|
- |
|
| 954 |
|
- |
|
| 955 |
brands.add("Accessories");
|
- |
|
| 956 |
brands.add("Oppo");
|
- |
|
| 957 |
brands.add("Vivo");
|
- |
|
| 958 |
brands.add("Samsung");
|
- |
|
| 959 |
brands.add("Realme");
|
- |
|
| 960 |
brands.add("Xiaomi");
|
- |
|
| 961 |
brands.add("Tecno");
|
- |
|
| 962 |
brands.add("Itel");
|
- |
|
| 963 |
|
- |
|
| 964 |
brands.add("Nokia");
|
- |
|
| 965 |
|
- |
|
| 966 |
for (int i = 6; i >= 1; i--) {
|
- |
|
| 967 |
|
- |
|
| 968 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 969 |
LOGGER.info("getStartMonth" + sortedMonthBrandValue.get(YearMonth.from(startMonth)));
|
- |
|
| 970 |
Map<String, Double> valbrand = sortedMonthBrandValue.get(YearMonth.from(startMonth));
|
- |
|
| 971 |
for (String brand : brands) {
|
- |
|
| 972 |
if (valbrand != null) {
|
- |
|
| 973 |
if (!valbrand.containsKey(brand)) {
|
- |
|
| 974 |
valbrand.put(brand, 0.0);
|
- |
|
| 975 |
} else {
|
- |
|
| 976 |
valbrand.put(brand, valbrand.get(brand));
|
- |
|
| 977 |
}
|
- |
|
| 978 |
|
- |
|
| 979 |
} else {
|
- |
|
| 980 |
valbrand = new HashMap<String, Double>();
|
- |
|
| 981 |
valbrand.put(brand, 0.0);
|
- |
|
| 982 |
}
|
- |
|
| 983 |
}
|
- |
|
| 984 |
|
- |
|
| 985 |
sortedMonthBrandValue.put(YearMonth.from(curDate.withDayOfMonth(1).minusMonths(i)), valbrand);
|
- |
|
| 986 |
|
- |
|
| 987 |
}
|
- |
|
| 988 |
Multimap<String, Map<YearMonth, Double>> brandMonthValueMap = ArrayListMultimap.create();
|
- |
|
| 989 |
|
- |
|
| 990 |
for (Entry<YearMonth, Map<String, Double>> month : sortedMonthBrandValue.entrySet()) {
|
- |
|
| 991 |
for (Entry<String, Double> val : month.getValue().entrySet()) {
|
- |
|
| 992 |
Map<YearMonth, Double> yearValue = new HashMap<>();
|
- |
|
| 993 |
|
- |
|
| 994 |
yearValue.put(month.getKey(), val.getValue() == null ? 0 : val.getValue());
|
- |
|
| 995 |
|
- |
|
| 996 |
brandMonthValueMap.put(val.getKey(), yearValue);
|
- |
|
| 997 |
|
- |
|
| 998 |
}
|
- |
|
| 999 |
}
|
- |
|
| 1000 |
|
- |
|
| 1001 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
- |
|
| 1002 |
|
- |
|
| 1003 |
for (String brand : brands) {
|
- |
|
| 1004 |
Collection<Map<YearMonth, Double>> coll = brandMonthValueMap.get(brand);
|
- |
|
| 1005 |
|
- |
|
| 1006 |
List<Double> valueList = new ArrayList<>();
|
- |
|
| 1007 |
for (Map<YearMonth, Double> col : coll) {
|
- |
|
| 1008 |
|
- |
|
| 1009 |
valueList.addAll(col.values());
|
- |
|
| 1010 |
}
|
- |
|
| 1011 |
sortedBrandValue.put(brand, valueList);
|
- |
|
| 1012 |
}
|
- |
|
| 1013 |
LinkedHashSet<String> labels = new LinkedHashSet<String>();
|
- |
|
| 1014 |
|
- |
|
| 1015 |
for (int i = 6; i >= 1; i--) {
|
- |
|
| 1016 |
|
- |
|
| 1017 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 1018 |
labels.add(startMonth.format(DateTimeFormatter.ofPattern("MMM''uu")).toString());
|
- |
|
| 1019 |
}
|
- |
|
| 1020 |
|
- |
|
| 1021 |
List<DatasetModel> datasets = new ArrayList<>();
|
- |
|
| 1022 |
List<String> colorList = new ArrayList<>();
|
- |
|
| 1023 |
colorList.add("papayawhip");
|
- |
|
| 1024 |
colorList.add("darkgreen");
|
- |
|
| 1025 |
colorList.add("dodgerblue");
|
- |
|
| 1026 |
colorList.add("darkblue");
|
- |
|
| 1027 |
colorList.add("gold");
|
- |
|
| 1028 |
|
- |
|
| 1029 |
colorList.add("coral");
|
- |
|
| 1030 |
|
- |
|
| 1031 |
colorList.add("steelblue");
|
- |
|
| 1032 |
colorList.add("red");
|
- |
|
| 1033 |
|
- |
|
| 1034 |
colorList.add("midnightblue");
|
- |
|
| 1035 |
colorList.add("cornsilk");
|
- |
|
| 1036 |
|
- |
|
| 1037 |
List<String> borderList = new ArrayList<>();
|
- |
|
| 1038 |
borderList.add("pink");
|
- |
|
| 1039 |
borderList.add("mediumseagreen");
|
- |
|
| 1040 |
borderList.add("lightblue");
|
- |
|
| 1041 |
borderList.add("#0000cd");
|
- |
|
| 1042 |
borderList.add("#f7e98e");
|
- |
|
| 1043 |
|
- |
|
| 1044 |
borderList.add("#ff8c69");
|
- |
|
| 1045 |
|
- |
|
| 1046 |
borderList.add("#0000cd");
|
- |
|
| 1047 |
borderList.add("lightsalmon");
|
- |
|
| 1048 |
|
- |
|
| 1049 |
borderList.add("#0000cd");
|
- |
|
| 1050 |
borderList.add("cornsilk");
|
- |
|
| 1051 |
|
- |
|
| 1052 |
int i = 0;
|
- |
|
| 1053 |
|
- |
|
| 1054 |
for (Entry<String, List<Double>> brandValue : sortedBrandValue.entrySet()) {
|
- |
|
| 1055 |
|
- |
|
| 1056 |
DatasetModel purchaseModel = new DatasetModel();
|
- |
|
| 1057 |
purchaseModel.setLabel(brandValue.getKey());
|
- |
|
| 1058 |
purchaseModel.setBackgroundColor(colorList.get(i));
|
- |
|
| 1059 |
if (brandValue.getValue().isEmpty()) {
|
- |
|
| 1060 |
|
- |
|
| 1061 |
purchaseModel.setData(Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
- |
|
| 1062 |
} else {
|
- |
|
| 1063 |
purchaseModel.setData(brandValue.getValue());
|
- |
|
| 1064 |
}
|
- |
|
| 1065 |
purchaseModel.setType("line");
|
- |
|
| 1066 |
purchaseModel.setOrder(1);
|
- |
|
| 1067 |
purchaseModel.setFill("false");
|
- |
|
| 1068 |
purchaseModel.setBorderColor(borderList.get(i));
|
- |
|
| 1069 |
datasets.add(purchaseModel);
|
- |
|
| 1070 |
|
- |
|
| 1071 |
i++;
|
- |
|
| 1072 |
}
|
- |
|
| 1073 |
|
- |
|
| 1074 |
DataModel dm = new DataModel();
|
- |
|
| 1075 |
dm.setDatasets(datasets);
|
- |
|
| 1076 |
dm.setLabels(labels);
|
- |
|
| 1077 |
|
- |
|
| 1078 |
LegendModel lm = new LegendModel();
|
- |
|
| 1079 |
lm.setPosition("top");
|
- |
|
| 1080 |
|
- |
|
| 1081 |
Tooltips tooltips = new Tooltips();
|
- |
|
| 1082 |
tooltips.setBodyFontSize(15);
|
- |
|
| 1083 |
tooltips.setTitleFontSize(15);
|
- |
|
| 1084 |
tooltips.setMode("index");
|
- |
|
| 1085 |
tooltips.setIntersect(false);
|
- |
|
| 1086 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
- |
|
| 1087 |
|
- |
|
| 1088 |
HoverModel hover = new HoverModel();
|
- |
|
| 1089 |
hover.setIntersect(false);
|
- |
|
| 1090 |
hover.setMode("index");
|
- |
|
| 1091 |
|
- |
|
| 1092 |
TitleModel tm = new TitleModel();
|
- |
|
| 1093 |
tm.setText("Brand Wise Monthly Price-Drop");
|
- |
|
| 1094 |
tm.setDisplay(true);
|
- |
|
| 1095 |
tm.setFontSize(20);
|
- |
|
| 1096 |
tm.setFontColor("#111");
|
- |
|
| 1097 |
|
- |
|
| 1098 |
OptionsModel om = new OptionsModel();
|
- |
|
| 1099 |
om.setResponsive(true);
|
- |
|
| 1100 |
om.setLegend(lm);
|
- |
|
| 1101 |
om.setTitle(tm);
|
- |
|
| 1102 |
om.setTooltips(tooltips);
|
- |
|
| 1103 |
om.setHover(hover);
|
- |
|
| 1104 |
|
- |
|
| 1105 |
ChartModel cm = new ChartModel();
|
- |
|
| 1106 |
|
- |
|
| 1107 |
cm.setType("line");
|
- |
|
| 1108 |
cm.setData(dm);
|
- |
|
| 1109 |
cm.setOptions(om);
|
- |
|
| 1110 |
|
- |
|
| 1111 |
LOGGER.info("cm" + cm);
|
- |
|
| 1112 |
|
- |
|
| 1113 |
return cm;
|
- |
|
| 1114 |
}
|
- |
|
| 1115 |
|
- |
|
| 1116 |
private ChartInvestmentModel getInvestmentChart(int fofoId) throws ProfitMandiBusinessException {
|
- |
|
| 1117 |
PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
|
- |
|
| 1118 |
|
- |
|
| 1119 |
Map<String, Float> investmentWalletAmount = new HashMap<>();
|
- |
|
| 1120 |
investmentWalletAmount.put("Wallet", investment.getWalletAmount());
|
- |
|
| 1121 |
investmentWalletAmount.put("InStocks", investment.getInStockAmount() - investment.getActivatedStockAmount());
|
- |
|
| 1122 |
investmentWalletAmount.put("Unbilled Order", investment.getUnbilledAmount());
|
- |
|
| 1123 |
investmentWalletAmount.put("GrnPending", investment.getGrnPendingAmount());
|
- |
|
| 1124 |
investmentWalletAmount.put("ReturnInTransit", investment.getReturnInTransitAmount());
|
- |
|
| 1125 |
|
- |
|
| 1126 |
if (investment.getShortInvestment() > 0) {
|
- |
|
| 1127 |
investmentWalletAmount.put("Short Investment", investment.getShortInvestment());
|
- |
|
| 1128 |
}
|
- |
|
| 1129 |
|
- |
|
| 1130 |
ChartInvestmentModel cm = new ChartInvestmentModel();
|
- |
|
| 1131 |
|
- |
|
| 1132 |
HashSet<String> labels = new HashSet<String>();
|
- |
|
| 1133 |
labels.addAll(investmentWalletAmount.keySet());
|
- |
|
| 1134 |
|
- |
|
| 1135 |
List<String> labelList = new ArrayList<>(labels);
|
- |
|
| 1136 |
List<String> backgroundColor = new ArrayList<>();
|
- |
|
| 1137 |
List<Float> labelsValue = new ArrayList<>();
|
- |
|
| 1138 |
List<Float> values = new ArrayList<>();
|
- |
|
| 1139 |
for (String label : labelList) {
|
- |
|
| 1140 |
values.add(investmentWalletAmount.get(label));
|
- |
|
| 1141 |
if (label.equals("Wallet")) {
|
- |
|
| 1142 |
backgroundColor.add("pink");
|
- |
|
| 1143 |
}
|
- |
|
| 1144 |
if (label.equals("Short Investment")) {
|
- |
|
| 1145 |
backgroundColor.add("red");
|
- |
|
| 1146 |
}
|
- |
|
| 1147 |
if (label.equals("InStocks")) {
|
- |
|
| 1148 |
backgroundColor.add("#9ACD32");
|
- |
|
| 1149 |
}
|
- |
|
| 1150 |
if (label.equals("Unbilled Order")) {
|
- |
|
| 1151 |
backgroundColor.add("blue");
|
- |
|
| 1152 |
}
|
- |
|
| 1153 |
|
- |
|
| 1154 |
if (label.equals("ReturnInTransit")) {
|
- |
|
| 1155 |
backgroundColor.add("orange");
|
- |
|
| 1156 |
}
|
- |
|
| 1157 |
if (label.equals("GrnPending")) {
|
- |
|
| 1158 |
backgroundColor.add("yellow");
|
- |
|
| 1159 |
}
|
- |
|
| 1160 |
|
- |
|
| 1161 |
}
|
- |
|
| 1162 |
|
- |
|
| 1163 |
Data data = new Data();
|
- |
|
| 1164 |
data.setData(values);
|
- |
|
| 1165 |
data.setBackgroundColor(backgroundColor);
|
- |
|
| 1166 |
data.setLabel("DataSet 1");
|
- |
|
| 1167 |
|
- |
|
| 1168 |
PieLables label = new PieLables();
|
- |
|
| 1169 |
label.setFontColor("White");
|
- |
|
| 1170 |
label.setFontSize(15);
|
- |
|
| 1171 |
|
- |
|
| 1172 |
Legend legend = new Legend();
|
- |
|
| 1173 |
legend.setLabels(label);
|
- |
|
| 1174 |
legend.setPosition("left");
|
- |
|
| 1175 |
|
- |
|
| 1176 |
List<Data> dataList = new ArrayList<>();
|
- |
|
| 1177 |
dataList.add(data);
|
- |
|
| 1178 |
|
- |
|
| 1179 |
DataInvestmentModel datasets = new DataInvestmentModel();
|
- |
|
| 1180 |
datasets.setDatasets(dataList);
|
- |
|
| 1181 |
datasets.setLabels(labels);
|
- |
|
| 1182 |
|
- |
|
| 1183 |
OptionModel om = new OptionModel();
|
- |
|
| 1184 |
om.setLegend(legend);
|
- |
|
| 1185 |
cm.setType("pie");
|
- |
|
| 1186 |
cm.setData(datasets);
|
- |
|
| 1187 |
cm.setOptions(om);
|
- |
|
| 1188 |
|
- |
|
| 1189 |
return cm;
|
- |
|
| 1190 |
}
|
- |
|
| 1191 |
|
- |
|
| 1192 |
private ChartModel getPurchaseOrderChart(int fofoId) throws ProfitMandiBusinessException {
|
- |
|
| 1193 |
|
- |
|
| 1194 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 1195 |
|
- |
|
| 1196 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(1);
|
- |
|
| 1197 |
|
- |
|
| 1198 |
List<SecondaryOrderBilledLmsModel> soblms = orderRepository.selectAllBilledOrderGroupByBrandFofoId(fofoId,
|
- |
|
| 1199 |
curDate.withDayOfMonth(1).minusMonths(6));
|
- |
|
| 1200 |
|
- |
|
| 1201 |
LOGGER.info("soblms" + soblms);
|
- |
|
| 1202 |
Map<String, Map<YearMonth, Double>> brandMonthValueMap = new HashMap<>();
|
- |
|
| 1203 |
for (SecondaryOrderBilledLmsModel orderBilledLmsMode : soblms) {
|
- |
|
| 1204 |
Map<YearMonth, Double> yearMonthMap = new HashMap<>();
|
- |
|
| 1205 |
yearMonthMap.put(YearMonth.from(startOfMonth), (double) orderBilledLmsMode.getFirstMonthValue());
|
- |
|
| 1206 |
yearMonthMap.put(YearMonth.from(startOfMonth.minusMonths(1)),
|
- |
|
| 1207 |
(double) orderBilledLmsMode.getSecondMonthValue());
|
- |
|
| 1208 |
|
- |
|
| 1209 |
yearMonthMap.put(YearMonth.from(startOfMonth.minusMonths(2)),
|
- |
|
| 1210 |
(double) orderBilledLmsMode.getThirdMonthValue());
|
- |
|
| 1211 |
yearMonthMap.put(YearMonth.from(startOfMonth.minusMonths(3)),
|
- |
|
| 1212 |
(double) orderBilledLmsMode.getFourthMonthValue());
|
- |
|
| 1213 |
yearMonthMap.put(YearMonth.from(startOfMonth.minusMonths(4)),
|
- |
|
| 1214 |
(double) orderBilledLmsMode.getFifthMonthValue());
|
- |
|
| 1215 |
yearMonthMap.put(YearMonth.from(startOfMonth.minusMonths(5)),
|
- |
|
| 1216 |
(double) orderBilledLmsMode.getSixthMonthValue());
|
- |
|
| 1217 |
Map<YearMonth, Double> sortedYearMonthMap = new TreeMap<YearMonth, Double>(yearMonthMap);
|
- |
|
| 1218 |
brandMonthValueMap.put(orderBilledLmsMode.getBrand(), sortedYearMonthMap);
|
- |
|
| 1219 |
|
- |
|
| 1220 |
}
|
- |
|
| 1221 |
LOGGER.info("brandMonthValueMap" + brandMonthValueMap);
|
- |
|
| 1222 |
|
- |
|
| 1223 |
List<String> brands = new ArrayList<>();
|
- |
|
| 1224 |
brands.add("Accessories");
|
- |
|
| 1225 |
brands.add("Oppo");
|
- |
|
| 1226 |
brands.add("Vivo");
|
- |
|
| 1227 |
brands.add("Samsung");
|
- |
|
| 1228 |
brands.add("Realme");
|
- |
|
| 1229 |
brands.add("Xiaomi");
|
- |
|
| 1230 |
brands.add("Tecno");
|
- |
|
| 1231 |
brands.add("Itel");
|
- |
|
| 1232 |
brands.add("Lava");
|
- |
|
| 1233 |
brands.add("Nokia");
|
- |
|
| 1234 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
- |
|
| 1235 |
|
- |
|
| 1236 |
for (String brand : brands) {
|
- |
|
| 1237 |
Map<YearMonth, Double> coll = brandMonthValueMap.get(brand);
|
- |
|
| 1238 |
LOGGER.info("coll" + coll);
|
- |
|
| 1239 |
List<Double> valueList = new ArrayList<>();
|
- |
|
| 1240 |
|
- |
|
| 1241 |
if (coll != null) {
|
- |
|
| 1242 |
|
- |
|
| 1243 |
valueList.addAll(coll.values());
|
- |
|
| 1244 |
}
|
- |
|
| 1245 |
sortedBrandValue.put(brand, valueList);
|
- |
|
| 1246 |
|
- |
|
| 1247 |
}
|
- |
|
| 1248 |
LinkedHashSet<String> labels = new LinkedHashSet<String>();
|
- |
|
| 1249 |
|
- |
|
| 1250 |
for (int i = 6; i >= 1; i--) {
|
- |
|
| 1251 |
|
- |
|
| 1252 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 1253 |
labels.add(startMonth.format(DateTimeFormatter.ofPattern("MMM''uu")).toString());
|
- |
|
| 1254 |
|
- |
|
| 1255 |
LOGGER.info("labels" + labels);
|
- |
|
| 1256 |
}
|
- |
|
| 1257 |
|
- |
|
| 1258 |
LOGGER.info("labels" + labels);
|
- |
|
| 1259 |
|
- |
|
| 1260 |
LOGGER.info("sortedBrandValue" + sortedBrandValue);
|
- |
|
| 1261 |
List<DatasetModel> datasets = new ArrayList<>();
|
- |
|
| 1262 |
List<String> colorList = new ArrayList<>();
|
- |
|
| 1263 |
colorList.add("papayawhip");
|
- |
|
| 1264 |
colorList.add("darkgreen");
|
- |
|
| 1265 |
colorList.add("dodgerblue");
|
- |
|
| 1266 |
colorList.add("darkblue");
|
- |
|
| 1267 |
colorList.add("gold");
|
- |
|
| 1268 |
|
- |
|
| 1269 |
colorList.add("coral");
|
- |
|
| 1270 |
|
- |
|
| 1271 |
colorList.add("steelblue");
|
- |
|
| 1272 |
colorList.add("red");
|
- |
|
| 1273 |
colorList.add("deeppink");
|
- |
|
| 1274 |
colorList.add("midnightblue");
|
- |
|
| 1275 |
colorList.add("cornsilk");
|
- |
|
| 1276 |
|
- |
|
| 1277 |
List<String> borderList = new ArrayList<>();
|
- |
|
| 1278 |
borderList.add("pink");
|
- |
|
| 1279 |
borderList.add("mediumseagreen");
|
- |
|
| 1280 |
borderList.add("lightblue");
|
- |
|
| 1281 |
borderList.add("#0000cd");
|
- |
|
| 1282 |
borderList.add("#f7e98e");
|
- |
|
| 1283 |
|
- |
|
| 1284 |
borderList.add("#ff8c69");
|
- |
|
| 1285 |
|
- |
|
| 1286 |
borderList.add("#0000cd");
|
- |
|
| 1287 |
borderList.add("lightsalmon");
|
- |
|
| 1288 |
borderList.add("pink");
|
- |
|
| 1289 |
borderList.add("#0000cd");
|
- |
|
| 1290 |
borderList.add("cornsilk");
|
- |
|
| 1291 |
|
- |
|
| 1292 |
int i = 0;
|
- |
|
| 1293 |
|
- |
|
| 1294 |
for (Entry<String, List<Double>> brandValue : sortedBrandValue.entrySet()) {
|
- |
|
| 1295 |
|
- |
|
| 1296 |
DatasetModel purchaseModel = new DatasetModel();
|
- |
|
| 1297 |
purchaseModel.setLabel(brandValue.getKey());
|
- |
|
| 1298 |
purchaseModel.setBackgroundColor(colorList.get(i));
|
- |
|
| 1299 |
if (brandValue.getValue().isEmpty()) {
|
- |
|
| 1300 |
|
- |
|
| 1301 |
purchaseModel.setData(Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
- |
|
| 1302 |
} else {
|
- |
|
| 1303 |
purchaseModel.setData(brandValue.getValue());
|
- |
|
| 1304 |
}
|
- |
|
| 1305 |
purchaseModel.setType("line");
|
- |
|
| 1306 |
purchaseModel.setOrder(1);
|
- |
|
| 1307 |
purchaseModel.setFill("false");
|
- |
|
| 1308 |
purchaseModel.setBorderColor(borderList.get(i));
|
- |
|
| 1309 |
datasets.add(purchaseModel);
|
- |
|
| 1310 |
|
- |
|
| 1311 |
i++;
|
- |
|
| 1312 |
}
|
- |
|
| 1313 |
|
- |
|
| 1314 |
DataModel dm = new DataModel();
|
- |
|
| 1315 |
dm.setDatasets(datasets);
|
- |
|
| 1316 |
dm.setLabels(labels);
|
- |
|
| 1317 |
|
- |
|
| 1318 |
LegendModel lm = new LegendModel();
|
- |
|
| 1319 |
lm.setPosition("top");
|
- |
|
| 1320 |
|
- |
|
| 1321 |
Tooltips tooltips = new Tooltips();
|
- |
|
| 1322 |
tooltips.setBodyFontSize(15);
|
- |
|
| 1323 |
tooltips.setTitleFontSize(15);
|
- |
|
| 1324 |
tooltips.setMode("index");
|
- |
|
| 1325 |
tooltips.setIntersect(false);
|
- |
|
| 1326 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
- |
|
| 1327 |
HoverModel hover = new HoverModel();
|
- |
|
| 1328 |
hover.setIntersect(false);
|
- |
|
| 1329 |
hover.setMode("index");
|
- |
|
| 1330 |
|
- |
|
| 1331 |
TitleModel tm = new TitleModel();
|
- |
|
| 1332 |
tm.setText("Brand Wise Monthly Purchase");
|
- |
|
| 1333 |
tm.setDisplay(true);
|
- |
|
| 1334 |
tm.setFontSize(20);
|
- |
|
| 1335 |
tm.setFontColor("#111");
|
- |
|
| 1336 |
|
- |
|
| 1337 |
OptionsModel om = new OptionsModel();
|
- |
|
| 1338 |
om.setResponsive(true);
|
- |
|
| 1339 |
om.setLegend(lm);
|
- |
|
| 1340 |
om.setTitle(tm);
|
- |
|
| 1341 |
om.setTooltips(tooltips);
|
- |
|
| 1342 |
om.setHover(hover);
|
- |
|
| 1343 |
|
- |
|
| 1344 |
ChartModel cm = new ChartModel();
|
- |
|
| 1345 |
cm.setType("line");
|
- |
|
| 1346 |
cm.setData(dm);
|
- |
|
| 1347 |
cm.setOptions(om);
|
- |
|
| 1348 |
|
- |
|
| 1349 |
LOGGER.info("cm" + cm);
|
- |
|
| 1350 |
|
- |
|
| 1351 |
return cm;
|
- |
|
| 1352 |
|
- |
|
| 1353 |
}
|
- |
|
| 1354 |
|
- |
|
| 1355 |
private ChartModel getLmsLineChart(int fofoId) throws ProfitMandiBusinessException {
|
- |
|
| 1356 |
|
- |
|
| 1357 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 1358 |
|
- |
|
| 1359 |
Map<YearMonth, Map<String, Double>> monthValueMap = new HashMap<>();
|
- |
|
| 1360 |
|
- |
|
| 1361 |
for (int i = 1; i <= 6; i++) {
|
- |
|
| 1362 |
|
- |
|
| 1363 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 1364 |
|
- |
|
| 1365 |
Map<String, Double> lmsBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
- |
|
| 1366 |
curDate.withDayOfMonth(1).minusMonths(i), curDate.withDayOfMonth(1).minusMonths(i - 1), fofoId);
|
- |
|
| 1367 |
|
- |
|
| 1368 |
Map<Integer, Double> accesorieslmsSale = fofoOrderRepository
|
- |
|
| 1369 |
.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1).minusMonths(i),
|
- |
|
| 1370 |
curDate.withDayOfMonth(1).minusMonths(i - 1), Optional.of(false));
|
- |
|
| 1371 |
LOGGER.info("lmsBrandWiseSale" + lmsBrandWiseSale);
|
- |
|
| 1372 |
|
- |
|
| 1373 |
lmsBrandWiseSale.put("Accessories", accesorieslmsSale.get(fofoId));
|
- |
|
| 1374 |
|
- |
|
| 1375 |
monthValueMap.put(YearMonth.from(startOfMonth), lmsBrandWiseSale);
|
- |
|
| 1376 |
}
|
- |
|
| 1377 |
LOGGER.info("monthmap" + monthValueMap);
|
- |
|
| 1378 |
|
- |
|
| 1379 |
Map<YearMonth, Map<String, Double>> sortedMonthValueMap = new TreeMap(monthValueMap);
|
- |
|
| 1380 |
LOGGER.info("monthmap" + sortedMonthValueMap);
|
- |
|
| 1381 |
|
- |
|
| 1382 |
Multimap<String, Map<YearMonth, Double>> brandMonthValueMap = ArrayListMultimap.create();
|
- |
|
| 1383 |
|
- |
|
| 1384 |
for (Entry<YearMonth, Map<String, Double>> month : sortedMonthValueMap.entrySet()) {
|
- |
|
| 1385 |
|
- |
|
| 1386 |
for (Entry<String, Double> val : month.getValue().entrySet()) {
|
- |
|
| 1387 |
Map<YearMonth, Double> yearValue = new HashMap<>();
|
- |
|
| 1388 |
|
- |
|
| 1389 |
yearValue.put(month.getKey(), val.getValue() == null ? 0 : val.getValue());
|
- |
|
| 1390 |
brandMonthValueMap.put(val.getKey(), yearValue);
|
- |
|
| 1391 |
|
- |
|
| 1392 |
}
|
- |
|
| 1393 |
}
|
- |
|
| 1394 |
|
- |
|
| 1395 |
LOGGER.info("map" + brandMonthValueMap);
|
- |
|
| 1396 |
|
- |
|
| 1397 |
List<String> brands = new ArrayList<>();
|
- |
|
| 1398 |
brands.add("Accessories");
|
- |
|
| 1399 |
brands.add("Oppo");
|
- |
|
| 1400 |
brands.add("Vivo");
|
- |
|
| 1401 |
brands.add("Samsung");
|
- |
|
| 1402 |
brands.add("Realme");
|
- |
|
| 1403 |
brands.add("Xiaomi");
|
- |
|
| 1404 |
brands.add("Tecno");
|
- |
|
| 1405 |
brands.add("Itel");
|
- |
|
| 1406 |
brands.add("Lava");
|
- |
|
| 1407 |
brands.add("Nokia");
|
- |
|
| 1408 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
- |
|
| 1409 |
|
- |
|
| 1410 |
for (String brand : brands) {
|
- |
|
| 1411 |
Collection<Map<YearMonth, Double>> coll = brandMonthValueMap.get(brand);
|
- |
|
| 1412 |
LOGGER.info("coll" + coll);
|
- |
|
| 1413 |
|
- |
|
| 1414 |
List<Double> valueList = new ArrayList<>();
|
- |
|
| 1415 |
for (Map<YearMonth, Double> col : coll) {
|
- |
|
| 1416 |
|
- |
|
| 1417 |
valueList.addAll(col.values());
|
- |
|
| 1418 |
}
|
- |
|
| 1419 |
|
- |
|
| 1420 |
sortedBrandValue.put(brand, valueList);
|
- |
|
| 1421 |
|
- |
|
| 1422 |
}
|
- |
|
| 1423 |
|
- |
|
| 1424 |
LOGGER.info("sortedBrandValue" + sortedBrandValue);
|
- |
|
| 1425 |
LinkedHashSet<String> labels = new LinkedHashSet<String>();
|
- |
|
| 1426 |
for (Entry<YearMonth, Map<String, Double>> val : sortedMonthValueMap.entrySet()) {
|
- |
|
| 1427 |
labels.add(val.getKey().format(DateTimeFormatter.ofPattern("MMM''uu")).toString());
|
- |
|
| 1428 |
|
- |
|
| 1429 |
}
|
- |
|
| 1430 |
|
- |
|
| 1431 |
List<String> labelList = new ArrayList<>(labels);
|
- |
|
| 1432 |
List<Double> lmsValues = new ArrayList<>();
|
- |
|
| 1433 |
|
- |
|
| 1434 |
List<DatasetModel> datasets = new ArrayList<>();
|
- |
|
| 1435 |
List<String> colorList = new ArrayList<>();
|
- |
|
| 1436 |
colorList.add("papayawhip");
|
- |
|
| 1437 |
colorList.add("mediumseagreen");
|
- |
|
| 1438 |
colorList.add("dodgerblue");
|
- |
|
| 1439 |
colorList.add("darkblue");
|
- |
|
| 1440 |
colorList.add("gold");
|
- |
|
| 1441 |
|
- |
|
| 1442 |
colorList.add("coral");
|
- |
|
| 1443 |
|
- |
|
| 1444 |
colorList.add("steelblue");
|
- |
|
| 1445 |
colorList.add("red");
|
- |
|
| 1446 |
colorList.add("deeppink");
|
- |
|
| 1447 |
colorList.add("midnightblue");
|
- |
|
| 1448 |
colorList.add("cornsilk");
|
- |
|
| 1449 |
|
- |
|
| 1450 |
List<String> borderList = new ArrayList<>();
|
- |
|
| 1451 |
borderList.add("pink");
|
- |
|
| 1452 |
borderList.add("lawngreen");
|
- |
|
| 1453 |
borderList.add("lightblue");
|
- |
|
| 1454 |
borderList.add("#0000cd");
|
- |
|
| 1455 |
borderList.add("#f7e98e");
|
- |
|
| 1456 |
|
- |
|
| 1457 |
borderList.add("lightcoral");
|
- |
|
| 1458 |
|
- |
|
| 1459 |
borderList.add("#0000cd");
|
- |
|
| 1460 |
borderList.add("lightsalmon");
|
- |
|
| 1461 |
borderList.add("pink");
|
- |
|
| 1462 |
borderList.add("#0000cd");
|
- |
|
| 1463 |
borderList.add("cornsilk");
|
- |
|
| 1464 |
|
- |
|
| 1465 |
int i = 0;
|
- |
|
| 1466 |
|
- |
|
| 1467 |
for (Entry<String, List<Double>> brandValue : sortedBrandValue.entrySet()) {
|
- |
|
| 1468 |
|
- |
|
| 1469 |
DatasetModel lineLmsChart = new DatasetModel();
|
- |
|
| 1470 |
lineLmsChart.setLabel(brandValue.getKey());
|
- |
|
| 1471 |
lineLmsChart.setBackgroundColor(colorList.get(i));
|
- |
|
| 1472 |
if (brandValue.getValue().isEmpty()) {
|
- |
|
| 1473 |
|
- |
|
| 1474 |
lineLmsChart.setData(Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
- |
|
| 1475 |
} else {
|
- |
|
| 1476 |
lineLmsChart.setData(brandValue.getValue());
|
- |
|
| 1477 |
}
|
- |
|
| 1478 |
lineLmsChart.setType("line");
|
- |
|
| 1479 |
lineLmsChart.setOrder(1);
|
- |
|
| 1480 |
lineLmsChart.setFill("false");
|
- |
|
| 1481 |
lineLmsChart.setBorderColor(borderList.get(i));
|
- |
|
| 1482 |
datasets.add(lineLmsChart);
|
- |
|
| 1483 |
|
- |
|
| 1484 |
i++;
|
- |
|
| 1485 |
}
|
- |
|
| 1486 |
|
- |
|
| 1487 |
DataModel dm = new DataModel();
|
- |
|
| 1488 |
dm.setDatasets(datasets);
|
- |
|
| 1489 |
dm.setLabels(labels);
|
- |
|
| 1490 |
|
- |
|
| 1491 |
LegendModel lm = new LegendModel();
|
- |
|
| 1492 |
lm.setPosition("top");
|
- |
|
| 1493 |
|
- |
|
| 1494 |
Tooltips tooltips = new Tooltips();
|
- |
|
| 1495 |
tooltips.setBodyFontSize(15);
|
- |
|
| 1496 |
tooltips.setTitleFontSize(15);
|
- |
|
| 1497 |
tooltips.setMode("index");
|
- |
|
| 1498 |
tooltips.setIntersect(false);
|
- |
|
| 1499 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
- |
|
| 1500 |
|
- |
|
| 1501 |
HoverModel hover = new HoverModel();
|
- |
|
| 1502 |
hover.setIntersect(false);
|
- |
|
| 1503 |
hover.setMode("index");
|
- |
|
| 1504 |
|
- |
|
| 1505 |
TitleModel tm = new TitleModel();
|
- |
|
| 1506 |
tm.setText("Brand Wise LMS");
|
- |
|
| 1507 |
tm.setDisplay(true);
|
- |
|
| 1508 |
tm.setFontSize(20);
|
- |
|
| 1509 |
tm.setFontColor("#111");
|
- |
|
| 1510 |
|
- |
|
| 1511 |
OptionsModel om = new OptionsModel();
|
- |
|
| 1512 |
om.setResponsive(true);
|
- |
|
| 1513 |
om.setLegend(lm);
|
- |
|
| 1514 |
om.setTitle(tm);
|
- |
|
| 1515 |
om.setTooltips(tooltips);
|
- |
|
| 1516 |
om.setHover(hover);
|
- |
|
| 1517 |
|
- |
|
| 1518 |
ChartModel cm = new ChartModel();
|
- |
|
| 1519 |
cm.setType("line");
|
- |
|
| 1520 |
cm.setData(dm);
|
- |
|
| 1521 |
cm.setOptions(om);
|
- |
|
| 1522 |
|
- |
|
| 1523 |
LOGGER.info("cm" + cm);
|
- |
|
| 1524 |
|
- |
|
| 1525 |
return cm;
|
- |
|
| 1526 |
|
- |
|
| 1527 |
}
|
- |
|
| 1528 |
|
- |
|
| 1529 |
private ChartModel getBrandChart(int fofoId) {
|
- |
|
| 1530 |
|
- |
|
| 1531 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 1532 |
|
- |
|
| 1533 |
LOGGER.info("cur Date" + curDate.withDayOfMonth(1));
|
- |
|
| 1534 |
|
- |
|
| 1535 |
LOGGER.info("curDateYear" + curDate.with(LocalTime.MAX));
|
- |
|
| 1536 |
|
- |
|
| 1537 |
Map<String, Double> brandwisesale = fofoOrderItemRepository
|
- |
|
| 1538 |
.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
|
- |
|
| 1539 |
|
- |
|
| 1540 |
LOGGER.info("brandwisesale" + brandwisesale);
|
- |
|
| 1541 |
|
- |
|
| 1542 |
Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
|
- |
|
| 1543 |
fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
|
- |
|
| 1544 |
brandwisesale.put("Accessories", accesoriesmtdsale.get(fofoId));
|
- |
|
| 1545 |
|
- |
|
| 1546 |
Map<String, Double> activatedImeisWithSellingPriceMTD = fofoOrderRepository
|
- |
|
| 1547 |
.selectValueOfActivatedImeis(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId).stream()
|
- |
|
| 1548 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
|
- |
|
| 1549 |
|
- |
|
| 1550 |
activatedImeisWithSellingPriceMTD.put("Lava", brandwisesale.get("Lava"));
|
- |
|
| 1551 |
|
- |
|
| 1552 |
Map<String, Double> activatedImeisWithSellingPriceLMTD = fofoOrderRepository
|
- |
|
| 1553 |
.selectValueOfActivatedImeis(curDate.withDayOfMonth(1).minusMonths(1),
|
- |
|
| 1554 |
curDate.with(LocalTime.MAX).minusMonths(1), fofoId)
|
- |
|
| 1555 |
.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
|
- |
|
| 1556 |
Map<String, Double> lmtdBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
- |
|
| 1557 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
|
- |
|
| 1558 |
activatedImeisWithSellingPriceLMTD.put("Lava", lmtdBrandWiseSale.get("Lava"));
|
- |
|
| 1559 |
|
- |
|
| 1560 |
Map<Integer, Double> accesorieslmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
|
- |
|
| 1561 |
fofoId, curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1),
|
- |
|
| 1562 |
Optional.of(false));
|
- |
|
| 1563 |
|
- |
|
| 1564 |
lmtdBrandWiseSale.put("Accessories", accesorieslmtdsale.get(fofoId));
|
- |
|
| 1565 |
|
- |
|
| 1566 |
ChartModel cm = new ChartModel();
|
- |
|
| 1567 |
|
- |
|
| 1568 |
HashSet<String> labels = new HashSet<String>();
|
- |
|
| 1569 |
labels.addAll(brandwisesale.keySet());
|
- |
|
| 1570 |
labels.addAll(lmtdBrandWiseSale.keySet());
|
- |
|
| 1571 |
|
- |
|
| 1572 |
List<String> labelList = new ArrayList<>(labels);
|
- |
|
| 1573 |
|
- |
|
| 1574 |
List<Double> mtdActivatedImeisValues = new ArrayList<>();
|
- |
|
| 1575 |
|
- |
|
| 1576 |
List<Double> mtdValues = new ArrayList<>();
|
- |
|
| 1577 |
List<Double> lmtdUnActivatedImeisValues = new ArrayList<>();
|
- |
|
| 1578 |
List<Double> lmtdActivatedImeisValues = new ArrayList<>();
|
- |
|
| 1579 |
List<Double> mtdUnActivatedImeisValues = new ArrayList<>();
|
- |
|
| 1580 |
List<Double> lmtdValues = new ArrayList<>();
|
- |
|
| 1581 |
for (String label : labelList) {
|
- |
|
| 1582 |
mtdActivatedImeisValues.add(activatedImeisWithSellingPriceMTD.get(label) == null ? 0
|
- |
|
| 1583 |
: activatedImeisWithSellingPriceMTD.get(label));
|
- |
|
| 1584 |
lmtdActivatedImeisValues.add(activatedImeisWithSellingPriceLMTD.get(label) == null ? 0
|
- |
|
| 1585 |
: activatedImeisWithSellingPriceLMTD.get(label));
|
- |
|
| 1586 |
|
- |
|
| 1587 |
mtdValues.add(brandwisesale.get(label) == null ? 0 : brandwisesale.get(label));
|
- |
|
| 1588 |
if (brandwisesale.get(label) != null) {
|
- |
|
| 1589 |
mtdUnActivatedImeisValues
|
- |
|
| 1590 |
.add(brandwisesale.get(label) - (activatedImeisWithSellingPriceMTD.get(label) == null ? 0
|
- |
|
| 1591 |
: activatedImeisWithSellingPriceMTD.get(label)));
|
- |
|
| 1592 |
} else {
|
- |
|
| 1593 |
mtdUnActivatedImeisValues.add(0.0);
|
- |
|
| 1594 |
}
|
- |
|
| 1595 |
if (lmtdBrandWiseSale.get(label) != null) {
|
- |
|
| 1596 |
lmtdUnActivatedImeisValues
|
- |
|
| 1597 |
.add(lmtdBrandWiseSale.get(label) - (activatedImeisWithSellingPriceLMTD.get(label) == null ? 0
|
- |
|
| 1598 |
: activatedImeisWithSellingPriceLMTD.get(label)));
|
- |
|
| 1599 |
} else {
|
- |
|
| 1600 |
lmtdUnActivatedImeisValues.add(0.0);
|
- |
|
| 1601 |
}
|
- |
|
| 1602 |
|
- |
|
| 1603 |
lmtdValues.add(lmtdBrandWiseSale.get(label) == null ? 0 : lmtdBrandWiseSale.get(label));
|
- |
|
| 1604 |
}
|
- |
|
| 1605 |
DatasetModel dsmtotal = new DatasetModel();
|
- |
|
| 1606 |
dsmtotal.setLabel("MTD");
|
- |
|
| 1607 |
dsmtotal.setBackgroundColor("blue");
|
- |
|
| 1608 |
dsmtotal.setBorderColor("blue");
|
- |
|
| 1609 |
dsmtotal.setData(mtdValues);
|
- |
|
| 1610 |
dsmtotal.setStack("stack0");
|
- |
|
| 1611 |
dsmtotal.setOrder(1);
|
- |
|
| 1612 |
|
- |
|
| 1613 |
DatasetModel dsmUnactivated = new DatasetModel();
|
- |
|
| 1614 |
dsmUnactivated.setLabel("MTD Unactivated");
|
- |
|
| 1615 |
dsmUnactivated.setBackgroundColor("red");
|
- |
|
| 1616 |
dsmUnactivated.setBorderColor("red");
|
- |
|
| 1617 |
dsmUnactivated.setData(mtdUnActivatedImeisValues);
|
- |
|
| 1618 |
dsmUnactivated.setStack("stack0");
|
- |
|
| 1619 |
dsmUnactivated.setOrder(1);
|
- |
|
| 1620 |
|
- |
|
| 1621 |
LOGGER.info("mtdValuesMoney" + mtdValues);
|
- |
|
| 1622 |
|
- |
|
| 1623 |
DatasetModel mtdActivatedImeis = new DatasetModel();
|
- |
|
| 1624 |
mtdActivatedImeis.setLabel("MTD Activation");
|
- |
|
| 1625 |
mtdActivatedImeis.setBorderColor("#00008b");
|
- |
|
| 1626 |
mtdActivatedImeis.setData(mtdActivatedImeisValues);
|
- |
|
| 1627 |
mtdActivatedImeis.setBackgroundColor("#00008b");
|
- |
|
| 1628 |
mtdActivatedImeis.setStack("stack0");
|
- |
|
| 1629 |
mtdActivatedImeis.setOrder(1);
|
- |
|
| 1630 |
|
- |
|
| 1631 |
DatasetModel lmtddsmtotal = new DatasetModel();
|
- |
|
| 1632 |
lmtddsmtotal.setLabel("LMTD");
|
- |
|
| 1633 |
lmtddsmtotal.setBackgroundColor("blue");
|
- |
|
| 1634 |
lmtddsmtotal.setData(lmtdValues);
|
- |
|
| 1635 |
lmtddsmtotal.setBorderColor("blue");
|
- |
|
| 1636 |
lmtddsmtotal.setStack("stack1");
|
- |
|
| 1637 |
lmtddsmtotal.setOrder(1);
|
- |
|
| 1638 |
|
- |
|
| 1639 |
DatasetModel lmtdUnActivated = new DatasetModel();
|
- |
|
| 1640 |
lmtdUnActivated.setLabel("LMTD Unactivation");
|
- |
|
| 1641 |
lmtdUnActivated.setBackgroundColor("red");
|
- |
|
| 1642 |
lmtdUnActivated.setBorderColor("red");
|
- |
|
| 1643 |
lmtdUnActivated.setData(lmtdUnActivatedImeisValues);
|
- |
|
| 1644 |
lmtdUnActivated.setStack("stack1");
|
- |
|
| 1645 |
lmtdUnActivated.setOrder(1);
|
- |
|
| 1646 |
|
- |
|
| 1647 |
DatasetModel LmtdActivatedImeis = new DatasetModel();
|
- |
|
| 1648 |
LmtdActivatedImeis.setLabel("LMTD Activation");
|
- |
|
| 1649 |
LmtdActivatedImeis.setBackgroundColor("#87ceeb");
|
- |
|
| 1650 |
LmtdActivatedImeis.setBorderColor("#87ceeb");
|
- |
|
| 1651 |
LmtdActivatedImeis.setData(lmtdActivatedImeisValues);
|
- |
|
| 1652 |
LmtdActivatedImeis.setStack("stack1");
|
- |
|
| 1653 |
LmtdActivatedImeis.setOrder(1);
|
- |
|
| 1654 |
|
- |
|
| 1655 |
DatasetModel linemtdChart = new DatasetModel();
|
- |
|
| 1656 |
linemtdChart.setLabel("MTD");
|
- |
|
| 1657 |
linemtdChart.setBackgroundColor("#006400");
|
- |
|
| 1658 |
linemtdChart.setBorderColor("#006400");
|
- |
|
| 1659 |
linemtdChart.setData(mtdValues);
|
- |
|
| 1660 |
linemtdChart.setType("line");
|
- |
|
| 1661 |
linemtdChart.setOrder(2);
|
- |
|
| 1662 |
linemtdChart.setFill("false");
|
- |
|
| 1663 |
|
- |
|
| 1664 |
DatasetModel lineLmtdChart = new DatasetModel();
|
- |
|
| 1665 |
lineLmtdChart.setLabel("LMTD");
|
- |
|
| 1666 |
lineLmtdChart.setBackgroundColor("hotpink");
|
- |
|
| 1667 |
lineLmtdChart.setBorderColor("hotpink");
|
- |
|
| 1668 |
lineLmtdChart.setData(lmtdValues);
|
- |
|
| 1669 |
lineLmtdChart.setType("line");
|
- |
|
| 1670 |
lineLmtdChart.setOrder(3);
|
- |
|
| 1671 |
lineLmtdChart.setFill("false");
|
- |
|
| 1672 |
|
- |
|
| 1673 |
List<DatasetModel> datasets = new ArrayList<>();
|
- |
|
| 1674 |
datasets.add(mtdActivatedImeis);
|
- |
|
| 1675 |
datasets.add(dsmUnactivated);
|
- |
|
| 1676 |
datasets.add(LmtdActivatedImeis);
|
- |
|
| 1677 |
datasets.add(lmtdUnActivated);
|
- |
|
| 1678 |
datasets.add(linemtdChart);
|
- |
|
| 1679 |
datasets.add(lineLmtdChart);
|
- |
|
| 1680 |
|
- |
|
| 1681 |
DataModel dm = new DataModel();
|
- |
|
| 1682 |
dm.setDatasets(datasets);
|
- |
|
| 1683 |
dm.setLabels(labels);
|
- |
|
| 1684 |
|
- |
|
| 1685 |
Tooltips tooltips = new Tooltips();
|
- |
|
| 1686 |
tooltips.setBodyFontSize(10);
|
- |
|
| 1687 |
tooltips.setTitleFontSize(10);
|
- |
|
| 1688 |
tooltips.setMode("index");
|
- |
|
| 1689 |
tooltips.setIntersect(false);
|
- |
|
| 1690 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
- |
|
| 1691 |
HoverModel hover = new HoverModel();
|
- |
|
| 1692 |
hover.setIntersect(false);
|
- |
|
| 1693 |
hover.setMode("index");
|
- |
|
| 1694 |
|
- |
|
| 1695 |
LegendModel lm = new LegendModel();
|
- |
|
| 1696 |
lm.setPosition("top");
|
- |
|
| 1697 |
|
- |
|
| 1698 |
TitleModel tm = new TitleModel();
|
- |
|
| 1699 |
tm.setText("Brand Wise Sales");
|
- |
|
| 1700 |
tm.setDisplay(true);
|
- |
|
| 1701 |
tm.setFontSize(20);
|
- |
|
| 1702 |
tm.setFontColor("#111");
|
- |
|
| 1703 |
|
- |
|
| 1704 |
List<Axis> xAxes = new ArrayList<>();
|
- |
|
| 1705 |
Axis xAxis = new Axis();
|
- |
|
| 1706 |
xAxis.setStacked(true);
|
- |
|
| 1707 |
xAxes.add(xAxis);
|
- |
|
| 1708 |
|
- |
|
| 1709 |
List<Axis> yAxes = new ArrayList<>();
|
- |
|
| 1710 |
Axis yAxis = new Axis();
|
- |
|
| 1711 |
yAxis.setStacked(false);
|
- |
|
| 1712 |
yAxes.add(yAxis);
|
- |
|
| 1713 |
|
- |
|
| 1714 |
ScalesModel sm = new ScalesModel();
|
- |
|
| 1715 |
sm.setxAxes(xAxes);
|
- |
|
| 1716 |
|
- |
|
| 1717 |
OptionsModel om = new OptionsModel();
|
- |
|
| 1718 |
om.setLegend(lm);
|
- |
|
| 1719 |
om.setTitle(tm);
|
- |
|
| 1720 |
om.setScales(sm);
|
- |
|
| 1721 |
om.setHover(hover);
|
- |
|
| 1722 |
om.setTooltips(tooltips);
|
- |
|
| 1723 |
|
- |
|
| 1724 |
cm.setType("bar");
|
- |
|
| 1725 |
cm.setData(dm);
|
- |
|
| 1726 |
cm.setOptions(om);
|
- |
|
| 1727 |
|
- |
|
| 1728 |
LOGGER.info("cm" + cm);
|
- |
|
| 1729 |
|
- |
|
| 1730 |
return cm;
|
- |
|
| 1731 |
|
- |
|
| 1732 |
}
|
- |
|
| 1733 |
|
- |
|
| 1734 |
private String adminPanel(int fofoId, String email, Model model) throws Exception {
|
- |
|
| 1735 |
List<Menu> menus = null;
|
- |
|
| 1736 |
try {
|
- |
|
| 1737 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
- |
|
| 1738 |
List<Position> positions = positionRepository.selectAll(authUser.getId());
|
- |
|
| 1739 |
Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
|
- |
|
| 1740 |
ReporticoCacheTable rctSaholic = null;
|
- |
|
| 1741 |
ReporticoCacheTable rctPartneStat = null;
|
- |
|
| 1742 |
|
- |
|
| 1743 |
Map<Integer, WarehouseWiseStockModel> warehouseStockMap = new HashMap<>();
|
- |
|
| 1744 |
LinkedHashMap<Integer, WarehouseWiseStockModel> warehouseStockSortedMap = new LinkedHashMap<>();
|
- |
|
| 1745 |
|
- |
|
| 1746 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
- |
|
| 1747 |
LinkedHashMap<Integer, String> wm = new LinkedHashMap<Integer, String>();
|
- |
|
| 1748 |
|
- |
|
| 1749 |
Map<AuthUser, Long> authUserTicketCount = null;
|
- |
|
| 1750 |
|
- |
|
| 1751 |
for (Map.Entry<Integer, String> entry : warehouseMap.entrySet()) {
|
- |
|
| 1752 |
wm.put(entry.getKey(), entry.getValue());
|
- |
|
| 1753 |
}
|
- |
|
| 1754 |
|
- |
|
| 1755 |
wm.put(0, "Total Values");
|
- |
|
| 1756 |
long stockValue = 0;
|
- |
|
| 1757 |
long stockQty = 0;
|
- |
|
| 1758 |
long pendingIndent = 0;
|
- |
|
| 1759 |
long tertiary = 0;
|
- |
|
| 1760 |
|
- |
|
| 1761 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
- |
|
| 1762 |
|
- |
|
| 1763 |
Set<Integer> fofoIds = storeGuyMap.get(authUser.getEmailId());
|
- |
|
| 1764 |
if (emails.contains(authUser.getEmailId())) {
|
- |
|
| 1765 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
- |
|
| 1766 |
LOGGER.info("fofoIds" + fofoIds);
|
- |
|
| 1767 |
}
|
- |
|
| 1768 |
if (fofoIds == null) {
|
- |
|
| 1769 |
List<Position> positions1 = positionRepository.selectAll(authUser.getId());
|
- |
|
| 1770 |
if (positions1.stream().filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_MASTER)
|
- |
|
| 1771 |
.count() > 0) {
|
- |
|
| 1772 |
fofoIds = csService.getPositionCustomRetailerMap(positions1).values().stream()
|
- |
|
| 1773 |
.flatMap(x -> x.stream()).map(x -> x.getPartnerId()).collect(Collectors.toSet());
|
- |
|
| 1774 |
}
|
- |
|
| 1775 |
}
|
- |
|
| 1776 |
|
- |
|
| 1777 |
if (fofoIds != null && fofoIds.size() > 0) {
|
- |
|
| 1778 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
- |
|
| 1779 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream()
|
- |
|
| 1780 |
.collect(Collectors.groupingBy(FofoStore::getWarehouseId,
|
- |
|
| 1781 |
Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
- |
|
| 1782 |
// warehouseStock
|
- |
|
| 1783 |
List<WarehouseWiseStockModel> warehouseStocks = saholicInventoryCISRepository
|
- |
|
| 1784 |
.selectGroupByWarehouse(new ArrayList<>(warehouseIdFofoIdMap.keySet()));
|
- |
|
| 1785 |
|
- |
|
| 1786 |
warehouseStockMap = warehouseStocks.stream().collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
- |
|
| 1787 |
|
- |
|
| 1788 |
if (!warehouseStockMap.isEmpty()) {
|
- |
|
| 1789 |
for (Entry<Integer, WarehouseWiseStockModel> warehouseStock : warehouseStockMap.entrySet()) {
|
- |
|
| 1790 |
stockValue += warehouseStock.getValue().getStockValue();
|
- |
|
| 1791 |
stockQty += warehouseStock.getValue().getStockQty();
|
- |
|
| 1792 |
pendingIndent += warehouseStock.getValue().getPendingIndent();
|
- |
|
| 1793 |
tertiary += warehouseStock.getValue().getTertiary();
|
- |
|
| 1794 |
}
|
- |
|
| 1795 |
WarehouseWiseStockModel ws = new WarehouseWiseStockModel();
|
- |
|
| 1796 |
ws.setStockQty(stockQty);
|
- |
|
| 1797 |
ws.setStockValue(stockValue);
|
- |
|
| 1798 |
ws.setPendingIndent(pendingIndent);
|
- |
|
| 1799 |
ws.setTertiary(tertiary);
|
- |
|
| 1800 |
ws.setWarehouseId(0);
|
- |
|
| 1801 |
warehouseStockMap.put(0, ws);
|
- |
|
| 1802 |
|
- |
|
| 1803 |
}
|
- |
|
| 1804 |
|
- |
|
| 1805 |
warehouseStockMap.entrySet().stream().sorted(Map.Entry.comparingByKey(Comparator.reverseOrder()))
|
- |
|
| 1806 |
.forEachOrdered(x -> warehouseStockSortedMap.put(x.getKey(), x.getValue()));
|
- |
|
| 1807 |
|
- |
|
| 1808 |
rctSaholic = reporticoCacheTableRepository.selectByTableName("SaholicInventoryCIS");
|
- |
|
| 1809 |
|
- |
|
| 1810 |
// warehouseStock
|
- |
|
| 1811 |
warehousePartnerDetailMap = this.getWarehousePartnerDetail(warehouseIdFofoIdMap);
|
- |
|
| 1812 |
rctPartneStat = reporticoCacheTableRepository.selectByTableName("partnerStat");
|
- |
|
| 1813 |
|
- |
|
| 1814 |
Set<CustomRetailer> positionRetailers = fofoIds.stream()
|
- |
|
| 1815 |
.map(x -> retailerService.getAllFofoRetailers().get(x)).filter(x -> x != null)
|
- |
|
| 1816 |
.collect(Collectors.toSet());
|
- |
|
| 1817 |
model.addAttribute("retailers", gson.toJson(positionRetailers));
|
- |
|
| 1818 |
model.addAttribute("reporticoProjectMap", ReporticoProject.salesReporticoProjectMap);
|
- |
|
| 1819 |
model.addAttribute("warehouses", getWarehouses(positionRetailers));
|
- |
|
| 1820 |
} else {
|
- |
|
| 1821 |
List<Position> warehousePositions = positions.stream()
|
- |
|
| 1822 |
.filter(x -> x.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_WAREHOUSE)
|
- |
|
| 1823 |
.collect(Collectors.toList());
|
- |
|
| 1824 |
if (warehousePositions.size() > 0) {
|
- |
|
| 1825 |
Set<CustomRetailer> positionRetailers = new HashSet<>();
|
- |
|
| 1826 |
csService.getPositionCustomRetailerMap(warehousePositions).values().forEach(customRetailers -> {
|
- |
|
| 1827 |
positionRetailers.addAll(customRetailers);
|
- |
|
| 1828 |
});
|
- |
|
| 1829 |
model.addAttribute("reporticoProjectMap", ReporticoProject.warehouseReporticoMap);
|
- |
|
| 1830 |
model.addAttribute("retailers", gson.toJson(positionRetailers));
|
- |
|
| 1831 |
model.addAttribute("warehouses", getWarehouses(positionRetailers));
|
- |
|
| 1832 |
}
|
- |
|
| 1833 |
}
|
- |
|
| 1834 |
|
- |
|
| 1835 |
if (positions.size() > 0) {
|
- |
|
| 1836 |
if (positions.stream()
|
- |
|
| 1837 |
.filter(x -> x.getEscalationType().equals(EscalationType.L3)
|
- |
|
| 1838 |
|| x.getEscalationType().equals(EscalationType.L4)
|
- |
|
| 1839 |
|| x.getEscalationType().equals(EscalationType.L5))
|
- |
|
| 1840 |
.count() > 0) {
|
- |
|
| 1841 |
authUserTicketCount = ticketRepository.selectAllAuthUserTicketCount(Optional.of(false));
|
- |
|
| 1842 |
}
|
- |
|
| 1843 |
}
|
- |
|
| 1844 |
|
- |
|
| 1845 |
if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in", "manish.tiwari@smartdukaan.com")
|
- |
|
| 1846 |
.contains(email)) {
|
- |
|
| 1847 |
menus = menuRepository.selectAll();
|
- |
|
| 1848 |
} else if (positions.size() > 0) {
|
- |
|
| 1849 |
if (positions.stream().filter(x -> x.getEscalationType().equals(EscalationType.L5)).count() > 0) {
|
- |
|
| 1850 |
menus = menuRepository.selectAll();
|
- |
|
| 1851 |
} else {
|
- |
|
| 1852 |
List<Integer> menuIds = menuCategoryRepository.selectAllByPositions(positions).stream()
|
- |
|
| 1853 |
.map(x -> x.getMenuId()).collect(Collectors.toList());
|
- |
|
| 1854 |
if (menuIds.size() > 0) {
|
- |
|
| 1855 |
menus = menuRepository.selectAllByIds(menuIds);
|
- |
|
| 1856 |
}
|
- |
|
| 1857 |
}
|
- |
|
| 1858 |
}
|
- |
|
| 1859 |
|
- |
|
| 1860 |
model.addAttribute("authId", authUser.getId());
|
- |
|
| 1861 |
|
- |
|
| 1862 |
model.addAttribute("rctPartneStat", rctPartneStat);
|
- |
|
| 1863 |
|
- |
|
| 1864 |
model.addAttribute("reporticoDate", rctSaholic);
|
- |
|
| 1865 |
model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
|
- |
|
| 1866 |
model.addAttribute("warehouseMap", wm);
|
- |
|
| 1867 |
model.addAttribute("authUserTicketCount", authUserTicketCount);
|
- |
|
| 1868 |
model.addAttribute("warehouseStockMap", warehouseStockSortedMap);
|
- |
|
| 1869 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 1870 |
|
- |
|
| 1871 |
model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
|
- |
|
| 1872 |
|
- |
|
| 1873 |
} catch (ProfitMandiBusinessException e) {
|
- |
|
| 1874 |
}
|
- |
|
| 1875 |
List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
|
- |
|
| 1876 |
LOGGER.info("menu" + menuList);
|
- |
|
| 1877 |
model.addAttribute("menu", menuList);
|
- |
|
| 1878 |
return "admin";
|
- |
|
| 1879 |
}
|
- |
|
| 1880 |
|
- |
|
| 1881 |
@RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
|
654 |
@RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
|
| 1882 |
public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
|
655 |
public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
|
| 1883 |
throws Exception {
|
656 |
throws Exception {
|
| 1884 |
|
657 |
|
| 1885 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
658 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| Line 1910... |
Line 683... |
| 1910 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
683 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| 1911 |
.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
|
684 |
.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
|
| 1912 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
685 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 1913 |
|
686 |
|
| 1914 |
Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
|
687 |
Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
|
| 1915 |
Map<Integer, PartnerDetailModel> fofoIdAndallValues = this.getPartnersStatDataFromFile();
|
688 |
Map<Integer, PartnerDetailModel> fofoIdAndallValues = adminUser.getPartnersStatDataFromFile();
|
| 1916 |
if (warehouseId != 0) {
|
689 |
if (warehouseId != 0) {
|
| 1917 |
List<Integer> fofoIds = warehouseIdFofoIdMap.get(warehouseId);
|
690 |
List<Integer> fofoIds = warehouseIdFofoIdMap.get(warehouseId);
|
| 1918 |
/*
|
691 |
/*
|
| 1919 |
* List<Integer> fofoIds =
|
692 |
* List<Integer> fofoIds =
|
| 1920 |
* fofoStoreRepository.selectActivePartnerByWarehouse(warehouseId).stream()
|
693 |
* fofoStoreRepository.selectActivePartnerByWarehouse(warehouseId).stream()
|
| Line 1967... |
Line 740... |
| 1967 |
inventoryService.getItemAvailabilityAndIndent();
|
740 |
inventoryService.getItemAvailabilityAndIndent();
|
| 1968 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
741 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1969 |
return "response";
|
742 |
return "response";
|
| 1970 |
}
|
743 |
}
|
| 1971 |
|
744 |
|
| 1972 |
public Map<Integer, PartnerDetailModel> getWarehousePartnerDetail(Map<Integer, List<Integer>> warehousePartnerMap)
|
- |
|
| 1973 |
throws Exception {
|
- |
|
| 1974 |
|
- |
|
| 1975 |
Map<Integer, PartnerDetailModel> warehouseIdAndallValues = new LinkedHashMap<>();
|
- |
|
| 1976 |
// Map<Integer, List<FofoStore>> warehousePartnerMap =
|
- |
|
| 1977 |
// fofoStoreRepository.getWarehousePartnerMap();
|
- |
|
| 1978 |
Map<Integer, PartnerDetailModel> partnerStats = this.getPartnersStatDataFromFile();
|
- |
|
| 1979 |
List<Integer> allfofoIds = new ArrayList<>();
|
- |
|
| 1980 |
if (partnerStats != null) {
|
- |
|
| 1981 |
for (Entry<Integer, List<Integer>> warehouse : warehousePartnerMap.entrySet()) {
|
- |
|
| 1982 |
List<Integer> fofoIds = warehouse.getValue().stream().map(x -> x).collect(Collectors.toList());
|
- |
|
| 1983 |
allfofoIds.addAll(fofoIds);
|
- |
|
| 1984 |
List<PartnerDetailModel> partnerDetails = fofoIds.stream().map(x -> partnerStats.get(x))
|
- |
|
| 1985 |
.collect(Collectors.toList());
|
- |
|
| 1986 |
if (partnerDetails != null && !partnerDetails.isEmpty()) {
|
- |
|
| 1987 |
PartnerDetailModel partnerDetailModel = partnerStatsService.getAggregateStats(partnerDetails);
|
- |
|
| 1988 |
warehouseIdAndallValues.put(warehouse.getKey(), partnerDetailModel);
|
- |
|
| 1989 |
}
|
- |
|
| 1990 |
|
- |
|
| 1991 |
}
|
- |
|
| 1992 |
List<PartnerDetailModel> allPartnerDetails = allfofoIds.stream().map(x -> partnerStats.get(x))
|
- |
|
| 1993 |
.collect(Collectors.toList());
|
- |
|
| 1994 |
LOGGER.info("allPartnerDetails" + allPartnerDetails);
|
- |
|
| 1995 |
PartnerDetailModel partnerDetailModel = partnerStatsService
|
- |
|
| 1996 |
.getAggregateStats(new ArrayList<>(allPartnerDetails));
|
- |
|
| 1997 |
warehouseIdAndallValues.put(0, partnerDetailModel);
|
- |
|
| 1998 |
}
|
- |
|
| 1999 |
return warehouseIdAndallValues;
|
- |
|
| 2000 |
}
|
- |
|
| 2001 |
|
- |
|
| 2002 |
@RequestMapping(value = "/getPartnersStatData", method = RequestMethod.GET)
|
745 |
@RequestMapping(value = "/getPartnersStatData", method = RequestMethod.GET)
|
| 2003 |
public String getPartnersStatData(HttpServletRequest request, Model model) throws Exception {
|
746 |
public String getPartnersStatData(HttpServletRequest request, Model model) throws Exception {
|
| 2004 |
Map<Integer, PartnerDetailModel> partnerStats = partnerStatsService.getAllPartnerStats();
|
747 |
Map<Integer, PartnerDetailModel> partnerStats = partnerStatsService.getAllPartnerStats();
|
| 2005 |
ObjectOutputStream oos = null;
|
748 |
ObjectOutputStream oos = null;
|
| 2006 |
FileOutputStream fout = null;
|
749 |
FileOutputStream fout = null;
|
| Line 2026... |
Line 769... |
| 2026 |
reporticoCacheTableRepository.persist(rct);
|
769 |
reporticoCacheTableRepository.persist(rct);
|
| 2027 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
770 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 2028 |
return "response";
|
771 |
return "response";
|
| 2029 |
}
|
772 |
}
|
| 2030 |
|
773 |
|
| 2031 |
public Map<Integer, PartnerDetailModel> getPartnersStatDataFromFile() throws Exception {
|
- |
|
| 2032 |
ObjectInputStream objectinputstream = null;
|
- |
|
| 2033 |
Map<Integer, PartnerDetailModel> partnerStat = null;
|
- |
|
| 2034 |
try {
|
- |
|
| 2035 |
FileInputStream streamIn = new FileInputStream("/tmp/partnerStat.tmp");
|
- |
|
| 2036 |
objectinputstream = new ObjectInputStream(streamIn);
|
- |
|
| 2037 |
partnerStat = (Map<Integer, PartnerDetailModel>) objectinputstream.readObject();
|
- |
|
| 2038 |
|
- |
|
| 2039 |
LOGGER.info("partnerStat" + partnerStat);
|
- |
|
| 2040 |
objectinputstream.close();
|
- |
|
| 2041 |
|
- |
|
| 2042 |
} catch (Exception e) {
|
- |
|
| 2043 |
LOGGER.info("exceptionddd" + e);
|
- |
|
| 2044 |
|
- |
|
| 2045 |
e.printStackTrace();
|
- |
|
| 2046 |
|
- |
|
| 2047 |
} finally {
|
- |
|
| 2048 |
if (objectinputstream != null) {
|
- |
|
| 2049 |
objectinputstream.close();
|
- |
|
| 2050 |
LOGGER.info("clofddd" + partnerStat);
|
- |
|
| 2051 |
|
- |
|
| 2052 |
}
|
- |
|
| 2053 |
}
|
- |
|
| 2054 |
return partnerStat;
|
- |
|
| 2055 |
|
- |
|
| 2056 |
}
|
- |
|
| 2057 |
|
- |
|
| 2058 |
@RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
|
774 |
@RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
|
| 2059 |
public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model,
|
775 |
public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model,
|
| 2060 |
@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
|
776 |
@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
|
| 2061 |
throws Exception {
|
777 |
throws Exception {
|
| 2062 |
|
778 |
|
| Line 2089... |
Line 805... |
| 2089 |
model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
|
805 |
model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
|
| 2090 |
model.addAttribute("warehouseMap", warehouseMap);
|
806 |
model.addAttribute("warehouseMap", warehouseMap);
|
| 2091 |
return "warehouse_item_details";
|
807 |
return "warehouse_item_details";
|
| 2092 |
}
|
808 |
}
|
| 2093 |
|
809 |
|
| 2094 |
private String getWarehouses(Set<CustomRetailer> positionRetailers) {
|
- |
|
| 2095 |
Map<Integer, String> warehouses = new HashMap<>();
|
- |
|
| 2096 |
positionRetailers.stream().forEach(x -> {
|
- |
|
| 2097 |
if (x.getWarehouseId() != 0) {
|
- |
|
| 2098 |
warehouses.put(x.getWarehouseId(), ProfitMandiConstants.WAREHOUSE_MAP.get(x.getWarehouseId()));
|
- |
|
| 2099 |
}
|
- |
|
| 2100 |
});
|
- |
|
| 2101 |
return gson.toJson(warehouses);
|
- |
|
| 2102 |
|
- |
|
| 2103 |
}
|
- |
|
| 2104 |
|
- |
|
| 2105 |
@RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
|
810 |
@RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
|
| 2106 |
public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand)
|
811 |
public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand)
|
| 2107 |
throws Exception {
|
812 |
throws Exception {
|
| 2108 |
|
813 |
|
| 2109 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
814 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| Line 2223... |
Line 928... |
| 2223 |
model.addAttribute("branditemSales", branditemSales);
|
928 |
model.addAttribute("branditemSales", branditemSales);
|
| 2224 |
model.addAttribute("warehouseMap", warehouseMap);
|
929 |
model.addAttribute("warehouseMap", warehouseMap);
|
| 2225 |
return "warehouse_accessories_itemwsie_sale";
|
930 |
return "warehouse_accessories_itemwsie_sale";
|
| 2226 |
}
|
931 |
}
|
| 2227 |
|
932 |
|
| 2228 |
private List<Menu> prepareMenu(List<Menu> menus) {
|
- |
|
| 2229 |
List<Menu> returnMenu = new ArrayList<>();
|
- |
|
| 2230 |
Map<Menu, List<Menu>> subMenuMap = new HashMap<Menu, List<Menu>>();
|
- |
|
| 2231 |
for (Menu menu : menus) {
|
- |
|
| 2232 |
if (menu.get_parent() == null) {
|
- |
|
| 2233 |
if (!subMenuMap.containsKey(menu)) {
|
- |
|
| 2234 |
subMenuMap.put(menu, new ArrayList<>());
|
- |
|
| 2235 |
}
|
- |
|
| 2236 |
} else {
|
- |
|
| 2237 |
Menu parentMenu = menu.get_parent();
|
- |
|
| 2238 |
if (!subMenuMap.containsKey(parentMenu)) {
|
- |
|
| 2239 |
subMenuMap.put(parentMenu, new ArrayList<>());
|
- |
|
| 2240 |
}
|
- |
|
| 2241 |
subMenuMap.get(parentMenu).add(menu);
|
- |
|
| 2242 |
}
|
- |
|
| 2243 |
}
|
- |
|
| 2244 |
subMenuMap.entrySet().stream().forEach(entry -> {
|
- |
|
| 2245 |
entry.getKey().setSubMenus(entry.getValue());
|
- |
|
| 2246 |
returnMenu.add(entry.getKey());
|
- |
|
| 2247 |
});
|
- |
|
| 2248 |
return returnMenu;
|
- |
|
| 2249 |
}
|
- |
|
| 2250 |
|
- |
|
| 2251 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
- |
|
| 2252 |
private boolean hasGift(int fofoId) {
|
- |
|
| 2253 |
try {
|
- |
|
| 2254 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
|
- |
|
| 2255 |
.getAvailability() > 0;
|
- |
|
| 2256 |
} catch (ProfitMandiBusinessException e) {
|
- |
|
| 2257 |
return false;
|
- |
|
| 2258 |
}
|
- |
|
| 2259 |
}
|
- |
|
| 2260 |
|
- |
|
| 2261 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
933 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
| 2262 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable {
|
934 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable {
|
| 2263 |
model.addAttribute("appContextPath", request.getContextPath());
|
935 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 2264 |
return "contact-us";
|
936 |
return "contact-us";
|
| 2265 |
}
|
937 |
}
|
| Line 2280... |
Line 952... |
| 2280 |
List<Notification> notifications = null;
|
952 |
List<Notification> notifications = null;
|
| 2281 |
|
953 |
|
| 2282 |
List<NotificationCampaign> notificationCampaigns = notificationCampaignRepository.getNotifications(messageType,
|
954 |
List<NotificationCampaign> notificationCampaigns = notificationCampaignRepository.getNotifications(messageType,
|
| 2283 |
userId, offset, limit);
|
955 |
userId, offset, limit);
|
| 2284 |
LOGGER.info("messageType" + messageType);
|
956 |
LOGGER.info("messageType" + messageType);
|
| 2285 |
notifications = getNotifications(notificationCampaigns, messageType);
|
957 |
notifications = fofoUser.getNotifications(notificationCampaigns, messageType);
|
| 2286 |
|
958 |
|
| 2287 |
model.addAttribute("notifications", notifications);
|
959 |
model.addAttribute("notifications", notifications);
|
| 2288 |
|
960 |
|
| 2289 |
LOGGER.info("notifications" + notifications);
|
961 |
LOGGER.info("notifications" + notifications);
|
| 2290 |
return "notification-template";
|
962 |
return "notification-template";
|
| 2291 |
}
|
963 |
}
|
| 2292 |
|
964 |
|
| 2293 |
public List<Notification> getNotifications(List<NotificationCampaign> nc, MessageType messageType)
|
- |
|
| 2294 |
throws ProfitMandiBusinessException {
|
- |
|
| 2295 |
List<Notification> notifications = new ArrayList<>();
|
- |
|
| 2296 |
Document document = null;
|
- |
|
| 2297 |
if (messageType != null) {
|
- |
|
| 2298 |
for (NotificationCampaign notificationCampaign : nc) {
|
- |
|
| 2299 |
if (notificationCampaign.getMessageType() == messageType) {
|
- |
|
| 2300 |
Notification ns = new Notification();
|
- |
|
| 2301 |
SimpleCampaignParams scp = gson.fromJson(notificationCampaign.getImplementationParams(),
|
- |
|
| 2302 |
SimpleCampaignParams.class);
|
- |
|
| 2303 |
Campaign campaign = new SimpleCampaign(scp);
|
- |
|
| 2304 |
LocalDateTime expire = campaign.getExpireTimestamp();
|
- |
|
| 2305 |
ns.setCid(Integer.toString(notificationCampaign.getId()));
|
- |
|
| 2306 |
ns.setType(campaign.getType());
|
- |
|
| 2307 |
ns.setMessage(campaign.getMessage());
|
- |
|
| 2308 |
ns.setTitle(campaign.getTitle());
|
- |
|
| 2309 |
if (notificationCampaign.getDocumentId() != null) {
|
- |
|
| 2310 |
document = documentRepository.selectById(notificationCampaign.getDocumentId());
|
- |
|
| 2311 |
ns.setDocumentName(document.getDisplayName());
|
- |
|
| 2312 |
}
|
- |
|
| 2313 |
ns.setUrl(campaign.getUrl());
|
- |
|
| 2314 |
ns.setShowImage(campaign.getShowImage());
|
- |
|
| 2315 |
ns.setImageUrl(campaign.getImageUrl());
|
- |
|
| 2316 |
ns.setDocumentId(notificationCampaign.getDocumentId());
|
- |
|
| 2317 |
ns.setMessageType(notificationCampaign.getMessageType());
|
- |
|
| 2318 |
ns.setCreated(
|
- |
|
| 2319 |
notificationCampaign.getCreatedTimestamp().toEpochSecond(ZoneOffset.ofHoursMinutes(5, 30))
|
- |
|
| 2320 |
* 1000);
|
- |
|
| 2321 |
if (LocalDateTime.now().isAfter(expire)) {
|
- |
|
| 2322 |
ns.setExpired(true);
|
- |
|
| 2323 |
} else {
|
- |
|
| 2324 |
ns.setExpired(false);
|
- |
|
| 2325 |
}
|
- |
|
| 2326 |
notifications.add(ns);
|
- |
|
| 2327 |
}
|
- |
|
| 2328 |
}
|
- |
|
| 2329 |
} else {
|
- |
|
| 2330 |
for (NotificationCampaign notificationCampaign : nc) {
|
- |
|
| 2331 |
|
- |
|
| 2332 |
Notification ns = new Notification();
|
- |
|
| 2333 |
SimpleCampaignParams scp = gson.fromJson(notificationCampaign.getImplementationParams(),
|
- |
|
| 2334 |
SimpleCampaignParams.class);
|
- |
|
| 2335 |
Campaign campaign = new SimpleCampaign(scp);
|
- |
|
| 2336 |
LocalDateTime expire = campaign.getExpireTimestamp();
|
- |
|
| 2337 |
ns.setCid(Integer.toString(notificationCampaign.getId()));
|
- |
|
| 2338 |
ns.setType(campaign.getType());
|
- |
|
| 2339 |
ns.setMessage(campaign.getMessage());
|
- |
|
| 2340 |
ns.setTitle(campaign.getTitle());
|
- |
|
| 2341 |
if (notificationCampaign.getDocumentId() != null) {
|
- |
|
| 2342 |
document = documentRepository.selectById(notificationCampaign.getDocumentId());
|
- |
|
| 2343 |
ns.setDocumentName(document.getDisplayName());
|
- |
|
| 2344 |
}
|
- |
|
| 2345 |
ns.setUrl(campaign.getUrl());
|
- |
|
| 2346 |
ns.setShowImage(campaign.getShowImage());
|
- |
|
| 2347 |
ns.setImageUrl(campaign.getImageUrl());
|
- |
|
| 2348 |
ns.setDocumentId(notificationCampaign.getDocumentId());
|
- |
|
| 2349 |
ns.setMessageType(notificationCampaign.getMessageType());
|
- |
|
| 2350 |
ns.setCreated(notificationCampaign.getCreatedTimestamp().toEpochSecond(ZoneOffset.ofHoursMinutes(5, 30))
|
- |
|
| 2351 |
* 1000);
|
- |
|
| 2352 |
if (LocalDateTime.now().isAfter(expire)) {
|
- |
|
| 2353 |
ns.setExpired(true);
|
- |
|
| 2354 |
} else {
|
- |
|
| 2355 |
ns.setExpired(false);
|
- |
|
| 2356 |
}
|
- |
|
| 2357 |
notifications.add(ns);
|
- |
|
| 2358 |
}
|
- |
|
| 2359 |
|
- |
|
| 2360 |
}
|
- |
|
| 2361 |
return notifications;
|
- |
|
| 2362 |
|
- |
|
| 2363 |
}
|
- |
|
| 2364 |
|
- |
|
| 2365 |
@RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
|
965 |
@RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
|
| 2366 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
|
966 |
public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
|
| 2367 |
@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid)
|
967 |
@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid)
|
| 2368 |
throws ProfitMandiBusinessException {
|
968 |
throws ProfitMandiBusinessException {
|
| 2369 |
Document document = documentRepository.selectById(documentId);
|
969 |
Document document = documentRepository.selectById(documentId);
|
| Line 2414... |
Line 1014... |
| 2414 |
headers.setContentLength(document.getSize());
|
1014 |
headers.setContentLength(document.getSize());
|
| 2415 |
final InputStreamResource inputStreamResource = new InputStreamResource(file);
|
1015 |
final InputStreamResource inputStreamResource = new InputStreamResource(file);
|
| 2416 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
1016 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 2417 |
}
|
1017 |
}
|
| 2418 |
|
1018 |
|
| 2419 |
public Map<Integer, PartnerDetailModel> getL2AuthUserPartnerDetail() throws Exception {
|
- |
|
| 2420 |
LOGGER.info("getL2AuthUserPartnerDetail Started");
|
- |
|
| 2421 |
Map<Integer, List<Integer>> L2L1Mapping = csService.getL2L1Mapping();
|
- |
|
| 2422 |
Map<Integer, Integer> authIdAndleadsCountMap = new HashMap<>();
|
- |
|
| 2423 |
for (Entry<Integer, List<Integer>> l2l1 : L2L1Mapping.entrySet()) {
|
- |
|
| 2424 |
List<Integer> authIds = l2l1.getValue();
|
- |
|
| 2425 |
authIds.add(l2l1.getKey());
|
- |
|
| 2426 |
|
- |
|
| 2427 |
List<Lead> leads = leadRepository.selectByAssignAuthIdsAndStatus(authIds, LeadStatus.followUp);
|
- |
|
| 2428 |
LOGGER.info("authIdAndleadsCountMap" + authIdAndleadsCountMap);
|
- |
|
| 2429 |
AuthUser auth = authRepository.selectById(l2l1.getKey());
|
- |
|
| 2430 |
if (!leads.isEmpty()) {
|
- |
|
| 2431 |
authIdAndleadsCountMap.put(auth.getId(), leads.size());
|
- |
|
| 2432 |
} else {
|
- |
|
| 2433 |
authIdAndleadsCountMap.put(auth.getId(), 0);
|
- |
|
| 2434 |
}
|
- |
|
| 2435 |
}
|
- |
|
| 2436 |
|
- |
|
| 2437 |
Map<Integer, PartnerDetailModel> partnerStats = partnerStatsService.getAllPartnerStats();
|
- |
|
| 2438 |
List<Integer> unmappedPartners = partnerStats.entrySet().stream().map(x -> x.getKey())
|
- |
|
| 2439 |
.collect(Collectors.toList());
|
- |
|
| 2440 |
LOGGER.info("authIdAndleadsCountMap" + authIdAndleadsCountMap);
|
- |
|
| 2441 |
|
- |
|
| 2442 |
Map<Integer, PartnerDetailModel> authIdAndallValues = new LinkedHashMap<>();
|
- |
|
| 2443 |
|
- |
|
| 2444 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
- |
|
| 2445 |
for (int authUserId : pp.keySet()) {
|
- |
|
| 2446 |
if (L2L1Mapping.keySet().contains(authUserId)) {
|
- |
|
| 2447 |
List<Integer> fofoIds = pp.get(authUserId);
|
- |
|
| 2448 |
unmappedPartners.removeAll(fofoIds);
|
- |
|
| 2449 |
List<PartnerDetailModel> partnerDetails = fofoIds.stream().map(x -> partnerStats.get(x))
|
- |
|
| 2450 |
.collect(Collectors.toList());
|
- |
|
| 2451 |
LOGGER.info("authUserId {}, partnerDetails2 {}" + authUserId, partnerDetails);
|
- |
|
| 2452 |
PartnerDetailModel partnerDetailModel = partnerStatsService.getAggregateStats(partnerDetails);
|
- |
|
| 2453 |
authIdAndallValues.put(authUserId, partnerDetailModel);
|
- |
|
| 2454 |
}
|
- |
|
| 2455 |
}
|
- |
|
| 2456 |
List<PartnerDetailModel> unmappedPartnerDetails = unmappedPartners.stream().map(x -> partnerStats.get(x))
|
- |
|
| 2457 |
.collect(Collectors.toList());
|
- |
|
| 2458 |
PartnerDetailModel partnerDetailModel = partnerStatsService
|
- |
|
| 2459 |
.getAggregateStats(new ArrayList<>(partnerStats.values()));
|
- |
|
| 2460 |
authIdAndallValues.put(-1, partnerStatsService.getAggregateStats(unmappedPartnerDetails));
|
- |
|
| 2461 |
authIdAndallValues.put(0, partnerDetailModel);
|
- |
|
| 2462 |
return authIdAndallValues;
|
- |
|
| 2463 |
}
|
- |
|
| 2464 |
|
- |
|
| 2465 |
@RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
|
1019 |
@RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
|
| 2466 |
public String getItemWiseTertiary(HttpServletRequest request,
|
1020 |
public String getItemWiseTertiary(HttpServletRequest request,
|
| 2467 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
|
1021 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
|
| 2468 |
throws ProfitMandiBusinessException {
|
1022 |
throws ProfitMandiBusinessException {
|
| 2469 |
List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
|
1023 |
List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
|
| Line 2487... |
Line 1041... |
| 2487 |
}
|
1041 |
}
|
| 2488 |
|
1042 |
|
| 2489 |
@RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
|
1043 |
@RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
|
| 2490 |
public String getPartnerInvestment(HttpServletRequest request,
|
1044 |
public String getPartnerInvestment(HttpServletRequest request,
|
| 2491 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
1045 |
@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
|
| 2492 |
Map<Integer, PartnerDetailModel> partnerStats = this.getPartnersStatDataFromFile();
|
1046 |
Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
|
| 2493 |
PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
|
1047 |
PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
|
| 2494 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
1048 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 2495 |
model.addAttribute("partnerDetailModel", partnerDetailModel);
|
1049 |
model.addAttribute("partnerDetailModel", partnerDetailModel);
|
| 2496 |
model.addAttribute("customRetailer", customRetailer);
|
1050 |
model.addAttribute("customRetailer", customRetailer);
|
| 2497 |
return "partner-investment";
|
1051 |
return "partner-investment";
|
| Line 2774... |
Line 1328... |
| 2774 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
1328 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
| 2775 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
1329 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 2776 |
|
1330 |
|
| 2777 |
ChartModel cm;
|
1331 |
ChartModel cm;
|
| 2778 |
if (warehouseId != 0) {
|
1332 |
if (warehouseId != 0) {
|
| 2779 |
cm = this.getBrandWiseLms(Arrays.asList(warehouseId),
|
1333 |
cm = adminUser.getBrandWiseLms(Arrays.asList(warehouseId),
|
| 2780 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1334 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
| 2781 |
} else {
|
1335 |
} else {
|
| 2782 |
cm = this.getBrandWiseLms(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
1336 |
cm = adminUser.getBrandWiseLms(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
| 2783 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1337 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
| 2784 |
|
1338 |
|
| 2785 |
}
|
1339 |
}
|
| 2786 |
|
1340 |
|
| 2787 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
1341 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| Line 2794... |
Line 1348... |
| 2794 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
1348 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
| 2795 |
@RequestParam(required = false) LocalDate date, Model model) throws Exception {
|
1349 |
@RequestParam(required = false) LocalDate date, Model model) throws Exception {
|
| 2796 |
|
1350 |
|
| 2797 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1351 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 2798 |
String email = loginDetails.getEmailId();
|
1352 |
String email = loginDetails.getEmailId();
|
| 2799 |
Map<String, Object> map = this.getFilter(warehouseId, email, date);
|
1353 |
Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
|
| 2800 |
model.addAttribute("warehouseId", warehouseId);
|
1354 |
model.addAttribute("warehouseId", warehouseId);
|
| 2801 |
model.addAllAttributes(map);
|
1355 |
model.addAllAttributes(map);
|
| 2802 |
|
1356 |
|
| 2803 |
return "chart-filter-lms";
|
1357 |
return "chart-filter-lms";
|
| 2804 |
}
|
1358 |
}
|
| Line 2808... |
Line 1362... |
| 2808 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
1362 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
| 2809 |
@RequestParam(required = false) LocalDate date, Model model) throws Exception {
|
1363 |
@RequestParam(required = false) LocalDate date, Model model) throws Exception {
|
| 2810 |
|
1364 |
|
| 2811 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1365 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 2812 |
String email = loginDetails.getEmailId();
|
1366 |
String email = loginDetails.getEmailId();
|
| 2813 |
Map<String, Object> map = this.getFilter(warehouseId, email, date);
|
1367 |
Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
|
| 2814 |
model.addAttribute("warehouseId", warehouseId);
|
1368 |
model.addAttribute("warehouseId", warehouseId);
|
| 2815 |
model.addAllAttributes(map);
|
1369 |
model.addAllAttributes(map);
|
| 2816 |
|
1370 |
|
| 2817 |
return "chart-filter-lmp";
|
1371 |
return "chart-filter-lmp";
|
| 2818 |
}
|
1372 |
}
|
| Line 2825... |
Line 1379... |
| 2825 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
1379 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
| 2826 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
1380 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 2827 |
|
1381 |
|
| 2828 |
ChartModel cm;
|
1382 |
ChartModel cm;
|
| 2829 |
if (warehouseId != 0) {
|
1383 |
if (warehouseId != 0) {
|
| 2830 |
cm = this.getBrandWiseLmp(Arrays.asList(warehouseId),
|
1384 |
cm = adminUser.getBrandWiseLmp(Arrays.asList(warehouseId),
|
| 2831 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1385 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
| 2832 |
} else {
|
1386 |
} else {
|
| 2833 |
cm = this.getBrandWiseLmp(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
1387 |
cm = adminUser.getBrandWiseLmp(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
| 2834 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1388 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
| 2835 |
|
1389 |
|
| 2836 |
}
|
1390 |
}
|
| 2837 |
|
1391 |
|
| 2838 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
1392 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 2839 |
model.addAttribute("chartMap", gson.toJson(cm));
|
1393 |
model.addAttribute("chartMap", gson.toJson(cm));
|
| 2840 |
return "brand-wise-mobile-lmp-chart";
|
1394 |
return "brand-wise-mobile-lmp-chart";
|
| 2841 |
}
|
1395 |
}
|
| 2842 |
|
1396 |
|
| 2843 |
public Map<String, Object> getFilter(int warehouseId, String email, LocalDate date)
|
- |
|
| 2844 |
throws ProfitMandiBusinessException {
|
- |
|
| 2845 |
Map<String, Object> map = new HashMap<>();
|
- |
|
| 2846 |
|
- |
|
| 2847 |
Map<Integer, CustomRetailer> customRetailersMap = null;
|
- |
|
| 2848 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
- |
|
| 2849 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
- |
|
| 2850 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
- |
|
| 2851 |
|
- |
|
| 2852 |
Set<Integer> fofoIds = null;
|
- |
|
| 2853 |
fofoIds = storeGuyMap.get(authUser.getEmailId());
|
- |
|
| 2854 |
if (emails.contains(authUser.getEmailId())) {
|
- |
|
| 2855 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
- |
|
| 2856 |
|
- |
|
| 2857 |
}
|
- |
|
| 2858 |
if (warehouseId != 0) {
|
- |
|
| 2859 |
|
- |
|
| 2860 |
fofoIds = fofoStoreRepository.selectPartnerByfofoIdAndWarehouse(new ArrayList<>(fofoIds), warehouseId)
|
- |
|
| 2861 |
.stream().map(x -> x).collect(Collectors.toSet());
|
- |
|
| 2862 |
|
- |
|
| 2863 |
}
|
- |
|
| 2864 |
if (date == null) {
|
- |
|
| 2865 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 2866 |
|
- |
|
| 2867 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
|
- |
|
| 2868 |
date = startOfMonth.toLocalDate();
|
- |
|
| 2869 |
}
|
- |
|
| 2870 |
|
- |
|
| 2871 |
if (fofoIds != null) {
|
- |
|
| 2872 |
customRetailersMap = retailerService
|
- |
|
| 2873 |
.getFofoRetailers(fofoIds.stream().map(x -> x).collect(Collectors.toList()));
|
- |
|
| 2874 |
|
- |
|
| 2875 |
}
|
- |
|
| 2876 |
|
- |
|
| 2877 |
map.put("date", date);
|
- |
|
| 2878 |
map.put("customRetailersMap", customRetailersMap);
|
- |
|
| 2879 |
map.put("fofoIds", fofoIds);
|
- |
|
| 2880 |
map.put("warehouseMap", warehouseMap);
|
- |
|
| 2881 |
|
- |
|
| 2882 |
return map;
|
- |
|
| 2883 |
|
- |
|
| 2884 |
}
|
- |
|
| 2885 |
|
- |
|
| 2886 |
private ChartModel getBrandWiseLms(List<Integer> warehouseIds, List<Integer> fofoIds, LocalDate startDateTime) {
|
- |
|
| 2887 |
LOGGER.info("params" + warehouseIds + fofoIds + startDateTime);
|
- |
|
| 2888 |
|
- |
|
| 2889 |
List<BrandWiseModel> brandWiseLms = fofoStoreRepository.selectGroupByBrandLms(fofoIds, warehouseIds,
|
- |
|
| 2890 |
startDateTime);
|
- |
|
| 2891 |
LOGGER.info("brandWiseLms" + brandWiseLms);
|
- |
|
| 2892 |
|
- |
|
| 2893 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
- |
|
| 2894 |
|
- |
|
| 2895 |
Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
|
- |
|
| 2896 |
for (BrandWiseModel bwl : brandWiseLms) {
|
- |
|
| 2897 |
Map<YearMonth, Double> brandValue = new HashMap<>();
|
- |
|
| 2898 |
if (brandMonthValue.containsKey(bwl.getBrand())) {
|
- |
|
| 2899 |
brandValue = brandMonthValue.get(bwl.getBrand());
|
- |
|
| 2900 |
brandValue.put(YearMonth.parse(bwl.getYearMonth(), dateTimeFormatter), (double) bwl.getAmount());
|
- |
|
| 2901 |
} else {
|
- |
|
| 2902 |
|
- |
|
| 2903 |
brandValue.put(YearMonth.parse(bwl.getYearMonth(), dateTimeFormatter), (double) bwl.getAmount());
|
- |
|
| 2904 |
|
- |
|
| 2905 |
}
|
- |
|
| 2906 |
brandMonthValue.put(bwl.getBrand(), brandValue);
|
- |
|
| 2907 |
|
- |
|
| 2908 |
}
|
- |
|
| 2909 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 2910 |
|
- |
|
| 2911 |
Period age = Period.between(startDateTime, LocalDate.now());
|
- |
|
| 2912 |
int months = age.getMonths();
|
- |
|
| 2913 |
LOGGER.info("months" + months);
|
- |
|
| 2914 |
LOGGER.info("brandWiseLms" + brandWiseLms);
|
- |
|
| 2915 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
- |
|
| 2916 |
List<String> brands = new ArrayList<>();
|
- |
|
| 2917 |
brands.add("Oppo");
|
- |
|
| 2918 |
brands.add("Vivo");
|
- |
|
| 2919 |
brands.add("Samsung");
|
- |
|
| 2920 |
brands.add("Realme");
|
- |
|
| 2921 |
brands.add("Xiaomi");
|
- |
|
| 2922 |
brands.add("Tecno");
|
- |
|
| 2923 |
brands.add("Itel");
|
- |
|
| 2924 |
brands.add("Lava");
|
- |
|
| 2925 |
brands.add("Nokia");
|
- |
|
| 2926 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
- |
|
| 2927 |
|
- |
|
| 2928 |
for (String brand : brands) {
|
- |
|
| 2929 |
Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
|
- |
|
| 2930 |
for (int i = months; i >= 0; i--) {
|
- |
|
| 2931 |
|
- |
|
| 2932 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 2933 |
|
- |
|
| 2934 |
if (yearMonthValue != null) {
|
- |
|
| 2935 |
if (yearMonthValue.get(YearMonth.from(startMonth)) == null) {
|
- |
|
| 2936 |
yearMonthValue.put(YearMonth.from(startMonth), 0.0);
|
- |
|
| 2937 |
}
|
- |
|
| 2938 |
|
- |
|
| 2939 |
} else {
|
- |
|
| 2940 |
yearMonthValue = new HashMap<>();
|
- |
|
| 2941 |
yearMonthValue.put(YearMonth.from(startMonth), 0.0);
|
- |
|
| 2942 |
}
|
- |
|
| 2943 |
}
|
- |
|
| 2944 |
|
- |
|
| 2945 |
Map<YearMonth, Double> sortedMonthBrandValue = new TreeMap<>(yearMonthValue);
|
- |
|
| 2946 |
|
- |
|
| 2947 |
brandMonthValue.put(brand, sortedMonthBrandValue);
|
- |
|
| 2948 |
|
- |
|
| 2949 |
sortedBrandValue.put(brand, sortedMonthBrandValue.values().stream().collect(Collectors.toList()));
|
- |
|
| 2950 |
|
- |
|
| 2951 |
}
|
- |
|
| 2952 |
|
- |
|
| 2953 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
- |
|
| 2954 |
|
- |
|
| 2955 |
LOGGER.info("sortedBrandValue" + sortedBrandValue);
|
- |
|
| 2956 |
|
- |
|
| 2957 |
LinkedHashSet<String> labels = new LinkedHashSet<String>();
|
- |
|
| 2958 |
|
- |
|
| 2959 |
for (int i = months; i >= 0; i--) {
|
- |
|
| 2960 |
|
- |
|
| 2961 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 2962 |
labels.add(startMonth.format(DateTimeFormatter.ofPattern("MMM''uu")).toString());
|
- |
|
| 2963 |
}
|
- |
|
| 2964 |
|
- |
|
| 2965 |
List<DatasetModel> datasets = new ArrayList<>();
|
- |
|
| 2966 |
List<String> colorList = new ArrayList<>();
|
- |
|
| 2967 |
colorList.add("darkgreen");
|
- |
|
| 2968 |
colorList.add("dodgerblue");
|
- |
|
| 2969 |
colorList.add("darkblue");
|
- |
|
| 2970 |
colorList.add("gold");
|
- |
|
| 2971 |
colorList.add("coral");
|
- |
|
| 2972 |
colorList.add("steelblue");
|
- |
|
| 2973 |
colorList.add("red");
|
- |
|
| 2974 |
colorList.add("midnightblue");
|
- |
|
| 2975 |
colorList.add("cornsilk");
|
- |
|
| 2976 |
|
- |
|
| 2977 |
List<String> borderList = new ArrayList<>();
|
- |
|
| 2978 |
borderList.add("mediumseagreen");
|
- |
|
| 2979 |
borderList.add("lightblue");
|
- |
|
| 2980 |
borderList.add("#0000cd");
|
- |
|
| 2981 |
borderList.add("#f7e98e");
|
- |
|
| 2982 |
|
- |
|
| 2983 |
borderList.add("#ff8c69");
|
- |
|
| 2984 |
|
- |
|
| 2985 |
borderList.add("#0000cd");
|
- |
|
| 2986 |
borderList.add("lightsalmon");
|
- |
|
| 2987 |
|
- |
|
| 2988 |
borderList.add("#0000cd");
|
- |
|
| 2989 |
borderList.add("cornsilk");
|
- |
|
| 2990 |
|
- |
|
| 2991 |
int i = 0;
|
- |
|
| 2992 |
|
- |
|
| 2993 |
for (Entry<String, List<Double>> brandValue : sortedBrandValue.entrySet()) {
|
- |
|
| 2994 |
|
- |
|
| 2995 |
DatasetModel lmsModel = new DatasetModel();
|
- |
|
| 2996 |
lmsModel.setLabel(brandValue.getKey());
|
- |
|
| 2997 |
lmsModel.setBackgroundColor(colorList.get(i));
|
- |
|
| 2998 |
|
- |
|
| 2999 |
lmsModel.setData(brandValue.getValue());
|
- |
|
| 3000 |
|
- |
|
| 3001 |
lmsModel.setType("line");
|
- |
|
| 3002 |
lmsModel.setOrder(1);
|
- |
|
| 3003 |
lmsModel.setFill("false");
|
- |
|
| 3004 |
lmsModel.setBorderColor(borderList.get(i));
|
- |
|
| 3005 |
datasets.add(lmsModel);
|
- |
|
| 3006 |
|
- |
|
| 3007 |
i++;
|
- |
|
| 3008 |
}
|
- |
|
| 3009 |
|
- |
|
| 3010 |
DataModel dm = new DataModel();
|
- |
|
| 3011 |
dm.setDatasets(datasets);
|
- |
|
| 3012 |
dm.setLabels(labels);
|
- |
|
| 3013 |
|
- |
|
| 3014 |
LegendModel lm = new LegendModel();
|
- |
|
| 3015 |
lm.setPosition("top");
|
- |
|
| 3016 |
|
- |
|
| 3017 |
Tooltips tooltips = new Tooltips();
|
- |
|
| 3018 |
tooltips.setBodyFontSize(15);
|
- |
|
| 3019 |
tooltips.setTitleFontSize(15);
|
- |
|
| 3020 |
tooltips.setMode("index");
|
- |
|
| 3021 |
tooltips.setIntersect(false);
|
- |
|
| 3022 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
- |
|
| 3023 |
|
- |
|
| 3024 |
HoverModel hover = new HoverModel();
|
- |
|
| 3025 |
hover.setIntersect(false);
|
- |
|
| 3026 |
hover.setMode("index");
|
- |
|
| 3027 |
|
- |
|
| 3028 |
TitleModel tm = new TitleModel();
|
- |
|
| 3029 |
tm.setText("Brand Wise Monthly Sale");
|
- |
|
| 3030 |
tm.setDisplay(true);
|
- |
|
| 3031 |
tm.setFontSize(20);
|
- |
|
| 3032 |
tm.setFontColor("#111");
|
- |
|
| 3033 |
|
- |
|
| 3034 |
OptionsModel om = new OptionsModel();
|
- |
|
| 3035 |
om.setResponsive(true);
|
- |
|
| 3036 |
om.setLegend(lm);
|
- |
|
| 3037 |
om.setTitle(tm);
|
- |
|
| 3038 |
om.setTooltips(tooltips);
|
- |
|
| 3039 |
om.setHover(hover);
|
- |
|
| 3040 |
|
- |
|
| 3041 |
ChartModel cm = new ChartModel();
|
- |
|
| 3042 |
|
- |
|
| 3043 |
cm.setType("line");
|
- |
|
| 3044 |
cm.setData(dm);
|
- |
|
| 3045 |
cm.setOptions(om);
|
- |
|
| 3046 |
|
- |
|
| 3047 |
LOGGER.info("cm" + cm);
|
- |
|
| 3048 |
|
- |
|
| 3049 |
return cm;
|
- |
|
| 3050 |
}
|
- |
|
| 3051 |
|
- |
|
| 3052 |
private ChartModel getBrandWiseLmp(List<Integer> warehouseIds, List<Integer> fofoIds, LocalDate startDateTime) {
|
- |
|
| 3053 |
LOGGER.info("params" + warehouseIds + fofoIds + startDateTime);
|
- |
|
| 3054 |
|
- |
|
| 3055 |
List<BrandWiseModel> brandWiseLms = orderRepository.selectGroupByBrandLmp(fofoIds, warehouseIds, startDateTime);
|
- |
|
| 3056 |
LOGGER.info("brandWiseLms" + brandWiseLms);
|
- |
|
| 3057 |
|
- |
|
| 3058 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
- |
|
| 3059 |
|
- |
|
| 3060 |
Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
|
- |
|
| 3061 |
for (BrandWiseModel bwl : brandWiseLms) {
|
- |
|
| 3062 |
Map<YearMonth, Double> brandValue = new HashMap<>();
|
- |
|
| 3063 |
if (brandMonthValue.containsKey(bwl.getBrand())) {
|
- |
|
| 3064 |
brandValue = brandMonthValue.get(bwl.getBrand());
|
- |
|
| 3065 |
brandValue.put(YearMonth.parse(bwl.getYearMonth(), dateTimeFormatter), (double) bwl.getAmount());
|
- |
|
| 3066 |
} else {
|
- |
|
| 3067 |
|
- |
|
| 3068 |
brandValue.put(YearMonth.parse(bwl.getYearMonth(), dateTimeFormatter), (double) bwl.getAmount());
|
- |
|
| 3069 |
|
- |
|
| 3070 |
}
|
- |
|
| 3071 |
brandMonthValue.put(bwl.getBrand(), brandValue);
|
- |
|
| 3072 |
|
- |
|
| 3073 |
}
|
- |
|
| 3074 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
- |
|
| 3075 |
|
- |
|
| 3076 |
Period age = Period.between(startDateTime, LocalDate.now());
|
- |
|
| 3077 |
int months = age.getMonths();
|
- |
|
| 3078 |
LOGGER.info("months" + months);
|
- |
|
| 3079 |
LOGGER.info("brandWiseLms" + brandWiseLms);
|
- |
|
| 3080 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
- |
|
| 3081 |
List<String> brands = new ArrayList<>();
|
- |
|
| 3082 |
brands.add("Oppo");
|
- |
|
| 3083 |
brands.add("Vivo");
|
- |
|
| 3084 |
brands.add("Samsung");
|
- |
|
| 3085 |
brands.add("Realme");
|
- |
|
| 3086 |
brands.add("Xiaomi");
|
- |
|
| 3087 |
brands.add("Tecno");
|
- |
|
| 3088 |
brands.add("Itel");
|
- |
|
| 3089 |
brands.add("Lava");
|
- |
|
| 3090 |
brands.add("Nokia");
|
- |
|
| 3091 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
- |
|
| 3092 |
|
- |
|
| 3093 |
for (String brand : brands) {
|
- |
|
| 3094 |
Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
|
- |
|
| 3095 |
for (int i = months; i >= 0; i--) {
|
- |
|
| 3096 |
|
- |
|
| 3097 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 3098 |
|
- |
|
| 3099 |
if (yearMonthValue != null) {
|
- |
|
| 3100 |
if (yearMonthValue.get(YearMonth.from(startMonth)) == null) {
|
- |
|
| 3101 |
yearMonthValue.put(YearMonth.from(startMonth), 0.0);
|
- |
|
| 3102 |
}
|
- |
|
| 3103 |
|
- |
|
| 3104 |
} else {
|
- |
|
| 3105 |
yearMonthValue = new HashMap<>();
|
- |
|
| 3106 |
yearMonthValue.put(YearMonth.from(startMonth), 0.0);
|
- |
|
| 3107 |
}
|
- |
|
| 3108 |
}
|
- |
|
| 3109 |
|
- |
|
| 3110 |
Map<YearMonth, Double> sortedMonthBrandValue = new TreeMap<>(yearMonthValue);
|
- |
|
| 3111 |
|
- |
|
| 3112 |
brandMonthValue.put(brand, sortedMonthBrandValue);
|
- |
|
| 3113 |
|
- |
|
| 3114 |
sortedBrandValue.put(brand, sortedMonthBrandValue.values().stream().collect(Collectors.toList()));
|
- |
|
| 3115 |
|
- |
|
| 3116 |
}
|
- |
|
| 3117 |
|
- |
|
| 3118 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
- |
|
| 3119 |
|
- |
|
| 3120 |
LOGGER.info("sortedBrandValue" + sortedBrandValue);
|
- |
|
| 3121 |
|
- |
|
| 3122 |
LinkedHashSet<String> labels = new LinkedHashSet<String>();
|
- |
|
| 3123 |
|
- |
|
| 3124 |
for (int i = months; i >= 0; i--) {
|
- |
|
| 3125 |
|
- |
|
| 3126 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
- |
|
| 3127 |
labels.add(startMonth.format(DateTimeFormatter.ofPattern("MMM''uu")).toString());
|
- |
|
| 3128 |
}
|
- |
|
| 3129 |
|
- |
|
| 3130 |
List<DatasetModel> datasets = new ArrayList<>();
|
- |
|
| 3131 |
List<String> colorList = new ArrayList<>();
|
- |
|
| 3132 |
colorList.add("darkgreen");
|
- |
|
| 3133 |
colorList.add("dodgerblue");
|
- |
|
| 3134 |
colorList.add("darkblue");
|
- |
|
| 3135 |
colorList.add("gold");
|
- |
|
| 3136 |
colorList.add("coral");
|
- |
|
| 3137 |
colorList.add("steelblue");
|
- |
|
| 3138 |
colorList.add("red");
|
- |
|
| 3139 |
colorList.add("midnightblue");
|
- |
|
| 3140 |
colorList.add("cornsilk");
|
- |
|
| 3141 |
|
- |
|
| 3142 |
List<String> borderList = new ArrayList<>();
|
- |
|
| 3143 |
borderList.add("mediumseagreen");
|
- |
|
| 3144 |
borderList.add("lightblue");
|
- |
|
| 3145 |
borderList.add("#0000cd");
|
- |
|
| 3146 |
borderList.add("#f7e98e");
|
- |
|
| 3147 |
|
- |
|
| 3148 |
borderList.add("#ff8c69");
|
- |
|
| 3149 |
|
- |
|
| 3150 |
borderList.add("#0000cd");
|
- |
|
| 3151 |
borderList.add("lightsalmon");
|
- |
|
| 3152 |
|
- |
|
| 3153 |
borderList.add("#0000cd");
|
- |
|
| 3154 |
borderList.add("cornsilk");
|
- |
|
| 3155 |
|
- |
|
| 3156 |
int i = 0;
|
- |
|
| 3157 |
|
- |
|
| 3158 |
for (Entry<String, List<Double>> brandValue : sortedBrandValue.entrySet()) {
|
- |
|
| 3159 |
|
- |
|
| 3160 |
DatasetModel lmsModel = new DatasetModel();
|
- |
|
| 3161 |
lmsModel.setLabel(brandValue.getKey());
|
- |
|
| 3162 |
lmsModel.setBackgroundColor(colorList.get(i));
|
- |
|
| 3163 |
|
- |
|
| 3164 |
lmsModel.setData(brandValue.getValue());
|
- |
|
| 3165 |
|
- |
|
| 3166 |
lmsModel.setType("line");
|
- |
|
| 3167 |
lmsModel.setOrder(1);
|
- |
|
| 3168 |
lmsModel.setFill("false");
|
- |
|
| 3169 |
lmsModel.setBorderColor(borderList.get(i));
|
- |
|
| 3170 |
datasets.add(lmsModel);
|
- |
|
| 3171 |
|
- |
|
| 3172 |
i++;
|
- |
|
| 3173 |
}
|
- |
|
| 3174 |
|
- |
|
| 3175 |
DataModel dm = new DataModel();
|
- |
|
| 3176 |
dm.setDatasets(datasets);
|
- |
|
| 3177 |
dm.setLabels(labels);
|
- |
|
| 3178 |
|
- |
|
| 3179 |
LegendModel lm = new LegendModel();
|
- |
|
| 3180 |
lm.setPosition("top");
|
- |
|
| 3181 |
|
- |
|
| 3182 |
Tooltips tooltips = new Tooltips();
|
- |
|
| 3183 |
tooltips.setBodyFontSize(15);
|
- |
|
| 3184 |
tooltips.setTitleFontSize(15);
|
- |
|
| 3185 |
tooltips.setMode("index");
|
- |
|
| 3186 |
tooltips.setIntersect(false);
|
- |
|
| 3187 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
- |
|
| 3188 |
|
- |
|
| 3189 |
HoverModel hover = new HoverModel();
|
- |
|
| 3190 |
hover.setIntersect(false);
|
- |
|
| 3191 |
hover.setMode("index");
|
- |
|
| 3192 |
|
- |
|
| 3193 |
TitleModel tm = new TitleModel();
|
- |
|
| 3194 |
tm.setText("Brand Wise Monthly Purchase");
|
- |
|
| 3195 |
tm.setDisplay(true);
|
- |
|
| 3196 |
tm.setFontSize(20);
|
- |
|
| 3197 |
tm.setFontColor("#111");
|
- |
|
| 3198 |
|
- |
|
| 3199 |
OptionsModel om = new OptionsModel();
|
- |
|
| 3200 |
om.setResponsive(true);
|
- |
|
| 3201 |
om.setLegend(lm);
|
- |
|
| 3202 |
om.setTitle(tm);
|
- |
|
| 3203 |
om.setTooltips(tooltips);
|
- |
|
| 3204 |
om.setHover(hover);
|
- |
|
| 3205 |
|
- |
|
| 3206 |
ChartModel cm = new ChartModel();
|
- |
|
| 3207 |
|
- |
|
| 3208 |
cm.setType("line");
|
- |
|
| 3209 |
cm.setData(dm);
|
- |
|
| 3210 |
cm.setOptions(om);
|
- |
|
| 3211 |
|
- |
|
| 3212 |
LOGGER.info("cm" + cm);
|
- |
|
| 3213 |
|
- |
|
| 3214 |
return cm;
|
- |
|
| 3215 |
}
|
- |
|
| 3216 |
|
- |
|
| 3217 |
}
|
1397 |
}
|