Subversion Repositories SmartDukaan

Rev

Rev 28409 | Rev 28432 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28409 Rev 28430
Line 13... Line 13...
13
import java.time.YearMonth;
13
import java.time.YearMonth;
14
import java.time.ZoneOffset;
14
import java.time.ZoneOffset;
15
import java.time.format.DateTimeFormatter;
15
import java.time.format.DateTimeFormatter;
16
import java.util.ArrayList;
16
import java.util.ArrayList;
17
import java.util.Arrays;
17
import java.util.Arrays;
-
 
18
import java.util.Collection;
18
import java.util.Comparator;
19
import java.util.Comparator;
19
import java.util.HashMap;
20
import java.util.HashMap;
20
import java.util.HashSet;
21
import java.util.HashSet;
21
import java.util.LinkedHashMap;
22
import java.util.LinkedHashMap;
-
 
23
import java.util.LinkedHashSet;
22
import java.util.List;
24
import java.util.List;
23
import java.util.Map;
25
import java.util.Map;
24
import java.util.Map.Entry;
26
import java.util.Map.Entry;
25
import java.util.Optional;
27
import java.util.Optional;
26
import java.util.Set;
28
import java.util.Set;
-
 
29
import java.util.TreeMap;
27
import java.util.stream.Collectors;
30
import java.util.stream.Collectors;
28
 
31
 
29
import javax.servlet.http.HttpServletRequest;
32
import javax.servlet.http.HttpServletRequest;
30
import javax.transaction.Transactional;
33
import javax.transaction.Transactional;
31
 
34
 
32
import org.apache.logging.log4j.LogManager;
35
import org.apache.logging.log4j.LogManager;
33
import org.apache.logging.log4j.Logger;
36
import org.apache.logging.log4j.Logger;
-
 
37
import org.bouncycastle.crypto.tls.HashAlgorithm;
34
import org.json.JSONObject;
38
import org.json.JSONObject;
35
import org.springframework.beans.factory.annotation.Autowired;
39
import org.springframework.beans.factory.annotation.Autowired;
36
import org.springframework.beans.factory.annotation.Value;
40
import org.springframework.beans.factory.annotation.Value;
37
import org.springframework.core.io.InputStreamResource;
41
import org.springframework.core.io.InputStreamResource;
38
import org.springframework.http.HttpHeaders;
42
import org.springframework.http.HttpHeaders;
Line 42... Line 46...
42
import org.springframework.ui.Model;
46
import org.springframework.ui.Model;
43
import org.springframework.web.bind.annotation.RequestMapping;
47
import org.springframework.web.bind.annotation.RequestMapping;
44
import org.springframework.web.bind.annotation.RequestMethod;
48
import org.springframework.web.bind.annotation.RequestMethod;
45
import org.springframework.web.bind.annotation.RequestParam;
49
import org.springframework.web.bind.annotation.RequestParam;
46
 
50
 
-
 
51
import com.google.common.collect.ArrayListMultimap;
-
 
52
import com.google.common.collect.Multimap;
47
import com.google.gson.Gson;
53
import com.google.gson.Gson;
48
import com.mongodb.DBObject;
54
import com.mongodb.DBObject;
49
import com.spice.profitmandi.common.enumuration.ContentType;
55
import com.spice.profitmandi.common.enumuration.ContentType;
50
import com.spice.profitmandi.common.enumuration.MessageType;
56
import com.spice.profitmandi.common.enumuration.MessageType;
51
import com.spice.profitmandi.common.enumuration.ReporticoProject;
57
import com.spice.profitmandi.common.enumuration.ReporticoProject;
Line 57... Line 63...
57
import com.spice.profitmandi.common.model.ChartModel;
63
import com.spice.profitmandi.common.model.ChartModel;
58
import com.spice.profitmandi.common.model.CustomRetailer;
64
import com.spice.profitmandi.common.model.CustomRetailer;
59
import com.spice.profitmandi.common.model.Data;
65
import com.spice.profitmandi.common.model.Data;
60
import com.spice.profitmandi.common.model.DataInvestmentModel;
66
import com.spice.profitmandi.common.model.DataInvestmentModel;
61
import com.spice.profitmandi.common.model.DataModel;
67
import com.spice.profitmandi.common.model.DataModel;
-
 
68
 
62
import com.spice.profitmandi.common.model.DatasetModel;
69
import com.spice.profitmandi.common.model.DatasetModel;
63
import com.spice.profitmandi.common.model.Legend;
70
import com.spice.profitmandi.common.model.Legend;
64
import com.spice.profitmandi.common.model.LegendModel;
71
import com.spice.profitmandi.common.model.LegendModel;
65
import com.spice.profitmandi.common.model.Notification;
72
import com.spice.profitmandi.common.model.Notification;
66
import com.spice.profitmandi.common.model.OnlineDeliveredOrderSum;
73
import com.spice.profitmandi.common.model.OnlineDeliveredOrderSum;
67
import com.spice.profitmandi.common.model.OptionModel;
74
import com.spice.profitmandi.common.model.OptionModel;
68
import com.spice.profitmandi.common.model.OptionsModel;
75
import com.spice.profitmandi.common.model.OptionsModel;
69
import com.spice.profitmandi.common.model.PieLables;
76
import com.spice.profitmandi.common.model.PieLables;
-
 
77
import com.spice.profitmandi.common.model.PluginsModel;
70
import com.spice.profitmandi.common.model.ProfitMandiConstants;
78
import com.spice.profitmandi.common.model.ProfitMandiConstants;
71
import com.spice.profitmandi.common.model.ScalesModel;
79
import com.spice.profitmandi.common.model.ScalesModel;
72
import com.spice.profitmandi.common.model.TitleModel;
80
import com.spice.profitmandi.common.model.TitleModel;
73
import com.spice.profitmandi.common.web.util.ResponseSender;
81
import com.spice.profitmandi.common.web.util.ResponseSender;
74
import com.spice.profitmandi.dao.Interface.Campaign;
82
import com.spice.profitmandi.dao.Interface.Campaign;
Line 179... Line 187...
179
	@Value("${web.api.root}")
