|
@@ -7,21 +7,21 @@ import com.qmth.distributed.print.business.bean.dto.CourseDimensionDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.CourseWeightDetailDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.CourseWeightDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto;
|
|
|
-import com.qmth.distributed.print.business.bean.params.CourseWeightParam;
|
|
|
-import com.qmth.distributed.print.business.bean.result.CourseEvaluationResult;
|
|
|
+import com.qmth.distributed.print.business.bean.params.ObeCourseWeightParam;
|
|
|
import com.qmth.distributed.print.business.bean.result.CourseTargetResult;
|
|
|
-import com.qmth.distributed.print.business.bean.result.CourseWeightResult;
|
|
|
-import com.qmth.distributed.print.business.entity.CourseEvaluation;
|
|
|
-import com.qmth.distributed.print.business.entity.CourseTarget;
|
|
|
-import com.qmth.distributed.print.business.entity.CourseWeight;
|
|
|
-import com.qmth.distributed.print.business.entity.TeachCourse;
|
|
|
+import com.qmth.distributed.print.business.bean.result.ObeCourseEvaluationResult;
|
|
|
+import com.qmth.distributed.print.business.bean.result.ObeCourseWeightResult;
|
|
|
+import com.qmth.distributed.print.business.entity.ObeCourseEvaluation;
|
|
|
+import com.qmth.distributed.print.business.entity.ObeCourseOutline;
|
|
|
+import com.qmth.distributed.print.business.entity.ObeCourseTarget;
|
|
|
+import com.qmth.distributed.print.business.entity.ObeCourseWeight;
|
|
|
import com.qmth.distributed.print.business.enums.CourseEvaluationTypeEnum;
|
|
|
import com.qmth.distributed.print.business.enums.CourseSettingTypeEnum;
|
|
|
-import com.qmth.distributed.print.business.mapper.CourseWeightMapper;
|
|
|
-import com.qmth.distributed.print.business.service.CourseEvaluationService;
|
|
|
-import com.qmth.distributed.print.business.service.CourseTargetService;
|
|
|
-import com.qmth.distributed.print.business.service.CourseWeightService;
|
|
|
-import com.qmth.distributed.print.business.service.TeachCourseService;
|
|
|
+import com.qmth.distributed.print.business.mapper.ObeCourseWeightMapper;
|
|
|
+import com.qmth.distributed.print.business.service.ObeCourseEvaluationService;
|
|
|
+import com.qmth.distributed.print.business.service.ObeCourseOutlineService;
|
|
|
+import com.qmth.distributed.print.business.service.ObeCourseTargetService;
|
|
|
+import com.qmth.distributed.print.business.service.ObeCourseWeightService;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
@@ -44,32 +44,30 @@ import java.util.stream.Collectors;
|
|
|
* @since 2024-02-22
|
|
|
*/
|
|
|
@Service
|
|
|
-public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, CourseWeight> implements CourseWeightService {
|
|
|
+public class ObeCourseWeightServiceImpl extends ServiceImpl<ObeCourseWeightMapper, ObeCourseWeight> implements
|
|
|
+ ObeCourseWeightService {
|
|
|
|
|
|
@Resource
|
|
|
- private TeachCourseService teachCourseService;
|
|
|
+ private ObeCourseOutlineService obeCourseOutlineService;
|
|
|
|
|
|
@Resource
|
|
|
- private CourseTargetService courseTargetService;
|
|
|
+ private ObeCourseTargetService obeCourseTargetService;
|
|
|
|
|
|
@Resource
|
|
|
- private CourseEvaluationService courseEvaluationService;
|
|
|
+ private ObeCourseEvaluationService obeCourseEvaluationService;
|
|
|
|
|
|
@Override
|
|
|
- public CourseWeightResult findCourseWeight(Long teachCourseId) {
|
|
|
- TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
|
|
|
- if (Objects.isNull(teachCourse)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("教学班不存在");
|
|
|
+ public ObeCourseWeightResult findCourseWeight(Long obeCourseOutlineId) {
|
|
|
+ ObeCourseOutline courseOutline = obeCourseOutlineService.getById(obeCourseOutlineId);
|
|
|
+ if (Objects.isNull(courseOutline)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程大纲不存在");
|
|
|
}
|
|
|
|
|
|
- BigDecimal defaultRate = teachCourse.getDefaultRate();
|
|
|
- BigDecimal customRate = teachCourse.getCustomRate();
|
|
|
-
|
|
|
// 现有目标
|
|
|
- List<CourseTargetResult> courseTargetList = courseTargetService.findCourseTargetList(teachCourseId);
|
|
|
+ List<CourseTargetResult> courseTargetList = obeCourseTargetService.findCourseTargetList(obeCourseOutlineId);
|
|
|
// 现有评价方式
|
|
|
- List<CourseEvaluationResult> courseEvaluationResultList = courseEvaluationService.findCourseEvaluationList(
|
|
|
- teachCourseId).stream().sorted((o1, o2) -> {
|
|
|
+ List<ObeCourseEvaluationResult> obeCourseEvaluationResultList = obeCourseEvaluationService.findCourseEvaluationList(
|
|
|
+ obeCourseOutlineId).stream().sorted((o1, o2) -> {
|
|
|
if (o1.getType().getIndex() == o2.getType().getIndex()) {
|
|
|
return o1.getEvaluationId() < o2.getEvaluationId() ? -1 : 0;
|
|
|
} else {
|
|
@@ -77,10 +75,9 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
// 现有权重
|
|
|
- List<CourseWeight> courseWeightList = this.list(
|
|
|
- new QueryWrapper<CourseWeight>().lambda().eq(CourseWeight::getTeachCourseId, teachCourseId));
|
|
|
+ List<ObeCourseWeight> obeCourseWeightList = this.list(new QueryWrapper<ObeCourseWeight>().lambda().eq(ObeCourseWeight::getObeCourseOutlineId, obeCourseOutlineId));
|
|
|
// 权重map
|
|
|
- Map<String, CourseWeight> courseWeightMap = courseWeightList.stream()
|
|
|
+ Map<String, ObeCourseWeight> courseWeightMap = obeCourseWeightList.stream()
|
|
|
.collect(Collectors.toMap(k -> k.getTargetId() + SystemConstant.HYPHEN + k.getEvaluationId(), v -> v));
|
|
|
|
|
|
List<CourseWeightDto> submitForm = new ArrayList<>();
|
|
@@ -94,9 +91,9 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
BigDecimal totalScore = new BigDecimal(0);
|
|
|
|
|
|
List<CourseWeightDetailDto> courseWeightDetailDtoList = new ArrayList<>();
|
|
|
- for (CourseEvaluationResult courseEvaluationResult : courseEvaluationResultList) {
|
|
|
- Long evaluationId = courseEvaluationResult.getEvaluationId();
|
|
|
- String evaluationName = courseEvaluationResult.getEvaluation();
|
|
|
+ for (ObeCourseEvaluationResult obeCourseEvaluationResult : obeCourseEvaluationResultList) {
|
|
|
+ Long evaluationId = obeCourseEvaluationResult.getEvaluationId();
|
|
|
+ String evaluationName = obeCourseEvaluationResult.getEvaluation();
|
|
|
String key = targetId + SystemConstant.HYPHEN + evaluationId;
|
|
|
|
|
|
Boolean enable = false;
|
|
@@ -104,22 +101,22 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
BigDecimal targetScore = BigDecimal.ZERO;
|
|
|
if (courseWeightMap.containsKey(key)) {
|
|
|
// 权重表中包含该目标评价的设置 - 获取权重表的数据
|
|
|
- CourseWeight courseWeight = courseWeightMap.get(key);
|
|
|
- enable = courseWeight.getEnable();
|
|
|
- weight = courseWeight.getWeight();
|
|
|
- targetScore = courseWeight.getTargetScore();
|
|
|
- } else if (CourseEvaluationTypeEnum.DEFAULT.equals(courseEvaluationResult.getType())) {
|
|
|
+ ObeCourseWeight obeCourseWeight = courseWeightMap.get(key);
|
|
|
+ enable = obeCourseWeight.getEnable();
|
|
|
+ weight = obeCourseWeight.getWeight();
|
|
|
+ targetScore = obeCourseWeight.getTargetScore();
|
|
|
+ } else if (CourseEvaluationTypeEnum.DEFAULT.equals(obeCourseEvaluationResult.getType())) {
|
|
|
enable = true;
|
|
|
weight = new BigDecimal(100);
|
|
|
}
|
|
|
CourseWeightDetailDto detail = new CourseWeightDetailDto();
|
|
|
detail.setEvaluationId(evaluationId);
|
|
|
detail.setEvaluationName(evaluationName);
|
|
|
- detail.setEvaluationDesc(courseEvaluationResult.getEvaluationDesc());
|
|
|
+ detail.setEvaluationDesc(obeCourseEvaluationResult.getEvaluationDesc());
|
|
|
detail.setEnable(enable);
|
|
|
detail.setWeight(weight);
|
|
|
detail.setTargetScore(targetScore);
|
|
|
- detail.setEvaluationType(courseEvaluationResult.getType());
|
|
|
+ detail.setEvaluationType(obeCourseEvaluationResult.getType());
|
|
|
if (enable) {
|
|
|
totalScore = totalScore.add(targetScore);
|
|
|
}
|
|
@@ -139,30 +136,25 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
submitForm.add(courseWeightDto);
|
|
|
}
|
|
|
}
|
|
|
- CourseWeightResult result = new CourseWeightResult();
|
|
|
- result.setWeightSettingSign(teachCourse.getWeightSettingSign());
|
|
|
- result.setDimensionSign(teachCourse.getDimensionSign());
|
|
|
- result.setDefaultRate(defaultRate);
|
|
|
- result.setCustomRate(customRate);
|
|
|
+ ObeCourseWeightResult result = new ObeCourseWeightResult();
|
|
|
+ result.setWeightSettingSign(courseOutline.getWeightSettingSign());
|
|
|
+ result.setDimensionSign(courseOutline.getDimensionSign());
|
|
|
result.setSubmitForm(submitForm);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CourseWeightResult findCourseWeightReport(Long teachCourseId) {
|
|
|
- TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
|
|
|
- if (Objects.isNull(teachCourse)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("教学班不存在");
|
|
|
+ public ObeCourseWeightResult findCourseWeightReport(Long obeCourseOutlineId) {
|
|
|
+ ObeCourseOutline courseOutline = obeCourseOutlineService.getById(obeCourseOutlineId);
|
|
|
+ if (Objects.isNull(courseOutline)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程大纲不存在");
|
|
|
}
|
|
|
|
|
|
- BigDecimal defaultRate = teachCourse.getDefaultRate();
|
|
|
- BigDecimal customRate = teachCourse.getCustomRate();
|
|
|
-
|
|
|
// 现有目标
|
|
|
- List<CourseTargetResult> courseTargetList = courseTargetService.findCourseTargetList(teachCourseId);
|
|
|
+ List<CourseTargetResult> courseTargetList = obeCourseTargetService.findCourseTargetList(obeCourseOutlineId);
|
|
|
// 现有评价方式
|
|
|
- List<CourseEvaluationResult> courseEvaluationResultList = courseEvaluationService.findCourseEvaluationList(
|
|
|
- teachCourseId).stream().sorted((o1, o2) -> {
|
|
|
+ List<ObeCourseEvaluationResult> obeCourseEvaluationResultList = obeCourseEvaluationService.findCourseEvaluationList(
|
|
|
+ obeCourseOutlineId).stream().sorted((o1, o2) -> {
|
|
|
if (o1.getType().getIndex() == o2.getType().getIndex()) {
|
|
|
return o1.getEvaluationId() < o2.getEvaluationId() ? -1 : 0;
|
|
|
} else {
|
|
@@ -170,10 +162,9 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
// 现有权重
|
|
|
- List<CourseWeight> courseWeightList = this.list(
|
|
|
- new QueryWrapper<CourseWeight>().lambda().eq(CourseWeight::getTeachCourseId, teachCourseId));
|
|
|
+ List<ObeCourseWeight> obeCourseWeightList = this.list(new QueryWrapper<ObeCourseWeight>().lambda().eq(ObeCourseWeight::getObeCourseOutlineId, obeCourseOutlineId));
|
|
|
// 权重map
|
|
|
- Map<String, CourseWeight> courseWeightMap = courseWeightList.stream()
|
|
|
+ Map<String, ObeCourseWeight> courseWeightMap = obeCourseWeightList.stream()
|
|
|
.collect(Collectors.toMap(k -> k.getTargetId() + SystemConstant.HYPHEN + k.getEvaluationId(), v -> v));
|
|
|
|
|
|
List<CourseWeightDto> submitForm = new ArrayList<>();
|
|
@@ -187,28 +178,28 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
BigDecimal totalScore = new BigDecimal(0);
|
|
|
|
|
|
List<CourseWeightDetailDto> courseWeightDetailDtoList = new ArrayList<>();
|
|
|
- for (CourseEvaluationResult courseEvaluationResult : courseEvaluationResultList) {
|
|
|
- Long evaluationId = courseEvaluationResult.getEvaluationId();
|
|
|
- String evaluationName = courseEvaluationResult.getEvaluation();
|
|
|
+ for (ObeCourseEvaluationResult obeCourseEvaluationResult : obeCourseEvaluationResultList) {
|
|
|
+ Long evaluationId = obeCourseEvaluationResult.getEvaluationId();
|
|
|
+ String evaluationName = obeCourseEvaluationResult.getEvaluation();
|
|
|
String key = targetId + SystemConstant.HYPHEN + evaluationId;
|
|
|
Boolean enable;
|
|
|
BigDecimal weight;
|
|
|
BigDecimal targetScore;
|
|
|
if (courseWeightMap.containsKey(key)) {
|
|
|
// 权重表中包含该目标评价的设置 - 获取权重表的数据
|
|
|
- CourseWeight courseWeight = courseWeightMap.get(key);
|
|
|
- enable = courseWeight.getEnable();
|
|
|
+ ObeCourseWeight obeCourseWeight = courseWeightMap.get(key);
|
|
|
+ enable = obeCourseWeight.getEnable();
|
|
|
if (enable) {
|
|
|
- weight = courseWeight.getWeight();
|
|
|
- targetScore = courseWeight.getTargetScore();
|
|
|
+ weight = obeCourseWeight.getWeight();
|
|
|
+ targetScore = obeCourseWeight.getTargetScore();
|
|
|
CourseWeightDetailDto detail = new CourseWeightDetailDto();
|
|
|
detail.setEvaluationId(evaluationId);
|
|
|
detail.setEvaluationName(evaluationName);
|
|
|
- detail.setEvaluationDesc(courseEvaluationResult.getEvaluationDesc());
|
|
|
+ detail.setEvaluationDesc(obeCourseEvaluationResult.getEvaluationDesc());
|
|
|
detail.setEnable(true);
|
|
|
detail.setWeight(weight);
|
|
|
detail.setTargetScore(targetScore);
|
|
|
- detail.setEvaluationType(courseEvaluationResult.getType());
|
|
|
+ detail.setEvaluationType(obeCourseEvaluationResult.getType());
|
|
|
totalScore = totalScore.add(targetScore);
|
|
|
courseWeightDetailDtoList.add(detail);
|
|
|
}
|
|
@@ -227,37 +218,31 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
submitForm.add(courseWeightDto);
|
|
|
}
|
|
|
}
|
|
|
- CourseWeightResult result = new CourseWeightResult();
|
|
|
- result.setWeightSettingSign(teachCourse.getWeightSettingSign());
|
|
|
- result.setDimensionSign(teachCourse.getDimensionSign());
|
|
|
- result.setDefaultRate(defaultRate);
|
|
|
- result.setCustomRate(customRate);
|
|
|
+ ObeCourseWeightResult result = new ObeCourseWeightResult();
|
|
|
+ result.setWeightSettingSign(courseOutline.getWeightSettingSign());
|
|
|
+ result.setDimensionSign(courseOutline.getDimensionSign());
|
|
|
result.setSubmitForm(submitForm);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public void saveCourseWeight(CourseWeightParam courseWeightParam, SysUser requestUser) {
|
|
|
+ public void saveCourseWeight(ObeCourseWeightParam obeCourseWeightParam, SysUser requestUser) {
|
|
|
List<String> errorMsgList = new ArrayList<>();
|
|
|
Long requestUserId = requestUser.getId();
|
|
|
- Long teachCourseId = courseWeightParam.getTeachCourseId();
|
|
|
- BigDecimal defaultRate = courseWeightParam.getDefaultRate();
|
|
|
- BigDecimal customRate = courseWeightParam.getCustomRate();
|
|
|
+ Long obeCourseOutlineId = obeCourseWeightParam.getObeCourseOutlineId();
|
|
|
|
|
|
- List<CourseWeightDto> submitForm = courseWeightParam.getSubmitForm();
|
|
|
+ List<CourseWeightDto> submitForm = obeCourseWeightParam.getSubmitForm();
|
|
|
|
|
|
- TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
|
|
|
- if (Objects.isNull(teachCourse)) {
|
|
|
+ ObeCourseOutline courseOutline = obeCourseOutlineService.getById(obeCourseOutlineId);
|
|
|
+ if (Objects.isNull(courseOutline)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("教学课程不存在");
|
|
|
}
|
|
|
- Long examId = teachCourse.getExamId();
|
|
|
- String courseCode = teachCourse.getCourseCode();
|
|
|
|
|
|
- teachCourseService.clearCourseSetting(teachCourseId, CourseSettingTypeEnum.COURSE_WEIGHT);
|
|
|
+ obeCourseOutlineService.clearCourseSetting(obeCourseOutlineId, CourseSettingTypeEnum.COURSE_WEIGHT);
|
|
|
|
|
|
- List<CourseTarget> courseTargetList = new ArrayList<>();
|
|
|
- List<CourseWeight> courseWeightList = new ArrayList<>();
|
|
|
+ List<ObeCourseTarget> obeCourseTargetList = new ArrayList<>();
|
|
|
+ List<ObeCourseWeight> obeCourseWeightList = new ArrayList<>();
|
|
|
|
|
|
// 课程目标整体权重检测
|
|
|
BigDecimal checkTargetTotalWeight = BigDecimal.ZERO;
|
|
@@ -267,15 +252,15 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
|
|
|
for (CourseWeightDto courseWeightDto : submitForm) {
|
|
|
Long courseTargetId = courseWeightDto.getCourseTargetId();
|
|
|
- CourseTarget courseTarget = courseTargetService.getById(courseTargetId);
|
|
|
- if (Objects.isNull(courseTarget)) {
|
|
|
+ ObeCourseTarget obeCourseTarget = obeCourseTargetService.getById(courseTargetId);
|
|
|
+ if (Objects.isNull(obeCourseTarget)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程目标不存在");
|
|
|
}
|
|
|
|
|
|
BigDecimal totalWeight = courseWeightDto.getTotalWeight();
|
|
|
- courseTarget.setTotalWeight(totalWeight);
|
|
|
- courseTarget.updateInfo(requestUserId);
|
|
|
- courseTargetList.add(courseTarget);
|
|
|
+ obeCourseTarget.setTotalWeight(totalWeight);
|
|
|
+ obeCourseTarget.updateInfo(requestUserId);
|
|
|
+ obeCourseTargetList.add(obeCourseTarget);
|
|
|
checkTargetTotalWeight = checkTargetTotalWeight.add(totalWeight);
|
|
|
|
|
|
// 评价方式整体权重检测(自定义)
|
|
@@ -283,14 +268,8 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
List<CourseWeightDetailDto> detailDtoList = courseWeightDto.getEvaluationList();
|
|
|
for (CourseWeightDetailDto detail : detailDtoList) {
|
|
|
Long evaluationId = detail.getEvaluationId();
|
|
|
- CourseEvaluation courseEvaluation = courseEvaluationService.getById(evaluationId);
|
|
|
- BigDecimal rate = new BigDecimal(0);
|
|
|
- CourseEvaluationTypeEnum evaluationType = courseEvaluation.getType();
|
|
|
- if (CourseEvaluationTypeEnum.DEFAULT.equals(evaluationType)) {
|
|
|
- rate = defaultRate;
|
|
|
- } else if (CourseEvaluationTypeEnum.CUSTOM.equals(evaluationType)) {
|
|
|
- rate = customRate;
|
|
|
- }
|
|
|
+ ObeCourseEvaluation obeCourseEvaluation = obeCourseEvaluationService.getById(evaluationId);
|
|
|
+ CourseEvaluationTypeEnum evaluationType = obeCourseEvaluation.getType();
|
|
|
|
|
|
Boolean enable = detail.getEnable();
|
|
|
BigDecimal weight = detail.getWeight();
|
|
@@ -305,44 +284,35 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
}
|
|
|
|
|
|
BigDecimal denominator = new BigDecimal(100);
|
|
|
- // 目标分值计算: 100 * 类型占比 * 目标占比 * 评价方式占比
|
|
|
+ // 目标分值计算: 100 * 目标占比 * 评价方式占比
|
|
|
BigDecimal targetScore = new BigDecimal(0);
|
|
|
if (enable) {
|
|
|
- targetScore = new BigDecimal(100).multiply(rate).divide(denominator, 2, RoundingMode.HALF_UP)
|
|
|
- .multiply(totalWeight).divide(denominator, 2, RoundingMode.HALF_UP).multiply(weight)
|
|
|
- .divide(denominator, 2, RoundingMode.HALF_UP);
|
|
|
+ targetScore = new BigDecimal(100).multiply(totalWeight).divide(denominator, 2, RoundingMode.HALF_UP)
|
|
|
+ .multiply(weight).divide(denominator, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
- CourseWeight courseWeight = new CourseWeight();
|
|
|
- courseWeight.setTeachCourseId(teachCourseId);
|
|
|
- courseWeight.setSchoolId(requestUser.getSchoolId());
|
|
|
- courseWeight.setExamId(examId);
|
|
|
- courseWeight.setCourseCode(courseCode);
|
|
|
- courseWeight.setUserId(requestUserId);
|
|
|
- courseWeight.setTargetId(courseTargetId);
|
|
|
- courseWeight.setEvaluationId(evaluationId);
|
|
|
- courseWeight.setEnable(enable);
|
|
|
- courseWeight.setWeight(weight);
|
|
|
- courseWeight.setTargetScore(targetScore);
|
|
|
- courseWeight.insertInfo(requestUserId);
|
|
|
- courseWeightList.add(courseWeight);
|
|
|
+ ObeCourseWeight obeCourseWeight = new ObeCourseWeight();
|
|
|
+ obeCourseWeight.setObeCourseOutlineId(obeCourseOutlineId);
|
|
|
+ obeCourseWeight.setSchoolId(requestUser.getSchoolId());
|
|
|
+ obeCourseWeight.setTargetId(courseTargetId);
|
|
|
+ obeCourseWeight.setEvaluationId(evaluationId);
|
|
|
+ obeCourseWeight.setEnable(enable);
|
|
|
+ obeCourseWeight.setWeight(weight);
|
|
|
+ obeCourseWeight.setTargetScore(targetScore);
|
|
|
+ obeCourseWeight.insertInfo(requestUserId);
|
|
|
+ obeCourseWeightList.add(obeCourseWeight);
|
|
|
}
|
|
|
// 数据校验2:各课程目标下自定义评价方式的总权重应等于100%;
|
|
|
int checkEvaluationTotalWeightCompareResult = checkEvaluationCustomTotalWeight.compareTo(new BigDecimal(100));
|
|
|
if (checkEvaluationTotalWeightCompareResult > 0) {
|
|
|
- errorMsgList.add(String.format("课程目标[%s]下评价方式的总权重为[%s],超过[%s]", courseTarget.getTargetName(),
|
|
|
+ errorMsgList.add(String.format("课程目标[%s]下评价方式的总权重为[%s],超过[%s]", obeCourseTarget.getTargetName(),
|
|
|
String.valueOf(checkEvaluationCustomTotalWeight) + '%', "100%"));
|
|
|
} else if (checkEvaluationTotalWeightCompareResult < 0) {
|
|
|
- errorMsgList.add(String.format("课程目标[%s]下评价方式的总权重为[%s],低于[%s]", courseTarget.getTargetName(),
|
|
|
+ errorMsgList.add(String.format("课程目标[%s]下评价方式的总权重为[%s],低于[%s]", obeCourseTarget.getTargetName(),
|
|
|
String.valueOf(checkEvaluationCustomTotalWeight) + '%', "100%"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 数据校验1:默认和自定义的权重合为100;
|
|
|
- if (defaultRate.add(customRate).compareTo(new BigDecimal(100)) != 0) {
|
|
|
- errorMsgList.add("平时成绩权重和期末成绩权重之和不为100%");
|
|
|
- }
|
|
|
-
|
|
|
// 数据校验3:目标整体权重应等于100%,用于计算课程整体达成度。
|
|
|
int checkTargetTotalWeightCompareResult = checkTargetTotalWeight.compareTo(new BigDecimal(100));
|
|
|
if (checkTargetTotalWeightCompareResult > 0) {
|
|
@@ -357,38 +327,36 @@ public class CourseWeightServiceImpl extends ServiceImpl<CourseWeightMapper, Cou
|
|
|
}
|
|
|
|
|
|
// 更新目标整体权重
|
|
|
- courseTargetService.updateBatchById(courseTargetList);
|
|
|
+ obeCourseTargetService.updateBatchById(obeCourseTargetList);
|
|
|
// 保存课程权重设置
|
|
|
- this.saveBatch(courseWeightList);
|
|
|
+ this.saveBatch(obeCourseWeightList);
|
|
|
// 更新课程权重设置状态
|
|
|
- teachCourse.setWeightSetting(true);
|
|
|
- teachCourse.setWeightSettingSign(SystemConstant.getDbUuid());
|
|
|
- teachCourse.setDefaultRate(defaultRate);
|
|
|
- teachCourse.setCustomRate(customRate);
|
|
|
- teachCourseService.updateById(teachCourse);
|
|
|
+ courseOutline.setWeightSetting(true);
|
|
|
+ courseOutline.setWeightSettingSign(SystemConstant.getDbUuid());
|
|
|
+ obeCourseOutlineService.updateById(courseOutline);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public void deleteCourseWeight(Long teachCourseId) {
|
|
|
- this.remove(new QueryWrapper<CourseWeight>().lambda().eq(CourseWeight::getTeachCourseId, teachCourseId));
|
|
|
- UpdateWrapper<CourseTarget> courseTargetUpdateWrapper = new UpdateWrapper<>();
|
|
|
- courseTargetUpdateWrapper.lambda().eq(CourseTarget::getTeachCourseId, teachCourseId)
|
|
|
- .set(CourseTarget::getTotalWeight, null);
|
|
|
- courseTargetService.update(courseTargetUpdateWrapper);
|
|
|
-
|
|
|
- UpdateWrapper<TeachCourse> teachCourseUpdateWrapper = new UpdateWrapper<>();
|
|
|
- teachCourseUpdateWrapper.lambda().eq(TeachCourse::getId, teachCourseId)
|
|
|
- .set(TeachCourse::getWeightSettingSign, null).set(TeachCourse::getDefaultRate, null).set(TeachCourse::getCustomRate, null);
|
|
|
- teachCourseService.update(teachCourseUpdateWrapper);
|
|
|
+ public void deleteCourseWeight(Long obeCourseOutlineId) {
|
|
|
+ this.remove(new QueryWrapper<ObeCourseWeight>().lambda().eq(ObeCourseWeight::getObeCourseOutlineId, obeCourseOutlineId));
|
|
|
+ UpdateWrapper<ObeCourseTarget> courseTargetUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ courseTargetUpdateWrapper.lambda().eq(ObeCourseTarget::getObeCourseOutlineId, obeCourseOutlineId)
|
|
|
+ .set(ObeCourseTarget::getTotalWeight, null);
|
|
|
+ obeCourseTargetService.update(courseTargetUpdateWrapper);
|
|
|
+
|
|
|
+ UpdateWrapper<ObeCourseOutline> teachCourseUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ teachCourseUpdateWrapper.lambda().eq(ObeCourseOutline::getId, obeCourseOutlineId)
|
|
|
+ .set(ObeCourseOutline::getWeightSettingSign, null);
|
|
|
+ obeCourseOutlineService.update(teachCourseUpdateWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<CourseWeightFormDto> findCourseWeightForm(Long teachCourseId) {
|
|
|
- TeachCourse teachCourse = teachCourseService.getById(teachCourseId);
|
|
|
- if (Objects.isNull(teachCourse)) {
|
|
|
+ public List<CourseWeightFormDto> findCourseWeightForm(Long obeCourseOutlineId) {
|
|
|
+ ObeCourseOutline courseOutline = obeCourseOutlineService.getById(obeCourseOutlineId);
|
|
|
+ if (Objects.isNull(courseOutline)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("教学课程不存在");
|
|
|
}
|
|
|
- return this.baseMapper.findCourseWeightForm(teachCourseId);
|
|
|
+ return this.baseMapper.findCourseWeightForm(obeCourseOutlineId);
|
|
|
}
|
|
|
}
|