/*
 * Author: wangjian
 * 生成Service
 */
package com.tofly.gpsboot.service.maintain;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.gpsboot.strategy.ExcelStrategy;
import com.tofly.pojo.maintain.dto.RepairorderDto;
import com.tofly.pojo.maintain.dto.RepairuserChildDto;
import com.tofly.pojo.maintain.vo.AuxiliarySingleVo;
import com.tofly.pojo.maintain.vo.RepairorderVo;
import com.tofly.pojo.maintain.vo.datail.RepairOrderDetailNewVo;
import com.tofly.pojo.maintain.vo.datail.RepairOrderDetailVo;
import com.tofly.gpsboot.exception.BusinessException;
import com.tofly.gpsboot.service.IBaseService;
import com.tofly.pojo.maintain.Repairorder;
import com.tofly.pojo.maintain.vo.datail.RepairOrderOverVo;
import org.springframework.web.multipart.MultipartFile;

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

/**
 * 抢维修工单信息表
 *
 * @author admin
 * @date Tue Apr 06 00:00:00 CST 2021
 */
public interface RepairorderService extends IBaseService<Repairorder, RepairorderVo>, ExcelStrategy {

    /**
     * 分页查询
     *
     * @param page
     * @param parDto
     * @return
     */
    Page<RepairorderVo> getRepairOrderPage(Page page, RepairorderDto parDto);

    /**
     * 新增基本和详情信息
     *
     * @param fileList
     * @param parDto
     * @throws BusinessException 抛出新增的详情为空
     */
    Repairorder savaPlanInfo(List<MultipartFile> fileList, RepairorderDto parDto) throws BusinessException;

    /**
     * 新增处理多个个人任务
     *
     * @param plan
     * @param repairUserChildDtoList
     * @param flag                   是否派工
     */
    void addRepairUserList(Repairorder plan, List<RepairuserChildDto> repairUserChildDtoList, Boolean flag);

    /**
     * 派工处理
     *
     * @param repairorder
     * @return
     */
    boolean dispatching(Repairorder repairorder);

    /**
     * 根据id 获取任务信息
     *
     * @param id
     * @return
     * @throws BusinessException
     */
    RepairOrderDetailVo getPlanInfo(Long id, String flag) throws BusinessException;

    /**
     * 修改基本和详情信息
     *
     * @param fileList
     * @throws BusinessException 抛出更新当前数据不存在
     */
    void updatePlanInfo(List<MultipartFile> fileList, RepairorderDto parDto) throws BusinessException;

    /**
     * 单个删除或批量删除信息
     *
     * @param idList
     * @throws BusinessException 抛出删除对象不存在
     */
    void deletePlanInfo(List<Long> idList) throws BusinessException;

    /**
     * 根据年计划详情生成对应工单列表
     *
     * @param yearId
     * @return
     */
    List<Repairorder> generateRepairOrder(Long yearId);

    /**
     * 工单驳回
     *
     * @param repairOrderId
     * @param notes
     * @return
     */
    Boolean orderRejected(Long repairOrderId, String notes);

    /**
     * 工单转发
     *
     * @param repairOrderId
     * @param forwardingUserId
     * @param notes
     * @return
     */
    Boolean orderForwarding(Long repairOrderId, Long forwardingUserId, String notes);

    /**
     * 根据年计划id月份 获取派工人id
     *
     * @param yearId
     * @param month
     * @return
     */
    Long getDispatchingId(Long yearId, String month);

    /**
     * 获取当前用户部门今天已签到的所有用户最新位置信息列表
     *
     * @return
     */
    List<AuxiliarySingleVo> getAuxiliarySingle(String deptIds);


    List<AuxiliarySingleVo> getAuxiliarySingle(Long deptId,String flag);


    /**
     * 终止抢维修工单
     *
     * @param orderId
     * @return
     */
    Boolean terminationRepairOrder(String orderId);

    /**
     * 获取新工单详情
     * @param orderId
     * @return
     */
    RepairOrderDetailNewVo getRepairOrderDetailNewVo(Long orderId);

    List<RepairorderVo> getWorkOrdersByDevice(String equipmentCode);

    List<RepairOrderOverVo> getRepairOrderOverVo();

    Map<String, Object> getRepairOrderReport(String yearAndMonth);

}