187
	@Value("${web.api.root}")
180
	private String webApiRoot;
188
	private String webApiRoot;
181
 
189
 
182
	@Value("${web.api.port}")
190
	@Value("${web.api.port}")
183
	private int webApiPort;
191
	private int webApiPort;
184
	
192
 
185
	@Autowired
193
	@Autowired
186
	private CookiesProcessor cookiesProcessor;
194
	private CookiesProcessor cookiesProcessor;
187
 
195
 
188
	@Autowired
196
	@Autowired
189
	private PendingOrderRepository pendingOrderRepository;
197
	private PendingOrderRepository pendingOrderRepository;
Line 231... Line 239...
231
	InventoryService inventoryService;
239
	InventoryService inventoryService;
232
 
240
 
233
	@Autowired
241
	@Autowired
234
	private PendingOrderItemRepository pendingOrderItemRepository;
242
	private PendingOrderItemRepository pendingOrderItemRepository;
235
 
243
 
236
	
-
 
237
	@Autowired
244
	@Autowired
238
	private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
245
	private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
239
 
246
 
240
	@Autowired
247
	@Autowired
241
	private FofoOrderItemRepository fofoOrderItemRepository;
248
	private FofoOrderItemRepository fofoOrderItemRepository;
Line 371... Line 378...
371
		} catch (ProfitMandiBusinessException e) {
378
		} catch (ProfitMandiBusinessException e) {
372
			LOGGER.error("FofoStore Code not found of fofoId {}", fofoId);
379
			LOGGER.error("FofoStore Code not found of fofoId {}", fofoId);
373
 
380
 
374
		}
381
		}
375
 
382
 
376
			return "12dashboard34";
383
		return "12dashboard34";
377
	}
384
	}
378
 
385
 
379
	private Map<String, Object> getInvestments(int fofoId) throws Exception {
386
	private Map<String, Object> getInvestments(int fofoId) throws Exception {
380
		Map<String, Object> investments = new LinkedHashMap<>();
387
		Map<String, Object> investments = new LinkedHashMap<>();
381
		PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
388
		PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
Line 563... Line 570...
563
 
570
 
564
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
571
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
565
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
572
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
566
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
573
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
567
		String email = loginDetails.getEmailId();
574
		String email = loginDetails.getEmailId();
568
		int fofoId =  loginDetails.getFofoId();
575
		int fofoId = loginDetails.getFofoId();
569
		
-
 
570
	LocalDateTime startDate =	LocalDate.now().withDayOfYear(1).atStartOfDay();
-
 
571
	LocalDateTime endtDate  =   LocalDateTime.now();			
-
 
572
	LOGGER.info("startDate"+startDate);	
-
 
573
	LOGGER.info("endtDate"+endtDate);	
-
 
574
	
-
 
575
	
-
 
576
	OnlineDeliveredOrderSum onlineDeliveredOrderSum= 	pendingOrderItemRepository.selectSumSellingPriceOnlineOrder(fofoId, startDate, endtDate);
-
 
577
		
-
 
578
	LOGGER.info("onlineDeliveredOrderSum"+onlineDeliveredOrderSum.getSellingPrice());	
-
 
579
 
576
 
-
 
577
		LocalDateTime startDate = LocalDate.now().withDayOfYear(1).atStartOfDay();
-
 
578
		LocalDateTime endtDate = LocalDateTime.now();
-
 
579
		OnlineDeliveredOrderSum onlineDeliveredOrderSum = pendingOrderItemRepository
-
 
580
				.selectSumSellingPriceOnlineOrder(fofoId, startDate, endtDate);
580
	
581
 
-
 
582
		LOGGER.info("onlineDeliveredOrderSum" + onlineDeliveredOrderSum.getSellingPrice());
-
 
583
 
581
	long countOrder =	pendingOrderRepository.pendingOrderCount(fofoId, OrderStatus.PROCESSING);
584
		long countOrder = pendingOrderRepository.pendingOrderCount(fofoId, OrderStatus.PROCESSING);
582
		LOGGER.info("countOrder"+countOrder);
585
		LOGGER.info("countOrder" + countOrder);
583
 
586
 
584
		model.addAttribute("countOrder", countOrder);
587
		model.addAttribute("countOrder", countOrder);
585
		model.addAttribute("onlineDeliveredOrderSum", onlineDeliveredOrderSum.getSellingPrice());
588
		model.addAttribute("onlineDeliveredOrderSum", onlineDeliveredOrderSum.getSellingPrice());
586
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
589
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
587
		model.addAttribute("isAdmin", isAdmin);
590
		model.addAttribute("isAdmin", isAdmin);
Line 666... Line 669...
666
		Map<Integer, String> monthValueMap = new HashMap<>();
669
		Map<Integer, String> monthValueMap = new HashMap<>();
667
		for (int i = 0; i <= 5; i++) {
670
		for (int i = 0; i <= 5; i++) {
668
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
671
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
669
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
672
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
670
		}
673
		}
671
		
-
 
672
		
-
 
673
 
674
 
674
		model.addAttribute("monthValueMap", monthValueMap);
675
		model.addAttribute("monthValueMap", monthValueMap);
675
		model.addAttribute("month", 0);
676
		model.addAttribute("month", 0);
676
 
677
 
677
		model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
678
		model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
Line 679... Line 680...
679
		model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
680
		model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
680
		model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
681
		model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
681
		/*
682
		/*
682
		 * if (loginDetails.isReadOnly()) { return "dashboard-readonly"; } else { }
683
		 * if (loginDetails.isReadOnly()) { return "dashboard-readonly"; } else { }
683
		 */
684
		 */
684
		
-
 
685
		
685
 
686
		return "dashboard1";
686
		return "dashboard1";
687
 
687
 
688
	}
688
	}
