Subversion Repositories SmartDukaan

Rev

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

Rev 26458 Rev 26460
Line 25... Line 25...
25
import org.apache.logging.log4j.LogManager;
25
import org.apache.logging.log4j.LogManager;
26
import org.apache.logging.log4j.Logger;
26
import org.apache.logging.log4j.Logger;
27
import org.json.JSONObject;
27
import org.json.JSONObject;
28
import org.springframework.beans.factory.annotation.Autowired;
28
import org.springframework.beans.factory.annotation.Autowired;
29
import org.springframework.beans.factory.annotation.Value;
29
import org.springframework.beans.factory.annotation.Value;
30
import org.springframework.cglib.core.Local;
-
 
31
import org.springframework.core.io.InputStreamResource;
30
import org.springframework.core.io.InputStreamResource;
32
import org.springframework.http.HttpHeaders;
31
import org.springframework.http.HttpHeaders;
33
import org.springframework.http.HttpStatus;
32
import org.springframework.http.HttpStatus;
34
import org.springframework.http.ResponseEntity;
33
import org.springframework.http.ResponseEntity;
35
import org.springframework.stereotype.Controller;
34
import org.springframework.stereotype.Controller;
Line 93... Line 92...
93
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
92
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
94
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
93
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
95
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
94
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
96
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
95
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
97
import com.spice.profitmandi.service.PartnerInvestmentService;
96
import com.spice.profitmandi.service.PartnerInvestmentService;
-
 
97
import com.spice.profitmandi.service.PartnerStatsService;
98
import com.spice.profitmandi.service.authentication.RoleManager;
98
import com.spice.profitmandi.service.authentication.RoleManager;
99
import com.spice.profitmandi.service.inventory.InventoryService;
99
import com.spice.profitmandi.service.inventory.InventoryService;
100
import com.spice.profitmandi.service.user.RetailerService;
100
import com.spice.profitmandi.service.user.RetailerService;
101
import com.spice.profitmandi.web.model.LoginDetails;
101
import com.spice.profitmandi.web.model.LoginDetails;
102
import com.spice.profitmandi.web.util.CookiesProcessor;
102
import com.spice.profitmandi.web.util.CookiesProcessor;
103
 
103
 
104
@Controller
104
@Controller
105
@Transactional(rollbackOn = Throwable.class)
105
@Transactional(rollbackOn = Throwable.class)
106
public class DashboardController {
106
public class DashboardController {
107
	
107
 
108
	private static final double ONE_LAC = 1*1000*100;
108
	private static final double ONE_LAC = 1 * 1000 * 100;
109
	private static final double TWO_LAC = 2*1000*100;
109
	private static final double TWO_LAC = 2 * 1000 * 100;
110
	private static final double FOUR_LAC = 4*1000*100;
110
	private static final double FOUR_LAC = 4 * 1000 * 100;
111
 
111
 
112
	@Value("${web.api.host}")
112
	@Value("${web.api.host}")
113
	private String webApiHost;
113
	private String webApiHost;
114
 
114
 
115
	@Value("${web.api.scheme}")
115
	@Value("${web.api.scheme}")
Line 121... Line 121...
121
	@Value("${web.api.port}")
121
	@Value("${web.api.port}")
122
	private int webApiPort;
122
	private int webApiPort;
123
 
123
 
124
	@Autowired
124
	@Autowired
125
	private CookiesProcessor cookiesProcessor;
125
	private CookiesProcessor cookiesProcessor;
-
 
126
	
-
 
127
	@Autowired
-
 
128
	private PartnerStatsService partnerStatsService;
126
 
129
 
127
	@Autowired
130
	@Autowired
128
	private MenuRepository menuRepository;
131
	private MenuRepository menuRepository;
129
 
132
 
130
	@Autowired
133
	@Autowired
Line 271... Line 274...
271
				currentMonthEnd);
274
				currentMonthEnd);
272
		if (hygieneCount == 0 && invalidHygieneCount == 0) {
275
		if (hygieneCount == 0 && invalidHygieneCount == 0) {
273
			invalidHygieneCount = 1;
276
			invalidHygieneCount = 1;
274
		}
277
		}
275
		model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
278
		model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
276
		
279
 
277
		model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
280
		model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
278
		model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
281
		model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
279
		return "12dashboard34";
282
		return "12dashboard34";
280
	}
283
	}
281
 
284
 
Line 316... Line 319...
316
				.get(fofoId);
319
				.get(fofoId);
317
		Double lmtdSale = fofoOrderItemRepository
320
		Double lmtdSale = fofoOrderItemRepository
318
				.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1).minusMonths(1),
321
				.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1).minusMonths(1),
319
						curDate.with(LocalTime.MAX).minusMonths(1), fofoId, false)
322
						curDate.with(LocalTime.MAX).minusMonths(1), fofoId, false)
320
				.get(fofoId);
323
				.get(fofoId);
321
		
-
 
322
 
324
 
323
		List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
325
		List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
324
				.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
326
				.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
325
		if (partnerTargetDetails.isEmpty()) {
327
		if (partnerTargetDetails.isEmpty()) {
326
			partnerTargetDetails = partnerTargetRepository
328
			partnerTargetDetails = partnerTargetRepository
Line 396... Line 398...
396
				model.addAttribute("partnerType", partnerType);
398
				model.addAttribute("partnerType", partnerType);
397
				model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
399
				model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
398
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
400
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
399
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
401
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
400
						.append("partnerId", fofoStore.getId()).toString());
402
						.append("partnerId", fofoStore.getId()).toString());
-
 
403
				model.addAttribute("activatedImeis",
401
				model.addAttribute("activatedImeis", inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
404
						inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
402
				LocalDateTime curDate = LocalDate.now().atStartOfDay();
405
				LocalDateTime curDate = LocalDate.now().atStartOfDay();
403
				Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
406
				Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
404
						.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
407
						.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
405
								curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
408
								curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
406
				LOGGER.info("accesoriesmtdsale" + accesoriesmtdsale);
409
				LOGGER.info("accesoriesmtdsale" + accesoriesmtdsale);
Line 419... Line 422...
419
				// this.setInvestments
422
				// this.setInvestments
420
				//
423
				//
421
				model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
424
				model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
422
				model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
425
				model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
423
						10, ProfitMandiConstants.CUTOFF_INVESTMENT));
426
						10, ProfitMandiConstants.CUTOFF_INVESTMENT));
424
				
427
 
425
				//Hardcoded for valentine
428
				// Hardcoded for valentine
426
				//Hardcoded for valentine
429
				// Hardcoded for valentine
