Răsfoiți Sursa

节目状态

licailing 4 ani în urmă
părinte
comite
d0d065507d

+ 6 - 7
src/main/java/com/izouma/wenlvju/domain/RateAudit.java

@@ -1,7 +1,7 @@
 package com.izouma.wenlvju.domain;
 
-import com.izouma.wenlvju.enums.RateStatus;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -10,8 +10,6 @@ import org.hibernate.annotations.Where;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
 
 
 @Data
@@ -24,13 +22,14 @@ import javax.persistence.Enumerated;
 public class RateAudit extends BaseEntity {
     private Long rateId;
 
-//    private LocalDateTime auditTime;
-
     private Long userId;
 
-    @Enumerated(EnumType.STRING)
-    private RateStatus status;
+//    @Enumerated(EnumType.STRING)
+    private String status;
 
     @Column(columnDefinition = "TEXT")
     private String remark;
+
+    @ApiModelProperty(value = "等级评定/节目报名")
+    private boolean programmeAudit;
 }

+ 4 - 0
src/main/java/com/izouma/wenlvju/domain/performance/Arrange.java

@@ -2,6 +2,7 @@ package com.izouma.wenlvju.domain.performance;
 
 import com.izouma.wenlvju.converter.LongArrayConverter;
 import com.izouma.wenlvju.domain.BaseEntity;