689
 
689
 
690
	@RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
690
	@RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
Line 692... Line 692...
692
			@RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
692
			@RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
693
			throws Exception {
693
			throws Exception {
694
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
694
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
695
		int fofoId = loginDetails.getFofoId();
695
		int fofoId = loginDetails.getFofoId();
696
		Map<String, Object> investment = getInvestmentsMonths(fofoId, month);
696
		Map<String, Object> investment = getInvestmentsMonths(fofoId, month);
697
		
-
 
698
		
697
 
699
		LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
698
		LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
700
		LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
699
		LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
701
		LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
700
		LocalDateTime currentMonthEnd = currentMonthStart.plusMonths(1).withDayOfMonth(1);
702
		double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
701
		double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
703
				currentMonthEnd) / 2;
702
				currentMonthEnd) / 2;
Line 707... Line 706...
707
				currentMonthEnd) / 2;
706
				currentMonthEnd) / 2;
708
		model.addAttribute("currentMonthRating", (float) Math.round(currentMonthRating * 10) / 10);
707
		model.addAttribute("currentMonthRating", (float) Math.round(currentMonthRating * 10) / 10);
709
		model.addAttribute("lastMonthRating", (float) Math.round(lastMonthRating * 10) / 10);
708
		model.addAttribute("lastMonthRating", (float) Math.round(lastMonthRating * 10) / 10);
710
		model.addAttribute("ratingTillDate", (float) Math.round(ratingTillDate * 10) / 10);
709
		model.addAttribute("ratingTillDate", (float) Math.round(ratingTillDate * 10) / 10);
711
 
710
 
712
		long hygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), true, currentMonthStart.minusMonths(month),
711
		long hygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), true,
713
				currentMonthEnd.minusMonths(month));
712
				currentMonthStart.minusMonths(month), currentMonthEnd.minusMonths(month));
714
 
713
 
715
		long invalidHygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), false,
714
		long invalidHygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), false,
716
				currentMonthStart.minusMonths(month),
715
				currentMonthStart.minusMonths(month), currentMonthEnd.minusMonths(month));
717
				currentMonthEnd.minusMonths(month));
-
 
718
		if (hygieneCount == 0 && invalidHygieneCount == 0) {
716
		if (hygieneCount == 0 && invalidHygieneCount == 0) {
719
			invalidHygieneCount = 1;
717
			invalidHygieneCount = 1;
720
		}
718
		}
721
		Map<Integer, String> monthValueMap = new HashMap<>();
719
		Map<Integer, String> monthValueMap = new HashMap<>();
722
		for (int i = 0; i <= 5; i++) {
720
		for (int i = 0; i <= 5; i++) {
723
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
721
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
724
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
722
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
725
		}
723
		}
726
		model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
724
		model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
727
		model.addAttribute("monthValueMap" ,monthValueMap);
725
		model.addAttribute("monthValueMap", monthValueMap);
728
		model.addAttribute("investments", investment);
726
		model.addAttribute("investments", investment);
729
		model.addAttribute("monthDays", LocalDate.now().minusMonths(month).lengthOfMonth());
727
		model.addAttribute("monthDays", LocalDate.now().minusMonths(month).lengthOfMonth());
730
		model.addAttribute("dayOfMonth", LocalDate.now().minusMonths(month).lengthOfMonth());
728
		model.addAttribute("dayOfMonth", LocalDate.now().minusMonths(month).lengthOfMonth());
731
		model.addAttribute("month",month);
729
		model.addAttribute("month", month);
732
		return "performance";
730
		return "performance";
733
	}
731
	}
734
 
732
 
735
	@RequestMapping(value = "/investmentDetails", method = RequestMethod.GET)
733
	@RequestMapping(value = "/investmentDetails", method = RequestMethod.GET)
736
	public String getInvestmentDetails(HttpServletRequest request, Model model) throws Exception {
734
	public String getInvestmentDetails(HttpServletRequest request, Model model) throws Exception {
Line 741... Line 739...
741
 
739
 
742
		LOGGER.info("InvestmentChart" + gson.toJson(cm));
740
		LOGGER.info("InvestmentChart" + gson.toJson(cm));
743
		LOGGER.info("InvestmentChart" + cm);
741
		LOGGER.info("InvestmentChart" + cm);
744
		return "investmentdetails";
742
		return "investmentdetails";
745
	}
743
	}
-
 
744
 
-
 
745
	@RequestMapping(value = "/getlmsLineChart", method = RequestMethod.GET)
-
 
746
	public String getlmsLineChart(HttpServletRequest request, Model model) throws Exception {
-
 
747
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
-
 
748
		int fofoId = loginDetails.getFofoId();
-
 
749
		ChartModel cm = this.getLmsLineChart(loginDetails.getFofoId());
-
 
750
 
-
 
751
		LOGGER.info("linechartMap" + gson.toJson(cm));
-
 
752
		model.addAttribute("linechartMap", gson.toJson(cm));
-
 
753
 
-
 
754
		return "lmsLineChart";
746
	
755
	}
-
 
756
 
-
 
757
	@RequestMapping(value = "/getBarChart", method = RequestMethod.GET)
-
 
758
	public String getBarChart(HttpServletRequest request, Model model) throws Exception {
-
 
759
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
-
 
760
		int fofoId = loginDetails.getFofoId();
-
 
761
		ChartModel cm = this.getBrandChart(fofoId);
-
 
762
 
-
 
763
		LOGGER.info("chartMap" + gson.toJson(cm));
-
 
764
		model.addAttribute("chartMap", gson.toJson(cm));
-
 
765
 
-
 
766
		return "bar_chart";
-
 
767
	}
