licailing 4 лет назад
Родитель
Сommit
8f59ea3556

+ 23 - 20
src/main/java/com/izouma/wenlvju/service/performance/ProgrammeService.java

@@ -99,9 +99,9 @@ public class ProgrammeService {
             if (ProgrammeStatus.INITIAL.equals(orig.getProgrammeStatus())) {
                 Performance performance = performanceRepo.findById(orig.getPerformanceId())
                         .orElseThrow(new BusinessException("无展演活动"));
-                if (LocalDate.now().isAfter(performance.getEndDate())) {
-                    throw new BusinessException("活动已报名结束!");
-                }
+//                if (LocalDate.now().isAfter(performance.getEndDate())) {
+//                    throw new BusinessException("活动已报名结束!");
+//                }
             }
             ObjUtils.merge(orig, record);
             orig.setParentSpecialtyId(artTypeService.getParent(orig.getSpecialtyId()));
@@ -109,9 +109,9 @@ public class ProgrammeService {
         } else {
             Performance performance = performanceRepo.findById(record.getPerformanceId())
                     .orElseThrow(new BusinessException("无展演活动"));
-            if (LocalDate.now().isAfter(performance.getEndDate())) {
-                throw new BusinessException("活动已报名结束!");
-            }
+//            if (LocalDate.now().isAfter(performance.getEndDate())) {
+//                throw new BusinessException("活动已报名结束!");
+//            }
             record.setParentSpecialtyId(artTypeService.getParent(record.getSpecialtyId()));
             record = programmeRepo.save(record);
         }
@@ -244,10 +244,13 @@ public class ProgrammeService {
     @Transactional(rollbackOn = Exception.class)
     public void upload(MultipartFile file, Long userId) throws Exception {
         Organization organization = organizationRepo.findByUserId(userId).orElseThrow(new BusinessException("无记录"));
-        Long performance = performanceRepo.findNow(LocalDate.now());
-        if (ObjectUtil.isNull(performance)) {
-            throw new BusinessException("没有正在报名中的展演活动");
-        }
+//        Long performance = performanceRepo.findNow(LocalDate.now());
+//        if (ObjectUtil.isNull(performance)) {
+//            throw new BusinessException("没有正在报名中的展演活动");
+//        }
+
+        // 临时开启
+        Long performance = performanceRepo.findByYear(String.valueOf(LocalDate.now().getYear())).getId();
 
         File destDir = TempFile.createTempDirectory("import");
         try {
@@ -259,15 +262,17 @@ public class ProgrammeService {
             if (!zip) {
                 rar = Pattern.matches("rar", FilenameUtils.getExtension(originalFilename));
             }
-            if (rar) {
-                FileUtils.unrar(file.getInputStream(), destDir);
-            } else if (zip) {
-                try {
-                    ZipUtil.unzip(file.getInputStream(), destDir, StandardCharsets.UTF_8);
-                } catch (Exception e) {
-                    ZipUtil.unzip(file.getInputStream(), destDir, Charset.forName("gbk"));
+            try {
+                if (rar) {
+                    FileUtils.unrar(file.getInputStream(), destDir);
+                } else if (zip) {
+                    try {
+                        ZipUtil.unzip(file.getInputStream(), destDir, StandardCharsets.UTF_8);
+                    } catch (Exception e) {
+                        ZipUtil.unzip(file.getInputStream(), destDir, Charset.forName("gbk"));
+                    }
                 }
-            } else {
+            } catch (Exception e) {
                 throw new BusinessException("最能上传zip或者rar压缩包");
             }
 
@@ -300,7 +305,6 @@ public class ProgrammeService {
             for (ProgUploadDTO dto : dtos) {
                 if (dto.getName() != null && dto.getSpecialty() != null) {
                     Programme programme = new Programme(dto);
-//                    System.out.println(dto.getSpecialty());
                     ArtType specialty = artTypeMap.get(dto.getSpecialty());
                     programme.setOrganizationId(organization.getId());
                     programme.setGradingOrganizationId(gradeMap.get(dto.getGradingOrganization()));
@@ -327,7 +331,6 @@ public class ProgrammeService {
 
                     File uploadFile = FileUtils.findInDir(destDir, dto.getName());
                     if (dto.getVideo() != null) {
-//                    File uploadFile = new File(destDir, dto.getVideo());
                         uploadFile = FileUtils.findInDir(destDir, dto.getVideo());
                     }
                     if (ObjectUtil.isNotNull(uploadFile) && uploadFile.exists()) {

+ 3 - 2
src/main/vue/src/views/performance/ProgrammeList.vue

@@ -480,7 +480,7 @@ export default {
         },
         beforeGetData() {
             let data = {
-                sort: 'createdAt,desc',
+                sort: 'programmeStatus,desc',
                 query: {}
             };
             if (this.form.competitionGroup) {
@@ -528,7 +528,8 @@ export default {
             this.downloading = true;
 
             let data = {
-                sort: 'createdAt,desc',
+                sort: 'programmeStatus,desc',
+                size: 1000,
                 query: {}
             };
             if (this.form.competitionGroup) {

+ 28 - 5
src/main/vue/src/views/performance/ProgrammeOrgList.vue

@@ -129,8 +129,9 @@
                 </el-row>
                 <el-form-item>
                     <el-button @click="canAdd" type="primary" icon="el-icon-search">查询 </el-button>
-                    <el-button @click="addRow" type="primary" icon="el-icon-plus" v-if="add">添加 </el-button>
-                    <el-upload
+                    <!-- <el-button @click="addRow" type="primary" icon="el-icon-plus" v-if="add">添加 </el-button> -->
+                    <el-button @click="addRow" type="primary" icon="el-icon-plus">添加 </el-button>
+                    <!-- <el-upload
                         :action="uploadUrl"
                         :before-upload="beforeUpload"
                         :headers="headers"
@@ -151,6 +152,27 @@
                             :disabled="loading"
                             >批量上传</el-button
                         >
+                    </el-upload> -->
+                    <el-upload
+                        :action="uploadUrl"
+                        :before-upload="beforeUpload"
+                        :headers="headers"
+                        :show-file-list="false"
+                        ref="upload"
+                        :on-success="onSuccess"
+                        class="uploader"
+                        :on-error="onfail"
+                        :loading="loading"
+                        :disabled="loading"
+                    >
+                        <el-button
+                            slot="trigger"
+                            type="primary"
+                            icon="el-icon-upload2"
+                            :loading="loading"
+                            :disabled="loading"
+                            >批量上传</el-button
+                        >
                     </el-upload>
                     <el-button
                         @click="download"
@@ -293,7 +315,7 @@
                 :src="videoUrl"
                 controlsList="nodownload noremote footbar"
                 controls
-                style="height: 100%; max-width: 100%"
+                style="height: 600px; width: 100%"
                 oncontextmenu="return false;"
                 ref="video"
                 v-if="showViedo"
@@ -488,7 +510,7 @@ export default {
         },
         beforeGetData() {
             let data = {
-                sort: 'createdAt,desc',
+                sort: 'programmeStatus,desc',
                 query: {
                     organizationId: this.organization.id,
                     performanceId: Number(this.$route.query.pid)
@@ -551,7 +573,8 @@ export default {
             this.downloading = true;
 
             let data = {
-                sort: 'createdAt,desc',
+                sort: 'programmeStatus,desc',
+                size: 1000,
                 query: {
                     organizationId: this.organization.id
                 }