Преглед на файлове

feat: 去掉video_stable中的配置项,改为数据字典获取开始结束url

WANGKANG преди 6 месеца
родител
ревизия
8878798aa1

+ 0 - 2
taais-admin/src/main/resources/application-dev.yml

@@ -1,6 +1,4 @@
 server:
-  video_stable_start_url: http://localhost:11006/video_stable
-  video_stable_stop_url: http://localhost:11006/video_stable_stop
   task_stop_url: http://localhost:11003/stop
   task_stop_url_cat: http://localhost:11004/stop
 

+ 25 - 10
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/VideoStableServiceImpl.java

@@ -26,7 +26,9 @@ import com.taais.common.json.utils.JsonUtils;
 import com.taais.common.orm.core.page.PageQuery;
 import com.taais.common.orm.core.service.impl.BaseServiceImpl;
 import com.taais.common.websocket.utils.WebSocketUtils;
+import com.taais.system.domain.vo.SysDictDataVo;
 import com.taais.system.domain.vo.SysOssVo;
+import com.taais.system.service.ISysDictDataService;
 import com.taais.system.service.ISysOssService;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
@@ -37,7 +39,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -59,11 +60,8 @@ import static com.taais.biz.service.impl.ToInfraredServiceImpl.readLogContent;
 @Service
 @Slf4j
 public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, VideoStable> implements IVideoStableService {
-    @Value("${server.video_stable_start_url}")
-    private String video_stable_start_url;
-
-    @Value("${server.video_stable_stop_url}")
-    private String video_stable_stop_url;
+    @Autowired
+    private ISysDictDataService sysDictDataService;
 
     @Autowired
     private ISysOssService ossService;
@@ -71,6 +69,23 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
     @Resource
     private VideoStableMapper videoStableMapper;
 
+    public String getKeyValueFromSysDictData(String key) {
+        SysDictDataVo res = sysDictDataService.selectDictDataByTypeAndLabel("biz_data_augmentation", key);
+        if (ObjectUtil.isNull(res)) {
+            throw new RuntimeException(key + "不存在于数据字典<biz_data_augmentation>中,请检查!");
+        } else {
+            return res.getDictValue();
+        }
+    }
+
+    public String get_start_api() {
+        return getKeyValueFromSysDictData("电子稳相开始url1");
+    }
+
+    public String get_stop_api() {
+        return getKeyValueFromSysDictData("电子稳相结束url");
+    }
+
     @Override
     public QueryWrapper query() {
         return super.query().from(VIDEO_STABLE);
@@ -111,7 +126,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
     @Override
     public List<VideoStableVo> selectList(VideoStableBo videoStableBo) {
         QueryWrapper queryWrapper = buildQueryWrapper(videoStableBo);
-        queryWrapper.orderBy(VIDEO_STABLE.CREATE_TIME,Boolean.FALSE);
+        queryWrapper.orderBy(VIDEO_STABLE.CREATE_TIME, Boolean.FALSE);
         return this.listAs(queryWrapper, VideoStableVo.class);
     }
 
@@ -124,7 +139,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
     @Override
     public PageResult<VideoStableVo> selectPage(VideoStableBo videoStableBo) {
         QueryWrapper queryWrapper = buildQueryWrapper(videoStableBo);
-        queryWrapper.orderBy(VIDEO_STABLE.CREATE_TIME,Boolean.FALSE);
+        queryWrapper.orderBy(VIDEO_STABLE.CREATE_TIME, Boolean.FALSE);
         Page<VideoStableVo> page = this.pageAs(PageQuery.build(), queryWrapper, VideoStableVo.class);
         return PageResult.build(page);
     }
@@ -235,7 +250,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
 
         videoStable.setLogPath(videoStable.getOutputPath() + File.separator + getLogFileName(videoStable));
 
-        HttpResponseEntity responseEntity = sendPostMsg(video_stable_start_url, videoStable);
+        HttpResponseEntity responseEntity = sendPostMsg(get_start_api(), videoStable);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             return CommonResult.success("任务开始成功,请等待完成");
         } else {
@@ -329,7 +344,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
         VideoStable videoStable = getById(id);
 
         videoStable.setLogPath(videoStable.getOutputPath() + File.separator + getLogFileName(videoStable));
-        HttpResponseEntity responseEntity = sendPostMsg(video_stable_stop_url, videoStable);
+        HttpResponseEntity responseEntity = sendPostMsg(get_stop_api(), videoStable);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             videoStable.setStatus(BizConstant.VideoStatus.INTERRUPTED);
             updateById(videoStable);