|
|
@@ -328,7 +328,6 @@ public class ProgrammeService {
|
|
|
public Map<String, String> group(List<Programme> byPerformanceId, Arrange arrange) {
|
|
|
boolean flag = true;
|
|
|
|
|
|
-
|
|
|
int quantity = arrange.getQuantity();
|
|
|
if (byPerformanceId.size() < quantity) {
|
|
|
flag = false;
|
|
|
@@ -364,11 +363,10 @@ public class ProgrammeService {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackOn = Exception.class)
|
|
|
- public Map<String, String> group1(Arrange arrange) {
|
|
|
+ public Map<String, String> group1(List<Programme> byPerformanceId, Arrange arrange) {
|
|
|
// 是否继续分组
|
|
|
boolean flag = true;
|
|
|
|
|
|
- List<Programme> byPerformanceId = programmeRepo.findAllByPerformanceIdAndProgrammeStatus(arrange.getPerformanceId(), ProgrammeStatus.SUBMIT);
|
|
|
int quantity = arrange.getQuantity();
|
|
|
if (byPerformanceId.size() < quantity) {
|
|
|
flag = false;
|
|
|
@@ -376,8 +374,6 @@ public class ProgrammeService {
|
|
|
|
|
|
List<Programme> result = new ArrayList<>(quantity);
|
|
|
if (CollUtil.isNotEmpty(arrange.getSpecialtyId())) {
|
|
|
-
|
|
|
-// List<Long> artTypeChild = artTypeService.getChild(arrange.getSpecialtyId(), new ArrayList<>(arrange.getSpecialtyId()));
|
|
|
List<Programme> programmeList = byPerformanceId.stream()
|
|
|
.filter(programme -> arrange.getSpecialtyId().contains(programme.getParentSpecialtyId()))
|
|
|
.collect(Collectors.toList());
|
|
|
@@ -385,7 +381,7 @@ public class ProgrammeService {
|
|
|
int size = programmeList.size();
|
|
|
if (size < quantity) {
|
|
|
programmeList.addAll(byPerformanceId.stream()
|
|
|
- .filter(programme -> !arrange.getSpecialtyId().contains(programme.getSpecialtyId()))
|
|
|
+ .filter(programme -> !arrange.getSpecialtyId().contains(programme.getParentSpecialtyId()))
|
|
|
.limit(quantity - size)
|
|
|
.collect(Collectors.toList()));
|
|
|
flag = false;
|
|
|
@@ -403,13 +399,13 @@ public class ProgrammeService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- public void saveAll(List<Programme> programmes, Long arrangeId) {
|
|
|
- programmes.forEach(programme -> {
|
|
|
- programme.setArrangeId(arrangeId);
|
|
|
-// programme.setProgrammeProcess(ProgrammeProcess.ARRANGE);
|
|
|
-// programme.setStatus(4);
|
|
|
- });
|
|
|
- programmeRepo.saveAll(programmes);
|
|
|
+ public void saveAll(List<Programme> programmes, Long arrangeId, int times) {
|
|
|
+ List<Long> ids = programmes.stream().map(Programme::getId).collect(Collectors.toList());
|
|
|
+ if (times > 1) {
|
|
|
+ programmeRepo.setReviewArrangeId(arrangeId, ids);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ programmeRepo.setArrangeId(arrangeId, ids);
|
|
|
}
|
|
|
|
|
|
public void sort(List<Programme> programmes) {
|
|
|
@@ -431,13 +427,32 @@ public class ProgrammeService {
|
|
|
移除分组
|
|
|
*/
|
|
|
public void removeArrange(Long id) {
|
|
|
+ Arrange arrange = arrangeRepo.findById(id).orElseThrow(new BusinessException("无分组"));
|
|
|
Programme programme = programmeRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
- Long arrangeId = programme.getArrangeId();
|
|
|
-// programme.setStatus(0);
|
|
|
- programme.setProgrammeStatus(ProgrammeStatus.INITIAL);
|
|
|
+ if (arrange.getAuditTimes() > 1) {
|
|
|
+ programme.setReviewArrangeId(null);
|
|
|
+ programmeRepo.save(programme);
|
|
|
+ // 此分组的专业,是否要移除专业
|
|
|
+ List<Long> specialtyIds = programmeRepo.findAllByReviewArrangeId(id)
|
|
|
+ .stream()
|
|
|
+ .map(Programme::getParentSpecialtyId)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ arrange.setSpecialtyId(specialtyIds);
|
|
|
+ arrangeRepo.save(arrange);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
programme.setArrangeId(null);
|
|
|
programmeRepo.save(programme);
|
|
|
- arrangeRepo.minusQuantity(arrangeId);
|
|
|
+ // 此分组的专业,是否要移除专业
|
|
|
+ List<Long> specialtyIds = programmeRepo.findAllByArrangeId(id)
|
|
|
+ .stream()
|
|
|
+ .map(Programme::getParentSpecialtyId)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ arrange.setSpecialtyId(specialtyIds);
|
|
|
+ arrangeRepo.save(arrange);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -446,10 +461,18 @@ public class ProgrammeService {
|
|
|
public void add(Long id, Long arrangeId) {
|
|
|
Arrange arrange = arrangeRepo.findById(arrangeId).orElseThrow(new BusinessException("无记录"));
|
|
|
Programme programme = programmeRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
- programme.setArrangeId(arrangeId);
|
|
|
+ if (arrange.getAuditTimes() > 1) {
|
|
|
+ programme.setReviewArrangeId(arrangeId);
|
|
|
+ } else {
|
|
|
+ programme.setArrangeId(arrangeId);
|
|
|
+ }
|
|
|
programmeRepo.save(programme);
|
|
|
|
|
|
arrange.setQuantity(arrange.getQuantity() + 1);
|
|
|
+ List<Long> specialtyId = arrange.getSpecialtyId();
|
|
|
+ if (!specialtyId.contains(programme.getParentSpecialtyId())) {
|
|
|
+ specialtyId.add(programme.getParentSpecialtyId());
|
|
|
+ }
|
|
|
arrangeRepo.save(arrange);
|
|
|
}
|
|
|
|
|
|
@@ -492,7 +515,7 @@ public class ProgrammeService {
|
|
|
.stream()
|
|
|
.collect(Collectors.toMap(Organization::getId, Organization::getName));
|
|
|
|
|
|
- return programmes.stream().map(programme -> {
|
|
|
+ return programmes.stream().map(programme -> {
|
|
|
ProgrammeShowDTO dto = new ProgrammeShowDTO(programme);
|
|
|
dto.setLevel(settingMap.get(programme.getLevelSettingId()));
|
|
|
dto.setGradingOrganization(gradeMap.get(programme.getGradingOrganizationId()));
|