Subversion Repositories SmartDukaan

Rev

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

Rev 28485 Rev 28641
Line 74... Line 74...
74
import com.spice.profitmandi.dao.model.InStockBrandModel;
74
import com.spice.profitmandi.dao.model.InStockBrandModel;
75
import com.spice.profitmandi.dao.model.ItemWiseTertiaryModel;
75
import com.spice.profitmandi.dao.model.ItemWiseTertiaryModel;
76
import com.spice.profitmandi.dao.model.MonthSaleModel;
76
import com.spice.profitmandi.dao.model.MonthSaleModel;
77
import com.spice.profitmandi.dao.model.PartnerDetailModel;
77
import com.spice.profitmandi.dao.model.PartnerDetailModel;
78
import com.spice.profitmandi.dao.model.PartnerPendingIndentItemModel;
78
import com.spice.profitmandi.dao.model.PartnerPendingIndentItemModel;
-
 
79
import com.spice.profitmandi.dao.model.PriceDropBrandModel;
79
import com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel;
80
import com.spice.profitmandi.dao.model.PriceDropWithDetailsByYearMonthModel;
80
import com.spice.profitmandi.dao.model.PriceDropYearMonthModel;
81
import com.spice.profitmandi.dao.model.PriceDropYearMonthModel;
81
import com.spice.profitmandi.dao.model.WarehouseBrandItemUnbilledActivatedModel;
82
import com.spice.profitmandi.dao.model.WarehouseBrandItemUnbilledActivatedModel;
82
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel;
83
import com.spice.profitmandi.dao.model.WarehouseBrandWiseItemSaleModel;
83
import com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel;
84
import com.spice.profitmandi.dao.model.WarehouseWiseBrandSaleModel;
Line 327... Line 328...
327
			ms.setPartnerType(partnerType);
328
			ms.setPartnerType(partnerType);
328
			ms.setMonth(startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
329
			ms.setMonth(startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
329
			monthSaleMap.put(i, ms);
330
			monthSaleMap.put(i, ms);
330
 
331
 
331
		}
332
		}
-
 
333
 
332
		model.addAttribute("monthSales", monthSaleMap);
334
		model.addAttribute("monthSales", monthSaleMap);
333
		return "monthSales";
335
		return "monthSales";
334
	}
336
	}
335
 
337
 
336
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
338
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
Line 371... Line 373...
371
				PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
373
				PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
372
				model.addAttribute("partnerType", partnerType);
374
				model.addAttribute("partnerType", partnerType);
373
				model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
375
				model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
374
				model.addAttribute("fofoStore", fofoStore);
376
				model.addAttribute("fofoStore", fofoStore);
375
				model.addAttribute("partnerType", partnerType);
377
				model.addAttribute("partnerType", partnerType);
376
				model.addAttribute("maa", loginDetails.getFofoId()==175138885);
378
				model.addAttribute("maa", loginDetails.getFofoId() == 175138885);
377
				
379
 
378
				model.addAttribute("hasGift", fofoUser.hasGift(loginDetails.getFofoId()));
380
				model.addAttribute("hasGift", fofoUser.hasGift(loginDetails.getFofoId()));
379
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
381
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
380
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
382
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
381
						.append("partnerId", fofoStore.getId()).toString());
383
						.append("partnerId", fofoStore.getId()).toString());
