| Line 2102... |
Line 2102... |
| 2102 |
Map<Milestone, Long> slmtdMap = partnerDetails.stream().collect(
|
2102 |
Map<Milestone, Long> slmtdMap = partnerDetails.stream().collect(
|
| 2103 |
Collectors.groupingBy(x -> Milestone.get(x.getSecondarylmtd()), Collectors.counting()));
|
2103 |
Collectors.groupingBy(x -> Milestone.get(x.getSecondarylmtd()), Collectors.counting()));
|
| 2104 |
Map<Milestone, Long> lmsMap = partnerDetails.stream().collect(
|
2104 |
Map<Milestone, Long> lmsMap = partnerDetails.stream().collect(
|
| 2105 |
Collectors.groupingBy(x -> Milestone.get(x.getSecondarylms()), Collectors.counting()));
|
2105 |
Collectors.groupingBy(x -> Milestone.get(x.getSecondarylms()), Collectors.counting()));
|
| 2106 |
|
2106 |
|
| - |
|
2107 |
Map<Milestone, List<Integer>> partnerIdsMap = partnerDetails.stream()
|
| - |
|
2108 |
.collect(Collectors.groupingBy(x -> Milestone.get(x.getSecondarymtd()),
|
| - |
|
2109 |
Collectors.mapping(x -> x.getFofoId(), Collectors.toList())));
|
| - |
|
2110 |
|
| 2107 |
model.addAttribute("smtdMap", smtdMap);
|
2111 |
model.addAttribute("smtdMap", smtdMap);
|
| 2108 |
model.addAttribute("slmtdMap", slmtdMap);
|
2112 |
model.addAttribute("slmtdMap", slmtdMap);
|
| 2109 |
model.addAttribute("avg3MonthS", avg3MonthS);
|
2113 |
model.addAttribute("avg3MonthS", avg3MonthS);
|
| 2110 |
model.addAttribute("lmsMap", lmsMap);
|
2114 |
model.addAttribute("lmsMap", lmsMap);
|
| - |
|
2115 |
model.addAttribute("partnerIdsMap", partnerIdsMap);
|
| 2111 |
|
2116 |
|
| 2112 |
}
|
2117 |
}
|
| 2113 |
|
2118 |
|
| 2114 |
}
|
2119 |
}
|
| 2115 |
}
|
2120 |
}
|
| Line 2219... |
Line 2224... |
| 2219 |
|
2224 |
|
| 2220 |
model.addAttribute("yearMonth", list);
|
2225 |
model.addAttribute("yearMonth", list);
|
| 2221 |
|
2226 |
|
| 2222 |
List<PartnerMonthlySaleModel> partnerMonthlySaleModels = fofoOrderItemRepository
|
2227 |
List<PartnerMonthlySaleModel> partnerMonthlySaleModels = fofoOrderItemRepository
|
| 2223 |
.selectPartnerMonthlySale(fofoIds, LocalDateTime.now().minusMonths(12));
|
2228 |
.selectPartnerMonthlySale(fofoIds, LocalDateTime.now().minusMonths(12));
|
| 2224 |
LOGGER.info("partnerMonthlySaleModels" + partnerMonthlySaleModels);
|
- |
|
| 2225 |
|
- |
|
| 2226 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
2229 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
| 2227 |
Map<Integer, Map<YearMonth, Double>> partnerMonthSaleMap = new HashMap<>();
|
2230 |
Map<Integer, Map<YearMonth, Double>> partnerMonthSaleMap = new HashMap<>();
|
| 2228 |
if (!partnerMonthlySaleModels.isEmpty()) {
|
2231 |
if (!partnerMonthlySaleModels.isEmpty()) {
|
| 2229 |
|
2232 |
|
| 2230 |
partnerMonthSaleMap = partnerMonthlySaleModels.stream()
|
2233 |
partnerMonthSaleMap = partnerMonthlySaleModels.stream()
|
| 2231 |
.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.toMap(
|
2234 |
.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.toMap(
|
| 2232 |
x -> YearMonth.parse(x.getYearMonth(), dateTimeFormatter), x -> (double) x.getAmount())));
|
2235 |
x -> YearMonth.parse(x.getYearMonth(), dateTimeFormatter), x -> (double) x.getAmount())));
|
| 2233 |
}
|
2236 |
}
|
| 2234 |
|
2237 |
|
| 2235 |
LOGGER.info("partnerMonthSaleMap" + partnerMonthSaleMap);
|
- |
|
| 2236 |
|
- |
|
| 2237 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailerUserId(fofoIds);
|
2238 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailerUserId(fofoIds);
|
| 2238 |
|
2239 |
|
| 2239 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
2240 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 2240 |
|
2241 |
|
| 2241 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
2242 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 2242 |
|
2243 |
|
| 2243 |
model.addAttribute("partnerMonthSaleMap", partnerMonthSaleMap);
|
2244 |
model.addAttribute("partnerMonthSaleMap", partnerMonthSaleMap);
|
| 2244 |
return "monthly-partner-sale";
|
2245 |
return "monthly-partner-sale";
|
| 2245 |
|
2246 |
|
| 2246 |
}
|
2247 |
}
|
| - |
|
2248 |
|
| - |
|
2249 |
@RequestMapping(value = "/getMonthWisePurchase", method = RequestMethod.GET)
|
| - |
|
2250 |
public String getMonthWisePurchase(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model model)
|
| - |
|
2251 |
throws Exception {
|
| - |
|
2252 |
|
| - |
|
2253 |
YearMonth now = YearMonth.now();
|
| - |
|
2254 |
YearMonth ym = YearMonth.now().minusMonths(12);
|
| - |
|
2255 |
List<YearMonth> list = new ArrayList<>();
|
| - |
|
2256 |
while (!ym.isAfter(now)) {
|
| - |
|
2257 |
list.add(ym);
|
| - |
|
2258 |
ym = ym.plusMonths(1);
|
| - |
|
2259 |
}
|
| - |
|
2260 |
|
| - |
|
2261 |
model.addAttribute("yearMonth", list);
|
| - |
|
2262 |
ArrayList<in.shop2020.model.v1.order.OrderStatus> orderStatus = new ArrayList<>();
|
| - |
|
2263 |
|
| - |
|
2264 |
orderStatus.add(SUBMITTED_FOR_PROCESSING);
|
| - |
|
2265 |
orderStatus.add(BILLED);
|
| - |
|
2266 |
orderStatus.add(SHIPPED_FROM_WH);
|
| - |
|
2267 |
orderStatus.add(DELIVERY_SUCCESS);
|
| - |
|
2268 |
|
| - |
|
2269 |
Map<Integer, Map<YearMonth, Double>> partnerMonthPurchaseMap = orderRepository
|
| - |
|
2270 |
.selectOrders(fofoIds, orderStatus, LocalDateTime.now().minusMonths(12)).stream()
|
| - |
|
2271 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
| - |
|
2272 |
Collectors.groupingBy(x -> YearMonth.from(x.getCreateTimestamp()),
|
| - |
|
2273 |
Collectors.summingDouble(x -> x.getTotalAmount()))));
|
| - |
|
2274 |
|
| - |
|
2275 |
LOGGER.info("partnerMonthPurchaseMap" + partnerMonthPurchaseMap);
|
| - |
|
2276 |
|
| - |
|
2277 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailerUserId(fofoIds);
|
| - |
|
2278 |
|
| - |
|
2279 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| - |
|
2280 |
|
| - |
|
2281 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| - |
|
2282 |
|
| - |
|
2283 |
model.addAttribute("partnerMonthPurchaseMap", partnerMonthPurchaseMap);
|
| - |
|
2284 |
return "monthly-partner-purchase";
|
| - |
|
2285 |
|
| - |
|
2286 |
}
|
| 2247 |
}
|
2287 |
}
|