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

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

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