427
				if(LocalDate.now().isBefore(LocalDate.of(2020, 3, 11))) {
430
				if (LocalDate.now().isBefore(LocalDate.of(2020, 3, 11))) {
-
 
431
					double valentineSales = fofoOrderItemRepository
428
					double valentineSales = fofoOrderItemRepository.selectSumAmountGroupByRetailer(LocalDate.of(2020, 3, 6).atStartOfDay(), 
432
							.selectSumAmountGroupByRetailer(LocalDate.of(2020, 3, 6).atStartOfDay(),
429
							LocalDate.of(2020, 3, 10).atStartOfDay(), loginDetails.getFofoId(), false).get(loginDetails.getFofoId());
433
									LocalDate.of(2020, 3, 10).atStartOfDay(), loginDetails.getFofoId(), false)
-
 
434
							.get(loginDetails.getFofoId());
430
					if(valentineSales < ONE_LAC) {
435
					if (valentineSales < ONE_LAC) {
431
						model.addAttribute("valentineSale", "ONE_LAC");
436
						model.addAttribute("valentineSale", "ONE_LAC");
432
						model.addAttribute("valentineShort", ONE_LAC - valentineSales);
437
						model.addAttribute("valentineShort", ONE_LAC - valentineSales);
433
					} else if(valentineSales < TWO_LAC) {
438
					} else if (valentineSales < TWO_LAC) {
434
						model.addAttribute("valentineSale", "TWO_LAC");
439
						model.addAttribute("valentineSale", "TWO_LAC");
435
						model.addAttribute("valentineShort", TWO_LAC - valentineSales);
440
						model.addAttribute("valentineShort", TWO_LAC - valentineSales);
436
					} else if (valentineSales < FOUR_LAC) {
441
					} else if (valentineSales < FOUR_LAC) {
437
						model.addAttribute("valentineSale", "FOUR_LAC");
442
						model.addAttribute("valentineSale", "FOUR_LAC");
438
						model.addAttribute("valentineShort", FOUR_LAC - valentineSales);
443
						model.addAttribute("valentineShort", FOUR_LAC - valentineSales);
Line 565... Line 570...
565
		List<Menu> menus = null;
570
		List<Menu> menus = null;
566
		try {
571
		try {
567
			AuthUser authUser = authRepository.selectByEmailOrMobile(email);
572
			AuthUser authUser = authRepository.selectByEmailOrMobile(email);
568
			List<Position> positions = positionRepository.selectAll(authUser.getId());
573
			List<Position> positions = positionRepository.selectAll(authUser.getId());
569
			Map<Integer, AuthUser> authIdAndAuthUserMap = null;
574
			Map<Integer, AuthUser> authIdAndAuthUserMap = null;
570
			Map<Integer, Object> authIdAndallValues = null;
575
			Map<Integer, PartnerDetailModel> authIdAndallValues = null;
571
			if (positions.size() > 0) {
576
			if (positions.size() > 0) {
572
				if (positions.stream().filter(x -> x.getEscalationType().equals(EscalationType.L3)).count() > 0) {
577
				if (positions.stream().filter(x -> x.getEscalationType().equals(EscalationType.L3)).count() > 0) {
573
 
578
 
574
					authIdAndAuthUserMap = authRepository.selectAllActiveUser().stream()
579
					authIdAndAuthUserMap = authRepository.selectAllActiveUser().stream()
575
							.collect(Collectors.toMap(x -> x.getId(), x -> x));
580
							.collect(Collectors.toMap(x -> x.getId(), x -> x));
576
 
581
 
577
					authIdAndallValues = this.getL2AuthUserPartnerDetail();
582
					authIdAndallValues = this.getL2AuthUserPartnerDetail();
578
 
-
 
579
					LOGGER.info("authIdAndallValues" + authIdAndallValues);
-
 
580
				}
583
				}
581
			}
584
			}
582
 
585
 
583
			if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in").contains(email)) {
586
			if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in").contains(email)) {
584
				menus = menuRepository.selectAll();
587
				menus = menuRepository.selectAll();
Line 630... Line 633...
630
		LOGGER.info("menu" + menuList);
633
		LOGGER.info("menu" + menuList);
631
		model.addAttribute("menu", menuList);
634
		model.addAttribute("menu", menuList);
632
		return "admin";
635
		return "admin";
633
	}
636
	}
634
 
637
 
635
	@RequestMapping(value = "/getL1AuthUser", method = RequestMethod.GET)
638
/*	@RequestMapping(value = "/getL1AuthUser", method = RequestMethod.GET)
636
	public String L1AuthUsersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
639
	public String L1AuthUsersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
637
			throws Exception {
640
			throws Exception {
638
 
641
 
639
		Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
642
		Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
640
 
643
 
Line 667... Line 670...
667
 
670
 
668
			authIdAndAuthUserMap.put(l1AuthId, authUser);
671
			authIdAndAuthUserMap.put(l1AuthId, authUser);
669
 
672
 
670
			List<Integer> fofoIds = pp.get(l1AuthId);
673
			List<Integer> fofoIds = pp.get(l1AuthId);
671
 
674
 
672
			Map<Integer, PartnerDailyInvestment> partnerInvestentMap = partnerInvestmentService.getInvestment(fofoIds, 0).stream()
675
			Map<Integer, PartnerDailyInvestment> partnerInvestentMap = partnerInvestmentService
673
					.collect(Collectors.toMap(x->x.getFofoId(), x->x));
676
					.getInvestment(fofoIds, 0).stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
674
			
677
 
675
			for (Integer fId : fofoIds) {
678
			for (Integer fId : fofoIds) {
676
				try {
679
				try {
677
					PartnerDailyInvestment investment = partnerInvestentMap.get(fId);
680
					PartnerDailyInvestment investment = partnerInvestentMap.get(fId);
678
					totalTodayInvestment += investment.getTotalInvestment();
681
					totalTodayInvestment += investment.getTotalInvestment();
679
					totalStockInInvestment += investment.getInStockAmount();
682
					totalStockInInvestment += investment.getInStockAmount();
680
				} catch(Exception e) {
683
				} catch (Exception e) {
681
				}
684
				}
682
 
685
 
683
				double currentMonthRating = hygieneDataRepository.selectRatingAvg(fId,
686
				double currentMonthRating = hygieneDataRepository.selectRatingAvg(fId,
684
						curDate.withDayOfMonth(1).minusMonths(1), curDate.plusMonths(1).withDayOfMonth(1));
687
						curDate.withDayOfMonth(1).minusMonths(1), curDate.plusMonths(1).withDayOfMonth(1));
685
 
688
 
Line 728... Line 731...
728
		model.addAttribute("authIdAndallValues", authIdAndallValues);
731
		model.addAttribute("authIdAndallValues", authIdAndallValues);
729
		model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
732
		model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
730
		LOGGER.info("authIdAndallValues" + authIdAndallValues);
733
		LOGGER.info("authIdAndallValues" + authIdAndallValues);
731
 
734
 
732
		return "auth_user_detail";
735
		return "auth_user_detail";
733
	}
736
	}*/
734
 
737
 
735
	@RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
738
/*	@RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
736
	public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
739
	public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
737
			throws Exception {
740
			throws Exception {
738
 
741
 
739
		Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
742
		Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
740
		List<Integer> fofoIds = pp.get(authId);
743
		List<Integer> fofoIds = pp.get(authId);
Line 777... Line 780...
777
 
780
 
778
		model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
781
		model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
779
		model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
782
		model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
780
 
783
 
781
		return "auth_user_partner_detail";
784
		return "auth_user_partner_detail";
782
	}
785
	}*/
783
 
786
 
784
	private String getWarehouses(Set<CustomRetailer> positionRetailers) {
787
	private String getWarehouses(Set<CustomRetailer> positionRetailers) {
785
		Map<Integer, String> warehouses = new HashMap<>();
788
		Map<Integer, String> warehouses = new HashMap<>();
786
		positionRetailers.stream().forEach(x -> {
789
		positionRetailers.stream().forEach(x -> {
787
			if (x.getWarehouseId() != 0) {
790
			if (x.getWarehouseId() != 0) {
Line 980... Line 983...
980
		headers.set("Content-disposition", "inline; filename=" + document.getName());
983
		headers.set("Content-disposition", "inline; filename=" + document.getName());
981
		headers.setContentLength(document.getSize());
984
		headers.setContentLength(document.getSize());
982
		final InputStreamResource inputStreamResource = new InputStreamResource(file);
985
		final InputStreamResource inputStreamResource = new InputStreamResource(file);
983
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
986
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
984
	}
987
	}
985
	
-
 
986
	
988
 
987
	public Map<Integer, Object> getL2AuthUserPartnerDetail() throws Exception {
989
	public Map<Integer, PartnerDetailModel> getL2AuthUserPartnerDetail() throws Exception {
988
		List<Position> pos = positionRepository.selectPositionbyCategoryIdAndEscalationType(
990
		List<Position> pos = positionRepository.selectPositionbyCategoryIdAndEscalationType(
989
				ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2);
991
				ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2);
990
 
992
 
991
		LOGGER.info("getL2AuthUserPartnerDetail Started");
993
		LOGGER.info("getL2AuthUserPartnerDetail Started");
992
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
-
 
993
		Map<Integer, Double> lmtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(
-
 
994
				curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), 0, false);
-
 
995
		Map<Integer, Double> mtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(curDate.withDayOfMonth(1),
-
 
996
				curDate.with(LocalTime.MAX), 0, false);
-
 
997
 
994
 
998
		Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
995
		Map<Integer, List<Integer>> L2L1Mapping = csService.getL2L1Mapping();
999
		Map<Integer, Long> ticketMap = ticketRepository.selectAllNotClosedTicketsGroupByRetailer();
-
 
1000
		Map<Integer, Integer> authIdAndleadsCountMap = new HashMap<>();
996
		Map<Integer, Integer> authIdAndleadsCountMap = new HashMap<>();
1001
		Map<Integer, List<Integer>> L2L1Mapping = csService.getL1L2Mapping();
-
 
1002
 
-
 
1003
		for (Entry<Integer, List<Integer>> l2l1 : L2L1Mapping.entrySet()) {
997
		for (Entry<Integer, List<Integer>> l2l1 : L2L1Mapping.entrySet()) {
1004
			List<Integer> authIds = l2l1.getValue();
998
			List<Integer> authIds = l2l1.getValue();
1005
			authIds.add(l2l1.getKey());
999
			authIds.add(l2l1.getKey());
1006
 
1000
 
1007
			List<Lead> leads = leadRepository.selectByAssignAuthIdsAndStatus(authIds, LeadStatus.followUp);
1001
			List<Lead> leads = leadRepository.selectByAssignAuthIdsAndStatus(authIds, LeadStatus.followUp);
Line 1012... Line 1006...
1012
			} else {
1006
			} else {
1013
				authIdAndleadsCountMap.put(auth.getId(), 0);
1007
				authIdAndleadsCountMap.put(auth.getId(), 0);
1014
			}
1008
			}
1015
		}
1009
		}
1016
		
1010
		
1017
		LOGGER.info("authIdAndleadsCountMap" + authIdAndleadsCountMap);
1011
		Map<Integer, PartnerDetailModel> partnerStats = partnerStatsService.getAllPartnerStats();
1018
 
1012
 
1019
		Map<Integer, Object> authIdAndallValues = new LinkedHashMap<>();
-
 
1020
 
-
 
1021
		for (Position po : pos) {
-
 
1022
 
-
 
1023
			double totallmtdAmount = 0;
-
 
1024
			double totalmtdAmount = 0;
-
 
1025
			int totalTicketCount = 0;
-
 
1026
			float totalTodayInvestment = 0;
-
 
1027
			float totalStockInInvestment = 0;
-
 
1028
			double currentMonthRatingAllPartners = 0;
-
 
1029
 
-
 
1030
			AuthUser auth = authRepository.selectById(po.getAuthUserId());
-
 
1031
			LOGGER.info("Auth User {}", auth);
-
 
1032
			List<Integer> fofoIds = pp.get(po.getAuthUserId());
-
 
1033
 
-
 
1034
			for (Integer fId : fofoIds) {
-
 
1035
				Map<String, Object> investmentMap = this.getInvestments(fId);
-
 
1036
 
-
 
1037
				double currentMonthRating = hygieneDataRepository.selectRatingAvg(fId,
-
 
1038
						curDate.withDayOfMonth(1).minusMonths(1), curDate.plusMonths(1).withDayOfMonth(1));
-
 
1039
 
-
 
1040
				currentMonthRatingAllPartners += currentMonthRating;
-
 
1041
 
-
 
1042
				fofoIds.size();
-
 
1043
 
-
 
1044
				Double lmtdAmount = lmtdSale.get(fId);
-
 
1045
				Double mtdAmount = mtdSale.get(fId);
-
 
1046
				Long ticketCount = ticketMap.get(fId);
-
 
1047
 
-
 
1048
				if (!investmentMap.isEmpty()) {
-
 
1049
					totalTodayInvestment += (float) investmentMap.get("today");
-
 
1050
					totalStockInInvestment += (float) investmentMap.get("inStock");
-
 
1051
 
-
 
1052
				}
-
 
1053
				LOGGER.info("totalTodayInvestment" + totalTodayInvestment);
1013
		LOGGER.info("authIdAndleadsCountMap" + authIdAndleadsCountMap);
1054
				LOGGER.info("totalStockInInvestment" + totalStockInInvestment);
-
 
1055
				if (ticketCount != null) {
-
 
1056
					totalTicketCount += ticketCount;
-
 
1057
				}
-
 
1058
 
-
 
1059
				if (lmtdAmount != null) {
-
 
1060
					totallmtdAmount += lmtdAmount;
-
 
1061
				}
-
 
1062
 
-
 
1063
				if (mtdAmount != null) {
-
 
1064
					totalmtdAmount += mtdAmount;
-
 
1065
				}
-
 
1066
 
-
 
1067
			}
-
 
1068
			LOGGER.info("currentMonthRatingAllPartners" + currentMonthRatingAllPartners);
-
 
1069
			LOGGER.info("size" + fofoIds.size());
-
 
1070
			double totalHygieneRating = currentMonthRatingAllPartners / fofoIds.size();
-
 
1071
 
1014
 
1072
			LOGGER.info("authIdAndleadsCountMap" + authIdAndleadsCountMap.get(po.getAuthUserId()));
1015
		Map<Integer, PartnerDetailModel> authIdAndallValues = new LinkedHashMap<>();
1073
 
1016
 
1074
			PartnerDetailModel pm = new PartnerDetailModel();
1017
		Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
1075
			pm.setLmtd(totallmtdAmount);
1018
		for (int authUserId : pp.keySet()) {
1076
			pm.setMtd(totalmtdAmount);
1019
			if (L2L1Mapping.keySet().contains(authUserId)) {
1077
			if(authIdAndleadsCountMap.get(po.getAuthUserId())!= null) {
1020
				List<Integer> fofoIds = pp.get(authUserId);
-
 
1021
				List<PartnerDetailModel> partnerDetails = fofoIds.stream().map(x->partnerStats.get(x)).collect(Collectors.toList());
-
 
1022
				PartnerDetailModel partnerDetailModel = partnerStatsService.getAggregateStats(partnerDetails);
1078
			pm.setLeads(authIdAndleadsCountMap.get(po.getAuthUserId()));
1023
				authIdAndallValues.put(authUserId, partnerDetailModel);
1079
			}
1024
			}
1080
			pm.setInvestment(totalTodayInvestment);
-
 
1081
			pm.setStockInInvestment(totalStockInInvestment);
-
 
1082
			pm.setTicket(totalTicketCount);
-
 
1083
			pm.setHygiene((double) Math.round(totalHygieneRating));
-
 
1084
			authIdAndallValues.put(auth.getId(), pm);
-
 
1085
 
-
 
1086
		}
1025
		}
-
 
1026
		PartnerDetailModel partnerDetailModel = partnerStatsService.getAggregateStats(new ArrayList<>(partnerStats.values()));
-
 
1027
		authIdAndallValues.put(0, partnerDetailModel);
1087
		return authIdAndallValues;
1028
		return authIdAndallValues;
1088
	}
1029
	}
1089
 
1030
 
1090
}
1031
}