|
|
@@ -1,9 +1,9 @@
|
|
|
package com.izouma.wenlvju.service.performance;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.izouma.wenlvju.domain.ArtType;
|
|
|
+import com.izouma.wenlvju.domain.RateAudit;
|
|
|
import com.izouma.wenlvju.domain.User;
|
|
|
import com.izouma.wenlvju.domain.performance.Arrange;
|
|
|
import com.izouma.wenlvju.domain.performance.ArrangeJudge;
|
|
|
@@ -12,10 +12,10 @@ 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;
|
|
|
import com.izouma.wenlvju.repo.ArtTypeRepo;
|
|
|
+import com.izouma.wenlvju.repo.RateAuditRepo;
|
|
|
import com.izouma.wenlvju.repo.UserRepo;
|
|
|
import com.izouma.wenlvju.repo.performance.ArrangeJudgeRepo;
|
|
|
import com.izouma.wenlvju.repo.performance.ArrangeRepo;
|
|
|
@@ -47,6 +47,7 @@ public class ArrangeService {
|
|
|
private ArrangeJudgeRepo arrangeJudgeRepo;
|
|
|
private UserRepo userRepo;
|
|
|
private PerformanceRepo performanceRepo;
|
|
|
+ private RateAuditRepo rateAuditRepo;
|
|
|
|
|
|
public Page<Arrange> all(PageQuery pageQuery) {
|
|
|
Map<Long, String> artMap = artTypeRepo.findAll()
|
|
|
@@ -288,12 +289,13 @@ public class ArrangeService {
|
|
|
List<Programme> byPerformanceId = programmeRepo.findAllByPerformanceIdAndProgrammeStatus(dto.getPerformanceId(), ProgrammeStatus.SUBMIT);
|
|
|
int group = (int) Math.ceil((double) byPerformanceId.size() / dto.getQuantity());
|
|
|
|
|
|
- for (int i = 1; i <= group; i++) {
|
|
|
+ long count = arrangeRepo.countArrangeByPerformanceId(dto.getPerformanceId());
|
|
|
+ for (int i = 0; i < group; i++) {
|
|
|
Arrange arrange = Arrange.builder()
|
|
|
.performanceId(dto.getPerformanceId())
|
|
|
.quantity(dto.getQuantity())
|
|
|
.specialtyId(dto.getSpecialtyId())
|
|
|
- .name("第" + i + "场")
|
|
|
+ .name("第" + count + "场")
|
|
|
.auditTimes(times)
|
|
|
.build();
|
|
|
|
|
|
@@ -315,6 +317,7 @@ public class ArrangeService {
|
|
|
//不需要这么多分组
|
|
|
break;
|
|
|
}
|
|
|
+ count++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -324,12 +327,24 @@ public class ArrangeService {
|
|
|
if (performance.getAuditTimes() > 1) {
|
|
|
online = performance.getReviewOnline();
|
|
|
}
|
|
|
- // 改为分配评委
|
|
|
+ // 改为分配评委中
|
|
|
performance.setStatus(PerformanceStatus.ARRANGE_JUDGE);
|
|
|
performanceRepo.save(performance);
|
|
|
if (!online) {
|
|
|
this.publishOffline(performanceId);
|
|
|
}
|
|
|
+
|
|
|
+ //记录状态
|
|
|
+// List<Long> pids = programmeRepo.findIdByPerformanceIdAndProgrammeStatus(performanceId, ProgrammeStatus.SUBMIT);
|
|
|
+// List<RateAudit> rateAudits = new ArrayList<>();
|
|
|
+// pids.forEach(id -> rateAudits.add(RateAudit.builder()
|
|
|
+// .status(PerformanceStatus.ARRANGE.toString())
|
|
|
+// .userId(userId)
|
|
|
+// .programmeAudit(true)
|
|
|
+// .rateId(id)
|
|
|
+// .remark("分组安排已发布")
|
|
|
+// .build()));
|
|
|
+// rateAuditRepo.saveAll(rateAudits);
|
|
|
}
|
|
|
|
|
|
public void publishOffline(Long performanceId) {
|
|
|
@@ -368,12 +383,19 @@ public class ArrangeService {
|
|
|
if (CollUtil.isEmpty(arrangeId)) {
|
|
|
return new PageImpl<>(new ArrayList<>(), JpaUtils.toPageRequest(pageQuery), 0);
|
|
|
}
|
|
|
+ Map<Long, String> artTypeMap = artTypeRepo.findAllByParentIsNull()
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(ArtType::getId, ArtType::getName));
|
|
|
pageQuery.setSort("date,asc;startTime,asc;");
|
|
|
return arrangeRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
|
|
|
List<Predicate> and = JpaUtils.toPredicates(pageQuery, Arrange.class, root, criteriaQuery, criteriaBuilder);
|
|
|
and.add(root.get("id").in(arrangeId));
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
- }), JpaUtils.toPageRequest(pageQuery));
|
|
|
+ }), JpaUtils.toPageRequest(pageQuery)).map(arrange -> {
|
|
|
+ List<String> names = arrange.getSpecialtyId().stream().map(artTypeMap::get).collect(Collectors.toList());
|
|
|
+ arrange.setSpecialtyName(names);
|
|
|
+ return arrange;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
}
|