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

添加服务追踪

parent 59f8655d
package com.mortals.xhx.busiz.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.event.model.req.callback.EventRecognBlackReq;
import com.mortals.xhx.module.hik.event.service.IHikEventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -22,13 +20,13 @@ public class HikCallbackController {
@PostMapping("eventRcv")
@UnAuth
public Rest<String> refreshMessage(@RequestBody EventRecognBlackReq req) {
log.info("【接收事件数据】【请求体】--> " + JSONObject.toJSONString(req));
public Rest<String> refreshMessage(@RequestBody String req) {
log.info("【接收事件数据】【请求体】--> {}", req);
try {
if ("OnEventNotify".equals(req.getMethod())) {
/* if ("OnEventNotify".equals(req.getMethod())) {
Rest<String> rest = hikEventService.handleEvent(req);
return rest;
}
}*/
return Rest.ok("接收成功");
//todo
......
......@@ -63,7 +63,7 @@ public class SubEventStartedService implements IApplicationStartedService {
public void start() {
ThreadPool.getInstance().init(20);
log.info("开始服务..[事件订阅服务]");
String eventtypes = GlobalSysInfo.getParamValue(Constant.PARAM_EVENTTYPES, "1644175361");
String eventtypes = GlobalSysInfo.getParamValue(Constant.PARAM_EVENTTYPES, "131614,131659,1644175361,1644171265");
List<Integer> eventTypes = StrUtil.split(eventtypes, ",".charAt(0), -1, false, Integer::parseInt);
EventSubReq eventSubReq = new EventSubReq();
......
......@@ -121,15 +121,10 @@ public class FacePlanServiceImpl extends AbstractCRUDServiceImpl<FacePlanDao, Fa
//设置监控点
List<String> cameraIndexCodes = deviceService.find(new DeviceQuery()).stream().distinct().map(DeviceEntity::getDeviceCode).collect(Collectors.toList());
// ArrayList<String> temp = new ArrayList<>();
//temp.add(cameraIndexCodes.get(0));
planRecognWhiteReq.setCameraIndexCodes(cameraIndexCodes);
//设置识别方式
planRecognWhiteReq.setRecognitionResourceType(RecognitionResourceEnum.SUPER_BRAIN.getValue());
// List<String> faceGroupIndexCodes = new ArrayList<>();
ResourceReq resourceReq = new ResourceReq();
resourceReq.setRecognitionResourceType(RecognitionResourceEnum.SUPER_BRAIN.getValue());
Rest<List<ResourceDataInfo>> resourceRecognition = hikFaceService.getResourceRecognition(resourceReq);
......@@ -137,16 +132,8 @@ public class FacePlanServiceImpl extends AbstractCRUDServiceImpl<FacePlanDao, Fa
ArrayList<String> recognitionResourceIndexCodes = new ArrayList<>();
recognitionResourceIndexCodes.add(resourceRecognition.getData().get(0).getIndexCode());
planRecognWhiteReq.setRecognitionResourceIndexCodes(recognitionResourceIndexCodes);
}
// List<String> recognitionResourceIndexCodes = faceGroupPersonService.find(new FaceGroupPersonQuery().faceGroupId(faceGroupEntity.getId())).stream().map(i -> i.getIndexCode()).filter(f -> !ObjectUtils.isEmpty(f)).collect(Collectors.toList());
// ArrayList<String> recognitionResourceIndexCodes = new ArrayList<>();
//temp1.add(recognitionResourceIndexCodes.get(0));
// temp1.add("2c24aa3bb9af4911a269bb887b5502f9");
// temp1.add(recognitionResourceIndexCodes.get(2));
// temp1.add(recognitionResourceIndexCodes.get(3));
// planRecognWhiteReq.setRecognitionResourceIndexCodes(temp1);
//planRecognWhiteReq.setRecognitionResourceIndexCodes(recognitionResourceIndexCodes);
//设置时间段 默认全天候
if (ObjectUtils.isEmpty(planRecognWhiteInfo)) {
......@@ -289,7 +276,17 @@ public class FacePlanServiceImpl extends AbstractCRUDServiceImpl<FacePlanDao, Fa
List<String> cameraIndexCodes = deviceService.find(new DeviceQuery()).stream().map(DeviceEntity::getDeviceCode).collect(Collectors.toList());
planRecognBlackReq.setCameraIndexCodes(cameraIndexCodes);
//设置识别方式
planRecognBlackReq.setRecognitionResourceType(RecognitionResourceEnum.FACE_RECOGNITION_SERVER.getValue());
planRecognBlackReq.setRecognitionResourceType(RecognitionResourceEnum.SUPER_BRAIN.getValue());
//设置识别资源
ResourceReq resourceReq = new ResourceReq();
resourceReq.setRecognitionResourceType(RecognitionResourceEnum.SUPER_BRAIN.getValue());
Rest<List<ResourceDataInfo>> resourceRecognition = hikFaceService.getResourceRecognition(resourceReq);
if(resourceRecognition.getCode()==YesNoEnum.YES.getValue()&&!ObjectUtils.isEmpty(resourceRecognition.getData())){
ArrayList<String> recognitionResourceIndexCodes = new ArrayList<>();
recognitionResourceIndexCodes.add(resourceRecognition.getData().get(0).getIndexCode());
planRecognBlackReq.setRecognitionResourceIndexCodes(recognitionResourceIndexCodes);
}
//设置时间段 默认全天候
AppointmentConfigEntity appointmentConfigEntity = appointmentConfigService.selectOne(new AppointmentConfigQuery());
if (!ObjectUtils.isEmpty(appointmentConfigEntity)) {
......
......@@ -3,7 +3,7 @@ package com.mortals.xhx.module.hik.event.model.req.callback;
import lombok.Data;
@Data
public class EventRecognBlackReq {
public class EventReq {
private String method;
private Params params;
}
\ No newline at end of file
......@@ -2,16 +2,18 @@ package com.mortals.xhx.module.hik.event.model.req.callback;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.common.Rest;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.util.Date;
@Data
public class EventsItem {
public class EventsItem<T> {
//事件唯一标识
private String eventId;
//
private EventData data;
//事件数据
private T data;
//事件类型
private Integer eventType;
//事件源编号,物理设备是资源编号
......
package com.mortals.xhx.module.hik.event.model.req.callback;
package com.mortals.xhx.module.hik.event.model.req.callback.recognition;
import java.util.List;
......
package com.mortals.xhx.module.hik.event.model.req.callback;
package com.mortals.xhx.module.hik.event.model.req.callback.recognition;
import lombok.Data;
......
package com.mortals.xhx.module.hik.event.model.req.callback;
package com.mortals.xhx.module.hik.event.model.req.callback.recognition;
import java.util.List;
import lombok.Data;
......
package com.mortals.xhx.module.hik.event.model.req.callback;
package com.mortals.xhx.module.hik.event.model.req.callback.recognition;
import lombok.Data;
......
package com.mortals.xhx.module.hik.event.model.req.callback;
package com.mortals.xhx.module.hik.event.model.req.callback.recognition;
import lombok.Data;
......
......@@ -2,7 +2,7 @@ package com.mortals.xhx.module.hik.event.service;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.event.model.req.callback.EventRecognBlackReq;
import com.mortals.xhx.module.hik.event.model.req.callback.EventReq;
import com.mortals.xhx.module.hik.event.model.req.sub.EventSubReq;
import com.mortals.xhx.module.hik.event.model.rsp.EventInfo;
......@@ -45,6 +45,6 @@ public interface IHikEventService {
* @param eventRecognBlackReq
* @return
*/
Rest<String> handleEvent(EventRecognBlackReq eventRecognBlackReq);
Rest<String> handleEvent(EventReq eventRecognBlackReq);
}
......@@ -12,10 +12,13 @@ import com.mortals.xhx.module.appointment.model.AppointmentPersonEntity;
import com.mortals.xhx.module.appointment.model.AppointmentPersonQuery;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsQuery;
import com.mortals.xhx.module.appointment.service.AppointmentConfigService;
import com.mortals.xhx.module.appointment.service.AppointmentPersonService;
import com.mortals.xhx.module.appointment.service.AppointmentRecordsService;
import com.mortals.xhx.module.hik.event.model.req.callback.*;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.EventData;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.FaceMatchItem;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.FaceRecognitionResult;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.Snap;
import com.mortals.xhx.module.monitor.model.MonitorAlarmEntity;
import com.mortals.xhx.module.monitor.model.MonitorAlarmQuery;
import com.mortals.xhx.module.monitor.model.MonitorAlarmRecordEntity;
......@@ -28,8 +31,6 @@ import com.mortals.xhx.module.realtime.service.RealtimeDataflowService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
......@@ -75,6 +76,7 @@ public class BlackPlanRecoginze extends EventTypeAbstract {
@Override
public void saveEventData(EventsItem event) {
log.info("预约人员识别事件,eventId:{}", event.getEventId());
Double similarity = DataUtil.converStr2Double(GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8"), 0);
EventData eventData = event.getData();
//识别结果
......
package com.mortals.xhx.module.hik.event.service.impl;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.module.hik.event.model.req.callback.EventData;
import com.mortals.xhx.module.hik.event.model.req.callback.EventsItem;
import java.util.Date;
/**
* @author:
* @date: 2023/4/17 9:22
......
......@@ -8,7 +8,6 @@ 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;
import com.mortals.xhx.module.hik.HikApiRest;
......@@ -17,15 +16,12 @@ import com.mortals.xhx.module.hik.event.model.req.sub.EventSubReq;
import com.mortals.xhx.module.hik.event.model.rsp.EventInfo;
import com.mortals.xhx.module.hik.event.service.IHikEventService;
import com.mortals.xhx.module.person.service.PersonService;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
import com.mortals.xhx.module.realtime.service.RealtimeDataflowService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 海康人员接口类
......@@ -107,7 +103,7 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
}
@Override
public Rest<String> handleEvent(EventRecognBlackReq req) {
public Rest<String> handleEvent(EventReq req) {
//处理识别业务 todo
Double similarity = DataUtil.converStr2Double(GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8"), 0);
//String similarity = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8");
......
package com.mortals.xhx.module.hik.event.service.impl;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.module.hik.event.model.req.callback.EventData;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.EventData;
import com.mortals.xhx.module.hik.event.model.req.callback.EventsItem;
import com.mortals.xhx.module.hik.event.model.req.callback.FaceRecognitionResult;
import com.mortals.xhx.module.hik.event.model.req.callback.Snap;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.FaceRecognitionResult;
import com.mortals.xhx.module.hik.event.model.req.callback.recognition.Snap;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
import com.mortals.xhx.module.realtime.service.RealtimeDataflowService;
import com.mortals.xhx.utils.SpringUtils;
......@@ -37,6 +37,7 @@ public class StrangerRecoginze extends EventTypeAbstract {
@Override
public void saveEventData(EventsItem event) {
log.info("处理陌生人事件,eventId:{}",event.getEventId());
EventData eventData = event.getData();
//识别结果
FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult();
......
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