| Line 365... |
Line 365... |
| 365 |
salesMap.put("currentType", currentType);
|
365 |
salesMap.put("currentType", currentType);
|
| 366 |
salesMap.put("currentTypeImage", PartnerType.imageMap.get(currentType));
|
366 |
salesMap.put("currentTypeImage", PartnerType.imageMap.get(currentType));
|
| 367 |
return salesMap;
|
367 |
return salesMap;
|
| 368 |
}
|
368 |
}
|
| 369 |
|
369 |
|
| 370 |
public ChartModel getBrandChart(int fofoId) {
|
- |
|
| 371 |
|
370 |
|
| 372 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
371 |
public ChartModel getBrandChart(int fofoId, LocalDate startDate, LocalDate endDate, boolean isQuantity) {
|
| 373 |
|
372 |
|
| 374 |
LOGGER.info("cur Date" + curDate.withDayOfMonth(1));
|
373 |
LocalDateTime curDate = startDate == null ? LocalDate.now().atStartOfDay().withDayOfMonth(1) : startDate.atStartOfDay();
|
| - |
|
374 |
LocalDateTime lastDate = endDate == null ? LocalDate.now().atStartOfDay().with(LocalTime.MAX) : endDate.atStartOfDay();
|
| 375 |
|
375 |
|
| 376 |
LOGGER.info("curDateYear" + curDate.with(LocalTime.MAX));
|
376 |
Map<String, Double> brandWiseAllSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate, lastDate, fofoId);
|
| - |
|
377 |
Map<String, Long> brandWiseSaleQuantity = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate, lastDate, fofoId);
|
| 377 |
|
378 |
|
| 378 |
Map<String, Double> brandwisesale = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
|
379 |
Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate, lastDate, Optional.of(false));
|
| - |
|
380 |
brandWiseAllSale.put("Accessories", accesoriesmtdsale.get(fofoId));
|
| - |
|
381 |
Map<Integer, Long> accesoriesMtdSaleQuantity = fofoOrderRepository.selectSumSaleQuantityGroupByFofoIdsForMobileOrAccessories(fofoId, curDate, lastDate, Optional.of(false));
|
| - |
|
382 |
brandWiseSaleQuantity.put("Accessories", accesoriesMtdSaleQuantity.get(fofoId));
|
| - |
|
383 |
List<ActivatedImeisWithSellingPrice> activatedImeisWithSellingPrices = fofoOrderRepository.selectValueOfActivatedImeis(curDate, lastDate, fofoId);
|
| - |
|
384 |
Map<String, Double> activatedImeisWithSellingPriceMTD = activatedImeisWithSellingPrices.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
|
| - |
|
385 |
Map<String, Long> activatedImeisWithSellingQuantityMTD = activatedImeisWithSellingPrices.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (long) x.getQuantity()));
|
| 379 |
|
386 |
|
| 380 |
LOGGER.info("brandwisesale" + brandwisesale);
|
387 |
activatedImeisWithSellingPriceMTD.put("Lava", brandWiseAllSale.get("Lava"));
|
| - |
|
388 |
activatedImeisWithSellingQuantityMTD.put("Lava", brandWiseSaleQuantity.get("Lava"));
|
| 381 |
|
389 |
|
| 382 |
Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
|
- |
|
| 383 |
fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
|
- |
|
| 384 |
brandwisesale.put("Accessories", accesoriesmtdsale.get(fofoId));
|
390 |
//--------------------------
|
| 385 |
|
391 |
|
| 386 |
Map<String, Double> activatedImeisWithSellingPriceMTD = fofoOrderRepository.selectValueOfActivatedImeis(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId).stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
|
392 |
Map<String, Double> LMTDBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.minusMonths(1), lastDate.minusMonths(1), fofoId);
|
| - |
|
393 |
Map<String, Long> LMTDBrandWiseSaleQuantity = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.minusMonths(1), lastDate.minusMonths(1), fofoId);
|
| 387 |
|
394 |
|
| - |
|
395 |
List<ActivatedImeisWithSellingPrice> LMTDActivatedImeisWithSellingPrices = fofoOrderRepository.selectValueOfActivatedImeis(curDate.minusMonths(1), lastDate.minusMonths(1), fofoId);
|
| 388 |
activatedImeisWithSellingPriceMTD.put("Lava", brandwisesale.get("Lava"));
|
396 |
Map<String, Double> LMTDActivatedImeisWithSellingPrice = LMTDActivatedImeisWithSellingPrices.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
|
| - |
|
397 |
Map<String, Long> LMTDActivatedImeisWithSellingQuantity = LMTDActivatedImeisWithSellingPrices.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (long) x.getQuantity()));
|
| 389 |
|
398 |
|
| 390 |
Map<String, Double> activatedImeisWithSellingPriceLMTD = fofoOrderRepository.selectValueOfActivatedImeis(curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId).stream().collect(Collectors.toMap(x -> x.getBrand(), x -> (double) x.getSellingPrice()));
|
399 |
LMTDActivatedImeisWithSellingPrice.put("Lava", LMTDBrandWiseSale.get("Lava"));
|
| 391 |
Map<String, Double> lmtdBrandWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(
|
- |
|
| 392 |
curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
|
- |
|
| 393 |
activatedImeisWithSellingPriceLMTD.put("Lava", lmtdBrandWiseSale.get("Lava"));
|
400 |
LMTDActivatedImeisWithSellingQuantity.put("Lava", LMTDBrandWiseSaleQuantity.get("Lava"));
|
| 394 |
|
- |
|
| 395 |
Map<Integer, Double> accesorieslmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(
|
- |
|
| 396 |
fofoId, curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), Optional.of(false));
|
- |
|
| 397 |
|
- |
|
| 398 |
lmtdBrandWiseSale.put("Accessories", accesorieslmtdsale.get(fofoId));
|
- |
|
| 399 |
|
401 |
|
| 400 |
ChartModel cm = new ChartModel();
|
402 |
ChartModel cm = new ChartModel();
|
| 401 |
|
403 |
|
| 402 |
HashSet<String> labels = new HashSet<String>();
|
404 |
List<String> brandList = Arrays.asList("Vivo", "Oppo", "Samsung", "Realme", "Xiaomi", "POCO", "Apple", "Tecno", "Lava", "Itel");
|
| 403 |
labels.addAll(brandwisesale.keySet());
|
- |
|
| 404 |
labels.addAll(lmtdBrandWiseSale.keySet());
|
- |
|
| 405 |
|
- |
|
| 406 |
List<String> labelList = new ArrayList<>(labels);
|
405 |
LinkedHashSet<String> brandAsLabel = new LinkedHashSet<>(brandList);
|
| 407 |
|
406 |
|
| 408 |
List<Double> mtdActivatedImeisValues = new ArrayList<>();
|
407 |
List<Double> mtdActivatedImeisValues = new ArrayList<>();
|
| 409 |
|
- |
|
| 410 |
List<Double> mtdValues = new ArrayList<>();
|
408 |
List<Double> mtdValues = new ArrayList<>();
|
| 411 |
List<Double> lmtdUnActivatedImeisValues = new ArrayList<>();
|
- |
|
| 412 |
List<Double> lmtdActivatedImeisValues = new ArrayList<>();
|
- |
|
| 413 |
List<Double> mtdUnActivatedImeisValues = new ArrayList<>();
|
409 |
List<Double> mtdUnActivatedImeisValues = new ArrayList<>();
|
| - |
|
410 |
List<Double> mtdActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
411 |
List<Double> mtdQuantity = new ArrayList<>();
|
| - |
|
412 |
List<Double> mtdUnActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
413 |
|
| - |
|
414 |
List<Double> lmtdActivatedImeisValues = new ArrayList<>();
|
| 414 |
List<Double> lmtdValues = new ArrayList<>();
|
415 |
List<Double> lmtdValues = new ArrayList<>();
|
| 415 |
for (String label : labelList) {
|
416 |
List<Double> lmtdUnActivatedImeisValues = new ArrayList<>();
|
| 416 |
mtdActivatedImeisValues.add(activatedImeisWithSellingPriceMTD.get(label) == null ? 0 : activatedImeisWithSellingPriceMTD.get(label));
|
417 |
List<Double> lmtdActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
418 |
List<Double> lmtdQuantity = new ArrayList<>();
|
| 417 |
lmtdActivatedImeisValues.add(activatedImeisWithSellingPriceLMTD.get(label) == null ? 0 : activatedImeisWithSellingPriceLMTD.get(label));
|
419 |
List<Double> lmtdUnActivatedImeisQuantity = new ArrayList<>();
|
| 418 |
|
420 |
|
| - |
|
421 |
|
| - |
|
422 |
for (String brand : brandList) {
|
| - |
|
423 |
if (isQuantity) {
|
| - |
|
424 |
mtdActivatedImeisQuantity.add(activatedImeisWithSellingQuantityMTD.get(brand) == null ? 0 : (double) activatedImeisWithSellingQuantityMTD.get(brand));
|
| 419 |
mtdValues.add(brandwisesale.get(label) == null ? 0 : brandwisesale.get(label));
|
425 |
mtdQuantity.add(brandWiseSaleQuantity.get(brand) == null ? 0 : (double) brandWiseSaleQuantity.get(brand));
|
| 420 |
if (brandwisesale.get(label) != null) {
|
426 |
if (brandWiseSaleQuantity.get(brand) != null) {
|
| 421 |
mtdUnActivatedImeisValues.add(brandwisesale.get(label) - (activatedImeisWithSellingPriceMTD.get(label) == null ? 0 : activatedImeisWithSellingPriceMTD.get(label)));
|
427 |
mtdUnActivatedImeisQuantity.add(brandWiseSaleQuantity.get(brand) - (activatedImeisWithSellingQuantityMTD.get(brand) == null ? 0 : (double) activatedImeisWithSellingQuantityMTD.get(brand)));
|
| 422 |
} else {
|
428 |
}
|
| 423 |
mtdUnActivatedImeisValues.add(0.0);
|
429 |
lmtdQuantity.add(LMTDBrandWiseSaleQuantity.get(brand) == null ? 0 : (double) LMTDBrandWiseSaleQuantity.get(brand));
|
| 424 |
}
|
- |
|
| 425 |
if (lmtdBrandWiseSale.get(label) != null) {
|
430 |
lmtdActivatedImeisQuantity.add(LMTDActivatedImeisWithSellingQuantity.get(brand) == null ? 0 : (double) LMTDActivatedImeisWithSellingQuantity.get(brand));
|
| 426 |
lmtdUnActivatedImeisValues.add(lmtdBrandWiseSale.get(label) - (activatedImeisWithSellingPriceLMTD.get(label) == null ? 0 : activatedImeisWithSellingPriceLMTD.get(label)));
|
431 |
lmtdUnActivatedImeisQuantity.add(LMTDBrandWiseSaleQuantity.get(brand) == null ? 0 : LMTDBrandWiseSaleQuantity.get(brand) - (LMTDActivatedImeisWithSellingQuantity.get(brand) == null ? 0 : (double) LMTDActivatedImeisWithSellingQuantity.get(brand)));
|
| 427 |
} else {
|
432 |
} else {
|
| - |
|
433 |
mtdActivatedImeisValues.add(activatedImeisWithSellingPriceMTD.get(brand) == null ? 0 : activatedImeisWithSellingPriceMTD.get(brand));
|
| - |
|
434 |
mtdValues.add(brandWiseAllSale.get(brand) == null ? 0 : brandWiseAllSale.get(brand));
|
| - |
|
435 |
if (brandWiseAllSale.get(brand) != null) {
|
| - |
|
436 |
mtdUnActivatedImeisValues.add(brandWiseAllSale.get(brand) - (activatedImeisWithSellingPriceMTD.get(brand) == null ? 0 : activatedImeisWithSellingPriceMTD.get(brand)));
|
| - |
|
437 |
}
|
| - |
|
438 |
lmtdValues.add(LMTDBrandWiseSale.get(brand) == null ? 0.0 : LMTDBrandWiseSale.get(brand));
|
| - |
|
439 |
lmtdActivatedImeisValues.add(LMTDActivatedImeisWithSellingPrice.get(brand) == null ? 0.0 : LMTDActivatedImeisWithSellingPrice.get(brand));
|
| 428 |
lmtdUnActivatedImeisValues.add(0.0);
|
440 |
if (LMTDBrandWiseSale.get(brand) != null) {
|
| - |
|
441 |
lmtdUnActivatedImeisValues.add(LMTDBrandWiseSale.get(brand) - (LMTDActivatedImeisWithSellingPrice.get(brand) == null ? 0.0 : LMTDActivatedImeisWithSellingPrice.get(brand)));
|
| - |
|
442 |
}
|
| 429 |
}
|
443 |
}
|
| 430 |
|
- |
|
| 431 |
lmtdValues.add(lmtdBrandWiseSale.get(label) == null ? 0 : lmtdBrandWiseSale.get(label));
|
- |
|
| 432 |
}
|
444 |
}
|
| - |
|
445 |
|
| 433 |
DatasetModel dsmtotal = new DatasetModel();
|
446 |
DatasetModel mtdActivatedImeis = new DatasetModel();
|
| 434 |
dsmtotal.setLabel("MTD");
|
447 |
mtdActivatedImeis.setLabel("Total Activation");
|
| 435 |
dsmtotal.setBackgroundColor("blue");
|
448 |
mtdActivatedImeis.setBorderColor("#00008b");
|
| 436 |
dsmtotal.setBorderColor("blue");
|
449 |
mtdActivatedImeis.setBackgroundColor("#00008b");
|
| 437 |
dsmtotal.setData(mtdValues);
|
- |
|
| 438 |
dsmtotal.setStack("stack0");
|
450 |
mtdActivatedImeis.setStack("stack0");
|
| 439 |
dsmtotal.setOrder(1);
|
451 |
mtdActivatedImeis.setOrder(0);
|
| 440 |
|
452 |
|
| 441 |
DatasetModel dsmUnactivated = new DatasetModel();
|
453 |
DatasetModel dsmUnactivated = new DatasetModel();
|
| 442 |
dsmUnactivated.setLabel("MTD Unactivated");
|
454 |
dsmUnactivated.setLabel("Total Unactivated");
|
| 443 |
dsmUnactivated.setBackgroundColor("red");
|
455 |
dsmUnactivated.setBackgroundColor("red");
|
| 444 |
dsmUnactivated.setBorderColor("red");
|
456 |
dsmUnactivated.setBorderColor("red");
|
| 445 |
dsmUnactivated.setData(mtdUnActivatedImeisValues);
|
- |
|
| 446 |
dsmUnactivated.setStack("stack0");
|
457 |
dsmUnactivated.setStack("stack0");
|
| 447 |
dsmUnactivated.setOrder(1);
|
458 |
dsmUnactivated.setOrder(1);
|
| 448 |
|
459 |
|
| - |
|
460 |
DatasetModel linemtdChart = new DatasetModel();
|
| - |
|
461 |
linemtdChart.setLabel("Total");
|
| - |
|
462 |
linemtdChart.setBackgroundColor("#006400");
|
| - |
|
463 |
linemtdChart.setBorderColor("#006400");
|
| - |
|
464 |
linemtdChart.setType("line");
|
| - |
|
465 |
linemtdChart.setOrder(2);
|
| 449 |
LOGGER.info("mtdValuesMoney" + mtdValues);
|
466 |
linemtdChart.setFill("false");
|
| 450 |
|
467 |
|
| 451 |
DatasetModel mtdActivatedImeis = new DatasetModel();
|
468 |
DatasetModel lmtdActivatedImeis = new DatasetModel();
|
| 452 |
mtdActivatedImeis.setLabel("MTD Activation");
|
469 |
lmtdActivatedImeis.setLabel("PM Total Activation");
|
| 453 |
mtdActivatedImeis.setBorderColor("#00008b");
|
470 |
lmtdActivatedImeis.setBackgroundColor("#87ceeb");
|
| 454 |
mtdActivatedImeis.setData(mtdActivatedImeisValues);
|
- |
|
| 455 |
mtdActivatedImeis.setBackgroundColor("#00008b");
|
471 |
lmtdActivatedImeis.setBorderColor("#87ceeb");
|
| 456 |
mtdActivatedImeis.setStack("stack0");
|
472 |
lmtdActivatedImeis.setStack("stack1");
|
| 457 |
mtdActivatedImeis.setOrder(1);
|
473 |
lmtdActivatedImeis.setOrder(3);
|
| 458 |
|
474 |
|
| 459 |
DatasetModel lmtddsmtotal = new DatasetModel();
|
- |
|
| 460 |
lmtddsmtotal.setLabel("LMTD");
|
- |
|
| 461 |
lmtddsmtotal.setBackgroundColor("blue");
|
- |
|
| 462 |
lmtddsmtotal.setData(lmtdValues);
|
- |
|
| 463 |
lmtddsmtotal.setBorderColor("blue");
|
- |
|
| 464 |
lmtddsmtotal.setStack("stack1");
|
- |
|
| 465 |
lmtddsmtotal.setOrder(1);
|
- |
|
| 466 |
|
475 |
|
| 467 |
DatasetModel lmtdUnActivated = new DatasetModel();
|
476 |
DatasetModel lmtdUnActivated = new DatasetModel();
|
| 468 |
lmtdUnActivated.setLabel("LMTD Unactivation");
|
477 |
lmtdUnActivated.setLabel("PM Total Unactivation");
|
| 469 |
lmtdUnActivated.setBackgroundColor("red");
|
478 |
lmtdUnActivated.setBackgroundColor("red");
|
| 470 |
lmtdUnActivated.setBorderColor("red");
|
479 |
lmtdUnActivated.setBorderColor("red");
|
| 471 |
lmtdUnActivated.setData(lmtdUnActivatedImeisValues);
|
- |
|
| 472 |
lmtdUnActivated.setStack("stack1");
|
480 |
lmtdUnActivated.setStack("stack1");
|
| 473 |
lmtdUnActivated.setOrder(1);
|
481 |
lmtdUnActivated.setOrder(4);
|
| 474 |
|
- |
|
| 475 |
DatasetModel LmtdActivatedImeis = new DatasetModel();
|
- |
|
| 476 |
LmtdActivatedImeis.setLabel("LMTD Activation");
|
- |
|
| 477 |
LmtdActivatedImeis.setBackgroundColor("#87ceeb");
|
- |
|
| 478 |
LmtdActivatedImeis.setBorderColor("#87ceeb");
|
- |
|
| 479 |
LmtdActivatedImeis.setData(lmtdActivatedImeisValues);
|
- |
|
| 480 |
LmtdActivatedImeis.setStack("stack1");
|
- |
|
| 481 |
LmtdActivatedImeis.setOrder(1);
|
- |
|
| 482 |
|
482 |
|
| 483 |
DatasetModel linemtdChart = new DatasetModel();
|
- |
|
| 484 |
linemtdChart.setLabel("MTD");
|
- |
|
| 485 |
linemtdChart.setBackgroundColor("#006400");
|
- |
|
| 486 |
linemtdChart.setBorderColor("#006400");
|
- |
|
| 487 |
linemtdChart.setData(mtdValues);
|
- |
|
| 488 |
linemtdChart.setType("line");
|
- |
|
| 489 |
linemtdChart.setOrder(2);
|
- |
|
| 490 |
linemtdChart.setFill("false");
|
- |
|
| 491 |
|
483 |
|
| 492 |
DatasetModel lineLmtdChart = new DatasetModel();
|
484 |
DatasetModel lineLmtdChart = new DatasetModel();
|
| 493 |
lineLmtdChart.setLabel("LMTD");
|
485 |
lineLmtdChart.setLabel("PM TOTAL");
|
| 494 |
lineLmtdChart.setBackgroundColor("hotpink");
|
486 |
lineLmtdChart.setBackgroundColor("hotpink");
|
| 495 |
lineLmtdChart.setBorderColor("hotpink");
|
487 |
lineLmtdChart.setBorderColor("hotpink");
|
| 496 |
lineLmtdChart.setData(lmtdValues);
|
- |
|
| 497 |
lineLmtdChart.setType("line");
|
488 |
lineLmtdChart.setType("line");
|
| 498 |
lineLmtdChart.setOrder(3);
|
489 |
lineLmtdChart.setOrder(5);
|
| 499 |
lineLmtdChart.setFill("false");
|
490 |
lineLmtdChart.setFill("false");
|
| 500 |
|
491 |
|
| - |
|
492 |
if (isQuantity) {
|
| - |
|
493 |
mtdActivatedImeis.setData(mtdActivatedImeisQuantity);
|
| - |
|
494 |
dsmUnactivated.setData(mtdUnActivatedImeisQuantity);
|
| - |
|
495 |
linemtdChart.setData(mtdQuantity);
|
| - |
|
496 |
lmtdActivatedImeis.setData(lmtdActivatedImeisQuantity);
|
| - |
|
497 |
lmtdUnActivated.setData(lmtdUnActivatedImeisQuantity);
|
| - |
|
498 |
lineLmtdChart.setData(lmtdQuantity);
|
| - |
|
499 |
} else {
|
| - |
|
500 |
mtdActivatedImeis.setData(mtdActivatedImeisValues);
|
| - |
|
501 |
dsmUnactivated.setData(mtdUnActivatedImeisValues);
|
| - |
|
502 |
linemtdChart.setData(mtdValues);
|
| - |
|
503 |
lmtdActivatedImeis.setData(lmtdActivatedImeisValues);
|
| - |
|
504 |
lmtdUnActivated.setData(lmtdUnActivatedImeisValues);
|
| - |
|
505 |
lineLmtdChart.setData(lmtdValues);
|
| - |
|
506 |
}
|
| - |
|
507 |
|
| 501 |
List<DatasetModel> datasets = new ArrayList<>();
|
508 |
List<DatasetModel> datasets = new ArrayList<>();
|
| 502 |
datasets.add(mtdActivatedImeis);
|
509 |
datasets.add(mtdActivatedImeis);
|
| 503 |
datasets.add(dsmUnactivated);
|
510 |
datasets.add(dsmUnactivated);
|
| 504 |
datasets.add(LmtdActivatedImeis);
|
- |
|
| 505 |
datasets.add(lmtdUnActivated);
|
- |
|
| 506 |
datasets.add(linemtdChart);
|
511 |
datasets.add(linemtdChart);
|
| - |
|
512 |
datasets.add(lmtdActivatedImeis);
|
| - |
|
513 |
datasets.add(lmtdUnActivated);
|
| 507 |
datasets.add(lineLmtdChart);
|
514 |
datasets.add(lineLmtdChart);
|
| 508 |
|
515 |
|
| 509 |
DataModel dm = new DataModel();
|
516 |
DataModel dm = new DataModel();
|
| 510 |
dm.setDatasets(datasets);
|
517 |
dm.setDatasets(datasets);
|
| 511 |
dm.setLabels(labels);
|
518 |
dm.setLabels(brandAsLabel);
|
| 512 |
|
- |
|
| 513 |
Tooltips tooltips = new Tooltips();
|
519 |
Tooltips tooltips = new Tooltips();
|
| 514 |
tooltips.setBodyFontSize(10);
|
520 |
tooltips.setBodyFontSize(25);
|
| 515 |
tooltips.setTitleFontSize(10);
|
521 |
tooltips.setTitleFontSize(25);
|
| 516 |
tooltips.setMode("index");
|
522 |
tooltips.setMode("index");
|
| 517 |
tooltips.setIntersect(false);
|
523 |
tooltips.setIntersect(false);
|
| 518 |
tooltips.setBackgroundColor("rgba(0, 0, 0, .5)");
|
524 |
tooltips.setBackgroundColor("rgba(0, 0, 0, 0.7)");
|
| 519 |
HoverModel hover = new HoverModel();
|
525 |
HoverModel hover = new HoverModel();
|
| 520 |
hover.setIntersect(false);
|
526 |
hover.setIntersect(false);
|
| 521 |
hover.setMode("index");
|
527 |
hover.setMode("index");
|
| 522 |
|
528 |
|
| 523 |
LegendModel lm = new LegendModel();
|
529 |
LegendModel lm = new LegendModel();
|
| Line 699... |
Line 705... |
| 699 |
}
|
705 |
}
|
| 700 |
return notifications;
|
706 |
return notifications;
|
| 701 |
|
707 |
|
| 702 |
}
|
708 |
}
|
| 703 |
|
709 |
|
| 704 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
- |
|
| 705 |
public boolean hasGift(int fofoId) {
|
710 |
public boolean hasGift(int fofoId) {
|
| 706 |
try {
|
711 |
try {
|
| 707 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId).getAvailability() > 0;
|
712 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId).getAvailability() > 0;
|
| 708 |
} catch (ProfitMandiBusinessException e) {
|
713 |
} catch (ProfitMandiBusinessException e) {
|
| 709 |
return false;
|
714 |
return false;
|
| 710 |
}
|
715 |
}
|
| 711 |
}
|
716 |
}
|
| 712 |
|
717 |
|
| - |
|
718 |
public ChartModel getModelBrandChart(int fofoId, String brand, LocalDate startDate, LocalDate endDate, boolean isQuantity) {
|
| - |
|
719 |
|
| - |
|
720 |
LocalDateTime curDate = startDate == null ? LocalDate.now().atStartOfDay().withDayOfMonth(1) : startDate.atStartOfDay();
|
| - |
|
721 |
LocalDateTime lastDate = endDate == null ? LocalDate.now().atStartOfDay().with(LocalTime.MAX) : endDate.atStartOfDay();
|
| - |
|
722 |
|
| - |
|
723 |
//----------------------------MTD-------------------------
|
| - |
|
724 |
Map<String, Double> modelWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate, lastDate, fofoId, "modelNumber", brand);
|
| - |
|
725 |
Map<String, Long> modelWiseSaleQuantity = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate, lastDate, fofoId, "modelNumber", brand);
|
| - |
|
726 |
|
| - |
|
727 |
List<ActivatedImeisWithSellingPrice> activatedImeisWithSellingPricesMTD = fofoOrderItemRepository.selectValueOfActivatedImeisModelWise(curDate, lastDate, fofoId, brand);
|
| - |
|
728 |
Map<String, Double> activatedImeisWithSellingPriceMTD = activatedImeisWithSellingPricesMTD.stream().collect(Collectors.toMap(x -> x.getModel(), x -> (double) x.getSellingPrice()));
|
| - |
|
729 |
Map<String, Long> activatedImeisWithSellingQuantityMTD = activatedImeisWithSellingPricesMTD.stream().collect(Collectors.toMap(x -> x.getModel(), x -> (long) x.getQuantity()));
|
| - |
|
730 |
|
| - |
|
731 |
|
| - |
|
732 |
//---------------------------------LMTD----------------------
|
| - |
|
733 |
Map<String, Double> lmtdModelWiseSale = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.minusMonths(1), lastDate.minusMonths(1), fofoId, "modelNumber", brand);
|
| - |
|
734 |
Map<String, Long> lmtdModelWiseSaleQuantity = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.minusMonths(1), lastDate.minusMonths(1), fofoId, "modelNumber", brand);
|
| - |
|
735 |
|
| - |
|
736 |
List<ActivatedImeisWithSellingPrice> lmtdActivatedImeisWithSellingPrices = fofoOrderItemRepository.selectValueOfActivatedImeisModelWise(curDate.minusMonths(1), lastDate.minusMonths(1), fofoId, brand);
|
| - |
|
737 |
Map<String, Double> lmtdActivatedImeisWithSellingPrice = lmtdActivatedImeisWithSellingPrices.stream().collect(Collectors.toMap(x -> x.getModel(), x -> (double) x.getSellingPrice()));
|
| - |
|
738 |
Map<String, Long> lmtdActivatedImeisWithSellingQuantity = lmtdActivatedImeisWithSellingPrices.stream().collect(Collectors.groupingBy(x -> x.getModel(), Collectors.summingLong(x -> x.getQuantity())));
|
| - |
|
739 |
|
| - |
|
740 |
ChartModel cm = new ChartModel();
|
| - |
|
741 |
|
| - |
|
742 |
List<String> brandList1 = lmtdModelWiseSale.keySet().stream().collect(Collectors.toList());
|
| - |
|
743 |
List<String> brandList2 = modelWiseSale.keySet().stream().collect(Collectors.toList());
|
| - |
|
744 |
HashSet<String> brandsAsLabelList = new HashSet<>();
|
| - |
|
745 |
brandsAsLabelList.addAll(brandList1);
|
| - |
|
746 |
brandsAsLabelList.addAll(brandList2);
|
| - |
|
747 |
// for MTD
|
| - |
|
748 |
List<Double> mtdActivatedImeisValues = new ArrayList<>();
|
| - |
|
749 |
List<Double> mtdUnActivatedImeisValues = new ArrayList<>();
|
| - |
|
750 |
List<Double> mtdValues = new ArrayList<>();
|
| - |
|
751 |
List<Double> mtdActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
752 |
List<Double> mtdUnActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
753 |
List<Double> mtdQuantity = new ArrayList<>();
|
| - |
|
754 |
|
| - |
|
755 |
// for LMTD
|
| - |
|
756 |
List<Double> lmtdActivatedImeisValues = new ArrayList<>();
|
| - |
|
757 |
List<Double> lmtdUnActivatedImeisValues = new ArrayList<>();
|
| - |
|
758 |
List<Double> lmtdValues = new ArrayList<>();
|
| - |
|
759 |
List<Double> lmtdActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
760 |
List<Double> lmtdUnActivatedImeisQuantity = new ArrayList<>();
|
| - |
|
761 |
List<Double> lmtdQuantity = new ArrayList<>();
|
| - |
|
762 |
|
| - |
|
763 |
|
| - |
|
764 |
LOGGER.info("labelsList - " + brandsAsLabelList);
|
| - |
|
765 |
for (String brandAsLabel : brandsAsLabelList) {
|
| - |
|
766 |
brandAsLabel = brandAsLabel.trim();
|
| - |
|
767 |
if (isQuantity) {
|
| - |
|
768 |
mtdActivatedImeisQuantity.add(activatedImeisWithSellingQuantityMTD.get(brandAsLabel) == null ? 0 : (double) activatedImeisWithSellingQuantityMTD.get(brandAsLabel));
|
| - |
|
769 |
mtdQuantity.add(modelWiseSaleQuantity.get(brandAsLabel) == null ? 0 : (double) modelWiseSaleQuantity.get(brandAsLabel));
|
| - |
|
770 |
mtdUnActivatedImeisQuantity.add(modelWiseSaleQuantity.get(brandAsLabel) == null ? 0 : modelWiseSaleQuantity.get(brandAsLabel) - (activatedImeisWithSellingQuantityMTD.get(brandAsLabel) == null ? 0 : (double) activatedImeisWithSellingQuantityMTD.get(brandAsLabel)));
|
| - |
|
771 |
|
| - |
|
772 |
lmtdActivatedImeisQuantity.add(lmtdActivatedImeisWithSellingQuantity.get(brandAsLabel) == null ? 0 : (double) lmtdActivatedImeisWithSellingQuantity.get(brandAsLabel));
|
| - |
|
773 |
lmtdUnActivatedImeisQuantity.add(lmtdModelWiseSaleQuantity.get(brandAsLabel) == null ? 0 : lmtdModelWiseSaleQuantity.get(brandAsLabel) - (lmtdActivatedImeisWithSellingQuantity.get(brandAsLabel) == null ? 0 : (double) lmtdActivatedImeisWithSellingQuantity.get(brandAsLabel)));
|
| - |
|
774 |
lmtdQuantity.add(lmtdModelWiseSaleQuantity.get(brandAsLabel) == null ? 0 : (double) lmtdModelWiseSaleQuantity.get(brandAsLabel));
|
| - |
|
775 |
} else {
|
| - |
|
776 |
mtdActivatedImeisValues.add(activatedImeisWithSellingPriceMTD.get(brandAsLabel) == null ? 0 : activatedImeisWithSellingPriceMTD.get(brandAsLabel));
|
| - |
|
777 |
mtdValues.add(modelWiseSale.get(brandAsLabel) == null ? 0 : modelWiseSale.get(brandAsLabel));
|
| - |
|
778 |
if (modelWiseSale.get(brandAsLabel) != null) {
|
| - |
|
779 |
mtdUnActivatedImeisValues.add(modelWiseSale.get(brandAsLabel) - (activatedImeisWithSellingPriceMTD.get(brandAsLabel) == null ? 0 : activatedImeisWithSellingPriceMTD.get(brandAsLabel)));
|
| - |
|
780 |
} else {
|
| - |
|
781 |
mtdUnActivatedImeisValues.add(0.0);
|
| - |
|
782 |
}
|
| - |
|
783 |
lmtdValues.add(lmtdModelWiseSale.get(brandAsLabel) == null ? 0 : lmtdModelWiseSale.get(brandAsLabel));
|
| - |
|
784 |
lmtdActivatedImeisValues.add(lmtdActivatedImeisWithSellingPrice.get(brandAsLabel) == null ? 0 : lmtdActivatedImeisWithSellingPrice.get(brandAsLabel));
|
| - |
|
785 |
if (lmtdModelWiseSale.get(brandAsLabel.trim()) != null) {
|
| - |
|
786 |
lmtdUnActivatedImeisValues.add(lmtdModelWiseSale.get(brandAsLabel) - (lmtdActivatedImeisWithSellingPrice.get(brandAsLabel) == null ? 0 : lmtdActivatedImeisWithSellingPrice.get(brandAsLabel)));
|
| - |
|
787 |
} else {
|
| - |
|
788 |
lmtdUnActivatedImeisValues.add(0.0);
|
| - |
|
789 |
}
|
| - |
|
790 |
}
|
| - |
|
791 |
}
|
| - |
|
792 |
|
| - |
|
793 |
DatasetModel mtdActivatedImeis = new DatasetModel();
|
| - |
|
794 |
mtdActivatedImeis.setLabel("Total Activation");
|
| - |
|
795 |
mtdActivatedImeis.setBorderColor("#00008b");
|
| - |
|
796 |
mtdActivatedImeis.setBackgroundColor("#00008b");
|
| - |
|
797 |
mtdActivatedImeis.setStack("stack0");
|
| - |
|
798 |
mtdActivatedImeis.setOrder(0);
|
| - |
|
799 |
|
| - |
|
800 |
DatasetModel dsmUnactivated = new DatasetModel();
|
| - |
|
801 |
dsmUnactivated.setLabel("Total Unactivated");
|
| - |
|
802 |
dsmUnactivated.setBackgroundColor("red");
|
| - |
|
803 |
dsmUnactivated.setBorderColor("red");
|
| - |
|
804 |
dsmUnactivated.setStack("stack0");
|
| - |
|
805 |
dsmUnactivated.setOrder(1);
|
| - |
|
806 |
|
| - |
|
807 |
DatasetModel linemtdChart = new DatasetModel();
|
| - |
|
808 |
linemtdChart.setLabel("Total");
|
| - |
|
809 |
linemtdChart.setBackgroundColor("#006400");
|
| - |
|
810 |
linemtdChart.setBorderColor("#006400");
|
| - |
|
811 |
linemtdChart.setType("line");
|
| - |
|
812 |
linemtdChart.setOrder(2);
|
| - |
|
813 |
linemtdChart.setFill("false");
|
| - |
|
814 |
|
| - |
|
815 |
DatasetModel LmtdActivatedImeis = new DatasetModel();
|
| - |
|
816 |
LmtdActivatedImeis.setLabel("PM Total Activation");
|
| - |
|
817 |
LmtdActivatedImeis.setBackgroundColor("#87ceeb");
|
| - |
|
818 |
LmtdActivatedImeis.setBorderColor("#87ceeb");
|
| - |
|
819 |
LmtdActivatedImeis.setStack("stack1");
|
| - |
|
820 |
LmtdActivatedImeis.setOrder(3);
|
| - |
|
821 |
|
| - |
|
822 |
DatasetModel lmtdUnActivated = new DatasetModel();
|
| - |
|
823 |
lmtdUnActivated.setLabel("PM Total Unactivation");
|
| - |
|
824 |
lmtdUnActivated.setBackgroundColor("red");
|
| - |
|
825 |
lmtdUnActivated.setBorderColor("red");
|
| - |
|
826 |
lmtdUnActivated.setStack("stack1");
|
| - |
|
827 |
lmtdUnActivated.setOrder(4);
|
| - |
|
828 |
|
| - |
|
829 |
DatasetModel lineLmtdChart = new DatasetModel();
|
| - |
|
830 |
lineLmtdChart.setLabel("PM TOTAL");
|
| - |
|
831 |
lineLmtdChart.setBackgroundColor("hotpink");
|
| - |
|
832 |
lineLmtdChart.setBorderColor("hotpink");
|
| - |
|
833 |
lineLmtdChart.setType("line");
|
| - |
|
834 |
lineLmtdChart.setOrder(5);
|
| - |
|
835 |
lineLmtdChart.setFill("false");
|
| - |
|
836 |
|
| - |
|
837 |
|
| - |
|
838 |
if (isQuantity) {
|
| - |
|
839 |
mtdActivatedImeis.setData(mtdActivatedImeisQuantity);
|
| - |
|
840 |
dsmUnactivated.setData(mtdUnActivatedImeisQuantity);
|
| - |
|
841 |
linemtdChart.setData(mtdQuantity);
|
| - |
|
842 |
LmtdActivatedImeis.setData(lmtdActivatedImeisQuantity);
|
| - |
|
843 |
lmtdUnActivated.setData(lmtdUnActivatedImeisQuantity);
|
| - |
|
844 |
lineLmtdChart.setData(lmtdQuantity);
|
| - |
|
845 |
} else {
|
| - |
|
846 |
mtdActivatedImeis.setData(mtdActivatedImeisValues);
|
| - |
|
847 |
dsmUnactivated.setData(mtdUnActivatedImeisValues);
|
| - |
|
848 |
linemtdChart.setData(mtdValues);
|
| - |
|
849 |
LmtdActivatedImeis.setData(lmtdActivatedImeisValues);
|
| - |
|
850 |
lmtdUnActivated.setData(lmtdUnActivatedImeisValues);
|
| - |
|
851 |
lineLmtdChart.setData(lmtdValues);
|
| - |
|
852 |
}
|
| - |
|
853 |
|
| - |
|
854 |
List<DatasetModel> datasets = new ArrayList<>();
|
| - |
|
855 |
datasets.add(mtdActivatedImeis);
|
| - |
|
856 |
datasets.add(dsmUnactivated);
|
| - |
|
857 |
datasets.add(linemtdChart);
|
| - |
|
858 |
datasets.add(LmtdActivatedImeis);
|
| - |
|
859 |
datasets.add(lmtdUnActivated);
|
| - |
|
860 |
datasets.add(lineLmtdChart);
|
| - |
|
861 |
|
| - |
|
862 |
DataModel dm = new DataModel();
|
| - |
|
863 |
dm.setDatasets(datasets);
|
| - |
|
864 |
dm.setLabels(brandsAsLabelList);
|
| - |
|
865 |
|
| - |
|
866 |
Tooltips tooltips = new Tooltips();
|
| - |
|
867 |
tooltips.setBodyFontSize(25);
|
| - |
|
868 |
tooltips.setTitleFontSize(25);
|
| - |
|
869 |
tooltips.setMode("index");
|
| - |
|
870 |
tooltips.setIntersect(false);
|
| - |
|
871 |
tooltips.setBackgroundColor("rgba(0, 0, 0, 0.7)");
|
| - |
|
872 |
HoverModel hover = new HoverModel();
|
| - |
|
873 |
hover.setIntersect(false);
|
| - |
|
874 |
hover.setMode("index");
|
| - |
|
875 |
|
| - |
|
876 |
LegendModel lm = new LegendModel();
|
| - |
|
877 |
lm.setPosition("top");
|
| - |
|
878 |
|
| - |
|
879 |
TitleModel tm = new TitleModel();
|
| - |
|
880 |
tm.setText("Model Wise Sales");
|
| - |
|
881 |
tm.setDisplay(true);
|
| - |
|
882 |
tm.setFontSize(20);
|
| - |
|
883 |
tm.setFontColor("#111");
|
| - |
|
884 |
|
| - |
|
885 |
List<Axis> xAxes = new ArrayList<>();
|
| - |
|
886 |
Axis xAxis = new Axis();
|
| - |
|
887 |
xAxis.setStacked(true);
|
| - |
|
888 |
xAxes.add(xAxis);
|
| - |
|
889 |
|
| - |
|
890 |
List<Axis> yAxes = new ArrayList<>();
|
| - |
|
891 |
Axis yAxis = new Axis();
|
| - |
|
892 |
yAxis.setStacked(false);
|
| - |
|
893 |
yAxes.add(yAxis);
|
| - |
|
894 |
|
| - |
|
895 |
ScalesModel sm = new ScalesModel();
|
| - |
|
896 |
sm.setxAxes(xAxes);
|
| - |
|
897 |
|
| - |
|
898 |
OptionsModel om = new OptionsModel();
|
| - |
|
899 |
om.setLegend(lm);
|
| - |
|
900 |
om.setTitle(tm);
|
| - |
|
901 |
om.setScales(sm);
|
| - |
|
902 |
om.setHover(hover);
|
| - |
|
903 |
om.setTooltips(tooltips);
|
| - |
|
904 |
|
| - |
|
905 |
cm.setType("bar");
|
| - |
|
906 |
cm.setData(dm);
|
| - |
|
907 |
cm.setOptions(om);
|
| - |
|
908 |
|
| - |
|
909 |
LOGGER.info("Model_cm" + cm);
|
| - |
|
910 |
return cm;
|
| - |
|
911 |
|
| - |
|
912 |
}
|
| - |
|
913 |
|
| 713 |
}
|
914 |
}
|