使用人脸识别离岗监测条件

  • 需要修改redis配置,将notify-keyspace-events的值修改为 Ehx 或者是 Ex (区分大小写)
  • 重启sys_menu

redis配置

  # It is possible to select the events that Redis will notify among a set
  # of classes. Every class is identified by a single character:
  #
  #  K     Keyspace events, published with __keyspace@<db>__ prefix.
  #  E     Keyevent events, published with __keyevent@<db>__ prefix.
  #  g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
  #  $     String commands
  #  l     List commands
  #  s     Set commands
  #  h     Hash commands
  #  z     Sorted set commands
  #  x     Expired events (events generated every time a key expires)
  #  e     Evicted events (events generated when a key is evicted for maxmemory)
  #  A     Alias for g$lshzxe, so that the "AKE" string means all the events.
  #
  #  The "notify-keyspace-events" takes as argument a string that is composed
  #  of zero or multiple characters. The empty string means that notifications
  #  are disabled.
  #
  #  Example: to enable list and generic events, from the point of view of the
  #           event name, use:
  #
  #  notify-keyspace-events Elg
  #
  #  Example 2: to get the stream of the expired keys subscribing to channel
  #             name __keyevent@0__:expired use:
  #
  #  notify-keyspace-events Ex
  #
  #  By default all notifications are disabled because most users don't need
  #  this feature and the feature has some overhead. Note that if you don't
  #  specify at least one of K or E, no events will be delivered.
  notify-keyspace-events Ehx

数据库设计

CREATE TABLE `pc_face_recognition_library` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `library_id` int(11) NOT NULL COMMENT '人脸识别库ID',
  `user_name` varchar(50) NOT NULL COMMENT '用户名',
  `job_number` varchar(50) DEFAULT '' COMMENT '工号',
  `user_name_code` varchar(255) NOT NULL COMMENT '姓名拼音',
  `gender` tinyint(1) NOT NULL DEFAULT '0' COMMENT '性别  0:男 1:女 2:未知',
  `profile_path` varchar(255) NOT NULL COMMENT '文件路径',
  `create_date` varchar(50) NOT NULL COMMENT '创建时间',
  `del_flag` int(11) DEFAULT '0' COMMENT '删除标记',
  `create_id` bigint(20) NOT NULL COMMENT '用户Id',
  `dept_id` bigint(20) DEFAULT NULL COMMENT '部门Id',
  `report_result` tinyint(1) NOT NULL COMMENT '人脸信息库上报结果  -1: 失败 0:不合格 1:成功 2:上报中',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=152 DEFAULT CHARSET=utf8 COMMENT='人脸识别人员库';

###################################################################
### pc_face_recognition_library 人脸库新增工号字段
###################################################################
ALTER TABLE `pc_face_recognition_library` 
MODIFY COLUMN `job_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '工号' AFTER `user_name`;

###################################
### pc_face_task 新增媒体播报信息
####################################
ALTER TABLE `pc_face_task`
ADD COLUMN `audio_type` int(2) NULL DEFAULT NULL COMMENT '模型媒体类型 0 MP3 1 文字转语音' AFTER `create_date`,
ADD COLUMN `audio_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'mp3地址' AFTER `audio_type`,
ADD COLUMN `audio_text` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文字转语音' AFTER `audio_url`,
MODIFY COLUMN `del_flag` int(2) NOT NULL DEFAULT 0 COMMENT '删除标记' AFTER `job_id`


###################################################
### pc_face_task_volume_device
##################################################
CREATE TABLE `pc_face_task_volume_device` (
  `id` int(11) NOT NULL COMMENT 'ID',
  `task_id` bigint(20) NOT NULL COMMENT '人脸识别任务ID',
  `device_id` int(11) NOT NULL COMMENT '音柱设备ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='人脸识别任务关联音柱';


###################################################
## sys_dict_data 离岗检测通道播放
###################################################
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3, '离岗检测通道播放', '2', 'pc_play_record_type', '', 'warning', 'Y', '0', 'admin', '2022-11-09 16:26:50', 'admin', '2022-11-09 16:27:24', '离岗检测播放');

