|
@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.distributed.print.business.bean.dto.CourseDimensionDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.CourseDimensionOccupiedDto;
|
|
@@ -67,15 +68,16 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
|
|
|
String targetContent = e.getTargetContent();
|
|
|
List<Long> dimensionIdList = JSON.parseArray(targetContent, Long.class);
|
|
|
List<CourseDimensionDto> dimensionList = new ArrayList<>();
|
|
|
-
|
|
|
- dimensionIdList.forEach(d -> {
|
|
|
- CourseDimensionDto courseDimensionDto = new CourseDimensionDto();
|
|
|
- CourseDimension courseDimension = courseDimensionMap.get(d);
|
|
|
- courseDimensionDto.setId(d);
|
|
|
- courseDimensionDto.setCode(courseDimension.getCode());
|
|
|
- courseDimensionDto.setName(courseDimension.getName());
|
|
|
- dimensionList.add(courseDimensionDto);
|
|
|
- });
|
|
|
+ if (SystemConstant.strNotNull(targetContent)){
|
|
|
+ dimensionIdList.forEach(d -> {
|
|
|
+ CourseDimensionDto courseDimensionDto = new CourseDimensionDto();
|
|
|
+ CourseDimension courseDimension = courseDimensionMap.get(d);
|
|
|
+ courseDimensionDto.setId(d);
|
|
|
+ courseDimensionDto.setCode(courseDimension.getCode());
|
|
|
+ courseDimensionDto.setName(courseDimension.getName());
|
|
|
+ dimensionList.add(courseDimensionDto);
|
|
|
+ });
|
|
|
+ }
|
|
|
cell.setDimensionList(dimensionList);
|
|
|
return Stream.of(cell);
|
|
|
}).collect(Collectors.toList());
|
|
@@ -93,8 +95,12 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
|
|
|
// 课程目标id - 该目标包含的所有知识点id集合
|
|
|
Map<Long, List<Long>> targetDimensionMap = courseTargetList.stream()
|
|
|
.collect(Collectors.toMap(BaseEntity::getId, v -> {
|
|
|
+ List<Long> dimensionList = new ArrayList<>();
|
|
|
String targetContent = v.getTargetContent();
|
|
|
- return JSON.parseArray(targetContent, Long.class);
|
|
|
+ if (SystemConstant.strNotNull(targetContent)){
|
|
|
+ dimensionList = JSON.parseArray(targetContent, Long.class);
|
|
|
+ }
|
|
|
+ return dimensionList;
|
|
|
}));
|
|
|
|
|
|
// 课程知识点
|
|
@@ -157,8 +163,11 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
|
|
|
|
|
|
// 占用的知识点id
|
|
|
List<Long> occupiedIdList = courseTargetResultList.stream().flatMap(e -> {
|
|
|
+ List<Long> idList = new ArrayList<>();
|
|
|
String content = e.getTargetContent();
|
|
|
- List<Long> idList = JSON.parseArray(content, Long.class);
|
|
|
+ if (SystemConstant.strNotNull(content)){
|
|
|
+ idList = JSON.parseArray(content, Long.class);
|
|
|
+ }
|
|
|
return idList.stream();
|
|
|
}).collect(Collectors.toList());
|
|
|
for (Long dimensionId : dimensionIdList) {
|
|
@@ -171,8 +180,6 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- teachCourseService.clearCourseSetting(teachCourseId, CourseSettingTypeEnum.COURSE_TARGET);
|
|
|
-
|
|
|
CourseTarget checkTargetName = this.getOne(
|
|
|
new QueryWrapper<CourseTarget>().lambda().eq(CourseTarget::getTeachCourseId, teachCourseId).eq(CourseTarget::getTargetName, targetName).last(SystemConstant.LIMIT1));
|
|
|
if (Objects.nonNull(checkTargetName) && !checkTargetName.getId().equals(id)) {
|
|
@@ -189,11 +196,17 @@ public class CourseTargetServiceImpl extends ServiceImpl<CourseTargetMapper, Cou
|
|
|
courseTarget.setTargetContent(JSON.toJSONString(dimensionIdList));
|
|
|
|
|
|
if (SystemConstant.longNotNull(id)) {
|
|
|
- // 编辑
|
|
|
+ // 编辑 (更新教学课程权重标识)
|
|
|
courseTarget.setId(id);
|
|
|
courseTarget.updateInfo(requestUserId);
|
|
|
+
|
|
|
+ UpdateWrapper<TeachCourse> teachCourseUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ teachCourseUpdateWrapper.lambda().eq(TeachCourse::getId, teachCourseId)
|
|
|
+ .set(TeachCourse::getWeightSettingSign, SystemConstant.getDbUuid());
|
|
|
+ teachCourseService.update(teachCourseUpdateWrapper);
|
|
|
} else {
|
|
|
- // 新增
|
|
|
+ // 新增 (清空权重设置)
|
|
|
+ teachCourseService.clearCourseSetting(teachCourseId, CourseSettingTypeEnum.COURSE_TARGET);
|
|
|
courseTarget.insertInfo(requestUserId);
|
|
|
}
|
|
|
this.saveOrUpdate(courseTarget);
|