Commit f87f1377 authored by 赵啸非's avatar 赵啸非

添加识别计划类

parent 5c27a53c
...@@ -316,5 +316,5 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '人员识别计划信息-菜 ...@@ -316,5 +316,5 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '人员识别计划信息-菜
-- ---------------------------- -- ----------------------------
-- 人员识别计划信息参数 SQL -- 人员识别计划信息参数 SQL
-- ---------------------------- -- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '识别计划的类型, BLACK_LIST-重点人员识别计划 WHITE_LIST-陌生人识别计划', 'FacePlan', 'recognitionPlanType', 'BLACK_LIST.重点人员识别计划', 'BLACK_LIST.重点人员识别计划', 1, 4, 0, 'recognitionPlanType', NULL, NULL, NULL); INSERT INTO `mortals_xhx_param` VALUES (null, '识别计划的类型, BLACK_LIST WHITE_LIST-陌生人识别计划', 'FacePlan', 'recognitionPlanType', '重点人员识别计划', '重点人员识别计划', 1, 4, 0, 'recognitionPlanType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '识别计划的类型, BLACK_LIST-重点人员识别计划 WHITE_LIST-陌生人识别计划', 'FacePlan', 'recognitionPlanType', 'WHITE_LIST.陌生人识别计划', 'WHITE_LIST.陌生人识别计划', 1, 4, 0, 'recognitionPlanType', NULL, NULL, NULL); INSERT INTO `mortals_xhx_param` VALUES (null, '识别计划的类型, BLACK_LIST WHITE_LIST-陌生人识别计划', 'FacePlan', 'recognitionPlanType', '陌生人识别计划', '陌生人识别计划', 1, 4, 0, 'recognitionPlanType', NULL, NULL, NULL);
...@@ -9,8 +9,8 @@ import java.util.Map; ...@@ -9,8 +9,8 @@ import java.util.Map;
* @author zxfei * @author zxfei
*/ */
public enum RecognitionPlanTypeEnum { public enum RecognitionPlanTypeEnum {
BLACK_LIST.重点人员识别计划("BLACK_LIST.重点人员识别计划", "BLACK_LIST.重点人员识别计划"), BLACK_LIST("BLACK_LIST", "重点人员识别计划"),
WHITE_LIST.陌生人识别计划("WHITE_LIST.陌生人识别计划", "WHITE_LIST.陌生人识别计划"); WHITE_LIST("WHITE_LIST", "陌生人识别计划");
private String value; private String value;
private String desc; private String desc;
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 识别计划的类型, BLACK_LIST-重点人员识别计划 WHITE_LIST-陌生人识别计划(BLACK_LIST.重点人员识别计划, WHITE_LIST.陌生人识别计划)枚举类
*
* @author zxfei
*/
public enum RecognitionResourceEnum {
SUPER_BRAIN("BLACK_LIST", "超脑"),
FACE_RECOGNITION_SERVER("FACE_RECOGNITION_SERVER", "脸谱"),
COMPARISON("COMPARISON", "深眸");
private String value;
private String desc;
RecognitionResourceEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static RecognitionResourceEnum getByValue(String value) {
for (RecognitionResourceEnum recognitionPlanTypeEnum : RecognitionResourceEnum.values()) {
if (recognitionPlanTypeEnum.getValue() == value) {
return recognitionPlanTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (RecognitionResourceEnum item : RecognitionResourceEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -8,8 +8,12 @@ public class ParamKey { ...@@ -8,8 +8,12 @@ public class ParamKey {
/** 物料编码长度,默认6 */ /** 物料编码长度,默认6 */
public static final String MATERIA_CODE_LENGTH = "iot:base:param:materia:length"; public static final String MATERIA_CODE_LENGTH = "iot:base:param:materia:length";
/** 默认人脸分组信息 */
public static final String PARAM_FACE_GROUP = "face_group"; public static final String PARAM_FACE_GROUP = "face_group";
/** 重点人员监控计划 */
public static final String PARAM_FACE_PLAN_BLACK = "plan_black";
/** 人脸识别阈值 */
public static final String PARAM_FACE_THRESHOLD = "face_threshold";
/** /**
* 系统参数:设备心跳间隔时间(单位:秒,默认值:60秒) * 系统参数:设备心跳间隔时间(单位:秒,默认值:60秒)
......
...@@ -6,16 +6,25 @@ import com.mortals.framework.ap.GlobalSysInfo; ...@@ -6,16 +6,25 @@ import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.springcloud.service.IApplicationStartedService; import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.framework.util.ThreadPool; import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.common.code.RecognitionPlanTypeEnum;
import com.mortals.xhx.common.code.RecognitionResourceEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.ParamKey; import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.face.model.FaceGroupEntity; import com.mortals.xhx.module.face.model.FaceGroupEntity;
import com.mortals.xhx.module.face.model.FaceGroupQuery; import com.mortals.xhx.module.face.model.FaceGroupQuery;
import com.mortals.xhx.module.face.model.FacePlanEntity;
import com.mortals.xhx.module.face.model.FacePlanQuery;
import com.mortals.xhx.module.face.service.FaceGroupService; import com.mortals.xhx.module.face.service.FaceGroupService;
import com.mortals.xhx.module.face.service.FacePlanService;
import com.mortals.xhx.module.hik.event.model.req.EventSubReq; import com.mortals.xhx.module.hik.event.model.req.EventSubReq;
import com.mortals.xhx.module.hik.event.model.rsp.EventInfo; import com.mortals.xhx.module.hik.event.model.rsp.EventInfo;
import com.mortals.xhx.module.hik.event.service.IHikEventService; import com.mortals.xhx.module.hik.event.service.IHikEventService;
import com.mortals.xhx.module.hik.face.model.req.group.FaceGroupReq; import com.mortals.xhx.module.hik.face.model.req.group.FaceGroupReq;
import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognBlackReq;
import com.mortals.xhx.module.hik.face.model.rsp.group.FaceGroupDataInfo; import com.mortals.xhx.module.hik.face.model.rsp.group.FaceGroupDataInfo;
import com.mortals.xhx.module.hik.face.service.IHikFaceService; import com.mortals.xhx.module.hik.face.service.IHikFaceService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -24,8 +33,10 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -24,8 +33,10 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Component @Component
...@@ -41,6 +52,11 @@ public class SubEventStartedService implements IApplicationStartedService { ...@@ -41,6 +52,11 @@ public class SubEventStartedService implements IApplicationStartedService {
private IHikFaceService hikFaceService; private IHikFaceService hikFaceService;
@Autowired @Autowired
private FaceGroupService faceGroupService; private FaceGroupService faceGroupService;
@Autowired
private FacePlanService facePlanService;
@Autowired
private DeviceService deviceService;
@Override @Override
...@@ -58,14 +74,12 @@ public class SubEventStartedService implements IApplicationStartedService { ...@@ -58,14 +74,12 @@ public class SubEventStartedService implements IApplicationStartedService {
Rest<List<EventInfo>> events = hikEventService.getEvents(); Rest<List<EventInfo>> events = hikEventService.getEvents();
log.info("get events resp==>{}", JSON.toJSONString(events)); log.info("get events resp==>{}", JSON.toJSONString(events));
//查询本地指定人脸分组 如果没有则添加 并更新 //查询本地指定人脸分组 如果没有则添加 并更新
String groupStr = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_GROUP, "注册群众"); String groupStr = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_GROUP, "注册群众");
List<String> groupList = StrUtil.split(groupStr, ",".charAt(0)); List<String> groupList = StrUtil.split(groupStr, ",".charAt(0));
for (String group : groupList) { for (String group : groupList) {
FaceGroupEntity faceGroupEntity = faceGroupService.selectOne(new FaceGroupQuery().name("注册群众")); FaceGroupEntity faceGroupEntity = faceGroupService.selectOne(new FaceGroupQuery().name(group));
if (ObjectUtils.isEmpty(faceGroupEntity)) { if (ObjectUtils.isEmpty(faceGroupEntity)) {
log.info("创建人脸分组..."); log.info("创建人脸分组...");
FaceGroupReq faceGroupReq = new FaceGroupReq(); FaceGroupReq faceGroupReq = new FaceGroupReq();
...@@ -85,6 +99,34 @@ public class SubEventStartedService implements IApplicationStartedService { ...@@ -85,6 +99,34 @@ public class SubEventStartedService implements IApplicationStartedService {
} }
} }
} }
//创建重点人员识别计划
String planBlackName = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_PLAN_BLACK, "取号监控");
int threshold = GlobalSysInfo.getParamIntValue(ParamKey.PARAM_FACE_THRESHOLD, 80);
FacePlanEntity facePlanEntity = facePlanService.selectOne(new FacePlanQuery().name(planBlackName));
if(ObjectUtils.isEmpty(facePlanEntity)){
//初始化新增取号监控识别计划
PlanRecognBlackReq planRecognBlackReq = new PlanRecognBlackReq();
planRecognBlackReq.setName(planBlackName);
planRecognBlackReq.setDescription(planBlackName);
planRecognBlackReq.setThreshold(threshold);
//设置人脸分组
FaceGroupEntity faceGroupEntity = faceGroupService.selectOne(new FaceGroupQuery().name("注册群众"));
List<String> faceGroupIndexCodes = new ArrayList<>();
faceGroupIndexCodes.add(faceGroupEntity.getIndexCode());
planRecognBlackReq.setFaceGroupIndexCodes(faceGroupIndexCodes);
//设置监控点
List<String> cameraIndexCodes = deviceService.find(new DeviceQuery()).stream().map(DeviceEntity::getDeviceCode).collect(Collectors.toList());
planRecognBlackReq.setCameraIndexCodes(cameraIndexCodes);
//设置识别方式
planRecognBlackReq.setRecognitionResourceType(RecognitionResourceEnum.COMPARISON.getValue());
}
//创建陌生人员识别计划
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment