Commit 04c193d0 authored by 赵啸非's avatar 赵啸非

添加识别计划类

parent 30d25155
package com.mortals.xhx.busiz.req.event;
import java.util.List;
import lombok.Data;
@Data
public class Params{
private String ability;
private List<EventsItem> events;
private String sendTime;
}
\ No newline at end of file
package com.mortals.xhx.busiz.web; package com.mortals.xhx.busiz.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.busiz.req.event.EventRecognBlackInfo; import com.mortals.xhx.module.hik.event.model.req.callback.EventRecognBlackReq;
import com.mortals.xhx.common.code.ApiRespCodeEnum; import com.mortals.xhx.module.hik.event.service.IHikEventService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -16,18 +16,26 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,18 +16,26 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
@RequestMapping("hik") @RequestMapping("hik")
public class HikCallbackController { public class HikCallbackController {
@Autowired
private IHikEventService hikEventService;
@PostMapping("eventRcv") @PostMapping("eventRcv")
@UnAuth @UnAuth
public Rest<String> refreshMessage(@RequestBody EventRecognBlackInfo req) { public Rest<String> refreshMessage(@RequestBody EventRecognBlackReq req) {
log.info("【接收事件数据】【请求体】--> " + JSONObject.toJSONString(req)); log.info("【接收事件数据】【请求体】--> " + JSONObject.toJSONString(req));
try { try {
if ("OnEventNotify".equals(req.getMethod())) {
Rest<String> rest = hikEventService.handleEvent(req);
return rest;
}
return Rest.ok("接收成功");
//todo //todo
} catch (Exception e) { } catch (Exception e) {
log.error("接收数据失败", e); log.error("接收数据失败", e);
return Rest.fail(); return Rest.fail();
} }
return Rest.ok();
} }
} }
...@@ -6,7 +6,6 @@ import com.mortals.framework.ap.GlobalSysInfo; ...@@ -6,7 +6,6 @@ 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.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;
...@@ -20,7 +19,7 @@ import com.mortals.xhx.module.face.model.FacePlanEntity; ...@@ -20,7 +19,7 @@ import com.mortals.xhx.module.face.model.FacePlanEntity;
import com.mortals.xhx.module.face.model.FacePlanQuery; 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.face.service.FacePlanService;
import com.mortals.xhx.module.hik.event.model.req.EventSubReq; 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.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;
......
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
......
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import lombok.Data; import lombok.Data;
@Data @Data
public class EventRecognBlackInfo{ public class EventRecognBlackReq {
private String method; private String method;
private Params params; private Params params;
} }
\ No newline at end of file
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
public class EventsItem { public class EventsItem {
private String eventId; private String eventId;
...@@ -11,6 +15,8 @@ public class EventsItem { ...@@ -11,6 +15,8 @@ public class EventsItem {
private String ability; private String ability;
private String srcType; private String srcType;
private int timeout; private int timeout;
private String happenTime; @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXXX")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
private Date happenTime;
private int status; private int status;
} }
\ No newline at end of file
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import lombok.Data; import lombok.Data;
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
public class FaceMatchItem{ public class FaceMatchItem{
private String faceGroupName; private String faceGroupName;
private String faceInfoSex; private String faceInfoSex;
private double similarity; private Double similarity;
private String facePicUrl; private String facePicUrl;
private String certificate; private String certificate;
private String faceGroupCode; private String faceGroupCode;
......
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
......
package com.mortals.xhx.module.hik.event.model.req.callback;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@Data
public class Params{
private String ability;
private List<EventsItem> events;
@JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXXX")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
private Date sendTime;
}
\ No newline at end of file
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import lombok.Data; import lombok.Data;
......
package com.mortals.xhx.busiz.req.event; package com.mortals.xhx.module.hik.event.model.req.callback;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
public class Snap{ public class Snap{
private String faceUrl; private String faceUrl;
private String faceTime; private Date faceTime;
private String glass; private String glass;
private String gender; private String gender;
private String ageGroup; private String ageGroup;
......
package com.mortals.xhx.module.hik.event.model.req; package com.mortals.xhx.module.hik.event.model.req.sub;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
......
...@@ -2,10 +2,9 @@ package com.mortals.xhx.module.hik.event.service; ...@@ -2,10 +2,9 @@ package com.mortals.xhx.module.hik.event.service;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.event.model.req.EventSubReq; import com.mortals.xhx.module.hik.event.model.req.callback.EventRecognBlackReq;
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.model.rsp.EventInfo;
import com.mortals.xhx.module.hik.person.model.req.person.PersonReq;
import com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo;
import java.util.List; import java.util.List;
...@@ -39,4 +38,13 @@ public interface IHikEventService { ...@@ -39,4 +38,13 @@ public interface IHikEventService {
*/ */
Rest<String> cancelEvent(EventSubReq eventSubReq); Rest<String> cancelEvent(EventSubReq eventSubReq);
/**
* 处理回调事件
*
* @param eventRecognBlackReq
* @return
*/
Rest<String> handleEvent(EventRecognBlackReq eventRecognBlackReq);
} }
...@@ -7,10 +7,10 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig; ...@@ -7,10 +7,10 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.AbstractHikService; import com.mortals.xhx.module.hik.AbstractHikService;
import com.mortals.xhx.module.hik.HikApiRest; import com.mortals.xhx.module.hik.HikApiRest;
import com.mortals.xhx.module.hik.event.model.req.EventSubReq; import com.mortals.xhx.module.hik.event.model.req.callback.EventRecognBlackReq;
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.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.rsp.plan.PlanRecognBlackInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -90,4 +90,11 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent ...@@ -90,4 +90,11 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
} }
} }
@Override
public Rest<String> handleEvent(EventRecognBlackReq eventRecognBlackReq) {
//处理识别业务 todo
return Rest.ok("处理成功!");
}
} }
...@@ -8,46 +8,46 @@ import com.mortals.framework.annotation.Excel; ...@@ -8,46 +8,46 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.notice.model.vo.NoticeVo; import com.mortals.xhx.module.notice.model.vo.NoticeVo;
/** /**
* 用户消息实体对象 * 用户消息实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-15 * @date 2023-04-16
*/ */
public class NoticeEntity extends NoticeVo { public class NoticeEntity extends NoticeVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 接收消息的用户的唯一标识符 * 接收消息的用户的唯一标识符
*/ */
private Long userId; private Long userId;
/** /**
* 消息的标题 * 消息的标题
*/ */
@Excel(name = "消息的标题") @Excel(name = "消息的标题")
private String title; private String title;
/** /**
* 消息的内容 * 消息的内容
*/ */
@Excel(name = "消息的内容") @Excel(name = "消息的内容")
private String content; private String content;
/** /**
* 是否已读 (0.否,1.是) * 是否已读 (0.否,1.是)
*/ */
@Excel(name = "是否已读 ", readConverterExp = "0=否,1.是") @Excel(name = "是否已读 ", readConverterExp = "0=否,1.是")
private Date read; private Integer read;
/** /**
* 消息的优先级,越高表示越紧急,不为空 * 消息的优先级,越高表示越紧急,不为空
*/ */
@Excel(name = "消息的优先级,越高表示越紧急,不为空") @Excel(name = "消息的优先级,越高表示越紧急,不为空")
private Integer priority; private Integer priority;
/** /**
* 消息的过期时间,超过此时间则自动标记为已读 * 消息的过期时间,超过此时间则自动标记为已读
*/ */
private Date expireTime; private Date expireTime;
/** /**
* 消息的来源类型,例如“系统”、“好友”等,可以为空 * 消息的来源类型,例如“系统”、“好友”等,可以为空
*/ */
@Excel(name = "消息的来源类型,例如“系统”、“好友”等,可以为空") @Excel(name = "消息的来源类型,例如“系统”、“好友”等,可以为空")
private String sourceType; private String sourceType;
...@@ -55,100 +55,100 @@ public class NoticeEntity extends NoticeVo { ...@@ -55,100 +55,100 @@ public class NoticeEntity extends NoticeVo {
public NoticeEntity(){} public NoticeEntity(){}
/** /**
* 获取 接收消息的用户的唯一标识符 * 获取 接收消息的用户的唯一标识符
* @return Long * @return Long
*/ */
public Long getUserId(){ public Long getUserId(){
return userId; return userId;
} }
/** /**
* 设置 接收消息的用户的唯一标识符 * 设置 接收消息的用户的唯一标识符
* @param userId * @param userId
*/ */
public void setUserId(Long userId){ public void setUserId(Long userId){
this.userId = userId; this.userId = userId;
} }
/** /**
* 获取 消息的标题 * 获取 消息的标题
* @return String * @return String
*/ */
public String getTitle(){ public String getTitle(){
return title; return title;
} }
/** /**
* 设置 消息的标题 * 设置 消息的标题
* @param title * @param title
*/ */
public void setTitle(String title){ public void setTitle(String title){
this.title = title; this.title = title;
} }
/** /**
* 获取 消息的内容 * 获取 消息的内容
* @return String * @return String
*/ */
public String getContent(){ public String getContent(){
return content; return content;
} }
/** /**
* 设置 消息的内容 * 设置 消息的内容
* @param content * @param content
*/ */
public void setContent(String content){ public void setContent(String content){
this.content = content; this.content = content;
} }
/** /**
* 获取 是否已读 (0.否,1.是) * 获取 是否已读 (0.否,1.是)
* @return Date * @return Integer
*/ */
public Date getRead(){ public Integer getRead(){
return read; return read;
} }
/** /**
* 设置 是否已读 (0.否,1.是) * 设置 是否已读 (0.否,1.是)
* @param read * @param read
*/ */
public void setRead(Date read){ public void setRead(Integer read){
this.read = read; this.read = read;
} }
/** /**
* 获取 消息的优先级,越高表示越紧急,不为空 * 获取 消息的优先级,越高表示越紧急,不为空
* @return Integer * @return Integer
*/ */
public Integer getPriority(){ public Integer getPriority(){
return priority; return priority;
} }
/** /**
* 设置 消息的优先级,越高表示越紧急,不为空 * 设置 消息的优先级,越高表示越紧急,不为空
* @param priority * @param priority
*/ */
public void setPriority(Integer priority){ public void setPriority(Integer priority){
this.priority = priority; this.priority = priority;
} }
/** /**
* 获取 消息的过期时间,超过此时间则自动标记为已读 * 获取 消息的过期时间,超过此时间则自动标记为已读
* @return Date * @return Date
*/ */
public Date getExpireTime(){ public Date getExpireTime(){
return expireTime; return expireTime;
} }
/** /**
* 设置 消息的过期时间,超过此时间则自动标记为已读 * 设置 消息的过期时间,超过此时间则自动标记为已读
* @param expireTime * @param expireTime
*/ */
public void setExpireTime(Date expireTime){ public void setExpireTime(Date expireTime){
this.expireTime = expireTime; this.expireTime = expireTime;
} }
/** /**
* 获取 消息的来源类型,例如“系统”、“好友”等,可以为空 * 获取 消息的来源类型,例如“系统”、“好友”等,可以为空
* @return String * @return String
*/ */
public String getSourceType(){ public String getSourceType(){
return sourceType; return sourceType;
} }
/** /**
* 设置 消息的来源类型,例如“系统”、“好友”等,可以为空 * 设置 消息的来源类型,例如“系统”、“好友”等,可以为空
* @param sourceType * @param sourceType
*/ */
public void setSourceType(String sourceType){ public void setSourceType(String sourceType){
this.sourceType = sourceType; this.sourceType = sourceType;
} }
...@@ -158,7 +158,7 @@ public class NoticeEntity extends NoticeVo { ...@@ -158,7 +158,7 @@ public class NoticeEntity extends NoticeVo {
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -166,7 +166,7 @@ public class NoticeEntity extends NoticeVo { ...@@ -166,7 +166,7 @@ public class NoticeEntity extends NoticeVo {
if (obj instanceof NoticeEntity) { if (obj instanceof NoticeEntity) {
NoticeEntity tmp = (NoticeEntity) obj; NoticeEntity tmp = (NoticeEntity) obj;
if (this.getId() == tmp.getId()) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
...@@ -186,18 +186,18 @@ public class NoticeEntity extends NoticeVo { ...@@ -186,18 +186,18 @@ public class NoticeEntity extends NoticeVo {
public void initAttrValue(){ public void initAttrValue(){
this.userId = null; this.userId = null;
this.title = ""; this.title = "";
this.content = ""; this.content = "";
this.read = null; this.read = 0;
this.priority = 0; this.priority = 0;
this.expireTime = null; this.expireTime = null;
this.sourceType = ""; this.sourceType = "";
} }
} }
\ No newline at end of file
###重点识别计划回调
POST {{baseUrl}}/hik/eventRcv
Content-Type: application/json
{
"method": "OnEventNotify",
"params": {
"sendTime": "2023-04-15T19:31:54.951+08:00",
"ability": "event_face_recognition",
"events": [{
"eventType": 1644175361,
"eventId": "ba49eeef-8c17-4c1a-8eab-53a0c9eb06fe",
"srcIndex": "eb82bf1b-a3dc-4e3d-8bfd-ff52e42245c9",
"ability": "event_frs",
"data": {
"faceRecognitionResult": {
"snap": {
"ageGroup": "young",
"gender": "male",
"glass": "yes",
"bkgUrl": "http://10.67.184.149:80/picture/Streaming/tracks/203/?006853427200019404 & size = 19404",
"faceUrl": "http://10.66.165.124:6120/pic?7dd489324-7doc81l*3dec1=--87zd61fa3e614idb1*=2d0i0s1*=idp1*=*d4i1t=pe7m5517641",
"faceTime": "2023-04-15 19:32:02"
},
"faceMatch": [{
"faceGroupCode": "eb82bf1b-a3dc-4e3d-8bfd-ff52e42245c9",
"faceGroupName": "ghc",
"faceInfoCode": "98c83004-c390-4d8b-a97a-34a3218a5ac7",
"faceInfoName": "233",
"faceInfoSex": "unknown",
"certificate": "32423",
"certificateType": "111",
"similarity": 0.05,
"facePicUrl": "http://10.33.47.14:6040/pic?=d2ei666i31f6935-f775aa--cf835d1a6d0ccidp= 89 d1"
}]
},
"srcEventId": "B89C250C-B8C2-4215-9A6C-09CC34DF25A7",
"resInfo": [{
"resourceType": "camera",
"indexCode": "f3b8b0ab19d043929e9985736ea31270",
"cn": "184.128_7627_人脸抓拍"
}]
},
"happenTime": "2023-04-15T19:32:02.000+08:00",
"srcType": "faceGroup",
"status": 0,
"timeout": 0
}]
}
}
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