package com.casic.missiles.modular.alarm.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.casic.missiles.core.datascope.DataScope;
import com.casic.missiles.modular.system.dto.UserClientView;
import com.casic.missiles.modular.system.model.AlarmJob;

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

/**
 * <p>
 * 报警工单表 服务类
 * </p>
 *
 * @author casic123
 * @since 2019-05-17
 */
public interface IAlarmJobService extends IService<AlarmJob> {
    List<Map<String,Object>> jobList( Page<Map<String,Object>> page, String keywords, String beginTime, String endTime, String jobStatus, String alarmType,String alarmContent, DataScope dataScope,Long userId);
    List<Map<String,Object>> jobListApp( Page<Map<String,Object>> page, String keywords, String beginTime, String endTime, String jobStatus, String alarmType,String alarmContent,Long deptId,Long userId,Long leaderId);
    // List<AlarmJob> jobListExport( Page<AlarmJob> page, String keywords, String beginTime,  String endTime,  String jobStatus, String alarmType,String alarmContent, DataScope dataScope);

    List<Map<String,Object>> jobListDelayRe( Page<Map<String,Object>> page, String keywords, String beginTime, String endTime, String alarmType,String alarmContent, DataScope dataScope,Long userId);
    List<Map<String,Object>> jobListDelayReApp( Page<Map<String,Object>> page, String keywords, String beginTime, String endTime, String alarmType,String alarmContent, Long deptId,Long userId,Long leaderId);

    List<Map<String,Object>> jobListDelayPro( Page<Map<String,Object>> page, String keywords, String beginTime,  String endTime,  String alarmType,String alarmContent, DataScope dataScope,Long userId );
    List<Map<String,Object>> jobListDelayProApp( Page<Map<String,Object>> page, String keywords, String beginTime,  String endTime,  String alarmType,String alarmContent, Long deptId,Long userId,Long leaderId);

    List<Map<String,Object>> jobListSearch(Page<Map<String,Object>> page, String keywords, String alarmLevel, String alarmContent, String jobStatus, String beginTime,String endTime,
                                              String getJobBeginTime, String getJobEndTime, String shouldGetBeginTime, String shouldGetEndTime, String handleJobBeginTime, String handleJobEndTime,
                                              String shouldHandleBeginTime, String shouldHandleEndTime, DataScope dataScope,Long userId);
    List<Map<String,Object>> jobListSearchApp(Page<Map<String,Object>> page, String keywords, String alarmLevel, String alarmContent, String jobStatus, String beginTime,String endTime,
                                           String getJobBeginTime, String getJobEndTime, String shouldGetBeginTime, String shouldGetEndTime, String handleJobBeginTime, String handleJobEndTime,
                                           String shouldHandleBeginTime, String shouldHandleEndTime, Long deptId, Long userId, Long leaderId);
    List<Map<String,Object>> jobInfo(int id, DataScope dataScope,Long personId);
    boolean getJob(int id, long personId);
    boolean confirmJob(int id,long personId,String firstState, String firstStatePhotos, String needHandle);
    boolean transferJob(int id, long transferPerson,String flowRec);
    boolean saveJob( int id,String handleMessage, String handlePhotos);
    boolean overJob( int id,long personId, String handleMessage, String handlePhotos);
    boolean overAlarm( int id);
    boolean handleJob(int id,long personId);

    Map<String,Object> countByJobStatus(long deptId,int spanDays);
    Map<String,Object> countMyJob(long userId,long deptId,int spanDays);

    boolean checkJobStatus(String jobStatus);
    boolean checkPcRole(Set<String> roleTips);

    Integer countByDataScope(DataScope dataScope,String alarmType, String jobStatus,String beginTime,String endTime);
    Integer countByResponse(String alarmType,String jobStatus,Long deptId,String beginTime,String endTime);
    Integer countByUser(String alarmType,String jobStatus,Long userId,String beginTime,String endTime);

    void updateSinkJob(String id,String msg,String wellCode);
    List<UserClientView> selectUserByWellCode(String wellCode);
    String selectClientIdByUser(Long userId);
}
