luogang 9 mēneši atpakaļ
vecāks
revīzija
50001b0982
19 mainītis faili ar 272 papildinājumiem un 71 dzēšanām
  1. 1 1
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/controller/SenMonitorPointMediaController.java
  2. 18 7
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/controller/SenMonitorTaskAlgorithmsController.java
  3. 12 1
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/controller/SenMonitorTaskController.java
  4. 0 1
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/domain/bo/SenMonitorTaskAlgorithmsBo.java
  5. 7 1
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/domain/bo/SenMonitorTaskBo.java
  6. 0 6
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/domain/vo/SenMonitorTaskVo.java
  7. 1 1
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/ISenMonitorPointMediaService.java
  8. 3 0
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/ISenMonitorTaskAlgorithmsService.java
  9. 3 1
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/ISenMonitorTaskService.java
  10. 2 2
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorPointMediaServiceImpl.java
  11. 30 4
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorPointServiceImpl.java
  12. 9 0
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorTaskAlgorithmsServiceImpl.java
  13. 17 9
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorTaskServiceImpl.java
  14. 0 2
      ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/task/EventTask.java
  15. 1 0
      ruoyi-modules/ruoyi-traffic/src/main/resources/mapper/SenMonitorTaskMapper.xml
  16. 22 0
      traffic-ui/src/api/manage/monitorTask/index.ts
  17. 141 30
      traffic-ui/src/views/manage/monitorPoint/videoConfig.vue
  18. 4 4
      traffic-ui/src/views/manage/monitorTask/index.vue
  19. 1 1
      traffic-ui/src/views/sense/video/index.vue

+ 1 - 1
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/controller/SenMonitorPointMediaController.java

