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,11 +8,11 @@ import com.mortals.framework.annotation.Excel; ...@@ -8,11 +8,11 @@ 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;
...@@ -35,7 +35,7 @@ public class NoticeEntity extends NoticeVo { ...@@ -35,7 +35,7 @@ public class NoticeEntity extends NoticeVo {
* 是否已读 (0.否,1.是) * 是否已读 (0.否,1.是)
*/ */
@Excel(name = "是否已读 ", readConverterExp = "0=否,1.是") @Excel(name = "是否已读 ", readConverterExp = "0=否,1.是")
private Date read; private Integer read;
/** /**
* 消息的优先级,越高表示越紧急,不为空 * 消息的优先级,越高表示越紧急,不为空
*/ */
...@@ -98,16 +98,16 @@ public class NoticeEntity extends NoticeVo { ...@@ -98,16 +98,16 @@ public class NoticeEntity extends NoticeVo {
} }
/** /**
* 获取 是否已读 (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;
} }
/** /**
...@@ -192,7 +192,7 @@ public class NoticeEntity extends NoticeVo { ...@@ -192,7 +192,7 @@ public class NoticeEntity extends NoticeVo {
this.content = ""; this.content = "";
this.read = null; this.read = 0;
this.priority = 0; this.priority = 0;
......
...@@ -4,11 +4,11 @@ import java.util.Date; ...@@ -4,11 +4,11 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.notice.model.NoticeEntity; import com.mortals.xhx.module.notice.model.NoticeEntity;
/** /**
* 用户消息查询对象 * 用户消息查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-15 * @date 2023-04-16
*/ */
public class NoticeQuery extends NoticeEntity { public class NoticeQuery extends NoticeEntity {
/** 开始 主键ID */ /** 开始 主键ID */
private Long idStart; private Long idStart;
...@@ -51,10 +51,19 @@ public class NoticeQuery extends NoticeEntity { ...@@ -51,10 +51,19 @@ public class NoticeQuery extends NoticeEntity {
/** 消息的内容排除列表 */ /** 消息的内容排除列表 */
private List <String> contentNotList; private List <String> contentNotList;
/** 开始 是否已读 (0.否,1.是) */ /** 开始 是否已读 (0.否,1.是) */
private String readStart; private Integer readStart;
/** 结束 是否已读 (0.否,1.是) */ /** 结束 是否已读 (0.否,1.是) */
private String readEnd; private Integer readEnd;
/** 增加 是否已读 (0.否,1.是) */
private Integer readIncrement;
/** 是否已读 (0.否,1.是)列表 */
private List <Integer> readList;
/** 是否已读 (0.否,1.是)排除列表 */
private List <Integer> readNotList;
/** 开始 消息的优先级,越高表示越紧急,不为空 */ /** 开始 消息的优先级,越高表示越紧急,不为空 */
private Integer priorityStart; private Integer priorityStart;
...@@ -362,7 +371,7 @@ public class NoticeQuery extends NoticeEntity { ...@@ -362,7 +371,7 @@ public class NoticeQuery extends NoticeEntity {
* 获取 开始 是否已读 (0.否,1.是) * 获取 开始 是否已读 (0.否,1.是)
* @return readStart * @return readStart
*/ */
public String getReadStart(){ public Integer getReadStart(){
return this.readStart; return this.readStart;
} }
...@@ -370,15 +379,15 @@ public class NoticeQuery extends NoticeEntity { ...@@ -370,15 +379,15 @@ public class NoticeQuery extends NoticeEntity {
* 设置 开始 是否已读 (0.否,1.是) * 设置 开始 是否已读 (0.否,1.是)
* @param readStart * @param readStart
*/ */
public void setReadStart(String readStart){ public void setReadStart(Integer readStart){
this.readStart = readStart; this.readStart = readStart;
} }
/** /**
* 获取 结束 是否已读 (0.否,1.是) * 获取 结束 是否已读 (0.否,1.是)
* @return readEnd * @return $readEnd
*/ */
public String getReadEnd(){ public Integer getReadEnd(){
return this.readEnd; return this.readEnd;
} }
...@@ -386,10 +395,59 @@ public class NoticeQuery extends NoticeEntity { ...@@ -386,10 +395,59 @@ public class NoticeQuery extends NoticeEntity {
* 设置 结束 是否已读 (0.否,1.是) * 设置 结束 是否已读 (0.否,1.是)
* @param readEnd * @param readEnd
*/ */
public void setReadEnd(String readEnd){ public void setReadEnd(Integer readEnd){
this.readEnd = readEnd; this.readEnd = readEnd;
} }
/**
* 获取 增加 是否已读 (0.否,1.是)
* @return readIncrement
*/
public Integer getReadIncrement(){
return this.readIncrement;
}
/**
* 设置 增加 是否已读 (0.否,1.是)
* @param readIncrement
*/
public void setReadIncrement(Integer readIncrement){
this.readIncrement = readIncrement;
}
/**
* 获取 是否已读 (0.否,1.是)
* @return readList
*/
public List<Integer> getReadList(){
return this.readList;
}
/**
* 设置 是否已读 (0.否,1.是)
* @param readList
*/
public void setReadList(List<Integer> readList){
this.readList = readList;
}
/**
* 获取 是否已读 (0.否,1.是)
* @return readNotList
*/
public List<Integer> getReadNotList(){
return this.readNotList;
}
/**
* 设置 是否已读 (0.否,1.是)
* @param readNotList
*/
public void setReadNotList(List<Integer> readNotList){
this.readNotList = readNotList;
}
/** /**
* 获取 开始 消息的优先级,越高表示越紧急,不为空 * 获取 开始 消息的优先级,越高表示越紧急,不为空
* @return priorityStart * @return priorityStart
...@@ -907,6 +965,59 @@ public class NoticeQuery extends NoticeEntity { ...@@ -907,6 +965,59 @@ public class NoticeQuery extends NoticeEntity {
return this; return this;
} }
/**
* 设置 是否已读 (0.否,1.是)
* @param read
*/
public NoticeQuery read(Integer read){
setRead(read);
return this;
}
/**
* 设置 开始 是否已读 (0.否,1.是)
* @param readStart
*/
public NoticeQuery readStart(Integer readStart){
this.readStart = readStart;
return this;
}
/**
* 设置 结束 是否已读 (0.否,1.是)
* @param readEnd
*/
public NoticeQuery readEnd(Integer readEnd){
this.readEnd = readEnd;
return this;
}
/**
* 设置 增加 是否已读 (0.否,1.是)
* @param readIncrement
*/
public NoticeQuery readIncrement(Integer readIncrement){
this.readIncrement = readIncrement;
return this;
}
/**
* 设置 是否已读 (0.否,1.是)
* @param readList
*/
public NoticeQuery readList(List<Integer> readList){
this.readList = readList;
return this;
}
/**
* 设置 是否已读 (0.否,1.是)
* @param readNotList
*/
public NoticeQuery readNotList(List<Integer> readNotList){
this.readNotList = readNotList;
return this;
}
/** /**
* 设置 消息的优先级,越高表示越紧急,不为空 * 设置 消息的优先级,越高表示越紧急,不为空
......
###重点识别计划回调
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