From e5f711997c3247dc74d5a820673cc911bd2fbcf4 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期五, 11 三月 2022 15:42:42 +0800
Subject: [PATCH] 功能完善

---
 dao/src/main/java/com/sandu/ximon/dao/domain/LedSFile.java                         |    6 ++++++
 dao/src/main/resources/mapper/LedSFileMapper.xml                                   |   24 +++++++++++++-----------
 sandu-common/src/main/java/com/sandu/common/file/FileUploadDto.java                |    6 ++++++
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java       |    3 +++
 dao/src/main/java/com/sandu/ximon/dao/domain/FileOperationRecord.java              |    5 +++++
 dao/src/main/resources/mapper/FileOperationRecordMapper.xml                        |    1 +
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LedSFileController.java |    3 +++
 7 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/FileOperationRecord.java b/dao/src/main/java/com/sandu/ximon/dao/domain/FileOperationRecord.java
index 5ac87ea..acb7960 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/domain/FileOperationRecord.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/FileOperationRecord.java
@@ -57,6 +57,11 @@
     private LocalDateTime createTime;
 
     /**
+     * 缂╃暐鍥�
+     */
+    private String screenShot;
+
+    /**
      * 鏂囦欢鍚嶇О
      */
     private String fileName;
diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/LedSFile.java b/dao/src/main/java/com/sandu/ximon/dao/domain/LedSFile.java
index e475e8a..a837be1 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/domain/LedSFile.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/LedSFile.java
@@ -61,6 +61,12 @@
      */
     private Integer width;
 
+
+    /**
+     * 缂╃暐鍥�
+     */
+    private String screenShot;
+
     /**
      * 
      */
diff --git a/dao/src/main/resources/mapper/FileOperationRecordMapper.xml b/dao/src/main/resources/mapper/FileOperationRecordMapper.xml
index 1aaa8f0..08e8688 100644
--- a/dao/src/main/resources/mapper/FileOperationRecordMapper.xml
+++ b/dao/src/main/resources/mapper/FileOperationRecordMapper.xml
@@ -8,6 +8,7 @@
             <id property="fileId" column="file_id" jdbcType="BIGINT"/>
             <result property="originName" column="origin_name" jdbcType="VARCHAR"/>
             <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
+            <result property="screenShot" column="screen_shot" jdbcType="VARCHAR"/>
             <result property="fileType" column="file_type" jdbcType="VARCHAR"/>
             <result property="fileSize" column="file_size" jdbcType="BIGINT"/>
             <result property="height" column="height" jdbcType="INTEGER"/>
diff --git a/dao/src/main/resources/mapper/LedSFileMapper.xml b/dao/src/main/resources/mapper/LedSFileMapper.xml
index 50560d2..cf94bb7 100644
--- a/dao/src/main/resources/mapper/LedSFileMapper.xml
+++ b/dao/src/main/resources/mapper/LedSFileMapper.xml
@@ -5,20 +5,22 @@
 <mapper namespace="com.sandu.ximon.dao.mapper.LedSFileMapper">
 
     <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LedSFile">
-            <id property="fileId" column="file_id" jdbcType="BIGINT"/>
-            <result property="cilentId" column="cilent_id" jdbcType="BIGINT"/>
-            <result property="userName" column="user_name" jdbcType="VARCHAR"/>
-            <result property="originName" column="origin_name" jdbcType="VARCHAR"/>
-            <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
-            <result property="fileType" column="file_type" jdbcType="VARCHAR"/>
-            <result property="fileSize" column="file_size" jdbcType="BIGINT"/>
-            <result property="height" column="height" jdbcType="INTEGER"/>
-            <result property="width" column="width" jdbcType="INTEGER"/>
-            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <id property="fileId" column="file_id" jdbcType="BIGINT"/>
+        <result property="cilentId" column="cilent_id" jdbcType="BIGINT"/>
+        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
+        <result property="originName" column="origin_name" jdbcType="VARCHAR"/>
+        <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
+        <result property="screenShot" column="screen_shot" jdbcType="VARCHAR"/>
+        <result property="fileType" column="file_type" jdbcType="VARCHAR"/>
+        <result property="fileSize" column="file_size" jdbcType="BIGINT"/>
+        <result property="height" column="height" jdbcType="INTEGER"/>
+        <result property="width" column="width" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <sql id="Base_Column_List">
-        file_id,cilent_id,user_name,
+        file_id
+        ,cilent_id,user_name,
         origin_name,file_url,file_type,
         file_size,height,width,
         create_time
diff --git a/sandu-common/src/main/java/com/sandu/common/file/FileUploadDto.java b/sandu-common/src/main/java/com/sandu/common/file/FileUploadDto.java
index 5af94cf..6c36bef 100644
--- a/sandu-common/src/main/java/com/sandu/common/file/FileUploadDto.java
+++ b/sandu-common/src/main/java/com/sandu/common/file/FileUploadDto.java
@@ -24,6 +24,12 @@
      */
     private String fileUrl;
 
+
+    /**
+     * 缂╃暐鍥�
+     */
+    private String screenShot;
+
     /**
      * 鏂囦欢 绫诲瀷
      */
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LedSFileController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LedSFileController.java
index 5b0d007..1dcd277 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LedSFileController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LedSFileController.java
@@ -58,6 +58,9 @@
     public ResponseVO<Object> uploadingFile(@RequestParam("file") MultipartFile file,@PathVariable Integer dateType) {
         FileUploadDto fileUploadDto = aliOssFileService.uploadFile(file);
         FileOperationRecord fileOperationRecord = new FileOperationRecord();
+        if("mp4".equals(fileUploadDto.getFileType())){
+            fileUploadDto.setScreenShot(fileUploadDto.getFileUrl()+"?x-oss-process=video/snapshot,t_10000,m_fast");
+        }
         BeanUtils.copyProperties(fileUploadDto, fileOperationRecord);
         fileOperationRecord.setDataType(dateType);
         fileOperationRecordService.save(fileOperationRecord);
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
index a2a16bd..64204b4 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
@@ -30,6 +30,9 @@
     public boolean addProgramFile(MultipartFile file) {
         FileUploadDto fileUploadDto = aliOssFileService.uploadFile(file);
         FileOperationRecord fileOperationRecord=new FileOperationRecord();
+        if("mp4".equals(fileUploadDto.getFileType())){
+            fileUploadDto.setScreenShot(fileUploadDto.getFileUrl()+"?x-oss-process=video/snapshot,t_10000,m_fast");
+        }
         BeanUtils.copyProperties(fileUploadDto, fileOperationRecord);
         fileOperationRecordService.save(fileOperationRecord);
         LedSFile sFile = new LedSFile();

--
Gitblit v1.9.3