gaoluyang
10 小时以前 f4ef6d1f4489e0d4cbba1845792945b924c16228
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
@@ -3,6 +3,8 @@
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractPageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractSaveReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractImportExcelVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractImportRespVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.contract.CrmContractTransferReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
@@ -10,6 +12,7 @@
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import jakarta.validation.Valid;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@@ -32,6 +35,14 @@
     * @return 编号
     */
    Long createContract(@Valid CrmContractSaveReqVO createReqVO, Long userId);
    /**
     * 导入合同
     *
     * @param importList 导入数据(每一行 = 一条明细,相同合同编号合并为一张合同)
     * @return 导入结果
     */
    CrmContractImportRespVO importContractList(List<CrmContractImportExcelVO> importList);
    /**
     * 更新合同
@@ -67,10 +78,18 @@
    /**
     * 发起合同审批流程
     *
     * @param id     合同编号
     * @param userId 用户编号
     * @param id                    合同编号
     * @param processDefinitionKey  流程定义 Key
     * @param userId                用户编号
     */
    void submitContract(Long id, Long userId);
    void submitContract(Long id, String processDefinitionKey, Long userId);
    /**
     * 获取合同审批流程列表
     *
     * @return 流程定义列表
     */
    List<Map<String, Object>> getContractApproveProcessDefinitionList();
    /**
     * 更新合同流程审批结果
@@ -87,6 +106,14 @@
     * @return 合同
     */
    CrmContractDO getContract(Long id);
    /**
     * 获得合同,基于合同编号
     *
     * @param no 合同编号
     * @return 合同
     */
    CrmContractDO getContractByNo(String no);
    /**
     * 校验合同是否合法
@@ -162,6 +189,26 @@
    Long getContractCountByCustomerId(Long customerId);
    /**
     * 批量统计各客户「已签订」的合同数量
     *
     * 「已签订」= 审批状态为审核通过的合同
     *
     * @param customerIds 客户编号集合
     * @return key:客户编号,value:合同数量。没有已签订合同的客户不在 map 中
     */
    Map<Long, Long> getContractCountMapByCustomerIds(Collection<Long> customerIds);
    /**
     * 批量统计各客户「已签订」的合同金额合计
     *
     * 「已签订」= 审批状态为审核通过的合同
     *
     * @param customerIds 客户编号集合
     * @return key:客户编号,value:金额合计。没有已签订合同的客户不在 map 中
     */
    Map<Long, BigDecimal> getContractPriceMapByCustomerIds(Collection<Long> customerIds);
    /**
     * 根据商机编号,获取关联客户的合同数量
     *
     * @param businessId 商机编号
@@ -202,4 +249,29 @@
     */
    List<CrmContractDO> getContractListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId);
    /**
     * 根据合同生成销售订单
     *
     * @param id     合同编号
     * @param userId 用户编号
     * @return 销售订单编号
     */
    Long generateSaleOrder(Long id, Long userId);
    /**
     * 更新合同状态
     *
     * @param id     合同编号
     * @param status 状态
     */
    void updateContractStatus(Long id, Integer status);
    /**
     * 根据销售订单编号更新合同状态
     *
     * @param orderId 销售订单编号
     * @param status  状态
     */
    void updateContractStatusByOrderId(Long orderId, Integer status);
}