747
 
768
 
748
	private ChartInvestmentModel getInvestmentChart(int fofoId) throws ProfitMandiBusinessException {
769
	private ChartInvestmentModel getInvestmentChart(int fofoId) throws ProfitMandiBusinessException {
749
		PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
770
		PartnerDailyInvestment investment = partnerInvestmentService.getInvestment(fofoId, 0);
750
 
771
 
751
		Map<String, Float> investmentWalletAmount = new HashMap<>();
772
		Map<String, Float> investmentWalletAmount = new HashMap<>();
Line 819... Line 840...
819
		cm.setOptions(om);
840
		cm.setOptions(om);
820
 
841
 
821
		return cm;
842
		return cm;
822
	}
843
	}
823
 
844
 
824
	private ChartModel getBrandChart(int fofoId) {
845
	private ChartModel getLmsLineChart(int fofoId) throws ProfitMandiBusinessException {
825
 
846
 
826
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
847
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
827
 
848
 
828
		LOGGER.info("cur Date" + curDate.withDayOfMonth(1));
849
		Map<YearMonth, Map<String, Double>> monthValueMap = new HashMap<>();
829
 
850
 
830
		LOGGER.info("curDateYear" + curDate.with(LocalTime.MAX));
851
		for (int i = 1; i <= 6; i++) {
831
 
852
 
832
		Map<String, Double> brandwisesale = fofoOrderItemRepository
-
 
833
				.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
853
			LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
834
 
854
 
835
		LOGGER.info("brandwisesale" + brandwisesale);
855
			Map<String, Double> lmsBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
-
 
856
					curDate.withDayOfMonth(1).minusMonths(i), curDate.withDayOfMonth(1).minusMonths(i - 1), fofoId);
836
 
857
 
837
		Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
858
			Map<Integer, Double> accesorieslmsSale = fofoOrderRepository
-
 
859
					.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1).minusMonths(i),
838
				fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
860
							curDate.withDayOfMonth(1).minusMonths(i - 1), Optional.of(false));
839
		brandwisesale.put("Accessories", accesoriesmtdsale.get(fofoId));
861
			LOGGER.info("lmsBrandWiseSale" + lmsBrandWiseSale);
840
 
862
 
841
		Map<String, Double> activatedImeisWithSellingPriceMTD = fofoOrderRepository
863
			lmsBrandWiseSale.put("Accessories", accesorieslmsSale.get(fofoId));
842
				.selectValueOfActivatedImeis(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId).stream()
-
 
843
				.collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
-
 
844
 
864
 
845
		activatedImeisWithSellingPriceMTD.put("Lava", brandwisesale.get("Lava"));
865
			monthValueMap.put(YearMonth.from(startOfMonth), lmsBrandWiseSale);
-
 
866
		}
-
 
867
		LOGGER.info("monthmap" + monthValueMap);
846
 
868
 
847
		Map<String, Double> activatedImeisWithSellingPriceLMTD = fofoOrderRepository
869
		Map<YearMonth, Map<String, Double>> sortedMonthValueMap = new TreeMap(monthValueMap);
848
				.selectValueOfActivatedImeis(curDate.withDayOfMonth(1).minusMonths(1),
-
 
849
						curDate.with(LocalTime.MAX).minusMonths(1), fofoId)
870
		LOGGER.info("monthmap" + sortedMonthValueMap);
850
				.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
-
 
851
 
871
 
852
		Map<String, Double> lmtdBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
872
		Multimap<String, Map<YearMonth, Double>> brandMonthValueMap = ArrayListMultimap.create();
853
				curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
-
 
854
		activatedImeisWithSellingPriceLMTD.put("Lava", lmtdBrandWiseSale.get("Lava"));
-
 
855
 
873
 
856
		Map<Integer, Double> accesorieslmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
-
 
857
				fofoId, curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1),
874
		for (Entry<YearMonth, Map<String, Double>> month : sortedMonthValueMap.entrySet()) {
858
				Optional.of(false));
-
 
859
 
875
 
860
		lmtdBrandWiseSale.put("Accessories", accesorieslmtdsale.get(fofoId));
876
			for (Entry<String, Double> val : month.getValue().entrySet()) {
-
 
877
				Map<YearMonth, Double> yearValue = new HashMap<>();
861
 
878
 
-
 
879
				yearValue.put(month.getKey(), val.getValue() == null ? 0 : val.getValue());
862
		ChartModel cm = new ChartModel();
880
				brandMonthValueMap.put(val.getKey(), yearValue);
863
 
881
 
864
		HashSet<String> labels = new HashSet<String>();
-
 
865
		labels.addAll(brandwisesale.keySet());
882
			}
866
		labels.addAll(lmtdBrandWiseSale.keySet());
-
 
-
 
883
		}
867
 
884
 
-
 
885
		LOGGER.info("map" + brandMonthValueMap);
-
 
886
		Map<String, List<Double>> brandlistValue = new HashMap<>();
868
		List<String> labelList = new ArrayList<>(labels);
887
		List<String> brands = new ArrayList<>();
-
 
888
		for (String bwr : brandMonthValueMap.keys()) {
-
 
889
			if (!brands.contains(bwr)) {
-
 
890
				brands.add(bwr);
869
 
891
 
-
 
892
			}
-
 
893
		}
870
		List<Double> mtdActivatedImeisValues = new ArrayList<>();
894
		LOGGER.info("brands" + brands);
871
 
895
 
872
		List<Double> mtdValues = new ArrayList<>();
-
 
873
		List<Double> lmtdUnActivatedImeisValues = new ArrayList<>();
-
 
874
		List<Double> lmtdActivatedImeisValues = new ArrayList<>();
-
 
875
		List<Double> mtdUnActivatedImeisValues = new ArrayList<>();
-
 
876
		List<Double> lmtdValues = new ArrayList<>();
