| Line 693... |
Line 693... |
| 693 |
|
693 |
|
| 694 |
Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().map(x -> customRetailerMap.get(x))
|
694 |
Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().map(x -> customRetailerMap.get(x))
|
| 695 |
.filter(x -> x != null).collect(Collectors.toList()).stream()
|
695 |
.filter(x -> x != null).collect(Collectors.toList()).stream()
|
| 696 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
696 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| 697 |
|
697 |
|
| 698 |
Map<Integer, PartnerCollectionAchievementModel> collectionAchievementMap = userWalletRepository
|
- |
|
| 699 |
.getPartnerWiseCollectionAchievement(fofoIdList, startDate).stream()
|
- |
|
| 700 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
- |
|
| 701 |
|
- |
|
| 702 |
List<Integer> remarkIds = partnerCollectionRemarkRepository.selectMaxRemarkId(fofoIdList);
|
698 |
List<Integer> remarkIds = partnerCollectionRemarkRepository.selectMaxRemarkId(fofoIdList);
|
| 703 |
|
699 |
|
| 704 |
LOGGER.info("remarkIds {}", remarkIds);
|
700 |
LOGGER.info("remarkIds {}", remarkIds);
|
| 705 |
|
701 |
|
| 706 |
long todayCollectionCount = 0;
|
702 |
long todayCollectionCount = 0;
|
| Line 710... |
Line 706... |
| 710 |
.filter(x -> x.getCreateTimestamp().toLocalDate().equals(LocalDate.now()))
|
706 |
.filter(x -> x.getCreateTimestamp().toLocalDate().equals(LocalDate.now()))
|
| 711 |
.collect(Collectors.counting());
|
707 |
.collect(Collectors.counting());
|
| 712 |
|
708 |
|
| 713 |
}
|
709 |
}
|
| 714 |
|
710 |
|
| 715 |
Map<Integer, PartnerCollectionPlanModel> foundCollectionMap = partnerCollectionService
|
711 |
Map<Integer, PartnerCollectionPlanModel> CollectionMap = partnerCollectionService
|
| 716 |
.getCollectionMap(fofoIdList, startDate);
|
712 |
.getCollectionMap(fofoIdList, startDate);
|
| 717 |
|
713 |
|
| 718 |
Map<Integer, List<PartnerSecondaryPlanModel>> partnerSecondayPlans = orderRepository
|
714 |
Map<Integer, List<PartnerSecondaryPlanModel>> partnerSecondayPlans = orderRepository
|
| 719 |
.selectPartnerSecondaryGroupByBrand(fofoIdList, startDate.toLocalDate()).stream()
|
715 |
.selectPartnerSecondaryGroupByBrand(fofoIdList, startDate.toLocalDate()).stream()
|
| 720 |
.collect(Collectors.groupingBy(x -> x.getFofoId()));
|
716 |
.collect(Collectors.groupingBy(x -> x.getFofoId()));
|
| Line 734... |
Line 730... |
| 734 |
if (partnerDailyInvestmentMap.get(fofoId) != null) {
|
730 |
if (partnerDailyInvestmentMap.get(fofoId) != null) {
|
| 735 |
ptam.setWalletAmount(partnerDailyInvestmentMap.get(fofoId).getWalletAmount());
|
731 |
ptam.setWalletAmount(partnerDailyInvestmentMap.get(fofoId).getWalletAmount());
|
| 736 |
ptam.setShortInvestment(partnerDailyInvestmentMap.get(fofoId).getShortInvestment());
|
732 |
ptam.setShortInvestment(partnerDailyInvestmentMap.get(fofoId).getShortInvestment());
|
| 737 |
}
|
733 |
}
|
| 738 |
|
734 |
|
| 739 |
if (foundCollectionMap.get(fofoId) != null) {
|
735 |
if (CollectionMap.get(fofoId) != null) {
|
| 740 |
PartnerCollectionPlanModel collectionPlan = foundCollectionMap.get(fofoId);
|
736 |
PartnerCollectionPlanModel collectionPlan = CollectionMap.get(fofoId);
|
| 741 |
PartnerCollectionAchievementModel collectionAchievement = collectionAchievementMap.get(fofoId);
|
- |
|
| - |
|
737 |
|
| 742 |
ptam.setRemark(collectionPlan.getRemark());
|
738 |
ptam.setRemark(collectionPlan.getRemark());
|
| 743 |
ptam.setMessage(collectionPlan.getMessage());
|
739 |
ptam.setMessage(collectionPlan.getMessage());
|
| 744 |
ptam.setRemarkTimestamp(collectionPlan.getRemarkTimestamp());
|
740 |
ptam.setRemarkTimestamp(collectionPlan.getRemarkTimestamp());
|
| 745 |
ptam.setRank(collectionPlan.getRank());
|
741 |
ptam.setRank(collectionPlan.getRank());
|
| 746 |
Integer authId = collectionPlan.getAuthId();
|
742 |
Integer authId = collectionPlan.getAuthId();
|
| Line 767... |
Line 763... |
| 767 |
}
|
763 |
}
|
| 768 |
}
|
764 |
}
|
| 769 |
|
765 |
|
| 770 |
ptam.setCollectionTarget(targetCollection);
|
766 |
ptam.setCollectionTarget(targetCollection);
|
| 771 |
}
|
767 |
}
|
| - |
|
768 |
if (collectionPlan.getAchievementPlan() != null && collectionPlan.getWalletTimestamp() != null
|
| - |
|
769 |
&& collectionPlan.getWalletTimestamp().toLocalDate().equals(startDate.toLocalDate())
|
| 772 |
if (collectionAchievement.getAmount() != null) {
|
770 |
&& collectionPlan.getTargetPlan() != null) {
|
| 773 |
if (authId != null && authId == authUser.getId()) {
|
771 |
if (authId != null && authId == authUser.getId()) {
|
| 774 |
|
772 |
|
| 775 |
totalPartnerAchievementCollection += collectionAchievement.getAmount();
|
773 |
totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
|
| 776 |
}
|
774 |
}
|
| 777 |
ptam.setCollectionAchievement(collectionAchievement.getAmount());
|
775 |
ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
|
| 778 |
}
|
776 |
}
|
| 779 |
|
777 |
|
| 780 |
if (authId != null && authId != authUser.getId()) {
|
778 |
if (authId != null && authId != authUser.getId()) {
|
| 781 |
ptam.setAuthUser(authRepository.selectById(authId));
|
779 |
ptam.setAuthUser(authRepository.selectById(authId));
|
| 782 |
|
780 |
|