Commit 7e747809 authored by 赵啸非's avatar 赵啸非

添加陌生人识别计划

parent 99bf9bdc
...@@ -100,7 +100,7 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService { ...@@ -100,7 +100,7 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService {
log.info("{}=>创建预约计划任务完成", DateUtils.getCurrStrDate()); log.info("{}=>创建预约计划任务完成", DateUtils.getCurrStrDate());
} }
private void createStrangerPlanByDay(){ private void createStrangerPlanByDay() {
int threshold = GlobalSysInfo.getParamIntValue(ParamKey.PARAM_FACE_THRESHOLD, 80); int threshold = GlobalSysInfo.getParamIntValue(ParamKey.PARAM_FACE_THRESHOLD, 80);
//创建或者更新 //创建或者更新
PlanRecognListReq planRecognListReq = new PlanRecognListReq(); PlanRecognListReq planRecognListReq = new PlanRecognListReq();
...@@ -113,8 +113,6 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService { ...@@ -113,8 +113,6 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService {
} }
return null; return null;
}).filter(f -> f != null).findFirst().orElseGet(() -> null); }).filter(f -> f != null).findFirst().orElseGet(() -> null);
if(ObjectUtils.isEmpty(planRecognWhiteInfo)){
// todo 创建陌生人计划 // todo 创建陌生人计划
//初始化新增取号监控识别计划 //初始化新增取号监控识别计划
PlanRecognReq planRecognBlackReq = new PlanRecognReq(); PlanRecognReq planRecognBlackReq = new PlanRecognReq();
...@@ -132,12 +130,12 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService { ...@@ -132,12 +130,12 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService {
//设置识别方式 //设置识别方式
planRecognBlackReq.setRecognitionResourceType(RecognitionResourceEnum.COMPARISON.getValue()); planRecognBlackReq.setRecognitionResourceType(RecognitionResourceEnum.COMPARISON.getValue());
//设置时间段 默认全天候 //设置时间段 默认全天候
Rest<String> planRecognBlackAddRest = hikPlanService.planRecognBlackAdd(planRecognBlackReq); if (ObjectUtils.isEmpty(planRecognWhiteInfo)) {
Rest<String> planRecognWhiteAddRest = hikPlanService.planRecognWhiteAdd(planRecognBlackReq);
if (planRecognBlackAddRest.getCode() == YesNoEnum.YES.getValue()) { if (planRecognWhiteAddRest.getCode() == YesNoEnum.YES.getValue()) {
FacePlanEntity planEntity = new FacePlanEntity(); FacePlanEntity planEntity = new FacePlanEntity();
planEntity.initAttrValue(); planEntity.initAttrValue();
planEntity.setIndexCode(planRecognBlackAddRest.getData()); planEntity.setIndexCode(planRecognWhiteAddRest.getData());
planEntity.setName(Constant.STRANGER_PLAN); planEntity.setName(Constant.STRANGER_PLAN);
planEntity.setDescription(Constant.STRANGER_PLAN); planEntity.setDescription(Constant.STRANGER_PLAN);
planEntity.setCreateTime(new Date()); planEntity.setCreateTime(new Date());
...@@ -145,8 +143,20 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService { ...@@ -145,8 +143,20 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService {
planEntity.setCreateUserName("admin"); planEntity.setCreateUserName("admin");
facePlanService.save(planEntity); facePlanService.save(planEntity);
} }
}else { } else {
//更新计划 //更新计划
planRecognBlackReq.setIndexCode(planRecognWhiteInfo.getIndexCode());
Rest<Boolean> planRecognWhiteUpdateRest = hikPlanService.planRecognWhiteUpdate(planRecognBlackReq);
if (planRecognWhiteUpdateRest.getCode() == YesNoEnum.YES.getValue()&&planRecognWhiteUpdateRest.getData()) {
FacePlanEntity whitePlan = facePlanService.selectOne(new FacePlanQuery().indexCode(planRecognWhiteInfo.getIndexCode()));
whitePlan.setUpdateTime(new Date());
whitePlan.setUpdateUserId(1L);
whitePlan.setUpdateUserName("system");
facePlanService.update(whitePlan);
}
} }
......
...@@ -5,6 +5,7 @@ import lombok.Data; ...@@ -5,6 +5,7 @@ import lombok.Data;
@Data @Data
public class PlanRecognReq { public class PlanRecognReq {
private String indexCode;
private List<String> cameraIndexCodes; private List<String> cameraIndexCodes;
private List<String> faceGroupIndexCodes; private List<String> faceGroupIndexCodes;
private String name; private String name;
......
...@@ -58,6 +58,14 @@ public interface IHikPlanService { ...@@ -58,6 +58,14 @@ public interface IHikPlanService {
*/ */
Rest<String> planRecognWhiteAdd(PlanRecognReq planRecognReq); Rest<String> planRecognWhiteAdd(PlanRecognReq planRecognReq);
/**
* 更新陌生人监视计划
*
* @param planRecognReq
* @return
*/
Rest<Boolean> planRecognWhiteUpdate(PlanRecognReq planRecognReq);
/** /**
* 陌生人人员监视计划删除 * 陌生人人员监视计划删除
* *
......
...@@ -160,6 +160,29 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe ...@@ -160,6 +160,29 @@ public class HikPlanServiceImpl extends AbstractHikService implements IHikPlanSe
} }
} }
@Override
public Rest<Boolean> planRecognWhiteUpdate(PlanRecognReq planRecognWhiteReq) {
ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/frs/v1/plan/recognition/white/update";
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<Boolean> rest = JSON.parseObject(respJson, new TypeReference<HikApiRest<Boolean>>() {
});
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 @Override
public Rest<Boolean> planRecognWhiteDel(PlanRecognReq planRecognWhiteReq) { public Rest<Boolean> planRecognWhiteDel(PlanRecognReq planRecognWhiteReq) {
ArtemisConfig config = getArtemisConfig(); ArtemisConfig config = getArtemisConfig();
......
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