package com.jpsoft.shinestar.modules.base.service;

import cn.hutool.core.date.DateTime;
import cn.hutool.json.JSONObject;
import com.github.pagehelper.Page;
import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
import com.jpsoft.shinestar.modules.base.entity.PersonDeviceLog;
import com.jpsoft.shinestar.modules.base.entity.PersonDeviceRelation;
import com.jpsoft.shinestar.modules.base.entity.PersonInfo;
import com.jpsoft.shinestar.modules.common.dto.Sort;

import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author 墨鱼_mo
 * @date 2020-3-15 14:12
 */
public interface PersonDeviceLogService {
    /**
     * 设备自动上传的过人记录
     * @param deviceNo
     * @param temperature
     * @param faceImageJson
     * @param libMatInfoListJson
     * @param matchPersonInfo
     */
    String deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date, Integer maskFlag, String faceImageUrl);
    Page<PersonDeviceLog> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
    List<PersonDeviceLog> pageList(Map<String, Object> searchParams, List<Sort> sortList);
    List<PersonDeviceLog> findByPersonAndDate(Long personId, Date startDate, Date endDate);
    Page<PersonDeviceLog> simplePageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
    PersonDeviceLog get(String id);
    List<Long> queryUnAttendanceList(String companyCode, Date startTime, Date endTime, List<String> excludeCompanyList);
    List<Long> queryAttendanceList(String companyCode, Date startDate, Date endDate, List<String> excludeCompanyList);
    PersonDeviceLog findLastPersonLog(Long personId, float temperatureMax);
    Integer getDayCheckedVistorNumByDeviceNoList(Date startTime, Date endTime, List<String> deviceNoList);
    Page<PersonDeviceLog> findLastPersonLogByCompanyList(DateTime beginOfDay, DateTime endOfDay, List<CompanyInfo> list, int pageNum, int pageSize);
    Page<PersonDeviceLog> findVisitorLogByDeviceNoList(DateTime beginOfDay, DateTime endOfDay, List<String> deviceNoList, int pageIndex, int pageSize);
    Page<PersonDeviceLog> findVisitorLogByDeviceNoList(DateTime beginOfDay, DateTime endOfDay, List<String> deviceNoList, int pageIndex, int pageSize, String filter, BigDecimal max);

    Page<PersonDeviceLog> findAllPersonLogByDeviceNo(DateTime beginOfDay, DateTime endOfDay, String deviceList, int pageIndex, int pageSize);

    Page<PersonDeviceLog> findAllPersonLogByCompanyListAndDeviceNoList(DateTime beginOfDay, DateTime endOfDay, List<CompanyInfo> companyList, List<String> deviceList, int pageIndex, int pageSize);
    Page<PersonDeviceLog> findLastTeacherLogByCompanyList(Date beginOfDay, Date endOfDay, List<CompanyInfo> list, int pageIndex, int pageSize);
    Page<PersonDeviceLog> findLastStudentLogByCompanyList(Date beginOfDay, Date endOfDay, List<CompanyInfo> list, int pageIndex, int pageSize);
    Integer getDayCheckedPersonTotalByCompanyList(Date startTime, Date endTime, List<CompanyInfo> list, String popedom);
    List<PersonDeviceLog> findExpiredVisitorRecord(int limit);
    int delete(String id);
    long countByAttendance(String companyCode, Date beginDate, Date endDate);
    Integer getDayAbnormalNumByDeviceNoList(DateTime dateTime, Date date, List<String> deviceNoList);
    String insertLog(String deviceNo, PersonInfo personInfo, BigDecimal temperature, String faceImageUrl, Date recordDate, int matchStatus, String matchMsg, int matchFaceId);

    PersonDeviceLog findByPersonAndRecordTime(Long personId, Date recordTime);

    List<Long> queryAttendanceListByCompanyId(String companyId, Date startDate, Date endDate);

    List<Long> queryUnAttendanceListByCompanyId(String companyId, Date startDate, Date endDate);

    List<PersonDeviceLog> findByPersonAndDateAndScene(Long id, Date beginTime, Date endTime, String scene);


    int importData() throws ParseException;

    int insert(PersonDeviceLog model);
    int update(PersonDeviceLog model);
}
