Subversion Repositories SmartDukaan

Rev

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

Rev 35480 Rev 35514
Line 2100... Line 2100...
2100
        model.addAllAttributes(map);
2100
        model.addAllAttributes(map);
2101
 
2101
 
2102
        return "chart-filter-lms";
2102
        return "chart-filter-lms";
2103
    }
2103
    }
2104
 
2104
 
2105
    @RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
2105
    @PostMapping("/getMobileLMPGraph")
2106
    public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
2106
    public String getMobileLMPGraph(@RequestBody LMSGraphRequest lmpGraphRequest, Model model) throws Exception {
2107
                                    @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
2107
        LocalDate startDate = lmpGraphRequest.getDate().toLocalDate();
2108
                                    @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
2108
        LocalDate endLocalDate = lmpGraphRequest.getEndDate().toLocalDate();
-
 
2109
 
2109
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
2110
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(lmpGraphRequest.getFofoIds())
-
 
2111
                .stream()
-
 
2112
                .collect(Collectors.groupingBy(FofoStore::getWarehouseId,
2110
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
2113
                        Collectors.mapping(FofoStore::getId, Collectors.toList())));
2111
 
2114
 
2112
        ChartModel cm;
2115
        ChartModel cm;
2113
        if (warehouseId != 0) {
2116
        if (lmpGraphRequest.getWarehouseId() != 0) {
-
 
2117
            cm = adminUser.getBrandWiseLmp(
2114
            cm = adminUser.getBrandWiseLmp(Arrays.asList(warehouseId), fofoIds.stream().map(x -> x).collect(Collectors.toList()), date.toLocalDate(), endDate.toLocalDate(), filterType);
2118
                    Arrays.asList(lmpGraphRequest.getWarehouseId()),
-
 
2119
                    lmpGraphRequest.getFofoIds(),
-
 
2120
                    startDate,
-
 
2121
                    endLocalDate,
-
 
2122
                    lmpGraphRequest.getFilterType()
-
 
2123
            );
2115
        } else {
2124
        } else {
-
 
2125
            cm = adminUser.getBrandWiseLmp(
2116
            cm = adminUser.getBrandWiseLmp(new ArrayList<>(warehouseIdFofoIdMap.keySet()), fofoIds.stream().map(x -> x).collect(Collectors.toList()), date.toLocalDate(), endDate.toLocalDate(), filterType);
2126
                    new ArrayList<>(warehouseIdFofoIdMap.keySet()),
-
 
2127
                    lmpGraphRequest.getFofoIds(),
-
 
2128
                    startDate,
-
 
2129
                    endLocalDate,
-
 
2130
                    lmpGraphRequest.getFilterType()
2117
 
2131
            );
2118
        }
2132
        }
2119
 
2133
 
2120
        LOGGER.info("chartMap" + gson.toJson(cm));
2134
        LOGGER.info("chartMap: " + gson.toJson(cm));
2121
        model.addAttribute("chartMap", gson.toJson(cm));
2135
        model.addAttribute("chartMap", gson.toJson(cm));
2122
        return "brand-wise-mobile-lmp-chart";
2136
        return "brand-wise-mobile-lmp-chart";
2123
    }
2137
    }
2124
 
2138
 
2125
    @RequestMapping(value = "/getSaleCountByMilestone", method = RequestMethod.GET)
2139
    @RequestMapping(value = "/getSaleCountByMilestone", method = RequestMethod.GET)