Subversion Repositories SmartDukaan

Rev

Rev 30137 | Rev 30146 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30137 Rev 30138
Line 604... Line 604...
604
			List<Integer> fofoIdl = new ArrayList<>(fofoIds);
604
			List<Integer> fofoIdl = new ArrayList<>(fofoIds);
605
			List<Integer> fofoIdList = fofoStoreRepository.selectByRetailerIds(fofoIdl).stream()
605
			List<Integer> fofoIdList = fofoStoreRepository.selectByRetailerIds(fofoIdl).stream()
606
					.filter(x -> !x.isInternal()).map(x -> x.getId()).collect(Collectors.toList());
606
					.filter(x -> !x.isInternal()).map(x -> x.getId()).collect(Collectors.toList());
607
 
607
 
608
			LocalDateTime startDate = LocalDate.now().atStartOfDay();
608
			LocalDateTime startDate = LocalDate.now().atStartOfDay();
609
			LocalDateTime endDate = LocalDate.now().atTime(LocalTime.MAX);
-
 
610
 
609
 
611
			if (dayValue.equals("previous")) {
610
			if (dayValue.equals("previous")) {
612
				startDate = LocalDate.now().minusDays(1).atStartOfDay();
611
				startDate = LocalDate.now().minusDays(1).atStartOfDay();
613
				endDate = LocalDate.now().minusDays(1).atTime(LocalTime.MAX);
-
 
-
 
612
 
614
			}
613
			}
615
 
614
 
616
			List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
615
			List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
617
					.selectAll(fofoIdList, startDate.minusDays(3).toLocalDate());
616
					.selectAll(fofoIdList, startDate.toLocalDate());
618
			if (!partnerDailyInvestments.isEmpty()) {
617
			if (!partnerDailyInvestments.isEmpty()) {
619
				partnerDailyInvestmentMap = partnerDailyInvestments.stream()
618
				partnerDailyInvestmentMap = partnerDailyInvestments.stream()
620
						.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
619
						.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
621
			}
620
			}
622
 
621
 
Line 870... Line 869...
870
					partnerCollectionPlan.setUpdatedTimestamp(LocalDateTime.now());
869
					partnerCollectionPlan.setUpdatedTimestamp(LocalDateTime.now());
871
				}
870
				}
872
			}
871
			}
873
		} else {
872
		} else {
874
			throw new ProfitMandiBusinessException("Date", "",
873
			throw new ProfitMandiBusinessException("Date", "",
875
					"you can't select the back date" + ptam.getCollectionCommitmentDate());
874
					"you can't select the back date " + ptam.getCollectionCommitmentDate());
876
		}
875
		}
877
 
876
 
878
		for (Entry<String, PartnerSecondaryPlanModel> pspm : ptam.getPartnerSecondaryModel().entrySet()) {
877
		for (Entry<String, PartnerSecondaryPlanModel> pspm : ptam.getPartnerSecondaryModel().entrySet()) {
879
 
878
 
880
			if (ptam.getCollectionCommitmentDate().isAfter(LocalDate.now())
879
			if (ptam.getCollectionCommitmentDate().isAfter(LocalDate.now())
Line 943... Line 942...
943
					}
942
					}
944
 
943
 
945
				}
944
				}
946
			} else {
945
			} else {
947
				throw new ProfitMandiBusinessException("Date", "",
946
				throw new ProfitMandiBusinessException("Date", "",
948
						"you can't select the back date" + ptam.getSecondaryCommitmentDate());
947
						"you can't select the back date " + ptam.getSecondaryCommitmentDate());
949
			}
948
			}
950
 
949
 
951
		}
950
		}
952
 
951
 
953
		return responseSender.ok(true);
952
		return responseSender.ok(true);