|
|
@@ -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()) {
|