package com.yeejoin.amos.supervision.business.service.intfc;

import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.supervision.business.dto.CheckDto;
import com.yeejoin.amos.supervision.business.dto.CheckInputItemDto;
import com.yeejoin.amos.supervision.business.dto.CheckRecordDto;
import com.yeejoin.amos.supervision.business.entity.mybatis.*;
import com.yeejoin.amos.supervision.business.param.*;
import com.yeejoin.amos.supervision.business.util.CheckDetailInputPageParam;
import com.yeejoin.amos.supervision.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.supervision.business.vo.CheckInfoVo;
import com.yeejoin.amos.supervision.business.vo.CheckVo;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.supervision.core.common.response.CommonPage;
import com.yeejoin.amos.supervision.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.supervision.core.common.response.QueryCriteriaRespone;
import com.yeejoin.amos.supervision.dao.entity.CheckShot;
import com.yeejoin.amos.supervision.exception.YeeException;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;

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

public interface ICheckService {
    /**
     * 计划执行记录查询
     *
     * @param commonPageable
     * @param param
     * @return
     */
    Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param);

    void saveCheckImg(List<CheckShot> imgList);

//    CheckDto saveCheckRecord(CheckRecordParam requestParam, AgencyUserModel user, DepartmentBo departmentModel, Toke token);

    /**
     * 巡检记录删除
     *
     * @param ids
     */
    @Transactional(rollbackFor = {YeeException.class, Exception.class})
    void delCheckById(List<Long> ids);

    /**
     * 获取检查结果中所有不合格检查项
     *
     * @param checkId
     * @return
     */
    List<Map> queryUnqualifiedInputItem(int checkId);

    AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId);

    AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId);

    /**
     * 巡检统计
     *
     * @param requestParam
     * @return
     */
    Map<String, Object> checkCalendar(CheckRecordParam requestParam);

    /**
     * 根据点ID查询点巡检记录 手机APP
     *
     * @param req
     * @return
     */
    Map<String, Object> queryRecordByPointId(HashMap<String, Object> req);

    /**
     * 查询巡检记录详情
     *
     * @param checkId
     * @return
     */
    Map<String, Object> queryRecordById(int checkId);

    List<CheckInfoVo> getCheckInfoList(String toke, String product, String appKey, CheckInfoPageParam param);

    /**
     * 查询巡检记录所有图片
     *
     * @param param
     * @return
     */
    List<Map<String, Object>> getCheckInfoImgsList(CheckInfoPageParam param);

    /**
     * 根据巡检ID获取图片
     *
     * @param ids
     * @return
     */
    List<Map<String, Object>> getCheckInfoImgsList(Long[] ids);

    /**
     * 根据id获取巡检记录
     *
     * @param ids
     * @return
     */
    List<CheckInfoVo> getSelectedCheckInfoList(String toke, String product, String appKey, Long[] ids);

    /**
     * 本月隐患治理趋势统计
     *
     * @param paramMap
     * @param dateMonth
     * @return
     */
    List<HashMap<String, Object>> getCountMonthChkByRole(HashMap<String, Object> paramMap, String dateMonth);

    /**
     * 风险点信息列表查询条件
     *
     * @param companyId
     * @param userInfo
     * @return
     */
    QueryCriteriaRespone getQueryCriteriaInit(String toke, String product, String appKey, String loginOrgCode, String roleTypeName, String departmentId, String companyId);

    List<HashMap<String, String>> getCalCountChkInfo(HashMap<String, Object> paramMap);

    /**
     * 获取用户
     *
     * @param paramsMap
     * @return
     */
    List<CheckUserBo> getAuthUserInfo(HashMap<String, Object> paramsMap);

    /**
     * 根据参数获取巡检记录巡检项
     *
     * @param param
     * @return
     */
    CommonPage<CheckInputBo> getCheckInputByCheckId(CheckDetailInputPageParam param);

    /**
     * 根据参数获取装备巡检记录巡检项
     *
     * @param param
     * @return
     */
    List<HashMap<String, Object>> getEquipInputByCheckId(CheckDetailInputPageParam param);

    /**
     * 根据巡检记录ID和巡检点ID获取巡检记录详情
     *
     * @param param
     * @return
     */
    CheckDetailBo getCheckDetailById(CheckDetailInputPageParam param);

    /**
     * 根据巡检记录ID获取巡检记录图片信息
     *
     * @param checkID
     * @return
     */
    List<String> getCheckInputPhotoById(Long checkID);

    /**
     * 获取巡检轨迹
     *
     * @param params
     * @return
     */
    Page<CheckTraListBo> getCheckTraList(CheckPtListPageParam params);


    /**
     * 计划路线点最新巡检记录查询
     *
     * @param params
     * @return
     */
    List<PlanRoutePointBo> getRoutePlanPointList(CheckPtListPageParam params);

    /**
     * 根据类型初始化查询条件
     *
     * @param type
     * @param user
     * @return
     */
    QueryCriteriaRespone findCheckSystemInit(String toke, String product, String appKey, String type, String orgCode, String roleTypeName, String departmentId, String companyId);

    /**
     * 巡检记录查询
     *
     * @param params
     * @return
     */
    Page<CheckInfoBo> getCheckInfoList(CheckInfoListPageParam params);

    Page<Map<String, Object>> getCheckInfoList1(String toke, String product, String appKey, CheckInfoListPageParam params);

    /**
     * 视图模块初始化数据
     *
     * @return
     */
    public GraphInitDataResponse getViewModuleInitData();

    /**
     * 巡检情况统计分析
     *
     * @param queryRequests
     * @return
     */
    List<CheckAnalysisVo> getCheckStatisticalAnalysis(String toke, String product, String appKey, CheckStatisticalParam queryRequests);

    /**
     * 根据orgcODE获取巡检累计个数
     *
     * @param loginOrgCode
     * @return
     */
    long getCumulativeCheckCountByOrgCode(String loginOrgCode);

    /**
     * 根据条件查询日巡检统计情况
     *
     * @param param
     * @return
     */
    List<Long> getCheckDataCount(HashMap<String, Object> param);

    List<String> getCheckPhotosByCheckAndInputId(int checkId, int checkInputId, int classifyId);

    List<String> getLivePhotos(Long checkID);

    List<Long> getPlanCheckDataCount(HashMap<String, Object> param);

    /**
     * 查询巡检装备
     *
     * @param param
     * @return
     */
    List<HashMap<String, Object>> getEquipByCheckId(CheckDetailInputPageParam param);

    /**
     * 最近一次漏检记录
     *
     * @param relationId 关系id
     * @return CheckRecordDto
     */
    Map<String, CheckRecordDto> obtainLastCheckRecord(String[] relationId);

    Page<HashMap<String, Object>> getPlanExecuteInfo(HashMap<String, Object> map, CommonPageable page);

    List<Map<String, Object>> getPlanExecuteStates();

    List<Map<String, Object>> getPlanExecuteTeams();

    /**
     * 保存检查记录
     *
     * @param recordParam 填写记录
     * @param reginParams 权限信息
     * @return CheckDto
     */
    List<CheckInputItemDto>  saveCheckRecord(CheckRecordParam recordParam, ReginParams reginParams) throws Exception;

    /**
     * 校验是否已经填写过
     *
     * @param planTaskId
     * @param pointId
     * @return
     */
    int checkHasRecord(Long planTaskId, Long pointId);

    Page<CheckVo> queryPage(CheckPageParam criterias);

    List<String> getPictureByCheckId(String checkId);
}
