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

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

@@ -34,7 +34,7 @@ public class Arrange extends BaseEntity {
     private LocalDate date;
 
     @ApiModelProperty(value = "上下午")
-    private boolean morning;
+    private Boolean morning;
 
     @ApiModelProperty(value = "时间安排")
     private LocalTime startTime;

+ 10 - 0
src/main/java/com/izouma/wenlvju/domain/performance/Performance.java

@@ -15,6 +15,7 @@ import javax.persistence.Column;
 import javax.persistence.Convert;
 import javax.persistence.Entity;
 import javax.persistence.Transient;
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.List;
 
@@ -60,6 +61,15 @@ public class Performance extends BaseEntity {
     @ApiModelProperty(value = "是否发布")
     private boolean publish;
 
+    @ApiModelProperty(value = "状态")
+    private String status;
+
+    @ApiModelProperty(value = "复审展演形式")
+    private Boolean reviewOnline;
+
+    @ApiModelProperty(value = "复审比例")
+    private BigDecimal reviewRatio;
+
     @Transient
     private long programmeNum;
 }

+ 0 - 4
src/main/java/com/izouma/wenlvju/service/UserService.java

@@ -5,11 +5,9 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
 import com.izouma.wenlvju.config.Constants;
 import com.izouma.wenlvju.domain.*;
 import com.izouma.wenlvju.domain.performance.Participant;
-import com.izouma.wenlvju.domain.performance.Programme;
 import com.izouma.wenlvju.dto.ExpertDTO;
 import com.izouma.wenlvju.dto.OrganizationRegDTO;
 import com.izouma.wenlvju.dto.PageQuery;
@@ -18,7 +16,6 @@ import com.izouma.wenlvju.enums.AuthorityName;
 import com.izouma.wenlvju.exception.BusinessException;
 import com.izouma.wenlvju.repo.*;
 import com.izouma.wenlvju.repo.performance.ParticipantRepo;
-import com.izouma.wenlvju.repo.performance.ProgrammeRepo;
 import com.izouma.wenlvju.security.Authority;
 import com.izouma.wenlvju.security.JwtTokenUtil;
 import com.izouma.wenlvju.security.JwtUserFactory;
@@ -62,7 +59,6 @@ public class UserService {
     private final OrganizationService     organizationService;
     private final SettingRepo             settingRepo;
     private final ParticipantRepo         participantRepo;
-    private final ProgrammeRepo           programmeRepo;
 
     public Page<User> all(PageQuery pageQuery) {
         return userRepo.findAll(JpaUtils.toSpecification(pageQuery, User.class), JpaUtils.toPageRequest(pageQuery));

+ 15 - 24
src/main/java/com/izouma/wenlvju/service/performance/ArrangeJudgeService.java

@@ -1,6 +1,7 @@
 package com.izouma.wenlvju.service.performance;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.izouma.wenlvju.converter.LongArrayConverter;
 import com.izouma.wenlvju.domain.User;
 import com.izouma.wenlvju.domain.performance.Arrange;
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
 
 import java.time.LocalDate;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -37,15 +39,19 @@ public class ArrangeJudgeService {
         List<Long> arrangeIds = converter.convertToEntityAttribute(arranges);
         Arrange arrange = arrangeRepo.findById(arrangeIds.get(0)).orElseThrow(new BusinessException("无分组"));
         LocalDate date = arrange.getDate();
-        boolean morning = arrange.isMorning();
-        List<Long> arrangeJudges = arrangeJudgeRepo.findExpertByDateAndMorning(date, morning);
-        if (CollUtil.isNotEmpty(arrangeJudges)) {
-            expertIds.forEach(id -> {
-                if (arrangeJudges.contains(id)) {
-                    User user = userRepo.findById(id).orElseThrow(new BusinessException("无此评委"));
-                    throw new BusinessException("该时间段," + user.getNickname() + "已分配");
-                }
-            });
+        Boolean morning = arrange.getMorning();
+        if (ObjectUtil.isNotNull(date)){
+            // 线上需要时间段判断
+
+            List<Long> arrangeJudges = arrangeJudgeRepo.findExpertByDateAndMorning(date, morning);
+            if (CollUtil.isNotEmpty(arrangeJudges)) {
+                expertIds.forEach(id -> {
+                    if (arrangeJudges.contains(id)) {
+                        User user = userRepo.findById(id).orElseThrow(new BusinessException("无此评委"));
+                        throw new BusinessException("该时间段," + user.getNickname() + "已分配");
+                    }
+                });
+            }
         }
 
         List<ArrangeJudge> save = new ArrayList<>();
@@ -68,19 +74,4 @@ public class ArrangeJudgeService {
         if (CollUtil.isEmpty(arrangeIds))
             arrangeJudgeRepo.cancelJudge(arrangeIds);
     }
-
-    public void assignJudgeOnline(String experts, Long arrangeId) {
-        LongArrayConverter converter = new LongArrayConverter();
-        List<Long> expertIds = converter.convertToEntityAttribute(experts);
-//        List<Long> arrangeIds = converter.convertToEntityAttribute(arranges);
-        List<ArrangeJudge> save = new ArrayList<>();
-//        arrangeIds.forEach(arrangeId ->
-        expertIds.forEach(expertId ->
-                save.add(ArrangeJudge.builder()
-                        .arrangeId(arrangeId)
-                        .expertId(expertId)
-                        .build()));
-
-        arrangeJudgeRepo.saveAll(save);
-    }
 }

+ 16 - 1
src/main/java/com/izouma/wenlvju/service/performance/ArrangeService.java

@@ -7,6 +7,7 @@ import com.izouma.wenlvju.domain.ArtType;
 import com.izouma.wenlvju.domain.User;
 import com.izouma.wenlvju.domain.performance.Arrange;
 import com.izouma.wenlvju.domain.performance.ArrangeJudge;
+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;
@@ -17,6 +18,7 @@ import com.izouma.wenlvju.repo.ArtTypeRepo;
 import com.izouma.wenlvju.repo.UserRepo;
 import com.izouma.wenlvju.repo.performance.ArrangeJudgeRepo;
 import com.izouma.wenlvju.repo.performance.ArrangeRepo;
+import com.izouma.wenlvju.repo.performance.PerformanceRepo;
 import com.izouma.wenlvju.repo.performance.ProgrammeRepo;
 import com.izouma.wenlvju.utils.JpaUtils;
 import lombok.AllArgsConstructor;
@@ -43,6 +45,7 @@ public class ArrangeService {
     private ProgrammeRepo    programmeRepo;
     private ArrangeJudgeRepo arrangeJudgeRepo;
     private UserRepo         userRepo;
+    private PerformanceRepo  performanceRepo;
 
     public Page<Arrange> all(PageQuery pageQuery) {
         Map<Long, String> artMap = artTypeRepo.findAll()
@@ -77,7 +80,7 @@ public class ArrangeService {
                             .map(artMap::get)
                             .collect(Collectors.toList()));
                     List<ArrangeJudge> arrangeJudges = judgeMap.get(arrange.getId());
-                    if (CollUtil.isNotEmpty(arrangeJudges)){
+                    if (CollUtil.isNotEmpty(arrangeJudges)) {
                         String experts = arrangeJudges.stream()
                                 .map(arrangeJudge -> userMap.get(arrangeJudge.getExpertId()))
                                 .collect(Collectors.joining(","));
@@ -88,6 +91,18 @@ 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);
+//        }
+//    }
+
     /*
     分组
      */

+ 14 - 0
src/main/java/com/izouma/wenlvju/web/OrganizationController.java

@@ -1,9 +1,12 @@
 package com.izouma.wenlvju.web;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.izouma.wenlvju.domain.Organization;
+import com.izouma.wenlvju.domain.User;
 import com.izouma.wenlvju.repo.SettingRepo;
+import com.izouma.wenlvju.repo.UserRepo;
 import com.izouma.wenlvju.service.OrganizationService;
 import com.izouma.wenlvju.dto.PageQuery;
 import com.izouma.wenlvju.exception.BusinessException;
@@ -27,6 +30,7 @@ public class OrganizationController extends BaseController {
     private OrganizationService organizationService;
     private OrganizationRepo    organizationRepo;
     private SettingRepo         settingRepo;
+    private UserRepo            userRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -97,5 +101,15 @@ public class OrganizationController extends BaseController {
         List<Organization> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @GetMapping("/byName")
+    public User byName(String name) {
+        List<Organization> byNames = organizationRepo.findAllByNameEquals(name);
+        if (CollUtil.isNotEmpty(byNames)) {
+            return userRepo.findById(byNames.get(0).getUserId()).orElse(null);
+        }
+        return null;
+
+    }
 }
 

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

@@ -68,7 +68,7 @@ public class ArrangeController extends BaseController {
         ExcelUtils.export(response, data);
     }
 
-    @ApiOperation("线下分组")
+    @ApiOperation("分组")
     @PostMapping("/group")
     public void group(@RequestBody ArrangeDTO record) {
         arrangeService.group(record);

+ 0 - 5
src/main/java/com/izouma/wenlvju/web/performance/ArrangeJudgeController.java

@@ -67,11 +67,6 @@ public class ArrangeJudgeController extends BaseController {
         arrangeJudgeService.assignJudge(experts, arranges);
     }
 
-    @ApiOperation("线上分配评委")
-    @PostMapping("/assignJudgeOnline")
-    public void assignJudgeOnline(String experts, Long arrangeId) {
-        arrangeJudgeService.assignJudgeOnline(experts, arrangeId);
-    }
 
     @PreAuthorize("hasRole('ADMIN')")
     @ApiOperation("取消分配")

+ 1 - 1
src/test/java/com/izouma/wenlvju/repo/UserRepoTest.java

@@ -74,7 +74,7 @@ public class UserRepoTest {
 
     @Test
     public void test3() {
-        System.out.println(jwtTokenUtil.generateToken(JwtUserFactory.create(userRepo.findById(1L)
+        System.out.println(jwtTokenUtil.generateToken(JwtUserFactory.create(userRepo.findById(25L)
                 .orElseThrow(new BusinessException("用户不存在")))));
     }