-
 
877
		for (String label : labelList) {
896
		for (String brand : brands) {
878
			mtdActivatedImeisValues.add(activatedImeisWithSellingPriceMTD.get(label) == null ? 0
-
 
879
					: activatedImeisWithSellingPriceMTD.get(label));
-
 
880
			lmtdActivatedImeisValues.add(activatedImeisWithSellingPriceLMTD.get(label) == null ? 0
-
 
881
					: activatedImeisWithSellingPriceLMTD.get(label));
-
 
882
 
-
 
883
			mtdValues.add(brandwisesale.get(label) == null ? 0 : brandwisesale.get(label));
897
			Collection<Map<YearMonth, Double>> coll = brandMonthValueMap.get(brand);
884
			if (brandwisesale.get(label) != null) {
-
 
885
				mtdUnActivatedImeisValues
-
 
886
						.add(brandwisesale.get(label) - (activatedImeisWithSellingPriceMTD.get(label) == null ? 0
-
 
887
								: activatedImeisWithSellingPriceMTD.get(label)));
-
 
888
			} else {
-
 
889
				mtdUnActivatedImeisValues.add(0.0);
-
 
890
			}
-
 
891
			if (lmtdBrandWiseSale.get(label) != null) {
-
 
892
				lmtdUnActivatedImeisValues
-
 
893
						.add(lmtdBrandWiseSale.get(label) - (activatedImeisWithSellingPriceLMTD.get(label) == null ? 0
-
 
894
								: activatedImeisWithSellingPriceLMTD.get(label)));
-
 
895
			} else {
-
 
896
				lmtdUnActivatedImeisValues.add(0.0);
-
 
897
			}
-
 
898
 
-
 
899
			lmtdValues.add(lmtdBrandWiseSale.get(label) == null ? 0 : lmtdBrandWiseSale.get(label));
-
 
900
		}
-
 
901
		DatasetModel dsmtotal = new DatasetModel();
-
 
902
		dsmtotal.setLabel("MTD");
-
 
903
		dsmtotal.setBackgroundColor("blue");
-
 
904
		dsmtotal.setData(mtdValues);
-
 
905
		dsmtotal.setStack("stack0");
-
 
906
		dsmtotal.setOrder(1);
-
 
907
 
-
 
908
		DatasetModel dsmUnactivated = new DatasetModel();
-
 
909
		dsmUnactivated.setLabel("MTD Unactivated");
-
 
910
		dsmUnactivated.setBackgroundColor("red");
-
 
911
		dsmUnactivated.setData(mtdUnActivatedImeisValues);
-
 
912
		dsmUnactivated.setStack("stack0");
-
 
913
		dsmUnactivated.setOrder(1);
-
 
914
 
-
 
915
		LOGGER.info("mtdValuesMoney" + mtdValues);
898
			LOGGER.info("coll" + coll);
916
 
-
 
917
		DatasetModel mtdActivatedImeis = new DatasetModel();
-
 
918
		mtdActivatedImeis.setLabel("MTD Activation");
-
 
919
		mtdActivatedImeis.setData(mtdActivatedImeisValues);
-
 
920
		mtdActivatedImeis.setBackgroundColor("#00008b");
-
 
921
		mtdActivatedImeis.setStack("stack0");
-
 
922
		mtdActivatedImeis.setOrder(1);
-
 
923
 
-
 
924
		DatasetModel lmtddsmtotal = new DatasetModel();
-
 
925
		lmtddsmtotal.setLabel("LMTD");
-
 
926
		lmtddsmtotal.setBackgroundColor("blue");
-
 
927
		lmtddsmtotal.setData(lmtdValues);
-
 
928
		lmtddsmtotal.setStack("stack1");
-
 
929
		lmtddsmtotal.setOrder(1);
-
 
930
 
899
 
931
		DatasetModel lmtdUnActivated = new DatasetModel();
900
			List<Double> valueList = new ArrayList<>();
932
		lmtdUnActivated.setLabel("LMTD Unactivation");
-
 
933
		lmtdUnActivated.setBackgroundColor("red");
-
 
934
		lmtdUnActivated.setData(lmtdUnActivatedImeisValues);
-
 
935
		lmtdUnActivated.setStack("stack1");
-
 
936
		lmtdUnActivated.setOrder(1);
-
 
937
 
-
 
938
		DatasetModel LmtdActivatedImeis = new DatasetModel();
-
 
939
		LmtdActivatedImeis.setLabel("LMTD Activation");
-
 
940
		LmtdActivatedImeis.setBackgroundColor("#87ceeb");
-
 
941
		LmtdActivatedImeis.setData(lmtdActivatedImeisValues);
-
 
942
		LmtdActivatedImeis.setStack("stack1");
-
 
943
		LmtdActivatedImeis.setOrder(1);
-
 
944
 
-
 
945
		DatasetModel linemtdChart = new DatasetModel();
901
			for (Map<YearMonth, Double> col : coll) {
946
		linemtdChart.setLabel("MTD");
-
 
947
		linemtdChart.setBackgroundColor("#006400");
-
 
948
 
902
 
949
		linemtdChart.setData(mtdValues);
903
				valueList.addAll(col.values());
950
		linemtdChart.setType("line");
-
 
951
		linemtdChart.setOrder(2);
-
 
952
		linemtdChart.setFill("false");
-
 
953
 
904
			}
954
		DatasetModel lineLmtdChart = new DatasetModel();
-
 
955
		lineLmtdChart.setLabel("LMTD");
-
 
956
		lineLmtdChart.setBackgroundColor("hotpink");
-
 
957
		lineLmtdChart.setData(lmtdValues);
-
 
958
		lineLmtdChart.setType("line");
-
 
959
		lineLmtdChart.setOrder(3);
-
 
960
		lineLmtdChart.setFill("false");
-
 
961
 
905
 
-
 
906
			brandlistValue.put(brand, valueList);
-
 
907
 
-
 
908
		}
