From 8e76389b026bc7d7d0aa0bc049e6832e855d2dbd Mon Sep 17 00:00:00 2001
From: zhangjian <zhangjianrock@163.com>
Date: 星期四, 01 六月 2023 15:28:18 +0800
Subject: [PATCH] 视频巡检任务 重新生成表

---
 ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectRecordMapper.java            |    3 +
 ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectRecordService.java         |    8 ++++
 ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectRecordServiceImpl.java |   14 +++++++
 ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java         |    1 
 ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java      |    3 +
 ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml                    |    5 +-
 ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectRecordController.java    |   50 +++++++++++++------------
 ard-work/src/main/resources/mapper/inspect/ArdVideoInspectRecordMapper.xml                  |   16 +++++++-
 8 files changed, 72 insertions(+), 28 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
index beb9483..193f73e 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
@@ -154,6 +154,7 @@
             Map option = new HashMap();
             option.put("value", item.getId());
             option.put("label", item.getName());
+            option.put("channel", item.getChannel());
            // option.put("description", item.getOilProduction());
             options.add(option);
         }
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectRecordController.java b/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectRecordController.java
index 71d660e..fbd225b 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectRecordController.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectRecordController.java
@@ -2,16 +2,10 @@
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -23,14 +17,13 @@
 
 /**
  * 瑙嗛宸℃璁板綍Controller
- * 
+ *
  * @author ruoyi
  * @date 2023-05-30
  */
 @RestController
 @RequestMapping("/inspect/record")
