123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- #ifndef FUNCONANDOFFJOB_H
- #define FUNCONANDOFFJOB_H
- #include "FuncBase.h"
- /**
- * @brief 在岗离岗检测
- 1、需要从“tChannel”表中获取在岗离岗的检测规则
- 2、理论上一个频率只有一个直播间,直播间内只要有人,且这个人是可以被人脸算法识别到的人,就是在岗
- *
- */
- /**
- * @brief 检测信息
- *
- */
- struct DecCondition
- {
- int ChannelID; /* 通道ID */
- std::string strChannelName; /* 通道名称 */
- int leaveTimeMaxNum; /* 离岗时间最大个数,给一个限制 */
- int leaveNumOnTime; /* 一定时间内的离岗次数 */
- int leaveOneTime; /* 单次离开报警时间,设置为0是不启用 */
- DecCondition();
- DecCondition(const DecCondition& other);
- DecCondition& operator=(const DecCondition& other);
- };
- /**
- * @brief 房间在岗信息
- *
- */
- struct RoomOnWorkInfo
- {
- bool bOnWork = false; /* 是否在岗 */
- int PKID; /* 主键ID,主要用来判断是否已经写入数据库 */
- int ChannelID; /* 通道ID */
- int RoomID; /* 房间ID */
- int CameraID; /* 摄像机ID */
- Enum_RoomType RoomType; /* 房间类型 */
- std::string strRoomName; /* 房间名称 */
- QDateTime StartTime; /* 开始时间 */
- QDateTime EndTime; /* 结束时间 */
- std::string strImagePath; /* 图片路径 */
- std::list<QDateTime> listLeaveTime; /* 离岗时间 */
- std::list<PersonInfo> listPersonInfo; /* 人员信息 */
- RoomOnWorkInfo();
- RoomOnWorkInfo& operator=(const RoomOnWorkInfo& other);
- RoomOnWorkInfo(const RoomOnWorkInfo& other);
- void clear();
- /* 添加人员信息,进行查重 */
- void addPersonInfo(const std::list<PersonInfo>& vecInfo);
- /* 更新在岗时间 */
- void updateOnWorkTime(const QDateTime& time);
- /* 获取人脸ID字符串 */
- std::string getFaceIDListString();
- /* 获取人脸名称字符串 */
- std::string getFaceNameListString();
- /* 获取离岗时间字符串 */
- std::string getLeaveTimeString();
- /* 获取人员最后在岗时间字符串 */
- std::string getLastOnWorkTimeString();
- /* 添加一次离岗时间 */
- void addOneLeaveTime(const QDateTime& time, int maxLeaveTime);
- /* 对离岗时间进行查重 */
- bool isLeaveTimeExist(const QDateTime& time);
-
- };
- class FuncOnAndOffJob : public FuncBase
- {
- public:
- FuncOnAndOffJob();
- ~FuncOnAndOffJob();
- protected:
- void task() override;
- private:
- /* 获取当前频率信息 */
- bool getCurrentFrequencyInfo(const int ChannelID, DecCondition& info);
- /* 人员在岗情况 */
- void onWorkProcess(RoomOnWorkInfo* pRoomOnWorkInfo, std::pair<const int, RoomCamActInfo>& roomInfo);
- /* 人员离岗情况 */
- void offWorkProcess(RoomOnWorkInfo* pRoomOnWorkInfo, std::pair<const int, RoomCamActInfo>& roomInfo);
- /* 删除离岗人员和未知人员信息 */
- void deleteNoWorkPerson(std::list<PersonInfo>& listPersonInfo);
- /* 获取当前直播间的摄像机名称列表 */
- std::list<std::string> getCameraNameList(const std::map<int, std::list<std::string>>& mapCameraAction);
- /* 创建报警记录 */
- // void createAlarmInfo(RoomOnWorkInfo* pRoomOnWorkInfo, std::pair<const int, RoomCamActInfo>& roomInfo, std::string actionDes, AlarmInfo& alarmInfo);
- private:
- ListAlarmInfo* m_pListAlarm = nullptr; /* 报警信息 */
- // std::map<int, ListAlarmInfo*> m_mapRoomPersonCount; /* 人员计数返回的信息,int是房间ID号 */
- // std::map<int, ListAlarmInfo*> m_mapRoomFaceInfo; /* 人脸识别返回的信息,int是房间ID号 */
- std::map<int, RoomOnWorkInfo*> m_mapRoomOnWorkInfo; /* 房间在岗信息 */
- DecCondition m_nowChnDetecRule; /* 当前频率的在岗离岗的检测规则 */
- RoomOnWorkInfo m_nowRoomOnWorkInfo; /* 当前房间在岗信息 */
- std::string m_strBaseInfo; /* 基础信息,主要是频率ID和房间ID */
- QDateTime m_curTime; /* 当前时间 */
- };
- #endif /* FUNCONANDOFFJOB_H */
|