-
 
909
 
-
 
910
		LOGGER.info("brandlistValue" + brandlistValue);
-
 
911
		LinkedHashSet<String> labels = new LinkedHashSet<String>();
-
 
912
		for (Entry<YearMonth, Map<String, Double>> val : sortedMonthValueMap.entrySet()) {
-
 
913
			labels.add(val.getKey().format(DateTimeFormatter.ofPattern("MMM''uu")).toString());
-
 
914
			
-
 
915
			
-
 
916
			
-
 
917
		
-
 
918
		}
-
 
919
 
-
 
920
		List<String> labelList = new ArrayList<>(labels);
-
 
921
		List<Double> lmsValues = new ArrayList<>();
962
		List<DatasetModel> datasets = new ArrayList<>();
922
		List<DatasetModel> datasets = new ArrayList<>();
-
 
923
 
-
 
924
		List<String> colorList = new ArrayList<>();
-
 
925
 
963
		datasets.add(mtdActivatedImeis);
926
		colorList.add("darkorange");
-
 
927
		colorList.add("#654321");
964
		datasets.add(dsmUnactivated);
928
		colorList.add("deeppink");
965
		datasets.add(LmtdActivatedImeis);
929
		colorList.add("darkgreen");
966
		datasets.add(lmtdUnActivated);
930
		colorList.add("darkred");
967
		datasets.add(linemtdChart);
931
		colorList.add("slateblue");
-
 
932
	
-
 
933
		List<String> borderList = new ArrayList<>();
-
 
934
 
-
 
935
		borderList.add("orange");
-
 
936
		borderList.add("#DB8C44");
-
 
937
		borderList.add("pink");
-
 
938
		borderList.add("green");
-
 
939
		borderList.add("red");
-
 
940
		borderList.add("lightskyblue");
-
 
941
 
-
 
942
		int i= 0;
-
 
943
	
-
 
944
		for (Entry<String, List<Double>> brandValue : brandlistValue.entrySet()) {
-
 
945
 
-
 
946
			DatasetModel lineLmsChart = new DatasetModel();
-
 
947
			lineLmsChart.setLabel(brandValue.getKey());
-
 
948
			lineLmsChart.setBackgroundColor(borderList.get(i));
-
 
949
			lineLmsChart.setData(brandValue.getValue());
-
 
950
			lineLmsChart.setType("line");
-
 
951
			lineLmsChart.setOrder(1);
-
 
952
			lineLmsChart.setFill("false");
-
 
953
			lineLmsChart.setBorderColor(colorList.get(i));
968
		datasets.add(lineLmtdChart);
954
			datasets.add(lineLmsChart);
-
 
955
		
-
 
956
			i++;
-
 
957
		}
969
 
958
 
970
		DataModel dm = new DataModel();
959
		DataModel dm = new DataModel();
971
		dm.setDatasets(datasets);
960
		dm.setDatasets(datasets);
972
		dm.setLabels(labels);
961
		dm.setLabels(labels);
973
 
962
 
974
		LegendModel lm = new LegendModel();
963
		LegendModel lm = new LegendModel();
975
		lm.setPosition("top");
964
		lm.setPosition("top");
976
 
965
 
977
		TitleModel tm = new TitleModel();
966
		TitleModel tm = new TitleModel();
978
		tm.setText("Brand Wise Sales");
967
		tm.setText("Brand Wise LMS");
979
		tm.setDisplay(true);
968
		tm.setDisplay(true);
980
 
969
 
981
		List<Axis> xAxes = new ArrayList<>();
-
 
982
		Axis xAxis = new Axis();
-
 
983
		xAxis.setStacked(true);
-
 
984
		xAxes.add(xAxis);
-
 
985
 
-
 
986
		List<Axis> yAxes = new ArrayList<>();
-
 
987
		Axis yAxis = new Axis();
-
 
988
		yAxis.setStacked(false);
-
 
989
		yAxes.add(yAxis);
-
 
990
 
-
 
991
		ScalesModel sm = new ScalesModel();
-
 
992
		sm.setxAxes(xAxes);
-
 
993
 
-
 
994
		OptionsModel om = new OptionsModel();
970
		OptionsModel om = new OptionsModel();
-
 
971
		om.setResponsive(true);
995
		om.setLegend(lm);
972
		om.setLegend(lm);
996
		om.setTitle(tm);
973
		om.setTitle(tm);
997
		om.setScales(sm);
-
 
998
 
974
 
-
 
975
		ChartModel cm = new ChartModel();
999
		cm.setType("bar");
976
		cm.setType("line");
1000
		cm.setData(dm);
977
		cm.setData(dm);
1001
		cm.setOptions(om);
978
		cm.setOptions(om);
1002
 
979
 
1003
		LOGGER.info("cm" + cm);
980
		LOGGER.info("cm" + cm);
1004
 
981
 
1005
		return cm;
982
		return cm;
1006
 
983
 
1007
	}
984
	}
1008
 
985
 
-
 
