package cn.iocoder.yudao.module.pms.service.iotopeationfill;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.IotModelTemplateAttrsRespVO;
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.*;
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotcountdata.IotCountDataDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecountdata.IotDeviceCountData;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO;

import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 运行记录填报 Service 接口
 *
 * @author 芋道源码
 */
public interface IotOpeationFillService {

    /**
     * 创建运行记录填报
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createIotOpeationFill(@Valid IotOpeationFillSaveReqVO createReqVO);

    /**
     * 更新运行记录填报
     *
     * @param updateReqVO 更新信息
     */
    void updateIotOpeationFill(@Valid IotOpeationFillSaveReqVO updateReqVO);

    /**
     * 删除运行记录填报
     *
     * @param id 编号
     */
    void deleteIotOpeationFill(Long id);

    int upFill1(IotOpeationFillSaveReqVO vo);
    int upFill2(IotOpeationFillSaveReqVO vo);

    /**
     * 获得运行记录填报
     *
     * @param id 编号
     * @return 运行记录填报
     */
    IotOpeationFillDO getIotOpeationFill(Long id);

    IotOpeationFillDO getFillById(IotOpeationFillDO fillDO);

    /**
     * 获得运行记录填报分页
     *
     * @param pageReqVO 分页查询
     * @return 运行记录填报分页
     */
    PageResult<IotOpeationFillDO> getIotOpeationFillPage(IotOpeationFillPageReqVO pageReqVO);

    List<IotOpeationFillDO> getFillDevices(List<Long> deviceIds);

    List<IotModelTemplateAttrsDO> getAttrsById(IotModelTemplateAttrsRespVO vo);

    int insertFill(List<IotOpeationFillDO> vo);

    List<IotOpeationFillDO> fillList(IotOpeationFillPageReqVO vo);

    List<IotOpeationFillDO> fillListByUserId(IotOpeationFillRespVO vo);

    /**
     * 查询 指定部门 指定日期的 瑞鹰日报
     * @param deptId 部门id
     * @param reportDateStr yyyy-MM-dd格式的日期
     * @return
     */
    IotOpeationFillDO selectRyFillReports(Long deptId, String reportDateStr);

    /**
     * 查询 指定部门 指定日期的 瑞恒日报
     * @param deptId 部门id
     * @param reportDateStr yyyy-MM-dd格式的日期
     * @return
     */
    IotOpeationFillDO selectRhFillReports(Long deptId, String reportDateStr);

    PageResult<IotOpeationFillDO> fillListPage(IotOpeationFillPageVO vo);

    void syncWordOrderData(List<Long> deviceIds, List<Long> oldDeptIds, Long deptId);

    List<IotOpeationFillDO> fillListByDeptId(IotOpeationFillRespVO vo);

    IotOpeationFillDO devListByOrderId(IotOpeationFillRespVO vo);

    List<IotOpeationFillDO> deviceList(IotOpeationFillRespVO vo);

    PageResult<IotOpeationFillOrderDO> fillList1(IotOpeationFillPageReqVO vo);

    List<IotOpeationFillDO> pdList1(IotOpeationFillDO vo);

    List<IotOpeationFillDO> flList(IotOpeationFillDO vo);

    PageResult<IotOpeationFillOrderDO> fillList2(IotOpeationFillPageReqVO vo,Collection<Long> deptIds);




    int insertLog(List<IotDeviceRunLogDO> logDO);


    int insertLog1(IotDeviceRunLogDO logDO);

    int updateLog(IotDeviceRunLogDO logDO);

    int updateSumLog(IotDeviceRunLogDO logDO);

    /**
     * 更新填写状态
     * @param vo
     * @return
     */
    int updateFill(IotOpeationFillSaveReqVO vo);

    /**
     * 批量更新状态
     * @param list
     * @return
     */

    int batchUpdateFill(List<IotOpeationFillSaveReqVO> list);

    List<IotOpeationFillRespVO> getFillList(IotOpeationFillRespVO vo);

    List<IotDeviceRunLogDO> getDeivceFillInfo(IotDeviceRunLogDO vo);

    IotDeviceRunLogDO getLogInfo(IotDeviceRunLogDO vo);

    IotDeviceRunLogDO getMaxFillInfo(IotDeviceRunLogDO vo);

    /**
     * 更新工单状态
     * @param vo
     * @return
     */
    int updateFillOrder(IotDeviceRunLogDO vo);

    int updateFillOrder1(IotDeviceRunLogDO vo);

    int updateFillOrder2(IotDeviceRunLogDO vo);




    List<IotOpeationFillDO> devList(IotOpeationFillDO fillDO);


    List<IotOpeationFillDO> orderList(IotOpeationFillDO fillDO);


    List<IotOpeationFillDO> delList(IotOpeationFillDO fillDO);

    int delRepeat(IotOpeationFillDO fillDO);

    int delRepeatOrder(IotOpeationFillDO fillDO);


    PageResult<IotOpeationFillOrderDO> fillRecords(IotOpeationFillPageReqVO vo);

    PageResult<IotDeviceRespVO> getFillDevices1(IotOpeationFillPageReqVO vo);

    PageResult<IotDeviceCountData> deviceCountList(IotOpeationFillPageReqVO vo);

    List<IotCountDataDO> countList(IotCountDataDO dataDO);

    List<IotCountDataDO> countDeviceList(IotCountDataDO dataDO);

    /**
     * 日报执行方法
     * @return
     */
    List<IotOpeationFillDO> reportMethod(List<IotOpeationFillOrderDO> orderList);

    IotOpeationFillDO isReport(IotOpeationFillDO fillDO);

    IotOpeationFillDO orderDO(IotOpeationFillDO fillDO);

    List<IotOpeationFillDO> reportList(IotOpeationFillDO fillDO);

    List<IotOpeationFillDO> reportList1(IotOpeationFillDO fillDO);

    IotDeviceRunLogDO reportData(IotDeviceRunLogDO runLogDO);



        // 批量查询已存在的日志
    List<IotDeviceRunLogDO> batchQueryExistingLogs(List<IotDeviceRunLogDO> logList);

        // 批量插入
    int batchInsertLogs(List<IotDeviceRunLogDO> logList);

        // 批量更新普通日志
    int batchUpdateLogs(List<IotDeviceRunLogDO> logList);

        // 批量更新累计日志
    int batchUpdateSumLogs(List<IotDeviceRunLogDO> logList);


    IotDeviceRunLogDO maxReportData(IotDeviceRunLogDO runLogDO);

    List<IotDeviceRunLogDO> batchQueryMaxReportData(List<IotDeviceRunLogDO> queryLogs);

    IotDeviceRunLogDO reportData1(IotDeviceRunLogDO runLogDO);

    IotDeviceRunLogDO getDesc(IotDeviceRunLogDO runLogDO);

    List<IotDeviceRunLogDO> batchGetDescByPointNames(Set<String> pointNameSet);

    Map<Long, Integer> batchGetIsReport(List<IotOpeationFillDO> queries);

    List<IotModelTemplateAttrsDO> getAttrsByIdBatch(List<IotModelTemplateAttrsRespVO> vos);

    List<IotDeviceRunLogDO> batchGetLogInfo(List<IotDeviceRunLogDO> queries);

    List<IotDeviceRunLogDO> batchGetMaxFillInfo(List<IotDeviceRunLogDO> queries);

    List<IotDeviceRunLogDO> batchReportData(List<IotDeviceRunLogDO> queries);

    Map<Long, IotOpeationFillDO> batchGetOrderDO(List<IotOpeationFillDO> queries);

    List<IotOpeationFillDO> reportList2(IotOpeationFillDO fillDO);

}