Commit 63430df8 authored by 赵啸非's avatar 赵啸非

添加识别计划任务等逻辑

parent efa500ff
...@@ -91,6 +91,15 @@ public final class Constant { ...@@ -91,6 +91,15 @@ public final class Constant {
*/ */
public static final String EXCHANGE_SPLIT = "."; public static final String EXCHANGE_SPLIT = ".";
/**
* 预约监控计划前缀
*/
public final static String APPOINTMENT_PLAN_PREFIX = "appointment_plan_";
/**
* 预约人员分组
*/
public final static String APPOINTMENT_GROUP_PREFIX = "appointment_group_";
} }
...@@ -23,7 +23,7 @@ import com.mortals.xhx.module.hik.event.model.req.sub.EventSubReq; ...@@ -23,7 +23,7 @@ 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;
import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognBlackReq; import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognReq;
import com.mortals.xhx.module.hik.face.model.rsp.group.FaceGroupDataInfo; import com.mortals.xhx.module.hik.face.model.rsp.group.FaceGroupDataInfo;
import com.mortals.xhx.module.hik.face.service.IHikFaceService; import com.mortals.xhx.module.hik.face.service.IHikFaceService;
import com.mortals.xhx.module.hik.face.service.IHikPlanService; import com.mortals.xhx.module.hik.face.service.IHikPlanService;
...@@ -100,14 +100,14 @@ public class SubEventStartedService implements IApplicationStartedService { ...@@ -100,14 +100,14 @@ public class SubEventStartedService implements IApplicationStartedService {
} }
} }
//创建重点人员识别计划 //删除创建陌生人员识别计划,todo
String planBlackName = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_PLAN_BLACK, "取号监控"); String planBlackName = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_PLAN_BLACK, "取号监控");
int threshold = GlobalSysInfo.getParamIntValue(ParamKey.PARAM_FACE_THRESHOLD, 80); int threshold = GlobalSysInfo.getParamIntValue(ParamKey.PARAM_FACE_THRESHOLD, 80);
FacePlanEntity facePlanEntity = facePlanService.selectOne(new FacePlanQuery().name(planBlackName)); FacePlanEntity facePlanEntity = facePlanService.selectOne(new FacePlanQuery().name(planBlackName));
if (ObjectUtils.isEmpty(facePlanEntity)) { if (ObjectUtils.isEmpty(facePlanEntity)) {
//初始化新增取号监控识别计划 //初始化新增取号监控识别计划
PlanRecognBlackReq planRecognBlackReq = new PlanRecognBlackReq(); PlanRecognReq planRecognBlackReq = new PlanRecognReq();
planRecognBlackReq.setName(planBlackName); planRecognBlackReq.setName(planBlackName);
planRecognBlackReq.setDescription(planBlackName); planRecognBlackReq.setDescription(planBlackName);
planRecognBlackReq.setThreshold(threshold); planRecognBlackReq.setThreshold(threshold);
......
...@@ -32,8 +32,6 @@ import java.util.List; ...@@ -32,8 +32,6 @@ import java.util.List;
@Service("SyncSubmitAppointTask") @Service("SyncSubmitAppointTask")
public class SyncSubmitAppointTaskImpl implements ITaskExcuteService { public class SyncSubmitAppointTaskImpl implements ITaskExcuteService {
@Autowired
private AppointmentPersonService appointmentPersonService;
@Autowired @Autowired
private AppointmentRecordsService appointmentRecordsService; private AppointmentRecordsService appointmentRecordsService;
......
...@@ -45,7 +45,7 @@ import java.util.List; ...@@ -45,7 +45,7 @@ import java.util.List;
* 时间间隔以同步注册用户之后 * 时间间隔以同步注册用户之后
* 默认同步到一个人脸用户组,如要其它用户组 则页面上进行添加 * 默认同步到一个人脸用户组,如要其它用户组 则页面上进行添加
* 需要根据计划进行同步人脸链接 * 需要根据计划进行同步人脸链接
* 默认 * 默认用户组 主要是陌生人识别 不在当前库中的 都是陌生人
* *
*/ */
@Slf4j @Slf4j
......
package com.mortals.xhx.module.face.service; package com.mortals.xhx.module.face.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.face.model.FaceGroupEntity; import com.mortals.xhx.module.face.model.FaceGroupEntity;
import com.mortals.xhx.module.hik.face.model.req.group.FaceGroupReq;
/** /**
* FaceGroupService * FaceGroupService
* *
...@@ -11,4 +14,7 @@ import com.mortals.xhx.module.face.model.FaceGroupEntity; ...@@ -11,4 +14,7 @@ import com.mortals.xhx.module.face.model.FaceGroupEntity;
*/ */
public interface FaceGroupService extends ICRUDService<FaceGroupEntity,Long>{ public interface FaceGroupService extends ICRUDService<FaceGroupEntity,Long>{
Rest<FaceGroupEntity> saveFaceGroupToHik(FaceGroupReq faceGroupReq);
} }
\ No newline at end of file
package com.mortals.xhx.module.face.service.impl; package com.mortals.xhx.module.face.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.hik.face.model.req.group.FaceGroupReq;
import com.mortals.xhx.module.hik.face.model.rsp.group.FaceGroupDataInfo;
import com.mortals.xhx.module.hik.face.service.IHikFaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -6,14 +13,37 @@ import com.mortals.framework.model.Context; ...@@ -6,14 +13,37 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.face.dao.FaceGroupDao; import com.mortals.xhx.module.face.dao.FaceGroupDao;
import com.mortals.xhx.module.face.model.FaceGroupEntity; import com.mortals.xhx.module.face.model.FaceGroupEntity;
import com.mortals.xhx.module.face.service.FaceGroupService; import com.mortals.xhx.module.face.service.FaceGroupService;
import java.util.Date;
/** /**
* FaceGroupService * FaceGroupService
* 人脸分组信息 service实现 * 人脸分组信息 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-04-15 * @date 2023-04-15
*/ */
@Service("faceGroupService") @Service("faceGroupService")
public class FaceGroupServiceImpl extends AbstractCRUDServiceImpl<FaceGroupDao, FaceGroupEntity, Long> implements FaceGroupService { public class FaceGroupServiceImpl extends AbstractCRUDServiceImpl<FaceGroupDao, FaceGroupEntity, Long> implements FaceGroupService {
@Autowired
private IHikFaceService hikFaceService;
@Override
public Rest<FaceGroupEntity> saveFaceGroupToHik(FaceGroupReq faceGroupReq) {
Rest<FaceGroupDataInfo> faceGroupRest = hikFaceService.faceGroupSingleAdd(faceGroupReq);
if (faceGroupRest.getCode() == YesNoEnum.YES.getValue()) {
FaceGroupEntity groupEntity = new FaceGroupEntity();
groupEntity.initAttrValue();
groupEntity.setName(faceGroupReq.getName());
groupEntity.setDescription(faceGroupReq.getDescription());
groupEntity.setIndexCode(faceGroupRest.getData().getIndexCode());
groupEntity.setCreateTime(new Date());
groupEntity.setCreateUserId(1L);
groupEntity.setCreateUserName("admin");
this.save(groupEntity);
return Rest.ok(groupEntity);
}
return Rest.fail();
}
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ import java.util.List; ...@@ -4,7 +4,7 @@ import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
public class PlanRecognBlackListReq{ public class PlanRecognListReq {
private List<String> faceGroupIndexCodes; private List<String> faceGroupIndexCodes;
private String name; private String name;
private String description; private String description;
......
...@@ -4,7 +4,7 @@ import java.util.List; ...@@ -4,7 +4,7 @@ import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
public class PlanRecognBlackReq{ public class PlanRecognReq {
private List<String> cameraIndexCodes; private List<String> cameraIndexCodes;
private List<String> faceGroupIndexCodes; private List<String> faceGroupIndexCodes;
private String name; private String name;
......
...@@ -2,14 +2,15 @@ package com.mortals.xhx.module.hik.face.service; ...@@ -2,14 +2,15 @@ package com.mortals.xhx.module.hik.face.service;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognBlackListReq; import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognListReq;
import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognBlackReq; import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognReq;
import com.mortals.xhx.module.hik.face.model.rsp.plan.PlanRecognBlackInfo; import com.mortals.xhx.module.hik.face.model.rsp.plan.PlanRecognBlackInfo;
import java.util.List; import java.util.List;
/** /**
* 海康门禁接口对接类 * 海康门禁接口对接类
*
* @author: * @author:
* @date: 2023/4/12 17:47 * @date: 2023/4/12 17:47
*/ */
...@@ -18,23 +19,51 @@ public interface IHikPlanService { ...@@ -18,23 +19,51 @@ public interface IHikPlanService {
/** /**
* 查询重点识别计划 * 查询重点识别计划
* @param planRecognBlackListReq *
* @param planRecognListReq
* @return * @return
*/ */
Rest<List<PlanRecognBlackInfo>> findPlanRecognBlackList(PlanRecognBlackListReq planRecognBlackListReq); Rest<List<PlanRecognBlackInfo>> findPlanRecognBlackList(PlanRecognListReq planRecognListReq);
/** /**
* 人员监视计划 * 添加人员监视计划
* @param planRecognBlackReq *
* @param planRecognReq
* @return * @return
*/ */
Rest<String> planRecognBlackAdd(PlanRecognBlackReq planRecognBlackReq); Rest<String> planRecognBlackAdd(PlanRecognReq planRecognReq);
/** /**
* 人员监视计划删除 * 人员监视计划删除
* @param planRecognBlackReq *
* @param planRecognReq
* @return * @return
*/ */
Rest<Boolean> planRecognBlackDel(PlanRecognBlackReq planRecognBlackReq); Rest<Boolean> planRecognBlackDel(PlanRecognReq planRecognReq);
/**
* 查询陌生人识别计划
*
* @param planRecognListReq
* @return
*/
Rest<List<PlanRecognBlackInfo>> findPlanRecognWhiteList(PlanRecognListReq planRecognListReq);
/**
* 添加陌生人监视计划
*
* @param planRecognReq
* @return
*/
Rest<String> planRecognWhiteAdd(PlanRecognReq planRecognReq);
/**
* 陌生人人员监视计划删除
*
* @param planRecognReq
* @return
*/
Rest<Boolean> planRecognWhiteDel(PlanRecognReq planRecognReq);
} }
...@@ -7,8 +7,8 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig; ...@@ -7,8 +7,8 @@ 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.face.model.req.plan.PlanRecognBlackListReq; import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognListReq;
import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognBlackReq; import com.mortals.xhx.module.hik.face.model.req.plan.PlanRecognReq;
import com.mortals.xhx.module.hik.face.model.rsp.plan.PlanRecognBlackInfo; import com.mortals.xhx.module.hik.face.model.rsp.plan.PlanRecognBlackInfo;
import com.mortals.xhx.module.hik.face.service.IHikPlanService; import com.mortals.xhx.module.hik.face.service.IHikPlanService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -27,7 +27,7 @@ import java.util.List; ...@@ -27,7 +27,7 @@ import java.util.List;
public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanService { public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanService {
@Override @Override
public Rest<List<PlanRecognBlackInfo>> findPlanRecognBlackList(PlanRecognBlackListReq planRecognBlackListReq) { public Rest<List<PlanRecognBlackInfo>> findPlanRecognBlackList(PlanRecognListReq planRecognBlackListReq) {
ArtemisConfig config = getArtemisConfig(); ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/black"; String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/black";
path.put(protocol, getCamsApi); path.put(protocol, getCamsApi);
...@@ -68,11 +68,12 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe ...@@ -68,11 +68,12 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe
* 当时间计划参数不传时,默认全天候。当传入此参数时,时间计划规则如下:按周计划进行配置,每一天的时间段上限为8,每一个时间段的开始时间必须小于结束时间。 * 当时间计划参数不传时,默认全天候。当传入此参数时,时间计划规则如下:按周计划进行配置,每一天的时间段上限为8,每一个时间段的开始时间必须小于结束时间。
* j)同一个深眸支持配置多个识别计划。 * j)同一个深眸支持配置多个识别计划。
* k)若设备上人脸分组达到上限,则有可能导致下发失败。 * k)若设备上人脸分组达到上限,则有可能导致下发失败。
*
* @param planRecognBlackReq * @param planRecognBlackReq
* @return * @return
*/ */
@Override @Override
public Rest<String> planRecognBlackAdd(PlanRecognBlackReq planRecognBlackReq) { public Rest<String> planRecognBlackAdd(PlanRecognReq planRecognBlackReq) {
ArtemisConfig config = getArtemisConfig(); ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/black/addition"; String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/black/addition";
path.put(protocol, getCamsApi); path.put(protocol, getCamsApi);
...@@ -95,7 +96,7 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe ...@@ -95,7 +96,7 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe
} }
@Override @Override
public Rest<Boolean> planRecognBlackDel(PlanRecognBlackReq planRecognBlackReq) { public Rest<Boolean> planRecognBlackDel(PlanRecognReq planRecognBlackReq) {
ArtemisConfig config = getArtemisConfig(); ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/black/deletion"; String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/black/deletion";
path.put(protocol, getCamsApi); path.put(protocol, getCamsApi);
...@@ -114,4 +115,69 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe ...@@ -114,4 +115,69 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
} }
} }
@Override
public Rest<List<PlanRecognBlackInfo>> findPlanRecognWhiteList(PlanRecognListReq planRecognWhiteListReq) {
ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/white";
path.put(protocol, getCamsApi);
try {
String respJson = ArtemisHttpUtil.doPostStringArtemis(config, path, JSON.toJSONString(planRecognWhiteListReq), null, null, "application/json");
HikApiRest<List<PlanRecognBlackInfo>> rest = JSON.parseObject(respJson, new TypeReference<HikApiRest<List<PlanRecognBlackInfo>>>() {
});
if (rest.getCode() == "0") {
return Rest.ok(rest.getData());
} else {
log.info("plan recognize white list error resp=>{}", respJson);
return Rest.fail(rest.getMsg());
}
} catch (Exception e) {
log.error("plan recognize white list error异常", e);
return Rest.fail(e.getMessage());
}
}
@Override
public Rest<String> planRecognWhiteAdd(PlanRecognReq planRecognWhiteReq) {
ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/white/addition";
path.put(protocol, getCamsApi);
try {
log.info("plan recognize white req=>{}", JSON.toJSONString(planRecognWhiteReq));
String respJson = ArtemisHttpUtil.doPostStringArtemis(config, path, JSON.toJSONString(planRecognWhiteReq), null, null, "application/json");
log.info("plan recognize white resp=>{}", respJson);
HikApiRest<String> rest = JSON.parseObject(respJson, new TypeReference<HikApiRest<String>>() {
});
if (rest.getCode() == "0") {
return Rest.ok(rest.getData());
} else {
log.info("plan recognize white add error resp=>{}", respJson);
return Rest.fail(rest.getMsg());
}
} catch (Exception e) {
log.error("plan recognize white add error异常", e);
return Rest.fail(e.getMessage());
}
}
@Override
public Rest<Boolean> planRecognWhiteDel(PlanRecognReq planRecognWhiteReq) {
ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/white/deletion";
path.put(protocol, getCamsApi);
try {
String respJson = ArtemisHttpUtil.doPostStringArtemis(config, path, JSON.toJSONString(planRecognWhiteReq), null, null, "application/json");
HikApiRest<Boolean> rest = JSON.parseObject(respJson, new TypeReference<HikApiRest<Boolean>>() {
});
if (rest.getCode() == "0") {
return Rest.ok(rest.getData());
} else {
log.info("plan recognize white error del resp=>{}", respJson);
return Rest.fail(rest.getMsg());
}
} catch (Exception e) {
log.error("plan recognize white del error异常", e);
return Rest.fail(e.getMessage());
}
}
} }
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