@@ -112,7 +112,7 @@ public class SenMonitorPointMediaController extends BaseController {
      */
     @SaCheckPermission("manage:eventsMedia:query")
     @GetMapping("/getPointMediaByPointId")
-    public R<SenMonitorPointMediaVo> getPointMediaByPointId(SenMonitorPointMediaBo bo) {
+    public R<List<SenMonitorPointMediaVo>> getPointMediaByPointId(SenMonitorPointMediaBo bo) {
         return R.ok(senMonitorPointMediaService.getPointMediaByPointId(bo));
     }
 }

+ 18 - 7
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/controller/SenMonitorTaskAlgorithmsController.java

@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.constraints.*;
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.dromara.domain.SenMonitorTaskAlgorithms;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.dromara.common.idempotent.annotation.RepeatSubmit;
@@ -31,7 +32,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
 @Validated
 @RequiredArgsConstructor
 @RestController
-@RequestMapping("/dromara/monitorTaskAlgorithms")
+@RequestMapping("/manage/monitorTaskAlgorithms")
 public class SenMonitorTaskAlgorithmsController extends BaseController {
 
     private final ISenMonitorTaskAlgorithmsService senMonitorTaskAlgorithmsService;
@@ -39,7 +40,7 @@ public class SenMonitorTaskAlgorithmsController extends BaseController {
     /**
      * 查询监控点任务-算法配置列表
      */
-    @SaCheckPermission("dromara:monitorTaskAlgorithms:list")
+    @SaCheckPermission("manage:monitorTaskAlgorithms:list")
     @GetMapping("/list")
     public TableDataInfo<SenMonitorTaskAlgorithmsVo> list(SenMonitorTaskAlgorithmsBo bo, PageQuery pageQuery) {
         return senMonitorTaskAlgorithmsService.queryPageList(bo, pageQuery);
@@ -48,7 +49,7 @@ public class SenMonitorTaskAlgorithmsController extends BaseController {
     /**
      * 导出监控点任务-算法配置列表
      */
-    @SaCheckPermission("dromara:monitorTaskAlgorithms:export")
+    @SaCheckPermission("manage:monitorTaskAlgorithms:export")
     @Log(title = "监控点任务-算法配置", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(SenMonitorTaskAlgorithmsBo bo, HttpServletResponse response) {
@@ -61,7 +62,7 @@ public class SenMonitorTaskAlgorithmsController extends BaseController {
      *
      * @param taskId 主键
      */
-    @SaCheckPermission("dromara:monitorTaskAlgorithms:query")
+    @SaCheckPermission("manage:monitorTaskAlgorithms:query")
     @GetMapping("/{taskId}")
     public R<SenMonitorTaskAlgorithmsVo> getInfo(@NotNull(message = "主键不能为空")
                                      @PathVariable Long taskId) {
@@ -71,7 +72,7 @@ public class SenMonitorTaskAlgorithmsController extends BaseController {
     /**
      * 新增监控点任务-算法配置
      */
-    @SaCheckPermission("dromara:monitorTaskAlgorithms:add")
+    @SaCheckPermission("manage:monitorTaskAlgorithms:add")
     @Log(title = "监控点任务-算法配置", businessType = BusinessType.INSERT)
     @RepeatSubmit()
     @PostMapping()
@@ -82,7 +83,7 @@ public class SenMonitorTaskAlgorithmsController extends BaseController {
     /**
      * 修改监控点任务-算法配置
      */
-    @SaCheckPermission("dromara:monitorTaskAlgorithms:edit")
+    @SaCheckPermission("manage:monitorTaskAlgorithms:edit")
     @Log(title = "监控点任务-算法配置", businessType = BusinessType.UPDATE)
     @RepeatSubmit()
     @PutMapping()
@@ -95,11 +96,21 @@ public class SenMonitorTaskAlgorithmsController extends BaseController {
      *
      * @param taskIds 主键串
      */
-    @SaCheckPermission("dromara:monitorTaskAlgorithms:remove")
+    @SaCheckPermission("manage:monitorTaskAlgorithms:remove")
     @Log(title = "监控点任务-算法配置", businessType = BusinessType.DELETE)
     @DeleteMapping("/{taskIds}")
     public R<Void> remove(@NotEmpty(message = "主键不能为空")
                           @PathVariable Long[] taskIds) {
         return toAjax(senMonitorTaskAlgorithmsService.deleteWithValidByIds(List.of(taskIds), true));
     }
+
+    /**
+     * 批量新增或修改监控点任务-算法配置
+     */
+    @Log(title = "监控点任务-算法配置", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping("/updateBatchByTaskId")
+    public R<Void> updateBatchByTaskId( @RequestBody List<SenMonitorTaskAlgorithms> list) {
+        return toAjax(senMonitorTaskAlgorithmsService.updateBatchByTaskId(list));
+    }
 }

+ 12 - 1
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/controller/SenMonitorTaskController.java

@@ -110,7 +110,18 @@ public class SenMonitorTaskController extends BaseController {
      */
     @SaCheckPermission("manage:monitorTask:query")
     @GetMapping("/getTaskInfoByPointId/{id}")
-    public R<Map<String,Object>> getTaskInfoByPointId(@PathVariable Long id) {
+    public R<List<SenMonitorTaskVo>> getTaskInfoByPointId(@PathVariable Long id) {
         return R.ok(senMonitorTaskService.getTaskInfoByPointId(id));
     }
+
+    /**
+     * 新增任务和算法配置
+     */
+    @SaCheckPermission("manage:monitorTask:add")
+    @Log(title = "任务管理", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping("addMonitorTaskAlgorithms")
+    public R<Void> addMonitorTaskAlgorithms(@Validated(AddGroup.class) @RequestBody SenMonitorTaskBo bo) {
+        return toAjax(senMonitorTaskService.addMonitorTaskAlgorithms(bo));
+    }
 }

+ 0 - 1
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/domain/bo/SenMonitorTaskAlgorithmsBo.java

@@ -35,7 +35,6 @@ public class SenMonitorTaskAlgorithmsBo extends BaseEntity {
     /**
      * 算法感兴趣绘制区域内容
      */
-    @NotBlank(message = "算法感兴趣绘制区域内容不能为空", groups = { AddGroup.class, EditGroup.class })
     private String configContent;
 
 

+ 7 - 1
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/domain/bo/SenMonitorTaskBo.java

@@ -5,6 +5,9 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
 import io.github.linpeilie.annotations.AutoMapper;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import org.dromara.domain.SenMonitorTaskAlgorithms;
+
+import java.util.List;
 
 /**
  * 任务管理业务对象 sen_monitor_task
@@ -47,5 +50,8 @@ public class SenMonitorTaskBo extends BaseEntity {
      */
     private String status;
 
-
+    /**
+     * 任务关联的算法
+     */
+    private List<SenMonitorTaskAlgorithms> taskAlgorithms;
 }

+ 0 - 6
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/domain/vo/SenMonitorTaskVo.java

@@ -73,12 +73,6 @@ public class SenMonitorTaskVo extends BaseEntity {
      * 任务状态(1-未开始 2-分析中3-分析完成)
      */
     private String status;
-
-    /**
-     * 离线任务关联的视频信息
-     */
-    private SenMonitorPointMedia mediaInfo;
-
     /**
      * 关联的算法信息
      */

+ 1 - 1
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/ISenMonitorPointMediaService.java

@@ -66,5 +66,5 @@ public interface ISenMonitorPointMediaService {
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
-    SenMonitorPointMediaVo getPointMediaByPointId(SenMonitorPointMediaBo bo);
+    List<SenMonitorPointMediaVo> getPointMediaByPointId(SenMonitorPointMediaBo bo);
 }

+ 3 - 0
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/ISenMonitorTaskAlgorithmsService.java

@@ -1,5 +1,6 @@
 package org.dromara.service;
 
+import org.dromara.domain.SenMonitorTaskAlgorithms;
 import org.dromara.domain.vo.SenMonitorTaskAlgorithmsVo;
 import org.dromara.domain.bo.SenMonitorTaskAlgorithmsBo;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -65,4 +66,6 @@ public interface ISenMonitorTaskAlgorithmsService {
      * @return 是否删除成功
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    Boolean updateBatchByTaskId(List<SenMonitorTaskAlgorithms> list);
 }

+ 3 - 1
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/ISenMonitorTaskService.java

@@ -67,5 +67,7 @@ public interface ISenMonitorTaskService {
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
-    Map<String, Object> getTaskInfoByPointId(Long id);
+    List<SenMonitorTaskVo> getTaskInfoByPointId(Long id);
+
+    Boolean addMonitorTaskAlgorithms(SenMonitorTaskBo bo);
 }

+ 2 - 2
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorPointMediaServiceImpl.java

@@ -133,8 +133,8 @@ public class SenMonitorPointMediaServiceImpl implements ISenMonitorPointMediaSer
     }
 
     @Override
-    public SenMonitorPointMediaVo getPointMediaByPointId(SenMonitorPointMediaBo bo) {
+    public List<SenMonitorPointMediaVo> getPointMediaByPointId(SenMonitorPointMediaBo bo) {
         LambdaQueryWrapper<SenMonitorPointMedia> lqw = new LambdaQueryWrapper<>();
-        return baseMapper.selectVoOne(lqw.eq(SenMonitorPointMedia::getPointId, bo.getPointId()));
+        return baseMapper.selectVoList(lqw.eq(SenMonitorPointMedia::getPointId, bo.getPointId()));
     }
 }

+ 30 - 4
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorPointServiceImpl.java

@@ -9,15 +9,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
 import org.dromara.domain.SenMonitorPointMedia;
+import org.dromara.domain.SenMonitorTask;
 import org.dromara.domain.vo.MonitorTreeVo;
-import org.dromara.mapper.SenMonitorPointMediaMapper;
+import org.dromara.mapper.*;
 import org.dromara.system.domain.SysArea;
 import org.dromara.system.mapper.SysAreaMapper;
 import org.springframework.stereotype.Service;
 import org.dromara.domain.bo.SenMonitorPointBo;
 import org.dromara.domain.vo.SenMonitorPointVo;
 import org.dromara.domain.SenMonitorPoint;
-import org.dromara.mapper.SenMonitorPointMapper;
 import org.dromara.service.ISenMonitorPointService;
 
 import java.util.*;
@@ -36,6 +36,11 @@ public class SenMonitorPointServiceImpl implements ISenMonitorPointService {
     private final SysAreaMapper areaMapper;
     private final SenMonitorPointMediaMapper mediaMapper;
 
+    private  final SenMonitorTaskMapper senMonitorTaskMapper;
+
+    private  final SenMonitorTaskAlgorithmsMapper senMonitorTaskAlgorithmsMapper;
+    private final SenEventsMapper senEventsMapper;
+
     /**
      * 查询监控点位信息
      *
@@ -117,6 +122,14 @@ public class SenMonitorPointServiceImpl implements ISenMonitorPointService {
     public Boolean updateByBo(SenMonitorPointBo bo) {
         SenMonitorPoint update = MapstructUtils.convert(bo, SenMonitorPoint.class);
         validEntityBeforeSave(update);
+        if(Objects.equals(bo.getVideoType(), "1")){
+            LambdaQueryWrapper<SenMonitorPointMedia> lqw = Wrappers.lambdaQuery();
+            lqw.eq(SenMonitorPointMedia::getPointId, bo.getPointId());
+            SenMonitorPointMedia media =mediaMapper.selectOne(lqw);
+            media.setDeviceNo(bo.getDeviceNo());
+            media.setStreamUrl(bo.getStreamUrl());
+            mediaMapper.updateById(media);
+        }
         return baseMapper.updateById(update) > 0;
     }
 
@@ -128,7 +141,7 @@ public class SenMonitorPointServiceImpl implements ISenMonitorPointService {
     }
 
     /**
-     * 校验并批量删除监控点位信息信息
+     * 校验并批量删除监控点位信息并且删除对应的任务配置
      *
      * @param ids     待删除的主键集合
      * @param isValid 是否进行有效性校验
@@ -139,7 +152,20 @@ public class SenMonitorPointServiceImpl implements ISenMonitorPointService {
         if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
-        return baseMapper.deleteByIds(ids) > 0;
+        boolean flag  = baseMapper.deleteByIds(ids) > 0;
+        //删除媒介信息
+        mediaMapper.deleteByIds(ids);
+        //删除任务信息 和任务配置信息
+        for (Long id : ids) {
+            LambdaQueryWrapper<SenMonitorTask> lqw = Wrappers.lambdaQuery();
+            lqw.eq(SenMonitorTask::getPointId, id);
+            List<SenMonitorTask>  taskList = senMonitorTaskMapper.selectList(lqw);
+            for (SenMonitorTask task : taskList) {
+                senMonitorTaskMapper.deleteById(task.getId());
+                senMonitorTaskAlgorithmsMapper.deleteById(task.getId());
+            }
+        }
+        return flag;
     }
 
     @Override

+ 9 - 0
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorTaskAlgorithmsServiceImpl.java

@@ -126,4 +126,13 @@ public class SenMonitorTaskAlgorithmsServiceImpl implements ISenMonitorTaskAlgor
         }
         return baseMapper.deleteByIds(ids) > 0;
     }
+
+    @Override
+    public Boolean updateBatchByTaskId(List<SenMonitorTaskAlgorithms> list) {
+        //先删除
+        if(list.size()>0){
+           baseMapper.deleteById(list.get(0).getTaskId());
+        }
+        return baseMapper.insert(list).size()>0;
+    }
 }

+ 17 - 9
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/service/impl/SenMonitorTaskServiceImpl.java

@@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor;
 import org.dromara.domain.SenMonitorPointMedia;
 import org.dromara.domain.SenMonitorTaskAlgorithms;
 import org.dromara.domain.vo.SenMonitorPointMediaVo;
+import org.dromara.domain.vo.SenMonitorTaskAlgorithmsVo;
 import org.dromara.mapper.SenMonitorPointMediaMapper;
 import org.dromara.mapper.SenMonitorTaskAlgorithmsMapper;
 import org.springframework.stereotype.Service;
@@ -137,22 +138,29 @@ public class SenMonitorTaskServiceImpl implements ISenMonitorTaskService {
     }
 
     @Override
-    public Map<String, Object> getTaskInfoByPointId(Long id) {
-        Map<String,Object> map = new HashMap<>();
+    public List<SenMonitorTaskVo> getTaskInfoByPointId(Long id) {
         LambdaQueryWrapper<SenMonitorTask> lqw = Wrappers.lambdaQuery();
         lqw.eq(SenMonitorTask::getPointId, id);
          List<SenMonitorTaskVo> senMonitorTaskList = baseMapper.selectVoList(lqw);
-
          if(senMonitorTaskList.size()>0){
              for (SenMonitorTaskVo senMonitorTaskVo : senMonitorTaskList) {
-                 map.put("videoType",senMonitorTaskVo.getVideoType());
-                 LambdaQueryWrapper<SenMonitorPointMedia> media = Wrappers.lambdaQuery();
-                 media.eq(SenMonitorPointMedia::getId, senMonitorTaskVo.getMediaId());
-                 senMonitorTaskVo.setMediaInfo(mediaMapper.selectOne(media));
                  senMonitorTaskVo.setTaskAlgorithms(taskAlgorithmsMapper.selectTaskAlgorithms(senMonitorTaskVo.getId()));
              }
          }
-        map.put("list",senMonitorTaskList);
-        return map;
+        return senMonitorTaskList;
+    }
+
+    @Override
+    public Boolean addMonitorTaskAlgorithms(SenMonitorTaskBo bo) {
+        SenMonitorTask add = MapstructUtils.convert(bo, SenMonitorTask.class);
+        boolean flag =  baseMapper.insert(add)>0;
+        if (flag) {
+            for(SenMonitorTaskAlgorithms senMonitorTaskAlgorithms : bo.getTaskAlgorithms()){
+                senMonitorTaskAlgorithms.setTaskId(add.getId());
+            }
+            taskAlgorithmsMapper.insertBatch(bo.getTaskAlgorithms());
+        }
+
+        return flag;
     }
 }

+ 0 - 2
ruoyi-modules/ruoyi-traffic/src/main/java/org/dromara/task/EventTask.java

@@ -22,8 +22,6 @@ public class EventTask {
     private final SenEventsMediaMapper eventsMediaMapper;
 
     @Scheduled(cron = "0 0/30 * * * ?")
-//    @Scheduled(cron = "0 15 10 ? * *")
-//    @Scheduled(cron = "*/10 * * * * *")
     public void AiToEventJob() {
         List<SenEvents> taskList = taskMapper.selectScheduledTask();
         for (SenEvents event : taskList) {

+ 1 - 0
ruoyi-modules/ruoyi-traffic/src/main/resources/mapper/SenMonitorTaskMapper.xml

@@ -51,6 +51,7 @@
         sys_area c ON c.area_id  = b.area_id
         LEFT JOIN
         sen_map_tmp map ON map.algorithm_category = sa.algorithm_category
+        WHERE sac.`status`='2'
         ORDER BY RAND()
         LIMIT 60
     </select>

+ 22 - 0
traffic-ui/src/api/manage/monitorTask/index.ts

@@ -71,3 +71,25 @@ export const getTaskInfoByPointId = (id) => {
     method: 'get'
   });
 };
+/**
+ * 批量修改监控点任务-算法配置
+ * @param data
+ */
+export const updateBatchByTaskId = (data) => {
+  return request({
+    url: '/manage/monitorTaskAlgorithms/updateBatchByTaskId',
+    method: 'post',
+    data
+  });
+};
+/**
+ * 新增任务和算法配置
+ * @param data
+ */
+export const addMonitorTaskAlgorithms = (data) => {
+  return request({
+    url: '/manage/monitorTask/addMonitorTaskAlgorithms',
+    method: 'post',
+    data
+  });
+};

+ 141 - 30
traffic-ui/src/views/manage/monitorPoint/videoConfig.vue

@@ -9,41 +9,58 @@
     <div class="map-tips">在地图中右键可以添加监控点</div>
     <div class="map" id="map"></div>
     <el-dialog v-model="showMarkerDialog" :title="markerInfo.pointName" width="400">
-      <span v-if="taskInfo.list.length == 0">暂无已配置并检测的类型,请点击右下角的配置</span>
-      <div v-else-if="taskInfo.videoType == 1">
-        <span>正在检测:</span>
-        <span v-for="el, index in taskInfo.list[0].taskAlgorithms" :key="el.algorithm_name">{{ index === 0 ? '' : ','
-          }}{{ el.algorithm_name }}</span>
+      <template v-if="markerInfo.videoType == '1'">
+        <span v-if="!pointMedia[0].taskInfo">暂无已配置并检测的类型,请点击右下角的配置</span>
+        <div v-else>
+          <span>正在检测:</span>
+          <span v-for="el, index in pointMedia[0].taskInfo.taskAlgorithms" :key="el.algorithm_name">{{ index === 0 ? ''
+            : ','
+            }}{{ el.algorithm_name }}</span>
+        </div>
+      </template>
+
+      <div v-else-if="markerInfo.videoType == '2'">
+        <div v-if="pointMedia.length==0">
+          暂无离线视频,请上传
+        </div>
+        <div v-else>
+           <div v-for="item in pointMedia" class="video-item">
+            {{item.fileName}}
+           </div>
+        </div>
       </div>
-      <div v-else-if="taskInfo.videoType == 2"></div>
       <template #footer>
         <div class="dialog-footer">
           <el-button type="" link @click="editMarker">修改</el-button>
-          <el-button type="" link @click="configClick">配置</el-button>
+          <el-button type="" v-if="markerInfo.videoType == '2'" link @click="uploadVideo">上传视频</el-button>
+          <el-button type="" v-else link @click="configClick">配置</el-button>
           <el-button type="" link @click="deleteMarker">删除</el-button>
         </div>
       </template>
     </el-dialog>
-    <el-dialog v-model="showConfigDialog" title="配置信息" width="800" :destroy-on-close="true">
-      <el-tabs v-model="activTab.first" class="custom-tabs" @tab-click="tabClick">
+    <el-dialog v-model="showConfigDialog" title="配置信息" width="1000" :destroy-on-close="true">
+      <el-tabs v-model="activTab.first" class="custom-tabs" @tab-change="tabChange">
         <el-tab-pane v-for="item in algorithmCategoryOptions" :key="item.value" :label="item.name" :name="item.value">
           <el-row :gutter="20">
-            <el-col :lg="6" :xs="24">
+            <el-col :lg="4" :xs="24">
               <div class="algorithm-type">
-                <div :class="{ 'algorithm-type-selected': el.id === activTab.second }" v-for="el in item.children" @click="activTab.second=el.id">{{
-                  el.algorithmName }}</div>
+                <div :class="{ 'algorithm-type-selected': el.id === activTab.second }" v-for="el in item.children"
+                  @click="activTab.second = el.id">{{
+                    el.algorithmName }}</div>
               </div>
             </el-col>
-            <el-col :lg="18" :xs="24" v-if="activTab.first === item.value">
-              <JessibucaPlayer class="player" :videoUrl="`https://live.nodemedia.cn:8443/live/sony_4k_264.flv`"
-                :show-paint="true" />
+            <el-col :lg="16" :xs="24" v-if="activTab.first === item.value">
+              <JessibucaPlayer class="player" :videoUrl="configMediaInfo.streamUrl" :show-paint="true" />
+            </el-col>
+            <el-col :lg="4" :xs="24">
+              <el-checkbox v-model="curCheckedEvent.ifCheck" label="检测此类型" size="large" />
             </el-col>
           </el-row>
         </el-tab-pane>
       </el-tabs>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" link @click="showConfigDialog = false">提交</el-button>
+          <el-button type="primary" @click="configSubmit">提交</el-button>
         </div>
       </template>
     </el-dialog>
@@ -64,7 +81,7 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="视频类型" prop="videoType" :rules="[{ required: true, message: '视频类型不能为空' }]">
-          <el-radio-group v-model="form.videoType">
+          <el-radio-group v-model="form.videoType" :disabled="dialog.title.includes('修改')">
             <el-radio value="1">实时视频</el-radio>
             <el-radio value="2">离线视频</el-radio>
           </el-radio-group>
@@ -101,9 +118,10 @@
 </template>
 
 <script lang="ts" setup>
-import { getListByAreaTree, addMonitorPoint, updateMonitorPoint, delMonitorPoint } from '@/api/manage/monitorPoint/index'
-import { getTaskInfoByPointId } from '@/api/manage/monitorTask'
+import { getListByAreaTree, addMonitorPoint, updateMonitorPoint, delMonitorPoint } from '@/api/manage/monitorPoint'
+import { getTaskInfoByPointId, updateBatchByTaskId, addMonitorTaskAlgorithms } from '@/api/manage/monitorTask'
 import { listAlgorithmConfig } from '@/api/manage/algorithmConfig'
+import { getPointMediaByPointId } from '@/api/manage/monitorPoint'
 import api from '@/api/system/user';
 import { getDicts } from '@/api/system/dict/data'
 import monitorIcon from '@/assets/images/monitor.svg'
@@ -121,10 +139,7 @@ const dialog = reactive<DialogOption>({
 });
 const markerInfo = ref({
   pointId: '',
-  pointName: ''
-})
-const taskInfo = ref<any>({
-  list: [],
+  pointName: '',
   videoType: ''
 })
 const showMarkerDialog = ref(false)
@@ -147,6 +162,13 @@ const form = ref({
   direction: '',
   intersectionId: ''
 });
+const pointMedia = ref([])
+const configMediaInfo = ref<any>({})
+const configTaskId = ref('')
+const curCheckedEvent = computed(() => {
+  const { children } = algorithmCategoryOptions.value.filter(item => item.value === activTab.first)[0]
+  return children.filter(item => item.id === activTab.second)[0]
+})
 onMounted(() => {
   var map = new BMapGL.Map("map"); // 创建地图实例
   var point = new BMapGL.Point(118.879999, 32.016216); // 创建点坐标
@@ -194,7 +216,10 @@ const getAlTabs = async () => {
     (rows || []).forEach(item => {
       algorithmCategoryOptions.value.forEach(el => {
         if (item.algorithmCategory === el.value) {
-          el.children.push(item)
+          el.children.push({
+            ...item,
+            ifCheck: false
+          })
         }
       })
     })
@@ -202,7 +227,10 @@ const getAlTabs = async () => {
   activTab.first = algorithmCategoryOptions.value[0].value
   activTab.second = algorithmCategoryOptions.value[0].children[0].id
 }
-const tabClick = () => { }
+const tabChange = () => {
+  const { children } = algorithmCategoryOptions.value.filter(item => item.value === activTab.first)[0]
+  activTab.second = children[0].id
+}
 /** 通过条件过滤节点  */
 const filterNode = (value: string, data: any) => {
   if (!value) return true;
@@ -245,25 +273,44 @@ const showMarks = () => {
     let icon = new BMapGL.Icon(monitorIcon, new BMapGL.Size(40, 40))
     var marker = new BMapGL.Marker(pt, { icon, myCustomProperty: '111' });
     bdmap.value.addOverlay(marker);
-    marker.addEventListener("click", () => {
+    marker.addEventListener("click", async () => {
       markerInfo.value = item
-      getTaskInfo(item.pointId)
+      await getMediaInfo(item.pointId)
       showMarkerDialog.value = true
     })
   })
 };
-const getTaskInfo = (pointId) => {
-  getTaskInfoByPointId(pointId).then(({ code, data }) => {
+const getMediaInfo = async (pointId) => {
+  let taskList = []
+  await getTaskInfoByPointId(pointId).then(({ code, data }) => {
+    if (code === 200) {
+      taskList = data
+    }
+  })
+  await getPointMediaByPointId({ pointId }).then(({ code, data }) => {
     if (code === 200) {
-      taskInfo.value = data
+      pointMedia.value = (data || []).map(item => ({
+        ...item,
+        taskInfo: null
+      }))
     }
   })
+  pointMedia.value.forEach(item => {
+    taskList.forEach(el => {
+      if (item.id === el.mediaId) {
+        item.taskInfo = el
+      }
+    })
+  })
 }
 const editMarker = () => {
   showMarkerDialog.value = false
   dialog.visible = true;
   dialog.title = '修改监控点位';
   Object.assign(form.value, markerInfo.value)
+  if (markerInfo.value.videoType ==='1') {
+    Object.assign(form.value,pointMedia.value[0])
+  }
 }
 const deleteMarker = async () => {
   await proxy?.$modal.confirm('您确定要删除该监控点位?');
@@ -275,8 +322,66 @@ const deleteMarker = async () => {
 }
 const configClick = () => {
   showMarkerDialog.value = false
+  configMediaInfo.value = pointMedia.value[0]
+  //先清空
+  algorithmCategoryOptions.value.forEach(item => {
+    item.children.forEach(el => {
+      el.ifCheck = false
+    })
+  })
+  configTaskId.value = ''
+  if (pointMedia.value[0].taskInfo) {
+    const { id, taskAlgorithms } = pointMedia.value[0].taskInfo
+    configTaskId.value = id
+    const checkedArr = taskAlgorithms.map(item => item.algorithm_id)
+    algorithmCategoryOptions.value.forEach(item => {
+      item.children.forEach(el => {
+        if (checkedArr.includes(el.id)) {
+          el.ifCheck = true
+        }
+      })
+    })
+  }
   showConfigDialog.value = true
 }
+const configSubmit = async () => {
+  const taskAlgorithms = []
+  algorithmCategoryOptions.value.forEach(item => {
+    item.children.forEach(el => {
+      if (el.ifCheck) {
+        taskAlgorithms.push(el)
+      }
+    })
+  })
+  if (taskAlgorithms.length === 0) return proxy?.$modal.msgError("请勾选检测的类型");
+  if (configTaskId.value) {
+    await updateBatchByTaskId(taskAlgorithms.map(item => ({
+      taskId: configTaskId.value,
+      algorithmId: item.id,
+      configContent: "{}"
+    })))
+  } else {
+    addMonitorTaskAlgorithms(
+      {
+        mediaId: configMediaInfo.value.id,
+        pointId: markerInfo.value.pointId,
+        videoType: markerInfo.value.videoType,
+        progress: 0,
+        status: '2',
+        taskAlgorithms: taskAlgorithms.map(item => ({
+          taskId: configTaskId.value,
+          algorithmId: item.id,
+          configContent: "{}"
+        }))
+      }
+    )
+  }
+  showConfigDialog.value = false
+  proxy?.$modal.msgSuccess("配置成功")
+}
+const uploadVideo = () => {
+
+}
 </script>
 
 <style lang="scss" scoped>
@@ -327,4 +432,10 @@ const configClick = () => {
 
   }
 }
+.video-item{
+  margin-top: 5px;
+  color: #409EFF;
+  cursor: pointer;
+  text-decoration: underline;
+}
 </style>

+ 4 - 4
traffic-ui/src/views/manage/monitorTask/index.vue

@@ -17,7 +17,7 @@
               <dict-tag :options="task_status" :value="scope.row.status"></dict-tag>
             </template>
           </el-table-column>
-          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template #default="scope">
               <el-tooltip content="修改" placement="top">
                 <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
@@ -28,7 +28,7 @@
                   v-hasPermi="['manage:monitorTask:remove']"></el-button>
               </el-tooltip>
             </template>
-          </el-table-column>
+          </el-table-column> -->
         </el-table>
       </el-tab-pane>
       <el-tab-pane label="离线视频" name="2">
@@ -49,7 +49,7 @@
               <dict-tag :options="task_status" :value="scope.row.status"></dict-tag>
             </template>
           </el-table-column>
-          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template #default="scope">
               <el-tooltip content="修改" placement="top">
                 <el-button link type="primary" icon="Edit"
@@ -60,7 +60,7 @@
                   v-hasPermi="['manage:monitorTask:remove']"></el-button>
               </el-tooltip>
             </template>
-          </el-table-column>
+          </el-table-column> -->
         </el-table>
       </el-tab-pane>
     </el-tabs>

+ 1 - 1
traffic-ui/src/views/sense/video/index.vue

@@ -69,7 +69,7 @@ const handleNodeClick = (val) => {
     playerName.value = val.areaName
     getPointMediaByPointId({ pointId: val.areaId }).then(({ code, data }) => {
       if (code === 200) {
-        mediaInfo.value = data
+        mediaInfo.value = data[0]
       }
     })
   }