|
@@ -57,19 +57,19 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
if (CollectionUtils.isNotEmpty(tpMatrixList)) {
|
|
if (CollectionUtils.isNotEmpty(tpMatrixList)) {
|
|
List<MatrixDto> matrixDtoList = new ArrayList<>();
|
|
List<MatrixDto> matrixDtoList = new ArrayList<>();
|
|
Map<Long, List<TPMatrix>> courseMap = tpMatrixList.stream().collect(Collectors.groupingBy(TPMatrix::getCourseId));
|
|
Map<Long, List<TPMatrix>> courseMap = tpMatrixList.stream().collect(Collectors.groupingBy(TPMatrix::getCourseId));
|
|
- for (Map.Entry<Long, List<TPMatrix>> entry : courseMap.entrySet()) {
|
|
|
|
|
|
+ courseMap.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> {
|
|
TPCourse tpCourse = tpCourseService.getById(entry.getKey());
|
|
TPCourse tpCourse = tpCourseService.getById(entry.getKey());
|
|
MatrixDto matrixDto = new MatrixDto();
|
|
MatrixDto matrixDto = new MatrixDto();
|
|
matrixDto.setCourseCode(tpCourse.getCourseCode());
|
|
matrixDto.setCourseCode(tpCourse.getCourseCode());
|
|
matrixDto.setCourseName(tpCourse.getCourseName());
|
|
matrixDto.setCourseName(tpCourse.getCourseName());
|
|
List<MatrixRequirementDto> matrixRequirementDtoList = new ArrayList<>();
|
|
List<MatrixRequirementDto> matrixRequirementDtoList = new ArrayList<>();
|
|
Map<Long, List<TPMatrix>> requirementMap = entry.getValue().stream().collect(Collectors.groupingBy(TPMatrix::getRequirementId));
|
|
Map<Long, List<TPMatrix>> requirementMap = entry.getValue().stream().collect(Collectors.groupingBy(TPMatrix::getRequirementId));
|
|
- for (Map.Entry<Long, List<TPMatrix>> requirementEntry : requirementMap.entrySet()) {
|
|
|
|
|
|
+ requirementMap.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(requirementEntry -> {
|
|
TPRequirement tpRequirement = tpRequirementService.getById(requirementEntry.getKey());
|
|
TPRequirement tpRequirement = tpRequirementService.getById(requirementEntry.getKey());
|
|
MatrixRequirementDto matrixRequirementDto = new MatrixRequirementDto();
|
|
MatrixRequirementDto matrixRequirementDto = new MatrixRequirementDto();
|
|
matrixRequirementDto.setName(tpRequirement.getName());
|
|
matrixRequirementDto.setName(tpRequirement.getName());
|
|
// 排序
|
|
// 排序
|
|
- List<MatrixSubRequirementDto> matrixSubRequirementDtoList = requirementEntry.getValue().stream().sorted(Comparator.comparing(TPMatrix::getSubName)).map(tpMatrix -> {
|
|
|
|
|
|
+ List<MatrixSubRequirementDto> matrixSubRequirementDtoList = requirementEntry.getValue().stream().map(tpMatrix -> {
|
|
MatrixSubRequirementDto matrixSubRequirementDto = new MatrixSubRequirementDto();
|
|
MatrixSubRequirementDto matrixSubRequirementDto = new MatrixSubRequirementDto();
|
|
matrixSubRequirementDto.setId(tpMatrix.getId());
|
|
matrixSubRequirementDto.setId(tpMatrix.getId());
|
|
matrixSubRequirementDto.setName(tpMatrix.getSubName());
|
|
matrixSubRequirementDto.setName(tpMatrix.getSubName());
|
|
@@ -78,10 +78,10 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
matrixRequirementDto.setSubRequirements(matrixSubRequirementDtoList);
|
|
matrixRequirementDto.setSubRequirements(matrixSubRequirementDtoList);
|
|
matrixRequirementDtoList.add(matrixRequirementDto);
|
|
matrixRequirementDtoList.add(matrixRequirementDto);
|
|
- }
|
|
|
|
|
|
+ });
|
|
matrixDto.setRequirements(matrixRequirementDtoList);
|
|
matrixDto.setRequirements(matrixRequirementDtoList);
|
|
matrixDtoList.add(matrixDto);
|
|
matrixDtoList.add(matrixDto);
|
|
- }
|
|
|
|
|
|
+ });
|
|
return matrixDtoList;
|
|
return matrixDtoList;
|
|
}
|
|
}
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
@@ -196,7 +196,7 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
tpMatrixAddList.add(tpMatrix);
|
|
tpMatrixAddList.add(tpMatrix);
|
|
} else {
|
|
} else {
|
|
if (matrixList.size() == 1) {
|
|
if (matrixList.size() == 1) {
|
|
- if(matrixList.get(0).getSubName() == null){
|
|
|
|
|
|
+ if (matrixList.get(0).getSubName() == null) {
|
|
tpMatrixRemoveList.add(matrixList.get(0).getId());
|
|
tpMatrixRemoveList.add(matrixList.get(0).getId());
|
|
|
|
|
|
for (int i = 1; i <= tpRequirement.getNodeCount(); i++) {
|
|
for (int i = 1; i <= tpRequirement.getNodeCount(); i++) {
|