package com.qmth.sop.business.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.sop.business.bean.params.CrmDetailSopParam;
import com.qmth.sop.business.bean.result.CrmProjectResult;
import com.qmth.sop.business.entity.TBCrmDetail;
import com.qmth.sop.business.entity.TFCustomFlow;
import com.qmth.sop.common.enums.FlowStatusEnum;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * <p>
 * 派单明细表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2024-05-14
 */
public interface TBCrmDetailService extends IService<TBCrmDetail> {

    /**
     * 查找派单sop信息
     *
     * @param crmNo
     * @return
     */
    public CrmProjectResult sopVarInfo(String crmNo);

    /**
     * 派单明细sop变量保存
     *
     * @param crmDetailSopParam
     * @return
     */
    public boolean sopVarSave(CrmDetailSopParam crmDetailSopParam);

    /**
     * 派单明细sop导入
     *
     * @param file
     * @param crmNo
     * @return
     */
    public Map<String, String> sopExcelImport(MultipartFile file, String crmNo);

    /**
     * 查询派单明细sop信息列表
     *
     * @param iPage
     * @param crmNo
     * @return
     */
    public IPage<TBCrmDetail> list(IPage<Map> iPage, String crmNo);

    /**
     * 创建/编辑派单明细sop
     *
     * @param tbCrmDetail
     * @return
     */
    public boolean sopSave(TBCrmDetail tbCrmDetail);

    /**
     * 查询自定义流程
     *
     * @param crmNo
     * @return
     */
    public TFCustomFlow queryCustomFlow(String crmNo);

    /**
     * 派单明细sop发布
     *
     * @param id
     * @return
     */
    public boolean sopPublish(Long id) throws Exception;

    /**
     * 派单明细sop删除
     *
     * @param id
     * @return
     */
    public boolean sopDelete(Long id);

    /**
     * 根据sopNo查询派单明细
     *
     * @param sopNo
     * @return
     */
    public TBCrmDetail findBySopNo(String sopNo);

    /**
     * 根据id查询流程状态
     *
     * @param id
     * @return
     */
    public FlowStatusEnum findById(Long id);
}