382
				model.addAttribute("activatedImeis",
384
				model.addAttribute("activatedImeis",
Line 546... Line 548...
546
 
548
 
547
	@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
549
	@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
548
	public String getPriceDropDetails(HttpServletRequest request,
550
	public String getPriceDropDetails(HttpServletRequest request,
549
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
551
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
550
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
552
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
551
			@RequestParam(name = "yearMonth", required = true, defaultValue = "0") String yearMonth, Model model)
553
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
552
			throws Exception {
554
			throws Exception {
553
 
555
 
554
		LOGGER.info("params" + fofoId + brand + yearMonth);
556
		LOGGER.info("params" + fofoId + brand + yearMonth);
555
 
557
 
556
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
558
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
Line 560... Line 562...
560
 
562
 
561
		model.addAttribute("priceDropdetailsList", priceDropdetailsList);
563
		model.addAttribute("priceDropdetailsList", priceDropdetailsList);
562
 
564
 
563
		return "price-drop-details";
565
		return "price-drop-details";
564
	}
566
	}
-
 
567
	
-
 
568
	
-
 
569
	@RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
-
 
570
	public String getPriceDropDetailSixMonths(HttpServletRequest request,
-
 
571
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
572
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
-
 
573
			throws Exception {
-
 
574
 
-
 
575
		LOGGER.info("params" + fofoId + brand);
-
 
576
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
-
 
577
		LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
-
 
578
		LocalDateTime endMonthTotal = curDate.withDayOfMonth(1).minusMonths(6);
-
 
579
 
-
 
580
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
-
 
581
				.selectBrandPendingPriceDropWithDetailsAndSixMonth(fofoId, brand, startfMonthSixMonth,endMonthTotal);
-
 
582
 
-
 
583
		LOGGER.info("priceDropdetailsList" + priceDropdetailsList);
-
 
584
 
-
 
585
		model.addAttribute("priceDropdetailsList", priceDropdetailsList);
-
 
586
 
-
 
587
		return "price-drop-details";
-
 
588
	}
565
 
589
 
-
 
590
	
566
	@RequestMapping(value = "/getMonthlyPriceDrop", method = RequestMethod.GET)
591
	@RequestMapping(value = "/getMonthlyPriceDrop", method = RequestMethod.GET)
567
	public String getMonthlyPriceDropTabular(HttpServletRequest request, Model model) throws Exception {
592
	public String getMonthlyPriceDropTabular(HttpServletRequest request, Model model) throws Exception {
568
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
593
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
569
		int fofoId = loginDetails.getFofoId();
594
		int fofoId = loginDetails.getFofoId();
570
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
595
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
571
 
596
 
572
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
597
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
-
 
598
		LocalDateTime startfMonthTotal = curDate.withDayOfMonth(1).minusMonths(12);
-
 
599
		LocalDateTime endMonthTotal = curDate.withDayOfMonth(1).minusMonths(6);
573
 
600
 
574
		List<YearMonth> ym = new ArrayList<YearMonth>();
601
		List<YearMonth> yms = new ArrayList<YearMonth>();
575
 
602
 
576
		for (int i = 1; i <= 6; i++) {
603
		for (int i = 1; i <= 6; i++) {
577
			ym.add(YearMonth.from(curDate.withDayOfMonth(1).minusMonths(i)));
604
			yms.add(YearMonth.from(curDate.withDayOfMonth(1).minusMonths(i)));
578
		}
605
		}
579
		Collections.reverse(ym);
606
		Collections.reverse(yms);
580
		model.addAttribute("ym", ym);
607
		model.addAttribute("yms", yms);
581
		LOGGER.info("ym" + ym);
608
		LOGGER.info("ym" + yms);
582
 
609
 
583
		List<PriceDropYearMonthModel> priceDropYearMonthModels = priceDropRepository
610
		List<PriceDropYearMonthModel> priceDropYearMonthModels = priceDropRepository
584
				.selectBrandPendingPriceDropByYearMonth(fofoId, startOfMonth);
611
				.selectBrandPendingPriceDropByYearMonth(fofoId, startOfMonth);
585
 
612
 
-
 
613
		List<PriceDropBrandModel> priceDropBrandSixMonthTotals = priceDropRepository
-
 
614
				.selectSixMonthBrandPriceDropByYearMonth(fofoId, startfMonthTotal, endMonthTotal);
-
 
615
 
586
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
616
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
587
 
617
 
588
		Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
618
		Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
-
 
619
 
-
 
620
		LOGGER.info("priceDropBrandSixMonthTotals" + priceDropBrandSixMonthTotals);
-
 
621
		
-
 
622
	
-
 
623
		Map<String, Double> priceDropBrandSixMonthMap=priceDropBrandSixMonthTotals.stream().collect(Collectors.toMap(x->x.getBrand(), x->(double)x.getAmount()));
-
 
624
		
-
 
625
		model.addAttribute("priceDropBrandSixMonthMap", priceDropBrandSixMonthMap);
-
 
626
		
589
		LOGGER.info("priceDropYearMonthModels" + priceDropYearMonthModels);
627
		LOGGER.info("priceDropYearMonthModels" + priceDropYearMonthModels);
590
		for (PriceDropYearMonthModel pdm : priceDropYearMonthModels) {
-
 
591
 
628
 
-
 
629
		for (PriceDropYearMonthModel pdm : priceDropYearMonthModels) {
592
			Map<YearMonth, Double> brandValue = new HashMap<>();
630
			Map<YearMonth, Double> brandValue = new HashMap<>();
-
 
631
 
593
			if (brandMonthValue.containsKey(pdm.getBrand())) {
632
			if (brandMonthValue.containsKey(pdm.getBrand())) {
594
				brandValue = brandMonthValue.get(pdm.getBrand());
633
				brandValue = brandMonthValue.get(pdm.getBrand());
595
				brandValue.put(YearMonth.parse(pdm.getYearMonth(), dateTimeFormatter), (double) pdm.getAmount());
634
				brandValue.put(YearMonth.parse(pdm.getYearMonth(), dateTimeFormatter), (double) pdm.getAmount());
596
			} else {
635
			} else {
597
 
636
 
Line 610... Line 649...
610
		brands.add("Tecno");
649
		brands.add("Tecno");
611
		brands.add("Itel");
650
		brands.add("Itel");
612
		brands.add("Nokia");
651
		brands.add("Nokia");
613
		Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
652
		Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
614
 
653
 
-
 
654
       model.addAttribute("brands", brands);
-
 
655
		
615
		for (String brand : brands) {
656
		for (String brand : brands) {
616
			Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
657
			Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
617
			for (int i = 6; i >= 1; i--) {
658
			for (int i = 6; i >= 1; i--) {
618
 
659
 
619
				LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
660
				LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);