| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | |
| | | return receivablePlanMapper.selectReceivablePlanCountByRemind(userId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, BigDecimal> getOverdueAmountMapByCustomerIds(Collection<Long> customerIds) { |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | if (CollUtil.isEmpty(customerIds)) { |
| | | return result; |
| | | } |
| | | List<CrmReceivablePlanDO> overdueList = |
| | | receivablePlanMapper.selectOverdueListByCustomerIds(customerIds, LocalDateTime.now()); |
| | | for (CrmReceivablePlanDO plan : overdueList) { |
| | | result.merge(plan.getCustomerId(), plan.getPrice(), BigDecimal::add); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, Integer> getOverdueCountMapByCustomerIds(Collection<Long> customerIds) { |
| | | Map<Long, Integer> result = new HashMap<>(); |
| | | if (CollUtil.isEmpty(customerIds)) { |
| | | return result; |
| | | } |
| | | List<CrmReceivablePlanDO> overdueList = |
| | | receivablePlanMapper.selectOverdueListByCustomerIds(customerIds, LocalDateTime.now()); |
| | | for (CrmReceivablePlanDO plan : overdueList) { |
| | | result.merge(plan.getCustomerId(), 1, Integer::sum); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |