| Line 241... |
Line 241... |
| 241 |
Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
|
241 |
Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
|
| 242 |
Map<YearMonth, Map<String, Double>> monthValueMap = new HashMap<>();
|
242 |
Map<YearMonth, Map<String, Double>> monthValueMap = new HashMap<>();
|
| 243 |
|
243 |
|
| 244 |
Map<String, Double> lmsBrandWiseSale = null;
|
244 |
Map<String, Double> lmsBrandWiseSale = null;
|
| 245 |
|
245 |
|
| 246 |
for (int i = 1; i <= 5; i++) {
|
246 |
for (int i = 0; i <= 6; i++) {
|
| 247 |
|
247 |
|
| 248 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
248 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
| 249 |
|
249 |
|
| - |
|
250 |
LOGGER.info("startOfMonth" + startOfMonth);
|
| - |
|
251 |
|
| 250 |
lmsBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
252 |
lmsBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
| 251 |
curDate.withDayOfMonth(1).minusMonths(i), curDate.withDayOfMonth(1).minusMonths(i - 1), fofoId);
|
253 |
curDate.withDayOfMonth(1).minusMonths(i), curDate.withDayOfMonth(1).minusMonths(i - 1), fofoId);
|
| 252 |
|
254 |
|
| 253 |
Map<Integer, Double> accesorieslmsSale = fofoOrderRepository
|
255 |
Map<Integer, Double> accesorieslmsSale = fofoOrderRepository
|
| 254 |
.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1).minusMonths(i),
|
256 |
.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1).minusMonths(i),
|
| Line 272... |
Line 274... |
| 272 |
|
274 |
|
| 273 |
}
|
275 |
}
|
| 274 |
|
276 |
|
| 275 |
}
|
277 |
}
|
| 276 |
|
278 |
|
| - |
|
279 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
| - |
|
280 |
|
| 277 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
281 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
| 278 |
|
282 |
|
| 279 |
for (String brand : brands) {
|
283 |
for (String brand : brands) {
|
| 280 |
Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
|
284 |
Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
|
| 281 |
for (int i = 6; i >= 1; i--) {
|
285 |
for (int i = 6; i >= 0; i--) {
|
| 282 |
|
286 |
|
| 283 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
287 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
| - |
|
288 |
LOGGER.info("startMonth" + startMonth);
|
| 284 |
|
289 |
|
| 285 |
if (yearMonthValue != null) {
|
290 |
if (yearMonthValue != null) {
|
| 286 |
if (yearMonthValue.get(YearMonth.from(startMonth)) == null) {
|
291 |
if (yearMonthValue.get(YearMonth.from(startMonth)) == null) {
|
| 287 |
yearMonthValue.put(YearMonth.from(startMonth), 0.0);
|
292 |
yearMonthValue.put(YearMonth.from(startMonth), 0.0);
|
| 288 |
}
|
293 |
}
|
| Line 299... |
Line 304... |
| 299 |
|
304 |
|
| 300 |
sortedBrandValue.put(brand, sortedMonthBrandValue.values().stream().collect(Collectors.toList()));
|
305 |
sortedBrandValue.put(brand, sortedMonthBrandValue.values().stream().collect(Collectors.toList()));
|
| 301 |
|
306 |
|
| 302 |
}
|
307 |
}
|
| 303 |
|
308 |
|
| - |
|
309 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
| - |
|
310 |
|
| 304 |
LOGGER.info("sortedBrandValue" + sortedBrandValue);
|
311 |
LOGGER.info("sortedBrandValue" + sortedBrandValue);
|
| 305 |
|
312 |
|
| 306 |
ChartModel cm = chartService.createChart(5, sortedBrandValue, colorList, borderList, "Brand Wise LMS");
|
313 |
ChartModel cm = chartService.createChart(6, sortedBrandValue, colorList, borderList, "Brand Wise LMS");
|
| 307 |
|
314 |
|
| 308 |
return cm;
|
315 |
return cm;
|
| 309 |
|
316 |
|
| 310 |
}
|
317 |
}
|
| 311 |
|
318 |
|
| 312 |
public ChartModel getPurchaseOrderChart(int fofoId) throws ProfitMandiBusinessException {
|
319 |
public ChartModel getPurchaseOrderChart(int fofoId) throws ProfitMandiBusinessException {
|
| 313 |
|
320 |
|
| 314 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
321 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| - |
|
322 |
|
| - |
|
323 |
LOGGER.info("startMonth" + curDate.withDayOfMonth(1).minusMonths(6));
|
| - |
|
324 |
|
| 315 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(1);
|
325 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(1);
|
| 316 |
List<BrandWiseModel> soblms = orderRepository.selectAllBilledOrderGroupByBrandFofoId(fofoId,
|
326 |
List<BrandWiseModel> soblms = orderRepository.selectAllBilledOrderGroupByBrandFofoId(fofoId,
|
| 317 |
startOfMonth.withDayOfMonth(1).minusMonths(6));
|
327 |
curDate.withDayOfMonth(1).minusMonths(6));
|
| 318 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
328 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MM-yyyy");
|
| 319 |
Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
|
329 |
Map<String, Map<YearMonth, Double>> brandMonthValue = new HashMap<>();
|
| 320 |
for (BrandWiseModel bwl : soblms) {
|
330 |
for (BrandWiseModel bwl : soblms) {
|
| 321 |
Map<YearMonth, Double> yearMonthValue = new HashMap<>();
|
331 |
Map<YearMonth, Double> yearMonthValue = new HashMap<>();
|
| 322 |
if (brandMonthValue.containsKey(bwl.getBrand())) {
|
332 |
if (brandMonthValue.containsKey(bwl.getBrand())) {
|
| Line 334... |
Line 344... |
| 334 |
|
344 |
|
| 335 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
345 |
Map<String, List<Double>> sortedBrandValue = new LinkedHashMap<>();
|
| 336 |
|
346 |
|
| 337 |
for (String brand : brands) {
|
347 |
for (String brand : brands) {
|
| 338 |
Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
|
348 |
Map<YearMonth, Double> yearMonthValue = brandMonthValue.get(brand);
|
| 339 |
for (int i = 6; i >= 1; i--) {
|
349 |
for (int i = 6; i >= 0; i--) {
|
| 340 |
|
350 |
|
| 341 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
351 |
LocalDateTime startMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
| 342 |
|
352 |
|
| 343 |
if (yearMonthValue != null) {
|
353 |
if (yearMonthValue != null) {
|
| 344 |
if (yearMonthValue.get(YearMonth.from(startMonth)) == null) {
|
354 |
if (yearMonthValue.get(YearMonth.from(startMonth)) == null) {
|
| Line 356... |
Line 366... |
| 356 |
brandMonthValue.put(brand, sortedMonthBrandValue);
|
366 |
brandMonthValue.put(brand, sortedMonthBrandValue);
|
| 357 |
|
367 |
|
| 358 |
sortedBrandValue.put(brand, sortedMonthBrandValue.values().stream().collect(Collectors.toList()));
|
368 |
sortedBrandValue.put(brand, sortedMonthBrandValue.values().stream().collect(Collectors.toList()));
|
| 359 |
|
369 |
|
| 360 |
}
|
370 |
}
|
| - |
|
371 |
|
| - |
|
372 |
LOGGER.info("brandMonthValue" + brandMonthValue);
|
| - |
|
373 |
|
| 361 |
ChartModel cm = chartService.createChart(5, sortedBrandValue, colorList, borderList,
|
374 |
ChartModel cm = chartService.createChart(6, sortedBrandValue, colorList, borderList,
|
| 362 |
"Brand Wise Monthly Purchase");
|
375 |
"Brand Wise Monthly Purchase");
|
| 363 |
|
376 |
|
| 364 |
return cm;
|
377 |
return cm;
|
| 365 |
|
378 |
|
| 366 |
}
|
379 |
}
|