Subversion Repositories SmartDukaan

Rev

Rev 33256 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33256 Rev 35848
Line 1... Line 1...
1
package com.smartdukaan.cron.scheduled;
1
package com.smartdukaan.cron.scheduled;
2
 
2
 
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
-
 
4
import com.spice.profitmandi.common.model.ProfitMandiConstants;
4
import com.spice.profitmandi.common.util.FormattingUtils;
5
import com.spice.profitmandi.common.util.FormattingUtils;
5
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
6
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
6
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
7
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
7
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
8
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
8
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
9
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
Line 58... Line 59...
58
		int referenceId = Integer.parseInt(FormattingUtils.getYearMonth(startOfPreviousMonth.atStartOfDay()));
59
		int referenceId = Integer.parseInt(FormattingUtils.getYearMonth(startOfPreviousMonth.atStartOfDay()));
59
		LocalDate lastOfPreviousMonth = firstDateOfCurrentMonth.minusDays(1);
60
		LocalDate lastOfPreviousMonth = firstDateOfCurrentMonth.minusDays(1);
60
		List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
61
		List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
61
				.selectAll(startOfPreviousMonth, lastOfPreviousMonth);
62
				.selectAll(startOfPreviousMonth, lastOfPreviousMonth);
62
		Map<Integer, Long> investmentMaintainedDaysMap = partnerDailyInvestments.stream()
63
		Map<Integer, Long> investmentMaintainedDaysMap = partnerDailyInvestments.stream()
63
				.filter(x -> x.getShortPercentage() <= 10)
64
				.filter(x -> x.getShortPercentage() <= ProfitMandiConstants.OK_INVESTMENT_SHORT_PERCENTAGE)
64
				.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
65
				.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
65
		LOGGER.info("investmentMaintainedDaysMap {}", investmentMaintainedDaysMap);
66
		LOGGER.info("investmentMaintainedDaysMap {}", investmentMaintainedDaysMap);
66
		List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectAllPending(SchemeType.INVESTMENT,
67
		List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectAllPending(SchemeType.INVESTMENT,
67
				startOfPreviousMonth.atStartOfDay(), firstDateOfCurrentMonth.atStartOfDay());
68
				startOfPreviousMonth.atStartOfDay(), firstDateOfCurrentMonth.atStartOfDay());
68
		Map<Integer, List<SchemeInOut>> inventoryItemIdSchemeMap = schemeInOuts.stream()
69
		Map<Integer, List<SchemeInOut>> inventoryItemIdSchemeMap = schemeInOuts.stream()
Line 121... Line 122...
121
		LocalDate startOfPreviousMonth = firstDateOfCurrentMonth.minusMonths(1);
122
		LocalDate startOfPreviousMonth = firstDateOfCurrentMonth.minusMonths(1);
122
		LocalDate lastOfPreviousMonth = firstDateOfCurrentMonth.minusDays(1);
123
		LocalDate lastOfPreviousMonth = firstDateOfCurrentMonth.minusDays(1);
123
		List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
124
		List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
124
				.selectAll(startOfPreviousMonth, lastOfPreviousMonth);
125
				.selectAll(startOfPreviousMonth, lastOfPreviousMonth);
125
		Map<Integer, Long> investmentMaintainedDaysMap = partnerDailyInvestments.stream()
126
		Map<Integer, Long> investmentMaintainedDaysMap = partnerDailyInvestments.stream()
126
				.filter(x -> x.getShortPercentage() <= 10)
127
				.filter(x -> x.getShortPercentage() <= ProfitMandiConstants.OK_INVESTMENT_SHORT_PERCENTAGE)
127
				.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
128
				.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
128
		LOGGER.info("investmentMaintainedDaysMap {}", investmentMaintainedDaysMap);
129
		LOGGER.info("investmentMaintainedDaysMap {}", investmentMaintainedDaysMap);
129
		List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectAllPending(SchemeType.INVESTMENT,
130
		List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectAllPending(SchemeType.INVESTMENT,
130
				startOfPreviousMonth.atStartOfDay(), firstDateOfCurrentMonth.atStartOfDay());
131
				startOfPreviousMonth.atStartOfDay(), firstDateOfCurrentMonth.atStartOfDay());
131
		Map<Integer, List<SchemeInOut>> inventoryItemIdSchemeMap = schemeInOuts.stream()
132
		Map<Integer, List<SchemeInOut>> inventoryItemIdSchemeMap = schemeInOuts.stream()