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

添加同步预约和注册用户类

parent d83cebef
...@@ -16,12 +16,17 @@ CREATE TABLE mortals_xhx_realtime_dataflow( ...@@ -16,12 +16,17 @@ CREATE TABLE mortals_xhx_realtime_dataflow(
`queueNum` varchar(255) NOT NULL COMMENT '排队编码', `queueNum` varchar(255) NOT NULL COMMENT '排队编码',
`location` varchar(255) NOT NULL COMMENT '办理位置', `location` varchar(255) NOT NULL COMMENT '办理位置',
`picture` varchar(255) COMMENT '识别截图', `picture` varchar(255) COMMENT '识别截图',
`picUri` varchar(255) COMMENT '相对图片pic',
`serverIndexCode` varchar(255) COMMENT '图片资源唯一标识',
`eventId` varchar(255) COMMENT '事件id',
`eventType` bigint(20) NOT NULL COMMENT '事件类型',
`createTime` datetime COMMENT '创建时间', `createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建人id', `createUserId` bigint(20) COMMENT '创建人id',
`updateTime` datetime COMMENT '更新时间', `updateTime` datetime COMMENT '更新时间',
`updateUserId` bigint(20) COMMENT '更新人id', `updateUserId` bigint(20) COMMENT '更新人id',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='人员发现记录'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='人员发现记录';
-- ---------------------------- -- ----------------------------
-- 预约签到记录表 -- 预约签到记录表
-- ---------------------------- -- ----------------------------
......
No preview for this file type
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 海康事件类型
*
* @author zxfei
*/
public enum HikAbilityEnum {
人脸识别事件("event_face_recognition", "人脸识别事件");
private String value;
private String desc;
HikAbilityEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static HikAbilityEnum getByValue(String value) {
for (HikAbilityEnum recognitionPlanTypeEnum : HikAbilityEnum.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 (HikAbilityEnum item : HikAbilityEnum.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
...@@ -4,21 +4,22 @@ import java.util.LinkedHashMap; ...@@ -4,21 +4,22 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
/** /**
* 海康事件类型 * 周五是否监测(0.否,1.是)枚举类
* *
* @author zxfei * @author zxfei
*/ */
public enum HikEventTypeEnum { public enum HikEventTypeEnum {
重点人员识别事件("event_face_recognition", "重点人员识别事件"); 重点人员识别事件(1644175361, "重点人员识别事件"),
private String value; 陌生人员识别事件(1644171265, "陌生人员识别事件");
private Integer value;
private String desc; private String desc;
HikEventTypeEnum(String value, String desc) { HikEventTypeEnum(Integer value, String desc) {
this.value = value; this.value = value;
this.desc = desc; this.desc = desc;
} }
public String getValue() { public Integer getValue() {
return this.value; return this.value;
} }
...@@ -26,10 +27,10 @@ public enum HikEventTypeEnum { ...@@ -26,10 +27,10 @@ public enum HikEventTypeEnum {
return this.desc; return this.desc;
} }
public static HikEventTypeEnum getByValue(String value) { public static HikEventTypeEnum getByValue(Integer value) {
for (HikEventTypeEnum recognitionPlanTypeEnum : HikEventTypeEnum.values()) { for (HikEventTypeEnum fridayEnum : HikEventTypeEnum.values()) {
if (recognitionPlanTypeEnum.getValue() == value) { if (fridayEnum.getValue() == value) {
return recognitionPlanTypeEnum; return fridayEnum;
} }
} }
return null; return null;
...@@ -41,12 +42,12 @@ public enum HikEventTypeEnum { ...@@ -41,12 +42,12 @@ public enum HikEventTypeEnum {
* @param eItem 不包含项 * @param eItem 不包含项
* @return * @return
*/ */
public static Map<String, String> getEnumMap(String... eItem) { public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>(); Map<String, String> resultMap = new LinkedHashMap<>();
for (HikEventTypeEnum item : HikEventTypeEnum.values()) { for (HikEventTypeEnum item : HikEventTypeEnum.values()) {
try { try {
boolean hasE = false; boolean hasE = false;
for (String e : eItem) { for (Integer e : eItem) {
if (item.getValue() == e) { if (item.getValue() == e) {
hasE = true; hasE = true;
break; break;
......
...@@ -44,6 +44,7 @@ import java.util.stream.Collectors; ...@@ -44,6 +44,7 @@ import java.util.stream.Collectors;
/** /**
* 同步预约人数。 * 同步预约人数。
* 定时每日执行,执行前删除当天已经同步的预约人
*/ */
@Slf4j @Slf4j
@Service("SyncAppointmentPersonTask") @Service("SyncAppointmentPersonTask")
...@@ -93,7 +94,6 @@ public class SyncAppointmentPersonTaskImpl implements ITaskExcuteService { ...@@ -93,7 +94,6 @@ public class SyncAppointmentPersonTaskImpl implements ITaskExcuteService {
if (restTotal.getCode() == YesNoEnum.YES.getValue()) { if (restTotal.getCode() == YesNoEnum.YES.getValue()) {
//同步今天预约用户 //同步今天预约用户
List<AppointmentDataItem> appointUserList = restTotal.getData().getData(); List<AppointmentDataItem> appointUserList = restTotal.getData().getData();
log.info("预约用户总数量:{}", appointUserList.size()); log.info("预约用户总数量:{}", appointUserList.size());
if (!ObjectUtils.isEmpty(appointUserList)) { if (!ObjectUtils.isEmpty(appointUserList)) {
//查询今天添加的预约 并删除 //查询今天添加的预约 并删除
...@@ -124,9 +124,8 @@ public class SyncAppointmentPersonTaskImpl implements ITaskExcuteService { ...@@ -124,9 +124,8 @@ public class SyncAppointmentPersonTaskImpl implements ITaskExcuteService {
return appointmentPersonEntity; return appointmentPersonEntity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(newUserList)) { if (!ObjectUtils.isEmpty(newUserList)) {
log.info("注册用户新增,size:{}", newUserList.size()); log.info("预约用户新增,size:{}", newUserList.size());
appointmentPersonService.save(newUserList); appointmentPersonService.save(newUserList);
} }
} }
......
...@@ -29,7 +29,7 @@ import java.util.List; ...@@ -29,7 +29,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 同步注册用户与预约人数 * 同步注册用户的证件照片
*/ */
@Slf4j @Slf4j
@Service("SyncRegisterUserPicTask") @Service("SyncRegisterUserPicTask")
......
...@@ -57,7 +57,8 @@ import java.util.Map; ...@@ -57,7 +57,8 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 同步注册用户与预约人数。 * 同步注册用户。
* 定时以一定时间间隔进行人员获取 定时时间要早于每日预约人数的同步时间
*/ */
@Slf4j @Slf4j
@Service("SyncRegisterUserTask") @Service("SyncRegisterUserTask")
...@@ -181,10 +182,10 @@ public class SyncRegisterUserTaskImpl implements ITaskExcuteService { ...@@ -181,10 +182,10 @@ public class SyncRegisterUserTaskImpl implements ITaskExcuteService {
personService.save(saveUserList); personService.save(saveUserList);
} }
if (!ObjectUtils.isEmpty(delUserList)) { // if (!ObjectUtils.isEmpty(delUserList)) {
log.info("注册用户删除,size:{}", delUserList.size()); // log.info("注册用户删除,size:{}", delUserList.size());
personService.remove(delUserList, null); // personService.remove(delUserList, null);
} // }
} }
......
...@@ -22,7 +22,7 @@ import org.springframework.util.ObjectUtils; ...@@ -22,7 +22,7 @@ import org.springframework.util.ObjectUtils;
import java.util.List; import java.util.List;
/** /**
* 同步用户,唯一标识为用户名。 * 同步门户用户,唯一标识为用户名。
*/ */
@Slf4j @Slf4j
@Service("SyncUserTask") @Service("SyncUserTask")
......
...@@ -41,7 +41,9 @@ import java.util.Date; ...@@ -41,7 +41,9 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 同步用户到海康指定库。 * 同步用户人脸数据到海康指定库。
* 时间间隔以同步注册用户之后
* 默认同步到一个人脸用户组,如要其它用户组 则页面上进行添加
*/ */
@Slf4j @Slf4j
@Service("SyncUserToHikTask") @Service("SyncUserToHikTask")
......
...@@ -17,7 +17,6 @@ public abstract class AbstractHikService { ...@@ -17,7 +17,6 @@ public abstract class AbstractHikService {
@Value("${hik.appSecret:''}") @Value("${hik.appSecret:''}")
protected String appSecret; protected String appSecret;
@Value("${hik.protocol:http://}") @Value("${hik.protocol:http://}")
protected String protocol; protected String protocol;
......
...@@ -7,6 +7,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig; ...@@ -7,6 +7,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.xhx.common.code.HikAbilityEnum;
import com.mortals.xhx.common.code.HikEventTypeEnum; import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.common.key.ParamKey; import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.hik.AbstractHikService; import com.mortals.xhx.module.hik.AbstractHikService;
...@@ -24,6 +25,7 @@ import org.springframework.stereotype.Service; ...@@ -24,6 +25,7 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 海康人员接口类 * 海康人员接口类
...@@ -111,35 +113,34 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent ...@@ -111,35 +113,34 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
//String similarity = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8"); //String similarity = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8");
Params params = req.getParams(); Params params = req.getParams();
if (HikEventTypeEnum.重点人员识别事件.getValue().equals(params.getAbility())) { if (HikAbilityEnum.人脸识别事件.getValue().equals(params.getAbility())) {
params.getEvents();
for (EventsItem event : params.getEvents()) { for (EventsItem event : params.getEvents()) {
//事件详细
String eventId = event.getEventId();
int eventType = event.getEventType();
EventData eventData = event.getData(); EventData eventData = event.getData();
//识别结果 //识别结果
FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult(); FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult();
//抓拍信息 //抓拍信息
Snap snap = faceRecognitionResult.getSnap(); Snap snap = faceRecognitionResult.getSnap();
//匹配的结果 if (HikEventTypeEnum.重点人员识别事件.getValue() == event.getEventType()) {
List<FaceMatchItem> faceMatchs = faceRecognitionResult.getFaceMatch(); //处理重点人员事件
for (FaceMatchItem faceMatch : faceMatchs) { //匹配的结果
List<FaceMatchItem> faceMatchs = faceRecognitionResult.getFaceMatch();
for (FaceMatchItem faceMatch : faceMatchs) {
//根据匹配结果 保存业务数据 todo
if (faceMatch.getSimilarity() > similarity) {
//保存当前识别结果到记录表中
}
}
} else if (HikEventTypeEnum.陌生人员识别事件.getValue() == event.getEventType()) {
//不论识别结果 保存流量数据 //不论识别结果 保存流量数据
RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity(); RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity();
realtimeDataflowEntity.setDetectTime(event.getHappenTime());
String resIndexCodes = eventData.getResInfo().stream().map(i -> i.getIndexCode()).collect(Collectors.joining(","));
realtimeDataflowEntity.setDevice(resIndexCodes);
realtimeDataflowEntity.setPicUri(eventData.getFaceRecognitionResult().getSnap().getFaceUrl());
realtimeDataflowEntity.setEventId(event.getEventId());
realtimeDataflowEntity.setEventType(HikEventTypeEnum.陌生人员识别事件.getValue().longValue());
// realtimeDataflowEntity.setPersonId();
// realtimeDataflowEntity.setName();
// realtimeDataflowEntity.setDevice();
// realtimeDataflowEntity.setDetectTime();
// realtimeDataflowEntity.setContact();
// realtimeDataflowEntity.setIdNumber();
// realtimeDataflowEntity.setIsBooking();
// realtimeDataflowEntity.setQueueNum();
// realtimeDataflowEntity.setLocation();
// realtimeDataflowEntity.setPicture();
// realtimeDataflowEntity.setOrderCols();
// realtimeDataflowEntity.setOrderColList();
realtimeDataflowEntity.setCreateUserId(1L); realtimeDataflowEntity.setCreateUserId(1L);
realtimeDataflowEntity.setCreateTime(new Date()); realtimeDataflowEntity.setCreateTime(new Date());
...@@ -149,14 +150,6 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent ...@@ -149,14 +150,6 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
realtimeDataflowEntity.initAttrValue(); realtimeDataflowEntity.initAttrValue();
//dataflowService.save() //dataflowService.save()
//根据匹配结果 保存业务数据 todo
if(faceMatch.getSimilarity()>similarity){
//保存当前识别结果到记录表中
}else {
//识别为陌生人 保存
}
} }
......
...@@ -33,8 +33,6 @@ import static com.mortals.framework.ap.SysConstains.*; ...@@ -33,8 +33,6 @@ import static com.mortals.framework.ap.SysConstains.*;
@RequestMapping("monitor/alarm") @RequestMapping("monitor/alarm")
public class MonitorAlarmController extends BaseCRUDJsonBodyMappingController<MonitorAlarmService,MonitorAlarmEntity,Long> { public class MonitorAlarmController extends BaseCRUDJsonBodyMappingController<MonitorAlarmService,MonitorAlarmEntity,Long> {
@Autowired
private ParamService paramService;
public MonitorAlarmController(){ public MonitorAlarmController(){
super.setModuleDesc( "监测预警记录"); super.setModuleDesc( "监测预警记录");
......
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