Subversion Repositories SmartDukaan

Rev

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

Rev 31264 Rev 31267
Line 1913... Line 1913...
1913
			Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1913
			Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1914
			if (partnerStats != null) {
1914
			if (partnerStats != null) {
1915
 
1915
 
1916
				List<PartnerDetailModel> partnerDetails = fofoIds.stream().filter(x -> partnerStats.containsKey(x))
1916
				List<PartnerDetailModel> partnerDetails = fofoIds.stream().filter(x -> partnerStats.containsKey(x))
1917
						.map(x -> partnerStats.get(x)).collect(Collectors.toList());
1917
						.map(x -> partnerStats.get(x)).collect(Collectors.toList());
-
 
1918
 
-
 
1919
				Map<Integer, Double> last3MonthSale = fofoOrderItemRepository.selectSumMopGroupByRetailer(
-
 
1920
						LocalDateTime.now().withDayOfMonth(1).minusMonths(2), LocalDateTime.now(), 0, false);
-
 
1921
 
-
 
1922
				Map<String, Long> lmsMap = new HashMap<>();
-
 
1923
				if (!last3MonthSale.isEmpty()) {
-
 
1924
 
-
 
1925
					int days = 60 + LocalDateTime.now().getDayOfMonth();
-
 
1926
 
-
 
1927
					for (Entry<Integer, Double> last3MonthEntry : last3MonthSale.entrySet()) {
-
 
1928
						if (fofoIds.contains(last3MonthEntry.getKey())) {
-
 
1929
 
-
 
1930
							Double monthSale = last3MonthEntry.getValue();
-
 
1931
 
-
 
1932
							if (monthSale == null) {
-
 
1933
								monthSale = (double) 0;
-
 
1934
 
-
 
1935
							}
-
 
1936
 
-
 
1937
							double avg3MonthSale = (monthSale / days) * 30;
-
 
1938
							String milestone = Milestone.get((int) avg3MonthSale);
-
 
1939
 
-
 
1940
							long value = 0;
-
 
1941
 
-
 
1942
							if (lmsMap.containsKey(milestone)) {
-
 
1943
								value = lmsMap.get(milestone) + 1;
-
 
1944
								lmsMap.put(milestone, value);
-
 
1945
							} else {
-
 
1946
								lmsMap.put(milestone, value + 1);
-
 
1947
 
-
 
1948
							}
-
 
1949
						}
-
 
1950
 
-
 
1951
					}
-
 
1952
 
-
 
1953
				}
-
 
1954
 
1918
				LOGGER.info("partnerDetails" + partnerDetails);
1955
				LOGGER.info("partnerDetails" + LocalDateTime.now().withDayOfMonth(1).minusMonths(2));
1919
 
1956
 
1920
				if (partnerDetails != null) {
1957
				if (partnerDetails != null) {
1921
 
1958
 
1922
					Map<Milestone, Long> mtdMap = partnerDetails.stream()
1959
					Map<String, Long> mtdMap = partnerDetails.stream()
1923
							.collect(Collectors.groupingBy(x -> x.getMtdValue(), Collectors.counting()));
1960
							.collect(Collectors.groupingBy(x -> x.getMtdValue(), Collectors.counting()));
1924
					Map<Milestone, Long> lmtdMap = partnerDetails.stream()
1961
					Map<String, Long> lmtdMap = partnerDetails.stream()
1925
							.collect(Collectors.groupingBy(x -> Milestone.get(x.getLmtd()), Collectors.counting()));
1962
							.collect(Collectors.groupingBy(x -> Milestone.get(x.getLmtd()), Collectors.counting()));
1926
 
1963
 
1927
					Map<Milestone, Long> lmsMap = partnerDetails.stream()
-
 
1928
							.collect(Collectors.groupingBy(x -> x.getLMSValue(), Collectors.counting()));
-
 
1929
 
-
 
1930
					LOGGER.info("mtdMap" + mtdMap);
1964
					LOGGER.info("mtdMap" + mtdMap);
1931
 
1965
 
1932
					LOGGER.info("lmtdMap" + lmtdMap);
1966
					LOGGER.info("lmtdMap" + lmtdMap);
1933
 
1967
 
1934
					LOGGER.info("lmsMap" + lmsMap);
1968
					LOGGER.info("lmsMap" + lmsMap);
Line 1940... Line 1974...
1940
				}
1974
				}
1941
 
1975
 
1942
			}
1976
			}
1943
		}
1977
		}
1944
 
1978
 
-
 
1979
		model.addAttribute("warehouseMap", ProfitMandiConstants.WAREHOUSE_MAP);
-
 
1980
 
-
 
1981
		LOGGER.info("warehouseId" + Milestone.values());
-
 
1982
 
-
 
1983
		model.addAttribute("warehouseId", warehouseId);
-
 
1984
 
1945
		model.addAttribute("milestones", Milestone.values());
1985
		model.addAttribute("milestones", Milestone.values());
1946
 
1986
 
1947
		return "milestone";
1987
		return "milestone";
1948
 
1988
 
1949
	}
1989
	}