cms 首页-课程目标与毕业要求支撑关系 9.21

dev_2307
zhc077 1 year ago
parent 33ac6593e7
commit 7ce46a514d
  1. 48
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/cms/service/CmsHomeTrainingPlanServiceImpl.java
  2. 25
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/cms/vo/CourseObjectivesAndGraduationRequirementsVo.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.ComputeUtils; import org.jeecg.common.util.ComputeUtils;
import org.jeecg.modules.cms.vo.CourseObjectivesAndGraduationRequirementsVo;
import org.jeecg.modules.course.entity.SeCourse; import org.jeecg.modules.course.entity.SeCourse;
import org.jeecg.modules.course.entity.SeCourseobjectives; import org.jeecg.modules.course.entity.SeCourseobjectives;
import org.jeecg.modules.course.service.ISeChapterService; import org.jeecg.modules.course.service.ISeChapterService;
@ -232,7 +233,8 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
// 2,培养方案对应的毕业要求-数据表格的列 // 2,培养方案对应的毕业要求-数据表格的列
returnMap.put("毕业要求", this.covertPyGraRequireList(basicId)); returnMap.put("毕业要求", this.covertPyGraRequireList(basicId));
//课程目标与毕业要求支撑关系 对应坐标与取值
List<CourseObjectivesAndGraduationRequirementsVo> voList = new LinkedList<>();
// 3,行与列对应的坐标值,统计每门课程与每个二级毕业要求的学分 // 3,行与列对应的坐标值,统计每门课程与每个二级毕业要求的学分
// 统计培养方案每门课程与每个二级毕业要求的学分 // 统计培养方案每门课程与每个二级毕业要求的学分
if (!ObjectUtils.isEmpty(seCourseList)) { if (!ObjectUtils.isEmpty(seCourseList)) {
@ -241,6 +243,7 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
List<SeCourseobjectives> seCourseobjectivesList = seCourseobjectivesService.list(new LambdaQueryWrapper<SeCourseobjectives>() List<SeCourseobjectives> seCourseobjectivesList = seCourseobjectivesService.list(new LambdaQueryWrapper<SeCourseobjectives>()
.eq(SeCourseobjectives::getCourseid, seCourse.getId()) .eq(SeCourseobjectives::getCourseid, seCourse.getId())
.eq(SeCourseobjectives::getIsrelated, "1") .eq(SeCourseobjectives::getIsrelated, "1")
// .eq(SeCourseobjectives::getCourseid, "1702248098153152513")
.ne(SeCourseobjectives::getPid, "0")); .ne(SeCourseobjectives::getPid, "0"));
if (ObjectUtils.isEmpty(seCourseobjectivesList)) continue; if (ObjectUtils.isEmpty(seCourseobjectivesList)) continue;
@ -256,8 +259,6 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
.in(Knowcourse::getKcmbid, seCourseobjectivesList.stream().map(o -> o.getId()).collect(Collectors.toSet())) .in(Knowcourse::getKcmbid, seCourseobjectivesList.stream().map(o -> o.getId()).collect(Collectors.toSet()))
); );
if (!ObjectUtils.isEmpty(knowcourseList)) { if (!ObjectUtils.isEmpty(knowcourseList)) {
//课程知识点支撑的课程目标 //课程知识点支撑的课程目标
// 【课程目标与课程知识点一对多(一个知识点只能支撑一个课程目标,多个知识点可以共同支撑一个课程目标)】 // 【课程目标与课程知识点一对多(一个知识点只能支撑一个课程目标,多个知识点可以共同支撑一个课程目标)】
@ -269,7 +270,7 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
//课程总学分 //课程总学分
AtomicReference<Double> courseTotalCredit = new AtomicReference<>(new Double(0)); AtomicReference<Double> courseTotalCredit = new AtomicReference<>(new Double(0));
if (!ObjectUtils.isEmpty(mbkcFenzuMap)) { if (!ObjectUtils.isEmpty(mbkcFenzuMap)) {
mbkcFenzuMap.forEach((k, v) -> { mbkcFenzuMap.forEach((k, knowcourseGroupList) -> {
/** /**
* 邱栋: * 邱栋:
* 学分这里是算出来的根据学时占比自动计算的 * 学分这里是算出来的根据学时占比自动计算的
@ -283,22 +284,51 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
* 学时占比*学分就是该课程目标占的学分它支撑那个毕业要求就支撑多少学分 * 学时占比*学分就是该课程目标占的学分它支撑那个毕业要求就支撑多少学分
*/ */
Knowcourse knowcourse = knowcourseGroupList.get(0);
//某一课程同一课程目标的总学时(支撑某一个课程目标的知识点学时和) //某一课程同一课程目标的总学时(支撑某一个课程目标的知识点学时和)
Double totalXs = v.stream().map(e -> e.getXs()).reduce(Double.valueOf(0), Double::sum); Double totalXs = knowcourseGroupList.stream().map(e -> e.getXs()).reduce(Double.valueOf(0), Double::sum);
log.info("课程:" + seCourse.getName() + ",的课程目标:" + v.get(0).getKcmb() + ",的总学时数:" + totalXs); log.info("课程:" + seCourse.getName() + ",的课程目标:" + knowcourse.getKcmb() + ",的总学时数:" + totalXs);
//某一课程同一课程目标的总学时占比 //某一课程同一课程目标的总学时占比
Double kcXueshiBilue = ComputeUtils.div2(totalXs, new Double(seCourse.getClasshours())); Double kcXueshiBilue = ComputeUtils.div2(totalXs, new Double(seCourse.getClasshours()));
log.info("课程:" + seCourse.getName() + ",的课程目标:" + v.get(0).getKcmb() + ",的学时占比数:" + kcXueshiBilue); log.info("课程:" + seCourse.getName() + ",的课程目标:" + knowcourse.getKcmb() + ",的学时占比数:" + kcXueshiBilue);
//某一课程同一课程目标的总学时占比学分 //某一课程同一课程目标的总学时占比学分
double kcXuefen = ComputeUtils.mul(kcXueshiBilue, seCourse.getCredit().doubleValue()); double kcXuefen = ComputeUtils.mul(kcXueshiBilue, seCourse.getCredit().doubleValue());
log.info("课程:" + seCourse.getName() + ",的课程目标:" + knowcourse.getKcmb() + ",的学分数:" + kcXuefen);
courseTotalCredit.updateAndGet(v1 -> v1 + kcXuefen); courseTotalCredit.updateAndGet(v1 -> v1 + kcXuefen);
log.info("课程:" + seCourse.getName() + ",的课程目标:" + v.get(0).getKcmb() + ",的学分数:" + kcXuefen);
//该课程目标对应的毕业要求
SeCourseobjectives courseobjectives = seCourseobjectivesService.getById(knowcourse.getKcmbid());
if (!ObjectUtils.isEmpty(courseobjectives)) {
CourseObjectivesAndGraduationRequirementsVo vo = new CourseObjectivesAndGraduationRequirementsVo();
String requireid = courseobjectives.getRequireid();
vo.setRequireId(requireid);
vo.setCourseId(seCourse.getId());
vo.setCredit(kcXuefen);
PyGraRequire pyGraRequire = pyGraRequireService.getById(requireid);
vo.setRequirePid(pyGraRequire.getPid());
voList.add(vo);
}
}); });
log.info("课程:" + seCourse.getName() + ",总学分数:" + courseTotalCredit.get().intValue()); log.info("课程:" + seCourse.getName() + ",总学分数:" + courseTotalCredit.get().intValue());
} }
//TODO
} }
} }
returnMap.put("关系", voList);
Map<String, List<CourseObjectivesAndGraduationRequirementsVo>> voGroupMap4subtotal = voList.stream().collect(Collectors.groupingBy(CourseObjectivesAndGraduationRequirementsVo::getRequireId));
if (!ObjectUtils.isEmpty(voGroupMap4subtotal)) {
Map<String, Object> subtotalMap = new LinkedHashMap<>();
voGroupMap4subtotal.forEach((k, vos) -> {
Double subtotalCredit = vos.stream().map(e -> e.getCredit()).reduce(Double.valueOf(0), Double::sum);
subtotalMap.put(k, subtotalCredit);
});
}
returnMap.put("小计", voList);
returnMap.put("汇总", voList);
} }

@ -0,0 +1,25 @@
package org.jeecg.modules.cms.vo;
import lombok.Data;
/**
* @Description: 课程目标与毕业要求支撑关系 对应坐标与取值
* @Author: Z.H.C
* @CreateTime: 2023-09-22 17:06
* @Version: 1.0
*/
@Data
public class CourseObjectivesAndGraduationRequirementsVo {
//课程id
private String courseId;
//毕业要求id
private String requireId;
//课程id与毕业要求id坐标的学分
private Double credit;
//毕业要求父id(用于同型号毕业要求汇总统计)
private String requirePid;
}
Loading…
Cancel
Save