|
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.impl;
|
|
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
|
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
|
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
|
|
+import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
|
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
|
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
|
@@ -16,6 +17,7 @@ import com.genersoft.iot.vmp.storager.dao.*;
|
|
|
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
|
|
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
|
|
import com.genersoft.iot.vmp.vmanager.bean.AiLib;
|
|
|
+import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
|
|
import com.genersoft.iot.vmp.vmanager.bean.UploadService;
|
|
|
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -275,7 +277,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|
|
public List<AiLib> queryLibraryList(){
|
|
|
return HfyDevAiMapper.getAiLibraryList();
|
|
|
}
|
|
|
-
|
|
|
+ public int addAiLib(Integer arithmetic,String libraryName){
|
|
|
+ // 判断算法是否为
|
|
|
+ //if(arithmetic==null){ throw new ControllerException(ErrorCode.ERROR400.getCode(),"请输入算法类型"); }
|
|
|
+ if(arithmetic.intValue()==2){ throw new ControllerException(ErrorCode.ERROR400.getCode(),"该算法不支持创建数据库");}
|
|
|
+ AiLib aiLib = new AiLib();
|
|
|
+ aiLib.setVersion("1");
|
|
|
+ aiLib.setArithmetic(arithmetic.intValue());
|
|
|
+ aiLib.setLibraryName(libraryName);
|
|
|
+ return HfyDevAiMapper.createAiLibrary(aiLib);
|
|
|
+ }
|
|
|
/**
|
|
|
* 添加数据库子项
|
|
|
* @param libraryId
|
|
@@ -287,7 +298,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|
|
public String addLibItem(int libraryId, String itemName, String itemNo, String card, MultipartFile file){
|
|
|
// 获取library数据
|
|
|
List<AiLib> aiLibArr = HfyDevAiMapper.getAiLibraryByLibId(libraryId);
|
|
|
- if(aiLibArr.isEmpty()){ logger.warn("无法找到lib库"); return "-1";}
|
|
|
+ if(aiLibArr.isEmpty()){throw new ControllerException(ErrorCode.ERROR400.getCode(),"无法找到lib库");}
|
|
|
AiLib libData = aiLibArr.stream().findFirst().get();
|
|
|
// 判断ai类型来检测是否合法
|
|
|
int arithmetic = libData.getArithmetic();
|
|
@@ -345,17 +356,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|
|
" pushUrl:"+pushUrl);
|
|
|
// 火情类型,但是触发类型不是无限制
|
|
|
if(arithmetic == 2 && triggerType != 1){
|
|
|
- logger.warn("火情类型,但是采用了黑白名单触发");
|
|
|
- return -1;
|
|
|
+ throw new ControllerException(ErrorCode.ERROR400.getCode(),"火情类型,但是采用了黑白名单触发");
|
|
|
}
|
|
|
// 黑白名单类型,但是没有选择libarayId
|
|
|
if(triggerType != 1 && libraryId <1){
|
|
|
- logger.warn("在非限制类型下使用了ai库");
|
|
|
- return -1;
|
|
|
+ throw new ControllerException(ErrorCode.ERROR400.getCode(),"在非限制类型下使用了ai库");
|
|
|
}
|
|
|
if(libraryId > 0 ){
|
|
|
List<AiLib> aiLibList = HfyDevAiMapper.findLibByAiTypeAndLibraryId(libraryId,arithmetic);
|
|
|
- if(aiLibList.isEmpty()){logger.warn("无法找到lib库"); return -1;}
|
|
|
+ if(aiLibList.isEmpty()){throw new ControllerException(ErrorCode.ERROR400.getCode(),"无法找到lib库");}
|
|
|
+
|
|
|
}
|
|
|
// 查找是否能够找到lib库id
|
|
|
|