package com.ho.flow.service;

import org.activiti.engine.runtime.ProcessInstance;

import java.util.List;
import java.util.Map;

/**
 * @author fancl
 * @desc: 工单的工作流
 * @date 2023/1/23
 */
public interface FlowWorkOrderService {

    /**
     * 开启一个流程
     * @param processDefinitionKey
     * @param tenantId
     * @param businessKey
     * @param variables
     */
    ProcessInstance startProcess(String processDefinitionKey, String businessKey, Map<String, Object> variables, String tenantId);

    /**
     * 查询待分配或待验收的列表
     * 返回的是对应的Map<key:业务id, value:taskId>
     * @param category
     * @param assignType 任务类型 canDistributeOrder canCheckOrder
     * @param stationIds
     * @param tenantId
     */
    Map<String, String> queryToBeDoneMap(String category, String assignType,List<String> candidateUsers, List<String> stationIds, String tenantId);

    /**
     * 查询个人任务列表
     * 返回 businessKey(即orderId) , taskId
     * @param category
     * @param assignee
     * @param tenantId
     * @return
     */
    Map<String, String> queryPersonalTask(String category ,String assignee, String tenantId);

    //从几个map中汇总业务id, 即 订单id
    List<String> getOrderIdList(Map<String,String> toDistributeMap,Map<String,String> toDoMap,Map<String,String> toCheckMap);

    //完成节点任务,
    void completeTask(String taskId, Map<String, Object> variables);

    /**
     * 判断岗位是否和 配置的匹配 匹配返回true , 否则返回false
     * @param positions
     * @param postConfig
     * @return
     */
    boolean matchPermit(List<String> positions , String[] postConfig);

    //整型元素转为字符串元素
    List<String> intToString(List<Integer> intList);
}