###################################################
### sys_menu 新增音柱播报记录菜单
###################################################
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `url`, `target`, `menu_type`, `visible`, `is_refresh`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('音柱播报记录', 3193, 6, '/pc/pc_play_record/face', 'menuItem', 'C', '0', '1', NULL, '#', 'admin', '2022-11-09 16:48:47', '', NULL, '');


ALTER TABLE `pc_face_recognition_library` 
ADD COLUMN `report_result` tinyint(1) NOT NULL COMMENT '人脸信息库上报结果  -1: 失败 0:不合格 1:成功 2:上报中' AFTER `dept_id`

################################
########### 注意这条SQL  先查看该表现有数据的最大ID是多少,再进行添加,并且将下列所有的parent_id替换成该条记录的ID
################################

INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `url`, `target`, `menu_type`, `visible`, `is_refresh`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3149, '人脸识别库', 0, 99, '#', 'menuItem', 'M', '0', '1', NULL, '#', 'admin', '2022-09-28 16:17:15', '', NULL, '');

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人员库', '3149', '1', '/pc/library', 'C', '0', 'pc:library:view', '#', 'admin', sysdate(), '', null, '人员库菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人员库查询', @parentId, '1',  '#',  'F', '0', 'pc:library:list',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人员库新增', @parentId, '2',  '#',  'F', '0', 'pc:library:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人员库修改', @parentId, '3',  '#',  'F', '0', 'pc:library:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人员库删除', @parentId, '4',  '#',  'F', '0', 'pc:library:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人员库导出', @parentId, '5',  '#',  'F', '0', 'pc:library:export',       '#', 'admin', sysdate(), '', null, '');


CREATE TABLE `pc_device_has_library` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `device_id` int(11) NOT NULL COMMENT '设备ID',
  `library_id` int(11) NOT NULL COMMENT '库ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='人脸识别分类库关联设备'; 


CREATE TABLE `pc_face_classify_library` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `unique_code` varchar(255) NOT NULL COMMENT '唯一编码',
  `library_name` varchar(255) NOT NULL COMMENT '库名称',
  `description` varchar(255) NOT NULL COMMENT '描述',
  `del_flag` int(2) DEFAULT '0' COMMENT '删除标记',
  `create_id` int(11) DEFAULT NULL COMMENT '创建人ID',
  `create_date` varchar(20) DEFAULT NULL COMMENT '创建时间',
  `update_id` int(11) DEFAULT NULL COMMENT '更新人ID',
  `update_date` varchar(20) DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='人脸识别分类库';


-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别分类库', '3149', '1', '/pc/face_classify_library', 'C', '0', 'pc:recognition_library:view', '#', 'admin', sysdate(), '', null, '人脸识别分类库菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别分类库查询', @parentId, '1',  '#',  'F', '0', 'pc:face_classify_library:list',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别分类库新增', @parentId, '2',  '#',  'F', '0', 'pc:face_classify_library:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别分类库修改', @parentId, '3',  '#',  'F', '0', 'pc:face_classify_library:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别分类库删除', @parentId, '4',  '#',  'F', '0', 'pc:face_classify_library:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别分类库导出', @parentId, '5',  '#',  'F', '0', 'pc:face_classify_library:export',       '#', 'admin', sysdate(), '', null, '');



