| Line 398... |
Line 398... |
| 398 |
try {
|
398 |
try {
|
| 399 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
399 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 400 |
if (!fofoStore.isActive()) {
|
400 |
if (!fofoStore.isActive()) {
|
| 401 |
return "redirect:/login";
|
401 |
return "redirect:/login";
|
| 402 |
}
|
402 |
}
|
| 403 |
|
403 |
|
| 404 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
404 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
|
| 405 |
model.addAttribute("partnerType", partnerType);
|
405 |
model.addAttribute("partnerType", partnerType);
|
| 406 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
406 |
model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
|
| 407 |
model.addAttribute("fofoStore", fofoStore);
|
407 |
model.addAttribute("fofoStore", fofoStore);
|
| 408 |
model.addAttribute("partnerType", partnerType);
|
408 |
model.addAttribute("partnerType", partnerType);
|
| Line 1892... |
Line 1892... |
| 1892 |
return "accessories-brand-wise-report";
|
1892 |
return "accessories-brand-wise-report";
|
| 1893 |
}
|
1893 |
}
|
| 1894 |
|
1894 |
|
| 1895 |
@RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
|
1895 |
@RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
|
| 1896 |
public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
|
1896 |
public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
|
| 1897 |
@RequestParam(required = false) LocalDate date, @RequestParam List<Integer> fofoIds, Model model)
|
1897 |
@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
|
| 1898 |
throws Exception {
|
1898 |
@RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
|
| 1899 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
1899 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| 1900 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
1900 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
| 1901 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
1901 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 1902 |
|
1902 |
|
| 1903 |
ChartModel cm;
|
1903 |
ChartModel cm;
|
| 1904 |
if (warehouseId != 0) {
|
1904 |
if (warehouseId != 0) {
|
| 1905 |
cm = adminUser.getBrandWiseLms(Arrays.asList(warehouseId),
|
1905 |
cm = adminUser.getBrandWiseLms(Arrays.asList(warehouseId),
|
| 1906 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1906 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date.toLocalDate(),
|
| - |
|
1907 |
endDate.toLocalDate(), filterType);
|
| 1907 |
} else {
|
1908 |
} else {
|
| 1908 |
cm = adminUser.getBrandWiseLms(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
1909 |
cm = adminUser.getBrandWiseLms(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
| 1909 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1910 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date.toLocalDate(),
|
| - |
|
1911 |
endDate.toLocalDate(), filterType);
|
| 1910 |
|
1912 |
|
| 1911 |
}
|
1913 |
}
|
| 1912 |
|
1914 |
|
| 1913 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
1915 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 1914 |
model.addAttribute("chartMap", gson.toJson(cm));
|
1916 |
model.addAttribute("chartMap", gson.toJson(cm));
|
| Line 1916... |
Line 1918... |
| 1916 |
}
|
1918 |
}
|
| 1917 |
|
1919 |
|
| 1918 |
@RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
|
1920 |
@RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
|
| 1919 |
public String getMobileLMSFilter(HttpServletRequest request,
|
1921 |
public String getMobileLMSFilter(HttpServletRequest request,
|
| 1920 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
1922 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
| 1921 |
@RequestParam(required = false) LocalDate date, Model model) throws Exception {
|
1923 |
@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
|
| - |
|
1924 |
Model model) throws Exception {
|
| 1922 |
|
1925 |
|
| 1923 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1926 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 1924 |
String email = loginDetails.getEmailId();
|
1927 |
String email = loginDetails.getEmailId();
|
| 1925 |
Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
|
- |
|
| 1926 |
model.addAttribute("warehouseId", warehouseId);
|
- |
|
| 1927 |
model.addAllAttributes(map);
|
- |
|
| 1928 |
|
1928 |
|
| 1929 |
return "chart-filter-lms";
|
1929 |
if (date == null) {
|
| 1930 |
}
|
- |
|
| - |
|
1930 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 1931 |
|
1931 |
|
| 1932 |
@RequestMapping(value = "/getMobileLMPFilter", method = RequestMethod.GET)
|
1932 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
|
| 1933 |
public String getMobileLMPFilter(HttpServletRequest request,
|
- |
|
| 1934 |
@RequestParam(required = false, defaultValue = "0") int warehouseId,
|
1933 |
date = startOfMonth.toLocalDate().atStartOfDay();
|
| 1935 |
@RequestParam(required = false) LocalDate date, Model model) throws Exception {
|
- |
|
| - |
|
1934 |
}
|
| 1936 |
|
1935 |
|
| - |
|
1936 |
if (endDate == null) {
|
| 1937 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
1937 |
LocalDateTime curDate = LocalDate.now().atTime(LocalTime.MAX);
|
| - |
|
1938 |
|
| 1938 |
String email = loginDetails.getEmailId();
|
1939 |
endDate = curDate;
|
| - |
|
1940 |
|
| - |
|
1941 |
}
|
| - |
|
1942 |
|
| 1939 |
Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
|
1943 |
Map<String, Object> map = adminUser.getFilter(warehouseId, email, date, endDate);
|
| 1940 |
model.addAttribute("warehouseId", warehouseId);
|
1944 |
model.addAttribute("warehouseId", warehouseId);
|
| 1941 |
model.addAllAttributes(map);
|
1945 |
model.addAllAttributes(map);
|
| 1942 |
|
1946 |
|
| 1943 |
return "chart-filter-lmp";
|
1947 |
return "chart-filter-lms";
|
| 1944 |
}
|
1948 |
}
|
| 1945 |
|
1949 |
|
| 1946 |
@RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
|
1950 |
@RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
|
| 1947 |
public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
|
1951 |
public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
|
| 1948 |
@RequestParam(required = false) LocalDate date, @RequestParam List<Integer> fofoIds, Model model)
|
1952 |
@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
|
| 1949 |
throws Exception {
|
1953 |
@RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
|
| 1950 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
1954 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| 1951 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
1955 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
|
| 1952 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
1956 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 1953 |
|
1957 |
|
| 1954 |
ChartModel cm;
|
1958 |
ChartModel cm;
|
| 1955 |
if (warehouseId != 0) {
|
1959 |
if (warehouseId != 0) {
|
| 1956 |
cm = adminUser.getBrandWiseLmp(Arrays.asList(warehouseId),
|
1960 |
cm = adminUser.getBrandWiseLmp(Arrays.asList(warehouseId),
|
| 1957 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1961 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date.toLocalDate(),
|
| - |
|
1962 |
endDate.toLocalDate(), filterType);
|
| 1958 |
} else {
|
1963 |
} else {
|
| 1959 |
cm = adminUser.getBrandWiseLmp(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
1964 |
cm = adminUser.getBrandWiseLmp(new ArrayList<>(warehouseIdFofoIdMap.keySet()),
|
| 1960 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date);
|
1965 |
fofoIds.stream().map(x -> x).collect(Collectors.toList()), date.toLocalDate(),
|
| - |
|
1966 |
endDate.toLocalDate(), filterType);
|
| 1961 |
|
1967 |
|
| 1962 |
}
|
1968 |
}
|
| 1963 |
|
1969 |
|
| 1964 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
1970 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 1965 |
model.addAttribute("chartMap", gson.toJson(cm));
|
1971 |
model.addAttribute("chartMap", gson.toJson(cm));
|