| Line 16... |
Line 16... |
| 16 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
16 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
| 17 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
17 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
| 18 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
18 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
| 19 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
19 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 20 |
import com.spice.profitmandi.dao.entity.transaction.SDCreditRequirement;
|
20 |
import com.spice.profitmandi.dao.entity.transaction.SDCreditRequirement;
|
| - |
|
21 |
import com.spice.profitmandi.dao.model.BulkCreditSummary;
|
| - |
|
22 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
| 21 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
23 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 22 |
import com.spice.profitmandi.dao.entity.user.User;
|
24 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 23 |
import com.spice.profitmandi.dao.entity.warehouse.BrandRegionMapping;
|
25 |
import com.spice.profitmandi.dao.entity.warehouse.BrandRegionMapping;
|
| 24 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
26 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 25 |
import com.spice.profitmandi.dao.enumuration.inventory.CatalogMovingEnum;
|
27 |
import com.spice.profitmandi.dao.enumuration.inventory.CatalogMovingEnum;
|
| Line 242... |
Line 244... |
| 242 |
|
244 |
|
| 243 |
@Autowired
|
245 |
@Autowired
|
| 244 |
LoanRepository loanRepository;
|
246 |
LoanRepository loanRepository;
|
| 245 |
|
247 |
|
| 246 |
@Autowired
|
248 |
@Autowired
|
| - |
|
249 |
SDCreditService sdCreditService;
|
| - |
|
250 |
|
| - |
|
251 |
@Autowired
|
| 247 |
RbmTargetService rbmTargetService;
|
252 |
RbmTargetService rbmTargetService;
|
| 248 |
|
253 |
|
| 249 |
@Autowired
|
254 |
@Autowired
|
| 250 |
FofoUser fofoUser;
|
255 |
FofoUser fofoUser;
|
| 251 |
|
256 |
|
| Line 1964... |
Line 1969... |
| 1964 |
|
1969 |
|
| 1965 |
Map<Integer, Double> currentMonthTillDateRetailerPOValueMap = orderRepository.selectOrderValueBetweenDatesGroupByFofoId(new ArrayList<>(fofoIds),
|
1970 |
Map<Integer, Double> currentMonthTillDateRetailerPOValueMap = orderRepository.selectOrderValueBetweenDatesGroupByFofoId(new ArrayList<>(fofoIds),
|
| 1966 |
Arrays.asList(OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH, OrderStatus.SHIPPED_TO_LOGST, OrderStatus.DELIVERY_SUCCESS, OrderStatus.ACCEPTED, OrderStatus.SUBMITTED_FOR_PROCESSING),
|
1971 |
Arrays.asList(OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH, OrderStatus.SHIPPED_TO_LOGST, OrderStatus.DELIVERY_SUCCESS, OrderStatus.ACCEPTED, OrderStatus.SUBMITTED_FOR_PROCESSING),
|
| 1967 |
YearMonth.now().atDay(1).atStartOfDay(), LocalDateTime.now()).stream().collect(Collectors.toMap(x -> x.getId(), x -> x.getAmount()));
|
1972 |
YearMonth.now().atDay(1).atStartOfDay(), LocalDateTime.now()).stream().collect(Collectors.toMap(x -> x.getId(), x -> x.getAmount()));
|
| 1968 |
|
1973 |
|
| 1969 |
List<Loan> loans = loanRepository.selectAllActiveLoan().stream().filter(x -> fofoIds.contains(x.getFofoId())).collect(Collectors.toList());
|
- |
|
| 1970 |
Map<Integer, List<Loan>> loanMap = loans.stream().collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.toList()));
|
1974 |
Map<Integer, BulkCreditSummary> bulkSummaryMap = sdCreditService.getCreditSummaryBulk();
|
| 1971 |
Map<Integer, BigDecimal> totalDueMap = new HashMap<>();
|
1975 |
Map<Integer, BigDecimal> totalDueMap = new HashMap<>();
|
| 1972 |
for (Entry<Integer, List<Loan>> fofoIdLoanEntry : loanMap.entrySet()) {
|
- |
|
| 1973 |
List<Loan> Loans = fofoIdLoanEntry.getValue();
|
- |
|
| 1974 |
int fofoId = fofoIdLoanEntry.getKey();
|
1976 |
for (int fofoId : fofoIds) {
|
| 1975 |
BigDecimal totalDue = new BigDecimal(0);
|
1977 |
BulkCreditSummary summary = bulkSummaryMap.get(fofoId);
|
| 1976 |
for (Loan loan : Loans) {
|
1978 |
if (summary != null) {
|
| 1977 |
BigDecimal pendingAmount = loan.getPendingAmount();
|
- |
|
| 1978 |
BigDecimal interestAccrued = loan.getInterestAccrued();
|
- |
|
| 1979 |
BigDecimal interestPaid = loan.getInterestPaid();
|
1979 |
totalDueMap.put(fofoId, summary.getTotalDue());
|
| 1980 |
totalDue = totalDue.add(interestAccrued.subtract(interestPaid).add(pendingAmount));
|
- |
|
| 1981 |
}
|
1980 |
}
|
| 1982 |
totalDueMap.put(fofoId, totalDue);
|
- |
|
| 1983 |
}
|
1981 |
}
|
| 1984 |
|
1982 |
|
| 1985 |
|
1983 |
|
| 1986 |
//Only L3 and above can change the activationType
|
1984 |
//Only L3 and above can change the activationType
|
| 1987 |
|
1985 |
|