986
	private ChartModel getBrandChart(int fofoId) {
-
 
987
 
-
 
988
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
-
 
989
 
-
 
990
		LOGGER.info("cur Date" + curDate.withDayOfMonth(1));
-
 
991
 
-
 
992
		LOGGER.info("curDateYear" + curDate.with(LocalTime.MAX));
-
 
993
 
-
 
994
		Map<String, Double> brandwisesale = fofoOrderItemRepository
-
 
995
		.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
-
 
996
 
-
 
997
		LOGGER.info("brandwisesale" + brandwisesale);
-
 
998
 
-
 
999
		Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
-
 
1000
		fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
-
 
1001
		brandwisesale.put("Accessories", accesoriesmtdsale.get(fofoId));
-
 
1002
 
-
 
1003
		Map<String, Double> activatedImeisWithSellingPriceMTD = fofoOrderRepository
-
 
1004
		.selectValueOfActivatedImeis(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId).stream()
-
 
1005
		.collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
-
 
1006
 
-
 
1007
		activatedImeisWithSellingPriceMTD.put("Lava", brandwisesale.get("Lava"));
-
 
1008
 
-
 
1009
		Map<String, Double> activatedImeisWithSellingPriceLMTD = fofoOrderRepository
-
 
1010
		.selectValueOfActivatedImeis(curDate.withDayOfMonth(1).minusMonths(1),
-
 
1011
		curDate.with(LocalTime.MAX).minusMonths(1), fofoId)
-
 
1012
		.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
-
 
1013
		Map<String, Double> lmtdBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
-
 
1014
		curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
-
 
1015
		activatedImeisWithSellingPriceLMTD.put("Lava", lmtdBrandWiseSale.get("Lava"));
-
 
1016
 
-
 
1017
		Map<Integer, Double> accesorieslmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
-
 
1018
		fofoId, curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1),
-
 
1019
		Optional.of(false));
-
 
1020
 
-
 
1021
		lmtdBrandWiseSale.put("Accessories", accesorieslmtdsale.get(fofoId));
-
 
1022
 
-
 
1023
		ChartModel cm = new ChartModel();
-
 
1024
 
-
 
1025
		 HashSet<String> labels = new HashSet<String>();
-
 
1026
		 labels.addAll(brandwisesale.keySet());
-
 
1027
		 labels.addAll(lmtdBrandWiseSale.keySet());
-
 
1028
 
-
 
1029
		 List<String> labelList = new ArrayList<>(labels);
-
 
1030
 
-
 
1031
		 List<Double> mtdActivatedImeisValues = new ArrayList<>();
-
 
1032
 
-
 
1033
		 List<Double> mtdValues = new ArrayList<>();
-
 
1034
		 List<Double> lmtdUnActivatedImeisValues = new ArrayList<>();
-
 
1035
		 List<Double> lmtdActivatedImeisValues = new ArrayList<>();
-
 
1036
		 List<Double> mtdUnActivatedImeisValues = new ArrayList<>();
-
 
1037
		 List<Double> lmtdValues = new ArrayList<>();
-
 
1038
		 for (String label : labelList) {
-
 
1039
		 mtdActivatedImeisValues.add(activatedImeisWithSellingPriceMTD.get(label) == null ? 0
-
 
1040
		 : activatedImeisWithSellingPriceMTD.get(label));
-
 
1041
		 lmtdActivatedImeisValues.add(activatedImeisWithSellingPriceLMTD.get(label) == null ? 0
-
 
1042
		 : activatedImeisWithSellingPriceLMTD.get(label));
-
 
1043
 
-
 
1044
		 mtdValues.add(brandwisesale.get(label) == null ? 0 : brandwisesale.get(label));
-
 
1045
		 if (brandwisesale.get(label) != null) {
-
 
1046
		 mtdUnActivatedImeisValues
-
 
1047
		 .add(brandwisesale.get(label) - (activatedImeisWithSellingPriceMTD.get(label) == null ? 0
-
 
1048
		 : activatedImeisWithSellingPriceMTD.get(label)));
-
 
1049
		 } else {
-
 
1050
		 mtdUnActivatedImeisValues.add(0.0);
-
 
1051
		 }
-
 
1052
		 if (lmtdBrandWiseSale.get(label) != null) {
-
 
1053
		 lmtdUnActivatedImeisValues
-
 
1054
		 .add(lmtdBrandWiseSale.get(label) - (activatedImeisWithSellingPriceLMTD.get(label) == null ? 0
-
 
1055
		 : activatedImeisWithSellingPriceLMTD.get(label)));
-
 
1056
		 } else {
-
 
1057
		 lmtdUnActivatedImeisValues.add(0.0);
-
 
1058
		 }
-
 
1059
 
-
 
1060
		 lmtdValues.add(lmtdBrandWiseSale.get(label) == null ? 0 : lmtdBrandWiseSale.get(label));
-
 
1061
		 }
-
 
1062
		 DatasetModel dsmtotal = new DatasetModel();
-
 
1063
		 dsmtotal.setLabel("MTD");
-
 
1064
		 dsmtotal.setBackgroundColor("blue");
-
 
1065
		 dsmtotal.setBorderColor("blue");
-
 
1066
		 dsmtotal.setData(mtdValues);
-
 
1067
		 dsmtotal.setStack("stack0");
-
 
1068
		 dsmtotal.setOrder(1);
-
 
1069
 
-
 
1070
		 DatasetModel dsmUnactivated = new DatasetModel();
-
 
1071
		 dsmUnactivated.setLabel("MTD Unactivated");
-
 
1072
		 dsmUnactivated.setBackgroundColor("red");
-
 
1073
		 dsmUnactivated.setBorderColor("red");
-
 
1074
		 dsmUnactivated.setData(mtdUnActivatedImeisValues);
-
 
1075
		 dsmUnactivated.setStack("stack0");
-
 
1076
		 dsmUnactivated.setOrder(1);
-
 
1077
 
-
 
1078
		 LOGGER.info("mtdValuesMoney" + mtdValues);
-
 
1079
 
-
 
1080
		 DatasetModel mtdActivatedImeis = new DatasetModel();
-
 
1081
		 mtdActivatedImeis.setLabel("MTD Activation");
-
 
1082
		 mtdActivatedImeis.setBorderColor("#00008b");
-
 
1083
		 mtdActivatedImeis.setData(mtdActivatedImeisValues);
-
 
1084
		 mtdActivatedImeis.setBackgroundColor("#00008b");
-
 
1085
		 mtdActivatedImeis.setStack("stack0");
-
 
1086
		 mtdActivatedImeis.setOrder(1);
-
 
