| Line 2213... |
Line 2213... |
| 2213 |
list.add(now);
|
2213 |
list.add(now);
|
| 2214 |
now = now.minusMonths(1);
|
2214 |
now = now.minusMonths(1);
|
| 2215 |
}
|
2215 |
}
|
| 2216 |
|
2216 |
|
| 2217 |
model.addAttribute("yearMonth", list);
|
2217 |
model.addAttribute("yearMonth", list);
|
| 2218 |
ArrayList<in.shop2020.model.v1.order.OrderStatus> orderStatus = new ArrayList<>();
|
- |
|
| 2219 |
|
2218 |
|
| 2220 |
orderStatus.add(SUBMITTED_FOR_PROCESSING);
|
- |
|
| 2221 |
orderStatus.add(BILLED);
|
- |
|
| 2222 |
orderStatus.add(SHIPPED_FROM_WH);
|
- |
|
| 2223 |
orderStatus.add(DELIVERY_SUCCESS);
|
- |
|
| 2224 |
List<Order> orders = orderRepository.selectOrders(fofoIds, orderStatus,
|
2219 |
List<PartnerMonthlySaleModel> partnerMonthlySaleModels = orderRepository.selectSecondaryGroupByYearMonth(fofoIds, LocalDate.now().withDayOfMonth(1).atStartOfDay().minusMonths(12));
|
| 2225 |
LocalDateTime.now().minusMonths(12).withDayOfMonth(1), LocalDateTime.now().plusDays(1));
|
- |
|
| 2226 |
|
- |
|
| 2227 |
Map<Integer, Map<YearMonth, Double>> partnerMonthPurchaseMap = orders.stream()
|
2220 |
Map<Integer, Map<YearMonth, Double>> partnerMonthPurchaseMap = partnerMonthlySaleModels.stream()
|
| 2228 |
.collect(Collectors.groupingBy(x -> x.getRetailerId(),
|
- |
|
| 2229 |
Collectors.groupingBy(x -> YearMonth.from(x.getCreateTimestamp()),
|
2221 |
.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.groupingBy(y -> YearMonth.parse(y.getYearMonth(), DateTimeFormatter.ofPattern("MM-yyyy")),
|
| 2230 |
Collectors.summingDouble(x -> Math.round(x.getTotalAmount().doubleValue())))));
|
2222 |
Collectors.summingDouble(x -> x.getAmount()))));
|
| 2231 |
|
- |
|
| 2232 |
LOGGER.info("orders" + orders);
|
- |
|
| 2233 |
|
2223 |
|
| 2234 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers().entrySet().stream()
|
2224 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers().entrySet().stream()
|
| 2235 |
.filter(x -> fofoIds.contains(x.getKey()))
|
2225 |
.filter(x -> fofoIds.contains(x.getKey()))
|
| 2236 |
.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
2226 |
.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
| 2237 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
2227 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 2238 |
|
- |
|
| 2239 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
- |
|
| 2240 |
|
- |
|
| 2241 |
model.addAttribute("partnerMonthPurchaseMap", partnerMonthPurchaseMap);
|
2228 |
model.addAttribute("partnerMonthPurchaseMap", partnerMonthPurchaseMap);
|
| 2242 |
return "monthly-partner-purchase";
|
2229 |
return "monthly-partner-purchase";
|
| 2243 |
|
2230 |
|
| 2244 |
}
|
2231 |
}
|
| 2245 |
}
|
2232 |
}
|