-public class ArdVideoInspectRecordController extends BaseController
-{
+public class ArdVideoInspectRecordController extends BaseController {
     @Autowired
     private IArdVideoInspectRecordService ardVideoInspectRecordService;
 
@@ -39,11 +32,25 @@
      */
     @PreAuthorize("@ss.hasPermi('inspect:record:list')")
     @GetMapping("/list")
-    public TableDataInfo list(ArdVideoInspectRecord ardVideoInspectRecord)
-    {
+    public TableDataInfo list(ArdVideoInspectRecord ardVideoInspectRecord) {
         startPage();
         List<ArdVideoInspectRecord> list = ardVideoInspectRecordService.selectArdVideoInspectRecordList(ardVideoInspectRecord);
         return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('inspect:record:list')")
+    @GetMapping("/listByStartTime")
+    public TableDataInfo listByStartTime(ArdVideoInspectRecord ardVideoInspectRecord) {
+        startPage();
+        List list = ardVideoInspectRecordService.selectArdVideoInspectRecordListByStartTime(ardVideoInspectRecord);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('inspect:record:list')")
+    @GetMapping("/getFileCountByStartMonth")
+    public List getFileCountByStartMonth(@RequestParam("startMonth") String startMonth) {
+        List list = ardVideoInspectRecordService.selectArdVideoInspectRecordCountByStartMonth(startMonth);
+        return list;
     }
 
     /**
@@ -52,8 +59,7 @@
     @PreAuthorize("@ss.hasPermi('inspect:record:export')")
     @Log(title = "瑙嗛宸℃璁板綍", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, ArdVideoInspectRecord ardVideoInspectRecord)
-    {
+    public void export(HttpServletResponse response, ArdVideoInspectRecord ardVideoInspectRecord) {
         List<ArdVideoInspectRecord> list = ardVideoInspectRecordService.selectArdVideoInspectRecordList(ardVideoInspectRecord);
         ExcelUtil<ArdVideoInspectRecord> util = new ExcelUtil<ArdVideoInspectRecord>(ArdVideoInspectRecord.class);
         util.exportExcel(response, list, "瑙嗛宸℃璁板綍鏁版嵁");
@@ -64,8 +70,7 @@
      */
     @PreAuthorize("@ss.hasPermi('inspect:record:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") String id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") String id) {
         return success(ardVideoInspectRecordService.selectArdVideoInspectRecordById(id));
     }
 
@@ -75,8 +80,7 @@
     @PreAuthorize("@ss.hasPermi('inspect:record:add')")
     @Log(title = "瑙嗛宸℃璁板綍", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody ArdVideoInspectRecord ardVideoInspectRecord)
-    {
+    public AjaxResult add(@RequestBody ArdVideoInspectRecord ardVideoInspectRecord) {
         return toAjax(ardVideoInspectRecordService.insertArdVideoInspectRecord(ardVideoInspectRecord));
     }
 
@@ -86,8 +90,7 @@
     @PreAuthorize("@ss.hasPermi('inspect:record:edit')")
     @Log(title = "瑙嗛宸℃璁板綍", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody ArdVideoInspectRecord ardVideoInspectRecord)
-    {
+    public AjaxResult edit(@RequestBody ArdVideoInspectRecord ardVideoInspectRecord) {
         return toAjax(ardVideoInspectRecordService.updateArdVideoInspectRecord(ardVideoInspectRecord));
     }
 
@@ -96,9 +99,8 @@
      */
     @PreAuthorize("@ss.hasPermi('inspect:record:remove')")
     @Log(title = "瑙嗛宸℃璁板綍", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable String[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
         return toAjax(ardVideoInspectRecordService.deleteArdVideoInspectRecordByIds(ids));
     }
 }
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java b/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java
index b8bea9c..ceac81a 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java
@@ -2,6 +2,8 @@
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.utils.uuid.UUID;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -77,6 +79,7 @@
     @PostMapping
     public AjaxResult add(@RequestBody ArdVideoInspectTask ardVideoInspectTask)
     {
+        ardVideoInspectTask.setId(UUID.randomUUID().toString());
         return toAjax(ardVideoInspectTaskService.insertArdVideoInspectTask(ardVideoInspectTask));
     }
 
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectRecordMapper.java b/ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectRecordMapper.java
index 9d59a93..7b80456 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectRecordMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectRecordMapper.java
@@ -26,6 +26,7 @@
      * @return 瑙嗛宸℃璁板綍闆嗗悎
      */
     public List<ArdVideoInspectRecord> selectArdVideoInspectRecordList(ArdVideoInspectRecord ardVideoInspectRecord);
+    public List selectArdVideoInspectRecordListByStartTime(ArdVideoInspectRecord ardVideoInspectRecord);
 
     /**
      * 鏂板瑙嗛宸℃璁板綍
@@ -58,4 +59,6 @@
      * @return 缁撴灉
      */
     public int deleteArdVideoInspectRecordByIds(String[] ids);
+
+    List selectArdVideoInspectRecordCountByStartMonth(String startMonth);
 }
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectRecordService.java b/ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectRecordService.java
index bb844f0..ba55704 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectRecordService.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectRecordService.java
@@ -28,6 +28,14 @@
     public List<ArdVideoInspectRecord> selectArdVideoInspectRecordList(ArdVideoInspectRecord ardVideoInspectRecord);
 
     /**
+     * 鎸夋棩鏈熸煡璇�
+     * @param ardVideoInspectRecord
+     * @return
+     */
+    public List selectArdVideoInspectRecordListByStartTime(ArdVideoInspectRecord ardVideoInspectRecord);
+    public List selectArdVideoInspectRecordCountByStartMonth(String startMonth);
+
+    /**
      * 鏂板瑙嗛宸℃璁板綍
      * 
      * @param ardVideoInspectRecord 瑙嗛宸℃璁板綍
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectRecordServiceImpl.java b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectRecordServiceImpl.java
index b5b98cc..c33dfa4 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectRecordServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectRecordServiceImpl.java
@@ -42,6 +42,20 @@
         return ardVideoInspectRecordMapper.selectArdVideoInspectRecordList(ardVideoInspectRecord);
     }
 
+    @Override
+    public List selectArdVideoInspectRecordListByStartTime(ArdVideoInspectRecord ardVideoInspectRecord) {
+        return ardVideoInspectRecordMapper.selectArdVideoInspectRecordListByStartTime(ardVideoInspectRecord);
+    }
+
+    /**
+     * 鎸夋湀浠借幏鍙栨瘡鏃ヨ褰曟枃浠舵暟閲�
+     * @param startMonth
+     * @return
+     */
+    public List<ArdVideoInspectRecord> selectArdVideoInspectRecordCountByStartMonth(String startMonth) {
+        return ardVideoInspectRecordMapper.selectArdVideoInspectRecordCountByStartMonth(startMonth);
+    }
+
     /**
      * 鏂板瑙嗛宸℃璁板綍
      *
diff --git a/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectRecordMapper.xml b/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectRecordMapper.xml
index c08b4cc..fa00cca 100644
--- a/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectRecordMapper.xml
+++ b/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectRecordMapper.xml
@@ -20,7 +20,7 @@
 
     <select id="selectArdVideoInspectRecordList" parameterType="ArdVideoInspectRecord" resultMap="ArdVideoInspectRecordResult">
         <include refid="selectArdVideoInspectRecordVo"/>
-        <where>  
+        <where>
             <if test="startTime != null  and startTime != ''"> and start_time = #{startTime}</if>
             <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
             <if test="recordFilePath != null  and recordFilePath != ''"> and record_file_path = #{recordFilePath}</if>
@@ -29,7 +29,19 @@
             <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
         </where>
     </select>
-    
+    <!--鎸夋棩鏈熸煡璇�-->
+    <select id="selectArdVideoInspectRecordListByStartTime" parameterType="ArdVideoInspectRecord" resultType="java.util.HashMap">
+        select r.*,s.well_id,w.well_id as well_name from ard_video_inspect_record r ,ard_video_inspect_task_step
+        s,ard_alarmpoints_well w where start_time like ('${startTime}%') and r.step_id = s.id and s.well_id = w.id
+    </select>
+    <!--鎸夋湀浠界粺璁℃枃浠舵暟閲�-->
+    <select id="selectArdVideoInspectRecordCountByStartMonth" parameterType="String" resultType="java.util.HashMap">
+        select f.start_date,count(*) from
+        (select substring(r.start_time,0,11)as start_date,* from ard_video_inspect_record r
+        where r.start_time like '${startMonth}%') as f
+        group by f.start_date
+    </select>
+
     <select id="selectArdVideoInspectRecordById" parameterType="String" resultMap="ArdVideoInspectRecordResult">
         <include refid="selectArdVideoInspectRecordVo"/>
         where id = #{id}
diff --git a/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml b/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml
index dd90643..c9fcb84 100644
--- a/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml
+++ b/ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml
@@ -50,6 +50,7 @@
             <if test="cameraId != null  and cameraId != ''"> and camera_id = #{cameraId}</if>
             <if test="channel != null "> and channel = #{channel}</if>
         </where>
+        order by id
     </select>
     
     <select id="selectArdVideoInspectTaskById" parameterType="String" resultMap="ArdVideoInspectTaskArdVideoInspectTaskStepResult">
@@ -148,9 +149,9 @@
     </delete>
 
     <insert id="batchArdVideoInspectTaskStep">
-        insert into ard_video_inspect_task_step( task_id, dept_id, user_id, id, order_number, recording_time, well_id) values
+        insert into ard_video_inspect_task_step( task_id, dept_id, user_id,  order_number, recording_time, well_id) values
 		<foreach item="item" index="index" collection="list" separator=",">
-            ( #{item.taskId}, #{item.deptId}, #{item.userId}, #{item.id}, #{item.orderNumber}, #{item.recordingTime}, #{item.wellId})
+            ( #{item.taskId}, #{item.deptId}, #{item.userId},  #{item.orderNumber}, #{item.recordingTime}, #{item.wellId})
         </foreach>
     </insert>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3