| Line 781... |
Line 781... |
| 781 |
if (dayValue.equals("previous")) {
|
781 |
if (dayValue.equals("previous")) {
|
| 782 |
startDate = LocalDate.now().minusDays(1).atStartOfDay();
|
782 |
startDate = LocalDate.now().minusDays(1).atStartOfDay();
|
| 783 |
|
783 |
|
| 784 |
}
|
784 |
}
|
| 785 |
|
785 |
|
| 786 |
List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
|
- |
|
| 787 |
.selectAll(fofoIdList, startDate.toLocalDate().minusDays(1));
|
786 |
if (fofoIdList.size() > 0) {
|
| 788 |
|
787 |
|
| 789 |
if (!partnerDailyInvestments.isEmpty()) {
|
- |
|
| 790 |
partnerDailyInvestmentMap = partnerDailyInvestments.stream()
|
788 |
List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
|
| 791 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
789 |
.selectAll(fofoIdList, startDate.toLocalDate().minusDays(1));
|
| 792 |
}
|
- |
|
| 793 |
|
790 |
|
| - |
|
791 |
if (!partnerDailyInvestments.isEmpty()) {
|
| 794 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
792 |
partnerDailyInvestmentMap = partnerDailyInvestments.stream()
|
| - |
|
793 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
794 |
}
|
| 795 |
|
795 |
|
| 796 |
Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().map(x -> customRetailerMap.get(x))
|
796 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 797 |
.filter(x -> x != null).collect(Collectors.toList()).stream()
|
- |
|
| 798 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
- |
|
| 799 |
|
- |
|
| 800 |
List<Integer> remarkIds = partnerCollectionRemarkRepository.selectMaxRemarkId(fofoIdList);
|
- |
|
| 801 |
|
- |
|
| 802 |
LOGGER.info("remarkIds {}", remarkIds);
|
- |
|
| 803 |
|
- |
|
| 804 |
long todayCollectionCount = 0;
|
- |
|
| 805 |
if (!remarkIds.isEmpty()) {
|
- |
|
| 806 |
todayCollectionCount = partnerCollectionRemarkRepository
|
- |
|
| 807 |
.selectByAuthIdAndIds(authUser.getId(), remarkIds).stream()
|
- |
|
| 808 |
.filter(x -> x.getCreateTimestamp().toLocalDate().equals(LocalDate.now()))
|
- |
|
| 809 |
.collect(Collectors.counting());
|
- |
|
| 810 |
|
797 |
|
| - |
|
798 |
Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().map(x -> customRetailerMap.get(x))
|
| - |
|
799 |
.filter(x -> x != null).collect(Collectors.toList()).stream()
|
| - |
|
800 |
.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
|
| - |
|
801 |
|
| - |
|
802 |
List<Integer> remarkIds = partnerCollectionRemarkRepository.selectMaxRemarkId(fofoIdList);
|
| - |
|
803 |
|
| - |
|
804 |
LOGGER.info("remarkIds {}", remarkIds);
|
| - |
|
805 |
|
| - |
|
806 |
long todayCollectionCount = 0;
|
| 811 |
}
|
807 |
if (!remarkIds.isEmpty()) {
|
| - |
|
808 |
todayCollectionCount = partnerCollectionRemarkRepository
|
| - |
|
809 |
.selectByAuthIdAndIds(authUser.getId(), remarkIds).stream()
|
| - |
|
810 |
.filter(x -> x.getCreateTimestamp().toLocalDate().equals(LocalDate.now()))
|
| - |
|
811 |
.collect(Collectors.counting());
|
| 812 |
|
812 |
|
| 813 |
Map<Integer, PartnerCollectionPlanModel> CollectionMap = partnerCollectionService
|
- |
|
| 814 |
.getCollectionMap(fofoIdList, startDate);
|
- |
|
| 815 |
|
- |
|
| 816 |
Map<Integer, List<PartnerSecondaryPlanModel>> partnerSecondayPlans = orderRepository
|
- |
|
| 817 |
.selectPartnerSecondaryGroupByBrand(fofoIdList, startDate.toLocalDate()).stream()
|
- |
|
| 818 |
.collect(Collectors.groupingBy(x -> x.getFofoId()));
|
- |
|
| 819 |
|
- |
|
| 820 |
LOGGER.info("partnerSecondayPlans {}", partnerSecondayPlans);
|
- |
|
| 821 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailers.entrySet()) {
|
- |
|
| 822 |
int fofoId = customRetailerEntry.getKey();
|
- |
|
| 823 |
CustomRetailer customRetailer = customRetailerEntry.getValue();
|
- |
|
| 824 |
float totalSecondaryPlan = 0;
|
- |
|
| 825 |
float totalSecondaryAchivement = 0;
|
- |
|
| 826 |
|
- |
|
| 827 |
PartnerTargetAchievementModel ptam = new PartnerTargetAchievementModel();
|
- |
|
| 828 |
ptam.setFofoId(fofoId);
|
- |
|
| 829 |
ptam.setBusinessName(customRetailer.getBusinessName());
|
- |
|
| 830 |
ptam.setMobile(customRetailer.getMobileNumber());
|
- |
|
| 831 |
|
- |
|
| 832 |
if (partnerDailyInvestmentMap.get(fofoId) != null) {
|
- |
|
| 833 |
ptam.setWalletAmount(partnerDailyInvestmentMap.get(fofoId).getWalletAmount());
|
- |
|
| 834 |
ptam.setShortInvestment(partnerDailyInvestmentMap.get(fofoId).getShortInvestment());
|
- |
|
| 835 |
}
|
813 |
}
|
| 836 |
|
814 |
|
| 837 |
if (CollectionMap.get(fofoId) != null) {
|
815 |
Map<Integer, PartnerCollectionPlanModel> CollectionMap = partnerCollectionService
|
| 838 |
PartnerCollectionPlanModel collectionPlan = CollectionMap.get(fofoId);
|
816 |
.getCollectionMap(fofoIdList, startDate);
|
| 839 |
|
817 |
|
| 840 |
ptam.setRemark(collectionPlan.getRemark());
|
818 |
Map<Integer, List<PartnerSecondaryPlanModel>> partnerSecondayPlans = orderRepository
|
| 841 |
ptam.setMessage(collectionPlan.getMessage());
|
- |
|
| 842 |
ptam.setRemarkTimestamp(collectionPlan.getRemarkTimestamp());
|
819 |
.selectPartnerSecondaryGroupByBrand(fofoIdList, startDate.toLocalDate()).stream()
|
| 843 |
ptam.setRank(collectionPlan.getRank());
|
820 |
.collect(Collectors.groupingBy(x -> x.getFofoId()));
|
| 844 |
Integer authId = collectionPlan.getAuthId();
|
- |
|
| 845 |
|
821 |
|
| - |
|
822 |
LOGGER.info("partnerSecondayPlans {}", partnerSecondayPlans);
|
| - |
|
823 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailers.entrySet()) {
|
| - |
|
824 |
int fofoId = customRetailerEntry.getKey();
|
| 846 |
Map<Integer, String> rankColorMap = ProfitMandiConstants.Rank_Color_Map;
|
825 |
CustomRetailer customRetailer = customRetailerEntry.getValue();
|
| - |
|
826 |
float totalSecondaryPlan = 0;
|
| - |
|
827 |
float totalSecondaryAchivement = 0;
|
| 847 |
|
828 |
|
| - |
|
829 |
PartnerTargetAchievementModel ptam = new PartnerTargetAchievementModel();
|
| - |
|
830 |
ptam.setFofoId(fofoId);
|
| - |
|
831 |
ptam.setBusinessName(customRetailer.getBusinessName());
|
| 848 |
ptam.setCollectionColor(rankColorMap.get(collectionPlan.getRank()));
|
832 |
ptam.setMobile(customRetailer.getMobileNumber());
|
| 849 |
|
833 |
|
| 850 |
LOGGER.info("authId" + authId);
|
834 |
if (partnerDailyInvestmentMap.get(fofoId) != null) {
|
| - |
|
835 |
ptam.setWalletAmount(partnerDailyInvestmentMap.get(fofoId).getWalletAmount());
|
| - |
|
836 |
ptam.setShortInvestment(partnerDailyInvestmentMap.get(fofoId).getShortInvestment());
|
| - |
|
837 |
}
|
| 851 |
|
838 |
|
| 852 |
if (collectionPlan.getTargetPlan() != null && collectionPlan.getCommittedDate() != null) {
|
839 |
if (CollectionMap.get(fofoId) != null) {
|
| 853 |
float targetCollection = 0;
|
840 |
PartnerCollectionPlanModel collectionPlan = CollectionMap.get(fofoId);
|
| 854 |
|
841 |
|
| 855 |
if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null) {
|
842 |
ptam.setRemark(collectionPlan.getRemark());
|
| 856 |
targetCollection = collectionPlan.getTargetPlan() - collectionPlan.getAchievementPlan();
|
843 |
ptam.setMessage(collectionPlan.getMessage());
|
| 857 |
} else {
|
844 |
ptam.setRemarkTimestamp(collectionPlan.getRemarkTimestamp());
|
| 858 |
targetCollection = collectionPlan.getTargetPlan();
|
845 |
ptam.setRank(collectionPlan.getRank());
|
| 859 |
}
|
846 |
Integer authId = collectionPlan.getAuthId();
|
| 860 |
|
847 |
|
| 861 |
if (authId != null && authId == authUser.getId()) {
|
848 |
Map<Integer, String> rankColorMap = ProfitMandiConstants.Rank_Color_Map;
|
| 862 |
|
849 |
|
| 863 |
if (!collectionPlan.getCommittedDate().isAfter(startDate)) {
|
850 |
ptam.setCollectionColor(rankColorMap.get(collectionPlan.getRank()));
|
| 864 |
totalPartnerTargetCollection += targetCollection;
|
- |
|
| 865 |
}
|
- |
|
| 866 |
}
|
- |
|
| 867 |
|
851 |
|
| 868 |
ptam.setCollectionTarget(targetCollection);
|
852 |
LOGGER.info("authId" + authId);
|
| 869 |
|
853 |
|
| 870 |
if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null
|
854 |
if (collectionPlan.getTargetPlan() != null && collectionPlan.getCommittedDate() != null) {
|
| 871 |
&& collectionPlan.getWalletTimestamp() != null
|
855 |
float targetCollection = 0;
|
| 872 |
&& collectionPlan.getWalletTimestamp().toLocalDate().equals(startDate.toLocalDate())) {
|
- |
|
| 873 |
if (authId != null && authId == authUser.getId()) {
|
- |
|
| 874 |
|
856 |
|
| - |
|
857 |
if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null) {
|
| - |
|
858 |
targetCollection = collectionPlan.getTargetPlan() - collectionPlan.getAchievementPlan();
|
| - |
|
859 |
} else {
|
| 875 |
totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
|
860 |
targetCollection = collectionPlan.getTargetPlan();
|
| 876 |
}
|
861 |
}
|
| 877 |
ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
|
- |
|
| 878 |
} else if (collectionPlan.getCommittedDate().toLocalDate().isEqual(startDate.toLocalDate())
|
- |
|
| 879 |
&& collectionPlan.getAchievementPlan() != null) {
|
- |
|
| - |
|
862 |
|
| 880 |
if (authId != null && authId == authUser.getId()) {
|
863 |
if (authId != null && authId == authUser.getId()) {
|
| 881 |
|
864 |
|
| - |
|
865 |
if (!collectionPlan.getCommittedDate().isAfter(startDate)) {
|
| 882 |
totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
|
866 |
totalPartnerTargetCollection += targetCollection;
|
| - |
|
867 |
}
|
| 883 |
}
|
868 |
}
|
| 884 |
ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
|
- |
|
| 885 |
|
- |
|
| 886 |
}
|
- |
|
| 887 |
}
|
- |
|
| 888 |
|
869 |
|
| 889 |
if (authId != null && authId != authUser.getId()) {
|
- |
|
| 890 |
ptam.setAuthUser(authRepository.selectById(authId));
|
870 |
ptam.setCollectionTarget(targetCollection);
|
| 891 |
|
- |
|
| 892 |
}
|
- |
|
| 893 |
|
871 |
|
| - |
|
872 |
if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null
|
| 894 |
if (collectionPlan.getCommittedDate() != null) {
|
873 |
&& collectionPlan.getWalletTimestamp() != null
|
| - |
|
874 |
&& collectionPlan.getWalletTimestamp().toLocalDate().equals(startDate.toLocalDate())) {
|
| - |
|
875 |
if (authId != null && authId == authUser.getId()) {
|
| 895 |
|
876 |
|
| 896 |
ptam.setCollectionCommitmentDate(collectionPlan.getCommittedDate().toLocalDate());
|
877 |
totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
|
| 897 |
}
|
878 |
}
|
| 898 |
|
- |
|
| - |
|
879 |
ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
|
| - |
|
880 |
} else if (collectionPlan.getCommittedDate().toLocalDate().isEqual(startDate.toLocalDate())
|
| - |
|
881 |
&& collectionPlan.getAchievementPlan() != null) {
|
| 899 |
}
|
882 |
if (authId != null && authId == authUser.getId()) {
|
| 900 |
|
883 |
|
| - |
|
884 |
totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
|
| 901 |
// Secondary
|
885 |
}
|
| - |
|
886 |
ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
|
| 902 |
|
887 |
|
| 903 |
PartnerSecondaryPlanModel otherPartnerSecondaryPlanModel = null;
|
- |
|
| 904 |
Map<String, PartnerSecondaryPlanModel> secondaryModelMap = new HashMap<>();
|
- |
|
| 905 |
if (partnerSecondayPlans.get(fofoId) != null) {
|
- |
|
| 906 |
long otherBrandSecondary = 0;
|
- |
|
| 907 |
for (PartnerSecondaryPlanModel pspm : partnerSecondayPlans.get(fofoId)) {
|
- |
|
| 908 |
Integer authId = pspm.getAuthId();
|
- |
|
| 909 |
if (!brands.contains(pspm.getBrand())) {
|
- |
|
| 910 |
if (pspm.getAchievementPlan() != null) {
|
- |
|
| 911 |
otherBrandSecondary += pspm.getAchievementPlan();
|
- |
|
| 912 |
}
|
888 |
}
|
| 913 |
} else {
|
- |
|
| 914 |
otherPartnerSecondaryPlanModel = pspm;
|
- |
|
| 915 |
}
|
- |
|
| 916 |
if (pspm.getTargetPlan() != null) {
|
- |
|
| 917 |
totalSecondaryPlan += pspm.getTargetPlan();
|
- |
|
| 918 |
}
|
889 |
}
|
| 919 |
|
890 |
|
| 920 |
if (pspm.getAchievementPlan() != null) {
|
891 |
if (authId != null && authId != authUser.getId()) {
|
| 921 |
totalSecondaryAchivement += pspm.getAchievementPlan();
|
892 |
ptam.setAuthUser(authRepository.selectById(authId));
|
| - |
|
893 |
|
| 922 |
}
|
894 |
}
|
| 923 |
|
895 |
|
| 924 |
if (pspm.getCommittedDate() != null) {
|
896 |
if (collectionPlan.getCommittedDate() != null) {
|
| 925 |
|
897 |
|
| 926 |
ptam.setSecondaryCommitmentDate(pspm.getCommittedDate().toLocalDate());
|
898 |
ptam.setCollectionCommitmentDate(collectionPlan.getCommittedDate().toLocalDate());
|
| 927 |
}
|
899 |
}
|
| 928 |
if (authId != null && authId == authUser.getId()) {
|
- |
|
| 929 |
|
900 |
|
| - |
|
901 |
}
|
| - |
|
902 |
|
| 930 |
if (pspm.getTargetPlan() != null && pspm.getCommittedDate() != null) {
|
903 |
// Secondary
|
| 931 |
|
904 |
|
| - |
|
905 |
PartnerSecondaryPlanModel otherPartnerSecondaryPlanModel = null;
|
| - |
|
906 |
Map<String, PartnerSecondaryPlanModel> secondaryModelMap = new HashMap<>();
|
| - |
|
907 |
if (partnerSecondayPlans.get(fofoId) != null) {
|
| - |
|
908 |
long otherBrandSecondary = 0;
|
| - |
|
909 |
for (PartnerSecondaryPlanModel pspm : partnerSecondayPlans.get(fofoId)) {
|
| - |
|
910 |
Integer authId = pspm.getAuthId();
|
| - |
|
911 |
if (!brands.contains(pspm.getBrand())) {
|
| 932 |
if (pspm.getCommittedDate().isEqual(startDate)) {
|
912 |
if (pspm.getAchievementPlan() != null) {
|
| 933 |
totalPartnerTargetSecondary += pspm.getTargetPlan();
|
913 |
otherBrandSecondary += pspm.getAchievementPlan();
|
| 934 |
}
|
914 |
}
|
| - |
|
915 |
} else {
|
| - |
|
916 |
otherPartnerSecondaryPlanModel = pspm;
|
| - |
|
917 |
}
|
| - |
|
918 |
if (pspm.getTargetPlan() != null) {
|
| - |
|
919 |
totalSecondaryPlan += pspm.getTargetPlan();
|
| 935 |
}
|
920 |
}
|
| 936 |
|
921 |
|
| 937 |
if (pspm.getAchievementPlan() != null) {
|
922 |
if (pspm.getAchievementPlan() != null) {
|
| 938 |
totalPartnerAchievementSecondary += pspm.getAchievementPlan();
|
923 |
totalSecondaryAchivement += pspm.getAchievementPlan();
|
| 939 |
}
|
924 |
}
|
| 940 |
|
925 |
|
| - |
|
926 |
if (pspm.getCommittedDate() != null) {
|
| - |
|
927 |
|
| - |
|
928 |
ptam.setSecondaryCommitmentDate(pspm.getCommittedDate().toLocalDate());
|
| - |
|
929 |
}
|
| - |
|
930 |
if (authId != null && authId == authUser.getId()) {
|
| - |
|
931 |
|
| - |
|
932 |
if (pspm.getTargetPlan() != null && pspm.getCommittedDate() != null) {
|
| - |
|
933 |
|
| - |
|
934 |
if (pspm.getCommittedDate().isEqual(startDate)) {
|
| - |
|
935 |
totalPartnerTargetSecondary += pspm.getTargetPlan();
|
| - |
|
936 |
}
|
| - |
|
937 |
}
|
| - |
|
938 |
|
| - |
|
939 |
if (pspm.getAchievementPlan() != null) {
|
| - |
|
940 |
totalPartnerAchievementSecondary += pspm.getAchievementPlan();
|
| - |
|
941 |
}
|
| - |
|
942 |
|
| - |
|
943 |
}
|
| 941 |
}
|
944 |
}
|
| 942 |
}
|
- |
|
| 943 |
if (otherPartnerSecondaryPlanModel != null) {
|
945 |
if (otherPartnerSecondaryPlanModel != null) {
|
| 944 |
otherPartnerSecondaryPlanModel.setAchievementPlan(otherBrandSecondary);
|
946 |
otherPartnerSecondaryPlanModel.setAchievementPlan(otherBrandSecondary);
|
| 945 |
}
|
947 |
}
|
| 946 |
secondaryModelMap = partnerSecondayPlans.get(fofoId).stream()
|
948 |
secondaryModelMap = partnerSecondayPlans.get(fofoId).stream()
|
| 947 |
.filter(x -> brands.contains(x.getBrand()))
|
949 |
.filter(x -> brands.contains(x.getBrand()))
|
| 948 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
950 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
| 949 |
|
951 |
|
| 950 |
if (secondaryModelMap.containsKey("Others")) {
|
952 |
if (secondaryModelMap.containsKey("Others")) {
|
| 951 |
PartnerSecondaryPlanModel psp = secondaryModelMap.get("Others");
|
953 |
PartnerSecondaryPlanModel psp = secondaryModelMap.get("Others");
|
| 952 |
psp.setAchievementPlan(otherBrandSecondary);
|
954 |
psp.setAchievementPlan(otherBrandSecondary);
|
| 953 |
} else {
|
955 |
} else {
|
| 954 |
secondaryModelMap.put("Others", new PartnerSecondaryPlanModel(fofoId, "Others", (long) 0,
|
956 |
secondaryModelMap.put("Others", new PartnerSecondaryPlanModel(fofoId, "Others", (long) 0,
|
| 955 |
otherBrandSecondary, authUser.getId(), null));
|
957 |
otherBrandSecondary, authUser.getId(), null));
|
| 956 |
}
|
958 |
}
|
| 957 |
for (String brand : brands) {
|
959 |
for (String brand : brands) {
|
| 958 |
if (!secondaryModelMap.containsKey(brand)) {
|
960 |
if (!secondaryModelMap.containsKey(brand)) {
|
| 959 |
secondaryModelMap.put(brand, new PartnerSecondaryPlanModel(fofoId, brand, (long) 0,
|
961 |
secondaryModelMap.put(brand, new PartnerSecondaryPlanModel(fofoId, brand, (long) 0,
|
| 960 |
(long) 0, authUser.getId(), null));
|
962 |
(long) 0, authUser.getId(), null));
|
| - |
|
963 |
}
|
| 961 |
}
|
964 |
}
|
| 962 |
}
|
- |
|
| 963 |
|
965 |
|
| 964 |
for (Entry<String, PartnerSecondaryPlanModel> secondaryModelEntry : secondaryModelMap.entrySet()) {
|
966 |
for (Entry<String, PartnerSecondaryPlanModel> secondaryModelEntry : secondaryModelMap.entrySet()) {
|
| 965 |
Integer authId = secondaryModelEntry.getValue().getAuthId();
|
967 |
Integer authId = secondaryModelEntry.getValue().getAuthId();
|
| 966 |
if (authId != null && authId != authUser.getId()) {
|
968 |
if (authId != null && authId != authUser.getId()) {
|
| 967 |
secondaryModelEntry.getValue().setAuthUser(authRepository.selectById(authId));
|
969 |
secondaryModelEntry.getValue().setAuthUser(authRepository.selectById(authId));
|
| 968 |
ptam.setSecondaryColor("red");
|
970 |
ptam.setSecondaryColor("red");
|
| - |
|
971 |
}
|
| - |
|
972 |
|
| 969 |
}
|
973 |
}
|
| 970 |
|
974 |
|
| - |
|
975 |
ptam.setPartnerSecondaryModel(secondaryModelMap);
|
| - |
|
976 |
ptam.setTotalSecondaryPlan(totalSecondaryPlan);
|
| - |
|
977 |
ptam.setTotalSecondaryAchievement(totalSecondaryAchivement);
|
| - |
|
978 |
// Secondary
|
| - |
|
979 |
|
| - |
|
980 |
} else {
|
| - |
|
981 |
for (String brand : brands) {
|
| - |
|
982 |
PartnerSecondaryPlanModel pspm = new PartnerSecondaryPlanModel();
|
| - |
|
983 |
pspm.setAchievementPlan((long) 0);
|
| - |
|
984 |
pspm.setTargetPlan((long) 0);
|
| - |
|
985 |
pspm.setBrand(brand);
|
| - |
|
986 |
pspm.setFofoId(fofoId);
|
| - |
|
987 |
secondaryModelMap.put(brand, pspm);
|
| - |
|
988 |
}
|
| - |
|
989 |
ptam.setPartnerSecondaryModel(secondaryModelMap);
|
| 971 |
}
|
990 |
}
|
| 972 |
|
991 |
|
| 973 |
ptam.setPartnerSecondaryModel(secondaryModelMap);
|
992 |
if (!partnerTicketCount.isEmpty()) {
|
| 974 |
ptam.setTotalSecondaryPlan(totalSecondaryPlan);
|
993 |
if (partnerTicketCount.get(fofoId) != null) {
|
| 975 |
ptam.setTotalSecondaryAchievement(totalSecondaryAchivement);
|
994 |
ptam.setTicketCount(partnerTicketCount.get(fofoId));
|
| 976 |
// Secondary
|
995 |
} else {
|
| - |
|
996 |
ptam.setTicketCount(0);
|
| 977 |
|
997 |
|
| 978 |
} else {
|
998 |
}
|
| 979 |
for (String brand : brands) {
|
- |
|
| 980 |
PartnerSecondaryPlanModel pspm = new PartnerSecondaryPlanModel();
|
- |
|
| 981 |
pspm.setAchievementPlan((long) 0);
|
- |
|
| 982 |
pspm.setTargetPlan((long) 0);
|
- |
|
| 983 |
pspm.setBrand(brand);
|
- |
|
| 984 |
pspm.setFofoId(fofoId);
|
- |
|
| 985 |
secondaryModelMap.put(brand, pspm);
|
- |
|
| 986 |
}
|
999 |
}
|
| 987 |
ptam.setPartnerSecondaryModel(secondaryModelMap);
|
- |
|
| 988 |
}
|
- |
|
| 989 |
|
1000 |
|
| 990 |
if (!partnerTicketCount.isEmpty()) {
|
- |
|
| 991 |
if (partnerTicketCount.get(fofoId) != null) {
|
- |
|
| 992 |
ptam.setTicketCount(partnerTicketCount.get(fofoId));
|
- |
|
| 993 |
} else {
|
- |
|
| 994 |
ptam.setTicketCount(0);
|
1001 |
ptams.add(ptam);
|
| 995 |
|
1002 |
|
| 996 |
}
|
- |
|
| 997 |
}
|
1003 |
}
|
| 998 |
|
1004 |
|
| - |
|
1005 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
| - |
|
1006 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
| - |
|
1007 |
tm.setTotalPartnerSecondary(totalPartnerAchievementSecondary);
|
| - |
|
1008 |
tm.setTotalPartnerCollection(totalPartnerAchievementCollection);
|
| 999 |
ptams.add(ptam);
|
1009 |
tm.setTodayCollectionCount((int) todayCollectionCount);
|
| 1000 |
|
1010 |
|
| 1001 |
}
|
- |
|
| 1002 |
|
- |
|
| 1003 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
- |
|
| 1004 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
- |
|
| 1005 |
tm.setTotalPartnerSecondary(totalPartnerAchievementSecondary);
|
- |
|
| 1006 |
tm.setTotalPartnerCollection(totalPartnerAchievementCollection);
|
1011 |
tm.setTargetAchievement(ptams.stream().sorted(Comparator.comparing(PartnerTargetAchievementModel::getRank))
|
| 1007 |
tm.setTodayCollectionCount((int) todayCollectionCount);
|
1012 |
.collect(Collectors.toList()));
|
| 1008 |
|
1013 |
|
| 1009 |
tm.setTargetAchievement(ptams.stream().sorted(Comparator.comparing(PartnerTargetAchievementModel::getRank))
|
- |
|
| 1010 |
.collect(Collectors.toList()));
|
1014 |
}
|
| 1011 |
|
1015 |
|
| 1012 |
}
|
1016 |
}
|
| 1013 |
|
- |
|
| 1014 |
return responseSender.ok(tm);
|
1017 |
return responseSender.ok(tm);
|
| 1015 |
|
1018 |
|
| 1016 |
}
|
1019 |
}
|
| 1017 |
|
1020 |
|
| 1018 |
@RequestMapping(value = "/target", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
1021 |
@RequestMapping(value = "/target", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|