licailing hace 4 años
padre
commit
7b40de2721

+ 14 - 0
src/main/java/com/izouma/wenlvju/service/performance/ProgrammeService.java

@@ -593,4 +593,18 @@ public class ProgrammeService {
             return dto;
         });
     }
+
+    /*
+    初筛
+     */
+    public void firstInstance(Long id, boolean pass) {
+        Programme programme = programmeRepo.findById(id).orElseThrow(new BusinessException("无节目"));
+        if (pass) {
+            programme.setStatus(3);
+            programmeRepo.save(programme);
+            return;
+        }
+        programme.setStatus(2);
+        programmeRepo.save(programme);
+    }
 }

+ 41 - 0
src/main/java/com/izouma/wenlvju/web/FileUploadController.java

@@ -148,4 +148,45 @@ public class FileUploadController {
             throw new BusinessException("上传失败", e.getMessage());
         }
     }
+
+    @PostMapping("/video1")
+    public String uploadVideo1(@RequestParam("file") MultipartFile file) {
+        String basePath = "application";
+        try {
+            basePath = file.getContentType().split("/")[0];
+        } catch (Exception ignored) {
+        }
+        String videoPath = basePath + "/" + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date())
+                + RandomStringUtils.randomAlphabetic(8)
+                + "." + FilenameUtils.getExtension(file.getOriginalFilename());
+
+        InputStream originInputstream;
+        try {
+            originInputstream = file.getInputStream();
+            if (StringUtils.isEmpty(file.getContentType()) || !file.getContentType().startsWith("video")) {
+                throw new BusinessException(file.getContentType() + " 非视频文件");
+            }
+
+            File destDir = TempFile.createTempDirectory("import." + FilenameUtils.getExtension(file.getOriginalFilename()));
+            file.transferTo(destDir);
+            Long videoTime = VideoUtils.getVideoTime(destDir);
+            log.info("视频长度:" + videoTime);
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = originInputstream.read(buffer)) > -1) {
+                baos.write(buffer, 0, len);
+            }
+            baos.flush();
+
+            InputStream is1 = new ByteArrayInputStream(baos.toByteArray());
+
+            return  storageService.uploadFromInputStream(is1, videoPath);
+        } catch (IOException e) {
+            log.error("上传失败", e);
+            throw new BusinessException("上传失败", e.getMessage());
+        }
+    }
 }

BIN
src/main/resources/templates/Programme.xlsx


+ 4 - 1
src/main/vue/src/views/performance/ProgrammeList.vue

@@ -183,9 +183,12 @@
             <el-table-column label="操作" align="left" fixed="right" min-width="280">
                 <template slot-scope="{ row }">
                     <el-button @click="showRow(row)" size="mini" plain>查看</el-button>
-                    <el-button type="warning" @click="playVideo(row)" size="mini" plain v-if="row.video"
+                    <el-button type="warning" @click="playVideo(row)" v-if="row.video" size="mini" plain
                         >浏览视频</el-button
                     >
+                    <el-button type="warning" @click="playImg(row)" v-if="!row.video" size="mini" plain
+                        >浏览图片</el-button
+                    >
                     <el-button @click="showCode(row)" type="primary" size="mini" plain>查看二维码</el-button>
                     <!-- <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button> -->
                 </template>