xiaoyi
3 天以前 abf1c0a35d85d38239ff5d2ed746a4e4b797c9d1
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
@@ -24,8 +24,12 @@
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;
@@ -36,7 +40,7 @@
/**
 * 回款计划 Service 实现类
 *
 * @author 芋道源码
 * @author 超级管理员
 */
@Service
@Validated
@@ -185,4 +189,32 @@
        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;
    }
}