1087
 
-
 
1088
		 DatasetModel lmtddsmtotal = new DatasetModel();
-
 
1089
		 lmtddsmtotal.setLabel("LMTD");
-
 
1090
		 lmtddsmtotal.setBackgroundColor("blue");
-
 
1091
		 lmtddsmtotal.setData(lmtdValues);
-
 
1092
		 lmtddsmtotal.setBorderColor("blue");
-
 
1093
		 lmtddsmtotal.setStack("stack1");
-
 
1094
		 lmtddsmtotal.setOrder(1);
-
 
1095
 
-
 
1096
		 DatasetModel lmtdUnActivated = new DatasetModel();
-
 
1097
		 lmtdUnActivated.setLabel("LMTD Unactivation");
-
 
1098
		 lmtdUnActivated.setBackgroundColor("red");
-
 
1099
		 lmtdUnActivated.setBorderColor("red");
-
 
1100
		 lmtdUnActivated.setData(lmtdUnActivatedImeisValues);
-
 
1101
		 lmtdUnActivated.setStack("stack1");
-
 
1102
		 lmtdUnActivated.setOrder(1);
-
 
1103
 
-
 
1104
		 DatasetModel LmtdActivatedImeis = new DatasetModel();
-
 
1105
		 LmtdActivatedImeis.setLabel("LMTD Activation");
-
 
1106
		 LmtdActivatedImeis.setBackgroundColor("#87ceeb");
-
 
1107
		 LmtdActivatedImeis.setBorderColor("#87ceeb");
-
 
1108
		 LmtdActivatedImeis.setData(lmtdActivatedImeisValues);
-
 
1109
		 LmtdActivatedImeis.setStack("stack1");
-
 
1110
		 LmtdActivatedImeis.setOrder(1);
-
 
1111
 
-
 
1112
		 DatasetModel linemtdChart = new DatasetModel();
-
 
1113
		 linemtdChart.setLabel("MTD");
-
 
1114
		 linemtdChart.setBackgroundColor("#006400");
-
 
1115
		 linemtdChart.setBorderColor("#006400");
-
 
1116
		 linemtdChart.setData(mtdValues);
-
 
1117
		 linemtdChart.setType("line");
-
 
1118
		 linemtdChart.setOrder(2);
-
 
1119
		 linemtdChart.setFill("false");
-
 
1120
 
-
 
1121
		 DatasetModel lineLmtdChart = new DatasetModel();
-
 
1122
		 lineLmtdChart.setLabel("LMTD");
-
 
1123
		 lineLmtdChart.setBackgroundColor("hotpink");
-
 
1124
		 lineLmtdChart.setBorderColor("hotpink");
-
 
1125
		 lineLmtdChart.setData(lmtdValues);
-
 
1126
		 lineLmtdChart.setType("line");
-
 
1127
		 lineLmtdChart.setOrder(3);
-
 
1128
		 lineLmtdChart.setFill("false");
-
 
1129
 
-
 
1130
		 List<DatasetModel> datasets = new ArrayList<>();
-
 
1131
		 datasets.add(mtdActivatedImeis);
-
 
1132
		 datasets.add(dsmUnactivated);
-
 
1133
		 datasets.add(LmtdActivatedImeis);
-
 
1134
		 datasets.add(lmtdUnActivated);
-
 
1135
		 datasets.add(linemtdChart);
-
 
1136
		 datasets.add(lineLmtdChart);
-
 
1137
 
-
 
1138
		 DataModel dm = new DataModel();
-
 
1139
		 dm.setDatasets(datasets);
-
 
1140
		 dm.setLabels(labels);
-
 
1141
 
-
 
1142
		 LegendModel lm = new LegendModel();
-
 
1143
		 lm.setPosition("top");
-
 
1144
 
-
 
1145
		 TitleModel tm = new TitleModel();
-
 
1146
		 tm.setText("Brand Wise Sales");
-
 
1147
		 tm.setDisplay(true);
-
 
1148
 
-
 
1149
		 List<Axis> xAxes = new ArrayList<>();
-
 
1150
		 Axis xAxis = new Axis();
-
 
1151
		 xAxis.setStacked(true);
-
 
1152
		 xAxes.add(xAxis);
-
 
1153
 
-
 
1154
		 List<Axis> yAxes = new ArrayList<>();
-
 
1155
		 Axis yAxis = new Axis();
-
 
1156
		 yAxis.setStacked(false);
-
 
1157
		 yAxes.add(yAxis);
-
 
1158
 
-
 
1159
		 ScalesModel sm = new ScalesModel();
-
 
1160
		 sm.setxAxes(xAxes);
-
 
1161
 
-
 
1162
		 OptionsModel om = new OptionsModel();
-
 
1163
		 om.setLegend(lm);
-
 
1164
		 om.setTitle(tm);
-
 
1165
		 om.setScales(sm);
-
 
1166
 
-
 
1167
		 cm.setType("bar");
-
 
1168
		 cm.setData(dm);
-
 
1169
		 cm.setOptions(om);
-
 
1170
 
-
 
1171
		 LOGGER.info("cm" + cm);
-
 
1172
 
-
 
1173
		 return cm;
-
 
1174
 
-
 
1175
		 }
-
 
1176
 
-
 
1177
 
1009
	private String adminPanel(int fofoId, String email, Model model) throws Exception {
1178
	private String adminPanel(int fofoId, String email, Model model) throws Exception {
1010
		List<Menu> menus = null;
1179
		List<Menu> menus = null;
1011
		try {
1180
		try {
1012
			AuthUser authUser = authRepository.selectByEmailOrMobile(email);
1181
			AuthUser authUser = authRepository.selectByEmailOrMobile(email);
1013
			List<Position> positions = positionRepository.selectAll(authUser.getId());
1182
			List<Position> positions = positionRepository.selectAll(authUser.getId());