|
|
@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -174,6 +175,50 @@ public class ClassCourseTimeStatisticsSetServiceImpl extends MPJBaseServiceImpl<
|
|
|
List<BaseClass> baseClassList = baseClassService.list();
|
|
|
List<BaseCourseSubject> baseCourseSubjectList = baseCourseSubjectService.list();
|
|
|
|
|
|
+ ClassCourseTimeStatisticsSetGroup classCourseTimeStatisticsSetGroup= classCourseTimeStatisticsSetGroupService.getById(dto.getId());
|
|
|
+
|
|
|
+ List<Long> soruceClassIds = Arrays.stream(classCourseTimeStatisticsSetGroup.getClassIds().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .map(Long::valueOf)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Long> soruceCourseIds = Arrays.stream(classCourseTimeStatisticsSetGroup.getCourseIds().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .map(Long::valueOf)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Long> deleteClassIds=soruceClassIds.stream()
|
|
|
+ .filter(element -> !dto.getClassIds().contains(element))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ List<Long> deleteCourseIds=soruceCourseIds.stream()
|
|
|
+ .filter(element -> !dto.getCourseIds().contains(element))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(!deleteClassIds.isEmpty()) {
|
|
|
+ for (Long classId : deleteClassIds) {
|
|
|
+ for (Long courseId : soruceCourseIds) {
|
|
|
+ classCourseTimeStatisticsSetMapper.delete(new QueryWrapper<ClassCourseTimeStatisticsSet>()
|
|
|
+ .lambda()
|
|
|
+ .eq(ClassCourseTimeStatisticsSet::getClassId, classId)
|
|
|
+ .eq(ClassCourseTimeStatisticsSet::getCourseId, courseId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!deleteCourseIds.isEmpty()) {
|
|
|
+ for (Long courseId : deleteCourseIds) {
|
|
|
+ for (Long classId : soruceClassIds) {
|
|
|
+ classCourseTimeStatisticsSetMapper.delete(new QueryWrapper<ClassCourseTimeStatisticsSet>()
|
|
|
+ .lambda()
|
|
|
+ .eq(ClassCourseTimeStatisticsSet::getClassId, classId)
|
|
|
+ .eq(ClassCourseTimeStatisticsSet::getCourseId, courseId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (Long classId : dto.getClassIds()) {
|
|
|
for (Long courseId : dto.getCourseIds()) {
|
|
|
|
|
|
@@ -245,4 +290,36 @@ public class ClassCourseTimeStatisticsSetServiceImpl extends MPJBaseServiceImpl<
|
|
|
}});
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean delete(List<Long> ids) {
|
|
|
+
|
|
|
+ for (Long id : ids) {
|
|
|
+ ClassCourseTimeStatisticsSetGroup classCourseTimeStatisticsSetGroup = classCourseTimeStatisticsSetGroupService.getById(id);
|
|
|
+
|
|
|
+ List<Long> soruceClassIds = Arrays.stream(classCourseTimeStatisticsSetGroup.getClassIds().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .map(Long::valueOf)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Long> soruceCourseIds = Arrays.stream(classCourseTimeStatisticsSetGroup.getCourseIds().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .map(Long::valueOf)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (Long classId : soruceClassIds) {
|
|
|
+ for (Long courseId : soruceCourseIds) {
|
|
|
+ classCourseTimeStatisticsSetMapper.delete(new QueryWrapper<ClassCourseTimeStatisticsSet>()
|
|
|
+ .lambda()
|
|
|
+ .eq(ClassCourseTimeStatisticsSet::getClassId, classId)
|
|
|
+ .eq(ClassCourseTimeStatisticsSet::getCourseId, courseId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ classCourseTimeStatisticsSetGroupService.removeBatchByIds(ids);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|