|
|
@@ -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);
|
|
|
- }
|
|
|
}
|