CREATE TABLE `pc_face_task` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `dept_id` bigint(20) NOT NULL COMMENT '部门ID',
  `library_id` bigint(11) DEFAULT NULL COMMENT '人脸分类库ID',
  `name` varchar(200) NOT NULL COMMENT '监控任务名称',
  `state` tinyint(1) NOT NULL COMMENT '监控任务状态: 0启用中,1禁用中',
  `date_type` tinyint(1) NOT NULL COMMENT '类型: 0指定周期,1指定日期  人脸识别默认1',
  `date_week` varchar(20) NOT NULL COMMENT '周期:2,3,4,5,6,7,1 表示周一到周日',
  `start_time` varchar(20) NOT NULL COMMENT '开始时间',
  `end_time` varchar(20) NOT NULL COMMENT '结束时间',
  `alarm_duration` int(11) NOT NULL DEFAULT '0' COMMENT '报警时长  单位:秒',
  `user_id` bigint(20) NOT NULL COMMENT '创建人ID',
  `create_date` varchar(20) NOT NULL COMMENT '创建时间',
  `audio_type` int(2) DEFAULT NULL COMMENT '模型媒体类型 0 MP3 1 文字转语音',
  `audio_url` varchar(255) DEFAULT NULL COMMENT 'mp3地址',
  `audio_text` varchar(1000) DEFAULT NULL COMMENT '文字转语音',
  `job_id` varchar(100) DEFAULT NULL COMMENT '任务id',
  `del_flag` int(2) NOT NULL DEFAULT '0' COMMENT '删除标记',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COMMENT='人脸识别任务';

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务', '3149', '1', '/pc/face_task', 'C', '0', 'pc:face_task:view', '#', 'admin', sysdate(), '', null, '人脸识别离岗任务菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务查询', @parentId, '1',  '#',  'F', '0', 'pc:face_task:list',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务新增', @parentId, '2',  '#',  'F', '0', 'pc:face_task:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务修改', @parentId, '3',  '#',  'F', '0', 'pc:face_task:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务删除', @parentId, '4',  '#',  'F', '0', 'pc:face_task:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务导出', @parentId, '5',  '#',  'F', '0', 'pc:face_task:export',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务导出', @parentId, '6',  '#',  'F', '0', 'pc:face_task:startAll',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别离岗任务导出', @parentId, '7',  '#',  'F', '0', 'pc:face_task:stopAll',       '#', 'admin', sysdate(), '', null, '');