+import com.izouma.wenlvju.enums.PerformanceStatus;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -60,6 +61,9 @@ public class Arrange extends BaseEntity {
     @ApiModelProperty(value = "发布")
     private boolean publish;
 
+    @ApiModelProperty(value = "审核次数")
+    private int auditTimes;
+
     @Transient
     private List<String> specialtyName;
 

+ 7 - 5
src/main/java/com/izouma/wenlvju/domain/performance/Performance.java

@@ -3,6 +3,7 @@ package com.izouma.wenlvju.domain.performance;
 import com.izouma.wenlvju.converter.PerformanceEnquiryListConverter;
 import com.izouma.wenlvju.domain.BaseEntity;
 import com.izouma.wenlvju.dto.PerformanceEnquiry;
+import com.izouma.wenlvju.enums.PerformanceStatus;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -11,10 +12,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.hibernate.annotations.Where;
 
-import javax.persistence.Column;
-import javax.persistence.Convert;
-import javax.persistence.Entity;
-import javax.persistence.Transient;
+import javax.persistence.*;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.List;
@@ -61,8 +59,12 @@ public class Performance extends BaseEntity {
     @ApiModelProperty(value = "是否发布")
     private boolean publish;
 
+    @Enumerated(EnumType.STRING)
     @ApiModelProperty(value = "状态")
-    private String status;
+    private PerformanceStatus status;
+
+    @ApiModelProperty(value = "审核次数")
+    private int auditTimes;
 
     @ApiModelProperty(value = "复审展演形式")
     private Boolean reviewOnline;

+ 2 - 0
src/main/java/com/izouma/wenlvju/dto/ArrangeDTO.java

@@ -41,4 +41,6 @@ public class ArrangeDTO {
     private int quantity;
 
     private List<Long> specialtyId;
+
+    private int times;
 }

+ 6 - 0
src/main/java/com/izouma/wenlvju/dto/ProgrammeDTO.java

@@ -8,6 +8,8 @@ import com.izouma.wenlvju.domain.VideoObject;
 import com.izouma.wenlvju.domain.performance.Participant;
 import com.izouma.wenlvju.domain.performance.Programme;
 import com.izouma.wenlvju.enums.CompetitionGroup;
+import com.izouma.wenlvju.enums.PerformanceStatus;
+import com.izouma.wenlvju.enums.ProgrammeStatus;
 import com.izouma.wenlvju.utils.excel.EnumExcelConverter;
 import com.izouma.wenlvju.utils.excel.LocalDateConverter;
 import io.swagger.annotations.ApiModel;
@@ -108,6 +110,10 @@ public class ProgrammeDTO {
     @ExcelIgnore
     private String certificate;
 
+    @ExcelIgnore
+    @ApiModelProperty(value = "状态")
+    private ProgrammeStatus programmeStatus;
+
     public ProgrammeDTO(Programme programme) {
         BeanUtil.copyProperties(programme, this);
         if (programme.getVideo() != null) {

+ 38 - 0
src/main/java/com/izouma/wenlvju/enums/PerformanceStatus.java

@@ -0,0 +1,38 @@
+package com.izouma.wenlvju.enums;
+
+public enum PerformanceStatus {
+    /*
+    待分组
+     */
+    ARRANGE,
+    /*
+    待分配评委
+     */
+    ARRANGE_JUDGE,
+    /*
+    待签到
+     */
+    SIGN_IN,
+    /*
+    待评分
+     */
+    RATE,
+
+    //复审
+//    /*
+//    待分组
+//    */
+//    SECOND_ARRANGE,
+//    /*
+//    待分配评委
+//     */
+//    SECOND_ARRANGE_JUDGE,
+//    /*
+//    待签到
+//     */
+//    SECOND_SIGN_IN,
+//    /*
+//    待评分
+//     */
+//    SECOND_RATE
+}

+ 5 - 0
src/main/java/com/izouma/wenlvju/repo/UserRepo.java

@@ -8,7 +8,9 @@ import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 
 public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
     @Transactional
@@ -28,4 +30,7 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
 
     List<User> findAllByDistrictAndAuthoritiesContainsAndDelFalse(String district, Authority authorities);
 
+    Optional<User> findByIdAndDelFalse(Long id);
+
+    List<User> findAllByIdInAndDelFalse(Collection<Long> id);
 }

+ 2 - 0
src/main/java/com/izouma/wenlvju/repo/performance/ArrangeRepo.java

@@ -29,6 +29,8 @@ public interface ArrangeRepo extends JpaRepository<Arrange, Long>, JpaSpecificat
 
     Arrange findFirstByPerformanceId(Long performanceId);
 
+    Arrange findFirstByPerformanceIdAndAuditTimes(Long performanceId, int auditTimes);
+
     @Query("update Arrange t set t.publish = true where t.performanceId = ?1")
     @Modifying
     @Transactional

+ 1 - 1
src/main/java/com/izouma/wenlvju/service/RateExpertAuditService.java

@@ -73,7 +73,7 @@ public class RateExpertAuditService {
                 .userId(userId)
                 .rateId(rateId)
                 .remark("市政管理员已评审完成,请你单位在5个工作日内将纸质申请材料(2份)送属地区文化行政主管部门。")
-                .status(RateStatus.SUBMIT_PAPER_MATERIALS)
+                .status(RateStatus.SUBMIT_PAPER_MATERIALS.toString())
                 .build();
         rateAuditRepo.save(rateAudit);
         // 市区评分发送短信

+ 8 - 8
src/main/java/com/izouma/wenlvju/service/RateService.java

@@ -89,7 +89,7 @@ public class RateService {
                             .userId(orig.getExpertUserId())
                             .rateId(orig.getId())
                             .remark("专家组已线下考察完毕")
-                            .status(RateStatus.SUBMIT_GRADE)
+                            .status(RateStatus.SUBMIT_GRADE.toString())
                             .build();
                     rateAuditRepo.save(rateAudit);
                     Map<String, String> gradeMessage = this.gradeMessage(now, orig.getExpertUserId(), orig
@@ -131,7 +131,7 @@ public class RateService {
                 .userId(userId)
                 .rateId(id)
                 .remark(RateStatus.REVIEW_PENDING.equals(status) ? "线下考察材料提交不全,被退回!" : "已取消专家组分配!")
-                .status(status)
+                .status(status.toString())
                 .build();
         rateAuditRepo.save(rateAudit);
     }
@@ -149,7 +149,7 @@ public class RateService {
                 .userId(userId)
                 .rateId(id)
                 .remark(remark)
-                .status(status)
+                .status(status.toString())
                 .build();
         rateAuditRepo.save(rateAudit);
         rate.setSort(rate.getStatus().getSort());
@@ -195,7 +195,7 @@ public class RateService {
                 .userId(userId)
                 .rateId(id)
                 .remark("专家组长设置线下审查时间为:" + formatter.format(time))
-                .status(RateStatus.REVIEW_PENDING)
+                .status(RateStatus.REVIEW_PENDING.toString())
                 .build();
         rateAuditRepo.save(rateAudit);
         rate.setSort(RateStatus.REVIEW_PENDING.getSort());
@@ -223,7 +223,7 @@ public class RateService {
                 .userId(userId)
                 .rateId(id)
                 .remark(remark)
-                .status(status)
+                .status(status.toString())
                 .build();
         rateAuditRepo.save(rateAudit);
         if (RateStatus.COMPLETE.equals(status)) {
@@ -468,7 +468,7 @@ public class RateService {
     public Map<String, String> reviewTimesMessage(Rate rate) {
         List<Long> ids = new ArrayList<>(rate.getExpertMemberUserId());
         ids.add(rate.getExpertUserId());
-        Map<Long, User> userMap = userRepo.findAllById(ids)
+        Map<Long, User> userMap = userRepo.findAllByIdInAndDelFalse(ids)
                 .stream()
                 .collect(Collectors.toMap(User::getId, user -> user));
         if (!rate.isChange()) {
@@ -531,7 +531,7 @@ public class RateService {
 //        Rate rate = rateRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         List<Long> ids = new ArrayList<>(rate.getExpertMemberUserId());
         ids.add(rate.getExpertUserId());
-        Map<Long, User> userMap = userRepo.findAllById(ids)
+        Map<Long, User> userMap = userRepo.findAllByIdInAndDelFalse(ids)
                 .stream()
                 .collect(Collectors.toMap(User::getId, user -> user));
 
@@ -577,7 +577,7 @@ public class RateService {
                 .map(User::getPhone)
                 .collect(Collectors.joining(","));
 
-        User expert = userRepo.findById(expertId).orElseThrow(new BusinessException("无专家"));
+        User expert = userRepo.findByIdAndDelFalse(expertId).orElseThrow(new BusinessException("无专家"));
 
         String body = "现场检查已完成:\n" +
                 "单位名称:%s\n" +

+ 1 - 2
src/main/java/com/izouma/wenlvju/service/performance/ArrangeJudgeService.java

@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
 
 import java.time.LocalDate;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
 @Service
@@ -47,7 +46,7 @@ public class ArrangeJudgeService {
             if (CollUtil.isNotEmpty(arrangeJudges)) {
                 expertIds.forEach(id -> {
                     if (arrangeJudges.contains(id)) {
-                        User user = userRepo.findById(id).orElseThrow(new BusinessException("无此评委"));
+                        User user = userRepo.findByIdAndDelFalse(id).orElseThrow(new BusinessException("无此评委"));
                         throw new BusinessException("该时间段," + user.getNickname() + "已分配");
                     }
                 });

+ 56 - 63
src/main/java/com/izouma/wenlvju/service/performance/ArrangeService.java

@@ -11,6 +11,7 @@ import com.izouma.wenlvju.domain.performance.Performance;
 import com.izouma.wenlvju.domain.performance.Programme;
 import com.izouma.wenlvju.dto.ArrangeDTO;
 import com.izouma.wenlvju.dto.PageQuery;
+import com.izouma.wenlvju.enums.PerformanceStatus;
 import com.izouma.wenlvju.enums.ProgrammeProcess;
 import com.izouma.wenlvju.enums.ProgrammeStatus;
 import com.izouma.wenlvju.exception.BusinessException;
@@ -70,7 +71,7 @@ public class ArrangeService {
         Map<Long, List<ArrangeJudge>> judgeMap = ajs
                 .stream()
                 .collect(Collectors.groupingBy(ArrangeJudge::getArrangeId));
-        Map<Long, String> userMap = userRepo.findAllById(userIds)
+        Map<Long, String> userMap = userRepo.findAllByIdInAndDelFalse(userIds)
                 .stream()
                 .collect(Collectors.toMap(User::getId, User::getNickname));
         return arrangeRepo.findAll(JpaUtils.toSpecification(pageQuery, Arrange.class), JpaUtils.toPageRequest(pageQuery))
@@ -91,27 +92,29 @@ public class ArrangeService {
                 });
     }
 
-//    public void chooseGroup(ArrangeDTO dto) {
-//        Arrange first = arrangeRepo.findFirstByPerformanceId(dto.getPerformanceId());
-//        if (ObjectUtil.isNotNull(first) && first.isPublish()) {
-//            throw new BusinessException("活动分组已发布");
-//        }
-//        Performance performance = performanceRepo.findById(dto.getPerformanceId())
-//                .orElseThrow(new BusinessException("无展演活动"));
-//        if (performance.isOnline()){
-//            this.groupOnline(dto);
-//        }
-//    }
+    public void chooseGroup(ArrangeDTO dto) {
+        Performance performance = performanceRepo.findById(dto.getPerformanceId())
+                .orElseThrow(new BusinessException("无展演活动"));
 
-    /*
-    分组
-     */
-    public void group(ArrangeDTO dto) {
-        Arrange first = arrangeRepo.findFirstByPerformanceId(dto.getPerformanceId());
+        Arrange first = arrangeRepo.findFirstByPerformanceIdAndAuditTimes(dto.getPerformanceId(), performance.getAuditTimes() + 1);
         if (ObjectUtil.isNotNull(first) && first.isPublish()) {
             throw new BusinessException("活动分组已发布");
         }
+        boolean online = performance.isOnline();
+        if (performance.getAuditTimes() > 1) {
+            online = performance.getReviewOnline();
+        }
+        if (online) {
+            this.groupOnline(dto, performance.getStatus());
+            return;
+        }
+        this.group(dto, performance.getStatus());
+    }
 
+    /*
+    分组
+     */
+    public void group(ArrangeDTO dto, PerformanceStatus status) {
         long total = 0;
         int days = Period.between(dto.getStartDate(), dto.getEndDate()).getDays();
         for (int i = 0; i <= days; i++) {
@@ -214,11 +217,6 @@ public class ArrangeService {
 
         for (int i = 0; i < group; i++) {
             LocalTime endTime = startTime.plusMinutes(time);
-//            if (!endTime.isBefore(dto.getMorningEndTime())) {
-//                if (Duration.between(dto.getMorningEndTime(), endTime).toMinutes() > dto.getDuration()) {
-//
-//                }
-//            }
             String amPm = morning ? "上午" : "下午";
             String name = format1 + amPm + "第" + arr[j] + "场";
             Arrange arrange = Arrange.builder()
@@ -267,6 +265,42 @@ public class ArrangeService {
         }
     }
 
+    /*
+    展演形式为线上进行分组
+    不需要时间、上下午、地点
+     */
+    public void groupOnline(ArrangeDTO dto, PerformanceStatus status) {
+        List<Programme> byPerformanceId = programmeRepo.findAllByPerformanceIdAndProgrammeStatus(dto.getPerformanceId(), ProgrammeStatus.SUBMIT);
+        int group = (int) Math.ceil((double) byPerformanceId.size() / dto.getQuantity());
+
+        for (int i = 0; i < group; i++) {
+            Arrange arrange = Arrange.builder()
+                    .performanceId(dto.getPerformanceId())
+                    .quantity(dto.getQuantity())
+                    .specialtyId(dto.getSpecialtyId())
+                    .name("第" + i + 1 + "场")
+                    .build();
+
+            Map<String, String> programmes = programmeService.group(byPerformanceId, arrange);
+            List<Programme> programmeList = JSONObject.parseArray(programmes.get("programmes"), Programme.class);
+            List<Long> ids = programmeList.stream()
+                    .map(Programme::getSpecialtyId)
+                    .distinct()
+                    .collect(Collectors.toList());
+            arrange.setSpecialtyId(ids);
+            arrange.setQuantity(programmeList.size());
+            arrange = arrangeRepo.save(arrange);
+
+            programmeService.saveAll(programmeList, arrange.getId());
+
+            // 插入节目
+            if (!Boolean.parseBoolean(programmes.get("flag"))) {
+                //不需要这么多分组
+                break;
+            }
+        }
+    }
+
     public void publish(Long performanceId) {
         // 分布发布
         arrangeRepo.publish(performanceId);
@@ -312,45 +346,4 @@ public class ArrangeService {
         }), JpaUtils.toPageRequest(pageQuery));
     }
 
-    /*
-    展演形式为线上进行分组
-    不需要时间、上下午、地点
-     */
-    public void groupOnline(ArrangeDTO dto) {
-        Arrange first = arrangeRepo.findFirstByPerformanceId(dto.getPerformanceId());
-        if (ObjectUtil.isNotNull(first) && first.isPublish()) {
-            throw new BusinessException("活动分组已发布");
-        }
-        List<Programme> byPerformanceId = programmeRepo.findAllByPerformanceIdAndProgrammeStatus(dto.getPerformanceId(), ProgrammeStatus.SUBMIT);
-        int group = (int) Math.ceil((double) byPerformanceId.size() / dto.getQuantity());
-
-        for (int i = 0; i < group; i++) {
-            Arrange arrange = Arrange.builder()
-                    .performanceId(dto.getPerformanceId())
-                    .quantity(dto.getQuantity())
-                    .specialtyId(dto.getSpecialtyId())
-                    .name("第" + i + 1 + "场")
-                    .build();
-
-            Map<String, String> programmes = programmeService.group(byPerformanceId, arrange);
-            List<Programme> programmeList = JSONObject.parseArray(programmes.get("programmes"), Programme.class);
-            List<Long> ids = programmeList.stream()
-                    .map(Programme::getSpecialtyId)
-                    .distinct()
-                    .collect(Collectors.toList());
-            arrange.setSpecialtyId(ids);
-            arrange.setQuantity(programmeList.size());
-            arrange = arrangeRepo.save(arrange);
-
-            programmeService.saveAll(programmeList, arrange.getId());
-
-            // 插入节目
-            if (!Boolean.parseBoolean(programmes.get("flag"))) {
-                //不需要这么多分组
-                break;
-            }
-        }
-    }
-
-
 }

+ 15 - 17
src/main/java/com/izouma/wenlvju/service/performance/ProgrammeService.java

@@ -16,10 +16,7 @@ import com.izouma.wenlvju.enums.ProgrammeProcess;
 import com.izouma.wenlvju.enums.ProgrammeStatus;
 import com.izouma.wenlvju.enums.SignedIn;
 import com.izouma.wenlvju.exception.BusinessException;
-import com.izouma.wenlvju.repo.ArtTypeRepo;
-import com.izouma.wenlvju.repo.GradingOrganizationRepo;
-import com.izouma.wenlvju.repo.OrganizationRepo;
-import com.izouma.wenlvju.repo.SettingRepo;
+import com.izouma.wenlvju.repo.*;
 import com.izouma.wenlvju.repo.performance.*;
 import com.izouma.wenlvju.service.ArtTypeService;
 import com.izouma.wenlvju.service.storage.StorageService;
@@ -64,6 +61,7 @@ public class ProgrammeService {
     private ProgrammeScoreRepo      programmeScoreRepo;
     private ArrangeJudgeRepo        arrangeJudgeRepo;
     private StorageService          storageService;
+    private RateAuditRepo           rateAuditRepo;
 
 
     public Page<Programme> all(PageQuery pageQuery) {
@@ -311,9 +309,6 @@ public class ProgrammeService {
 
     public void excelTemp(HttpServletResponse response) throws IOException {
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-//        File file = new File(this.getClass().getResource("/templates/Programme.xlsx").getPath());
-//        InputStream is = new FileInputStream(file);
-
         InputStream is = getClass().getResourceAsStream("/templates/Programme.xlsx");
         byte[] buffer = new byte[1024];
         int len;
@@ -602,17 +597,17 @@ public class ProgrammeService {
     /*
     第一次审核
      */
-    public void firstAudit(Long id, boolean pass) {
+    public void firstAudit(Long id, ProgrammeStatus status, String remark, Long userId) {
         Programme programme = programmeRepo.findById(id).orElseThrow(new BusinessException("无节目"));
-        if (pass) {
-//            programme.setStatus(3);
-            programme.setProgrammeStatus(ProgrammeStatus.UNDER_REVIEW);
-            programmeRepo.save(programme);
-            return;
-        }
-//        programme.setStatus(2);
-        programme.setProgrammeStatus(ProgrammeStatus.AUDIT_FAILED);
+        programme.setProgrammeStatus(status);
         programmeRepo.save(programme);
+        RateAudit.builder()
+                .status(status.toString())
+                .rateId(id)
+                .programmeAudit(true)
+                .remark(remark)
+                .userId(userId)
+                .build();
     }
 
     /*
@@ -621,7 +616,10 @@ public class ProgrammeService {
     public ProgrammeShowDTO showByGO(Long id) {
         Programme programme = programmeRepo.findById(id).orElseThrow(new BusinessException("无节目"));
         ProgrammeShowDTO dto = new ProgrammeShowDTO(programme);
-        List<ParticipantDTO> participants = participantRepo.findAllByProgrammeId(id).stream().map(ParticipantDTO::new).collect(Collectors.toList());
+        List<ParticipantDTO> participants = participantRepo.findAllByProgrammeId(id)
+                .stream()
+                .map(ParticipantDTO::new)
+                .collect(Collectors.toList());
         dto.setParticipants(participants);
         return dto;
     }

+ 9 - 3
src/main/java/com/izouma/wenlvju/web/OrganizationController.java

@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/organization")
@@ -103,13 +104,18 @@ public class OrganizationController extends BaseController {
     }
 
     @GetMapping("/byName")
-    public User byName(String name) {
+    public String byName(String name) {
         List<Organization> byNames = organizationRepo.findAllByNameEquals(name);
         if (CollUtil.isNotEmpty(byNames)) {
-            return userRepo.findById(byNames.get(0).getUserId()).orElse(null);
+            List<User> users = userRepo.findAllByIdInAndDelFalse(byNames.stream()
+                    .map(Organization::getUserId)
+                    .collect(Collectors.toList()));
+            if (CollUtil.isNotEmpty(users)) {
+                String phone = users.get(0).getPhone();
+                return phone.replace(phone.substring(3, phone.length() - 4),"****");
+            }
         }
         return null;
-
     }
 }
 

+ 1 - 8
src/main/java/com/izouma/wenlvju/web/performance/ArrangeController.java

@@ -71,16 +71,9 @@ public class ArrangeController extends BaseController {
     @ApiOperation("分组")
     @PostMapping("/group")
     public void group(@RequestBody ArrangeDTO record) {
-        arrangeService.group(record);
+        arrangeService.chooseGroup(record);
     }
 
-    @ApiOperation("线上分组")
-    @PostMapping("/groupOnline")
-    public void groupOnline(@RequestBody ArrangeDTO record) {
-        arrangeService.groupOnline(record);
-    }
-
-
     @ApiOperation("分组发布")
     @PostMapping("/publish")
     public void publish(@RequestParam Long performanceId) {

+ 19 - 2
src/main/java/com/izouma/wenlvju/web/performance/ProgrammeController.java

@@ -2,11 +2,14 @@ package com.izouma.wenlvju.web.performance;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.izouma.wenlvju.domain.ArtType;
+import com.izouma.wenlvju.domain.performance.Performance;
 import com.izouma.wenlvju.domain.performance.Programme;
 import com.izouma.wenlvju.dto.*;
+import com.izouma.wenlvju.enums.ProgrammeStatus;
 import com.izouma.wenlvju.enums.SignedIn;
 import com.izouma.wenlvju.exception.BusinessException;
 import com.izouma.wenlvju.repo.ArtTypeRepo;
+import com.izouma.wenlvju.repo.performance.PerformanceRepo;
 import com.izouma.wenlvju.repo.performance.ProgrammeRepo;
 import com.izouma.wenlvju.service.UserService;
 import com.izouma.wenlvju.service.performance.ProgrammeService;
@@ -23,6 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.time.LocalDate;
 import java.util.List;
 import java.util.Map;
 
@@ -35,15 +39,28 @@ public class ProgrammeController extends BaseController {
     private ProgrammeRepo    programmeRepo;
     private ArtTypeRepo      artTypeRepo;
     private UserService      userService;
+    private PerformanceRepo  performanceRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
     public Programme save(@RequestBody Programme record) {
         if (record.getId() != null) {
             Programme orig = programmeRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            if (ProgrammeStatus.INITIAL.equals(orig.getProgrammeStatus())) {
+                Performance performance = performanceRepo.findById(orig.getPerformanceId())
+                        .orElseThrow(new BusinessException("无展演活动"));
+                if (LocalDate.now().isAfter(performance.getEndDate())) {
+                    throw new BusinessException("活动已报名结束!");
+                }
+            }
             ObjUtils.merge(orig, record);
             return programmeRepo.save(orig);
         }
+        Performance performance = performanceRepo.findById(record.getPerformanceId())
+                .orElseThrow(new BusinessException("无展演活动"));
+        if (LocalDate.now().isAfter(performance.getEndDate())) {
+            throw new BusinessException("活动已报名结束!");
+        }
         return programmeRepo.save(record);
     }
 
@@ -146,8 +163,8 @@ public class ProgrammeController extends BaseController {
 
     @PostMapping("/firstAudit")
     @ApiOperation("考级机构初审")
-    public void firstAudit(@RequestParam Long id, boolean pass) {
-        programmeService.firstAudit(id, pass);
+    public void firstAudit(@RequestParam Long id, @RequestParam ProgrammeStatus status, String remark) {
+        programmeService.firstAudit(id, status, remark, SecurityUtils.getAuthenticatedUser().getId());
     }
 
     @GetMapping("/getShow/{id}")

+ 26 - 10
src/main/vue/src/views/performance/ProgrammeList.vue

@@ -224,12 +224,22 @@
                         >浏览图片</el-button
                     >
                     <el-button type="warning" @click="playVideo(row)" v-else size="mini" plain>浏览视频</el-button>
-                    <el-button @click="audit(row, true)" type="primary" size="mini" plain v-if="row.status == 1"
-                        >通过</el-button
-                    >
-                    <el-button @click="audit(row, false)" type="danger" size="mini" plain v-if="row.status == 1"
+                    <el-button
+                        @click="audit(row, 'AUDIT_FAILED')"
+                        type="danger"
+                        size="mini"
+                        plain
+                        v-if="row.programmeStatus == 'SUBMIT'"
                         >不通过</el-button
                     >
+                    <el-button
+                        @click="audit(row, 'SUBMIT')"
+                        type="info"
+                        size="mini"
+                        plain
+                        v-if="row.programmeStatus == 'AUDIT_FAILED'"
+                        >撤回</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>
@@ -614,11 +624,16 @@ export default {
             this.showImg = true;
             this.annex = row.annex;
         },
-        audit(row, pass) {
+        audit(row, status) {
             this.$set(row, 'loading', true);
-
-            this.$confirm('审核后将不能修改或撤回,确认要审核吗?', '提示', {
-                confirmButtonText: '审核',
+            let str = '确认该节目未通过初选?',
+                remark = '未通过考级机构初选。';
+            if (status == 'SUBMIT') {
+                str = '确认撤回,撤回后可参加后续的审核。';
+                remark = '撤消未通过考级机构初选。';
+            }
+            this.$confirm(str, '提示', {
+                confirmButtonText: '确认',
                 cancelButtonText: '取消',
                 type: 'warning'
             })
@@ -626,11 +641,12 @@ export default {
                     this.$http
                         .post('/programme/firstAudit', {
                             id: row.id,
-                            pass: pass
+                            status: status,
+                            remark: remark
                         })
                         .then(res => {
                             this.$set(row, 'loading', false);
-                            this.$message.success('审核成功');
+                            this.$message.success('操作成功');
                             this.getData();
                         })
                         .catch(e => {

+ 5 - 1
src/main/vue/src/views/rate/RateAuditEdit.vue

@@ -54,7 +54,11 @@ export default {
     created() {
         if (this.$route.query.id) {
             this.$http
-                .post('/rateAudit/all', { size: 100, query: { rateId: this.$route.query.id } }, { body: 'json' })
+                .post(
+                    '/rateAudit/all',
+                    { size: 100, query: { rateId: this.$route.query.id, programmeAudit: false } },
+                    { body: 'json' }
+                )
                 .then(res => {
                     this.audits = res.content;
                 })

+ 6 - 0
src/test/java/com/izouma/wenlvju/repo/RepoTest.java

@@ -203,4 +203,10 @@ public class RepoTest extends ApplicationTests {
         });
         programmeRepo.saveAll(programmes);
     }
+
+    @Test
+    public void test6(){
+        String phone = "18205083565";
+        System.out.println(phone.replace(phone.substring(3, phone.length() - 4), "****"));
+    }
 }