CREATE TABLE `pc_face_task_device` (
  `id` bigint(11) NOT NULL AUTO_INCREMENT,
  `device_id` bigint(11) NOT NULL COMMENT '通道设备ID',
  `type` tinyint(1) NOT NULL COMMENT '类型 1:入口通道  2:出口通道',
  `face_task_id` int(11) NOT NULL COMMENT '任务ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COMMENT='人脸识别任务关联设备';

CREATE TABLE `pc_face_recognition_device` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `del_flag` int(2) DEFAULT NULL COMMENT '删除标记',
  `create_id` int(11) DEFAULT NULL COMMENT '创建人ID',
  `create_date` varchar(20) DEFAULT NULL COMMENT '创建时间',
  `update_id` int(11) DEFAULT NULL COMMENT '更新人ID',
  `update_date` varchar(20) DEFAULT NULL COMMENT '更新时间',
  `dept_id` int(11) NOT NULL COMMENT '部门ID',
  `name` varchar(30) NOT NULL COMMENT '通道名称',
  `ip` varchar(20) NOT NULL COMMENT '通道流IP',
  `port` int(11) NOT NULL COMMENT '通道流端口号',
  `user_name` varchar(20) NOT NULL COMMENT '流通道用户名',
  `password` varchar(50) NOT NULL COMMENT '通道流密码',
  `unique_code` varchar(32) NOT NULL COMMENT '通道唯一编码',
  `imei` varchar(30) DEFAULT NULL COMMENT '通道号',
  `app_status` int(2) DEFAULT NULL COMMENT '通道应用状态 0 激活 1 禁用',
  `online_status` int(2) DEFAULT NULL COMMENT '通道在线状态 0 在线 1 离线',
  `address` varchar(255) DEFAULT NULL COMMENT '通道详细地址',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='人脸识别设备表';

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理', '3149', '1', '/pc/face_recognition_device', 'C', '0', 'pc:face_recognition_device:view', '#', 'admin', sysdate(), '', null, '人脸识别设备管理菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理查询', @parentId, '1',  '#',  'F', '0', 'pc:face_recognition_device:list',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理新增', @parentId, '2',  '#',  'F', '0', 'pc:face_recognition_device:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理修改', @parentId, '3',  '#',  'F', '0', 'pc:face_recognition_device:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理删除', @parentId, '4',  '#',  'F', '0', 'pc:face_recognition_device:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理导出', @parentId, '5',  '#',  'F', '0', 'pc:face_recognition_device:export',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理导出', @parentId, '5',  '#',  'F', '0', 'pc:face_recognition_device:startAll',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别设备管理导出', @parentId, '5',  '#',  'F', '0', 'pc:face_recognition_device:stopAll',       '#', 'admin', sysdate(), '', null, '');

CREATE TABLE `pc_face_recognition_result` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `del_flag` int(2) DEFAULT '0' COMMENT '删除标记',
  `create_id` int(11) DEFAULT NULL COMMENT '创建人ID',
  `create_date` varchar(20) DEFAULT NULL COMMENT '创建时间',
  `update_id` int(11) DEFAULT NULL COMMENT '更新人ID',
  `update_date` varchar(20) DEFAULT NULL COMMENT '更新时间',
  `dept_id` int(11) DEFAULT NULL COMMENT '部门ID',
  `device_id` int(11) DEFAULT NULL COMMENT '人脸识别设备ID',
  `score` double(5,2) NOT NULL COMMENT '置信度',
  `exit_image_path` varchar(255) NOT NULL COMMENT '结果图片地址',
  `exit_result` varchar(255) DEFAULT NULL COMMENT '出口结果',
  `exit_time` varchar(20) DEFAULT NULL COMMENT '出口检测时间',
  `entrance_image_path` varchar(255) DEFAULT NULL COMMENT '入口图片',
  `entrance_result` varchar(255) DEFAULT NULL COMMENT '入口结果',
  `entrance_time` varchar(20) DEFAULT NULL COMMENT '入口检测时间',
  `result_type` tinyint(1) DEFAULT NULL COMMENT '是否离岗  1 离岗 0 未离岗',
  `task_id` bigint(20) NOT NULL COMMENT '任务ID',
  `face_id` int(11) DEFAULT NULL COMMENT '人脸ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='人脸识别结果表';

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别结果', '3149', '1', '/pc/face_recognition_result', 'C', '0', 'pc:face_recognition_result:view', '#', 'admin', sysdate(), '', null, '人脸识别结果菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别结果查询', @parentId, '1',  '#',  'F', '0', 'pc:face_recognition_result:list',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_taptype, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别结果新增', @parentId, '2',  '#',  'F', '0', 'pc:face_recognition_result:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别结果修改', @parentId, '3',  '#',  'F', '0', 'pc:face_recognition_result:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别结果删除', @parentId, '4',  '#',  'F', '0', 'pc:face_recognition_result:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('人脸识别结果导出', @parentId, '5',  '#',  'F', '0', 'pc:face_recognition_result:export',       '#', 'admin', sysdate(), '', null, '');

################################
########### 字典属性
################################

#是否离岗
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('是否离岗', 'leave_post_type', '0', 'admin', '2022-10-14 17:10:35', '', NULL, NULL);

INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, '离岗', '1', 'leave_post_type', '', 'danger', 'Y', '0', 'admin', '2022-10-14 17:11:11', 'admin', '2022-10-14 17:11:18', '');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2, '未离岗', '0', 'leave_post_type', '', 'primary', 'Y', '0', 'admin', '2022-10-14 17:11:38', 'admin', '2022-10-14 17:11:54', '');

#人脸信息上报回调
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('人脸库上报状态', 'face_report_result_callback', '0', 'admin', '2022-11-02 14:52:13', '', NULL, NULL);

INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, '信息上报失败', '-1', 'face_report_result_callback', NULL, 'danger', 'Y', '0', 'admin', '2022-11-02 14:52:48', '', NULL, NULL);
INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2, '人脸图片不合格', '0', 'face_report_result_callback', '', 'warning', 'Y', '0', 'admin', '2022-11-02 14:53:25', 'admin', '2022-11-02 15:00:44', '');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3, '正常', '1', 'face_report_result_callback', '', 'primary', 'Y', '0', 'admin', '2022-11-02 14:53:46', 'admin', '2022-11-02 15:00:39', '');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (4, '信息上报中', '2', 'face_report_result_callback', NULL, 'info', 'Y', '0', 'admin', '2022-11-02 14:54:16', '', NULL, NULL);

###################################################################
###  pc_face_recognition_device
###################################################################
ALTER TABLE `pc_face_recognition_device` 
ADD COLUMN `coordinate` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '通道识别框图坐标' AFTER `unique_code`

ALTER TABLE `pc_face_task`
ADD COLUMN `threshold` double NOT NULL DEFAULT 0 COMMENT '离岗检测阈值' AFTER `del_flag`;

ALTER TABLE `pc_face_recognition_result` 
ADD COLUMN `entrance_score` double(5, 2) NULL COMMENT '入口置信度' AFTER `score`;

初始化基础环境

#启用模型
python /AiBox/face_function/face_app.py  --port 10007  --works 2

docker run -idt --name  face2 --net=host -v /usr/local/server/aicsp/uploadPath:/usr/local/server/aicsp/uploadPath  --restart=always face_recognition:2.1.0  bash

#aicsp
docker run -idt --name aicsp -p 8091:8091 -v /usr/local/server/aicsp/:/usr/local/server/aicsp/  --restart=always aicsp:latest bash

#redis
docker run -itd --net=host  --name redis -p 6379:6379 -v /usr/local/docker/face_redis/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/face_redis/data:/data redis redis-server /etc/redis/redis.conf 
#mysql
docker run -idt --net=host --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=PcAiPass@2021! mysql:latest

docker run --net=host  --name mysql -p 3306:3306  -v /usr/local/docker/face_mysql/logs:/logs -v /usr/local/docker/face_mysql/data:/var/lib/mysql -v /usr/local/docker/face_mysql/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -e MYSQL_ROOT_PASSWORD=PcAiPass@2021! -d mysql:5.7

    public boolean checkTaskIsRunning(PcFaceTask pcFaceTask, String resultDate) {
        try {
            String[] baseWeek = pcFaceTask.getDateWeek().split(",");
            Calendar calendar = Calendar.getInstance();
            String[] dateToWeek = {String.valueOf(calendar.get(Calendar.DAY_OF_WEEK))}; //获取当前任务指定日期转化的星期
            String todayDate = DayUtils.getTodayDate();
            if (!DayUtils.isWeekOver(baseWeek, dateToWeek)) {
                return false;
            }

            //当前时间减去15分钟
            String startDateStr = todayDate + " " + pcFaceTask.getStartTime();
            String endDateStr = todayDate + " " + pcFaceTask.getEndTime();
            SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date startDate =sdf.parse(startDateStr);
            Date endDate =sdf.parse(endDateStr);
            endDate.setTime(endDate.getTime() + pcFaceTask.getAlarmDuration()*1000);
            String newEndDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endDate);
            //从当前日期减去15分钟
            calendar.add(Calendar.MINUTE, -15);
            return DayUtils.isOverlapping(resultDate, startDateStr, newEndDateStr);
        }catch (Exception e){

        }
    }

ALTER TABLE pc_face_recognition_library MODIFY COLUMN iframe_url text COMMENT ‘iframe_url’, AFTER user_name;

文档更新时间: 2023-12-18 03:25   作者:JeffreyCheung