cms首页-置顶培养方案 课程与毕业要求关系功能添加 9.21

dev_2307
hechao.zhu 1 year ago
parent 3631b37e1b
commit 33ac6593e7
  1. 13
      jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ComputeUtils.java
  2. 82
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/cms/service/CmsHomeTrainingPlanServiceImpl.java

@ -60,4 +60,17 @@ public class ComputeUtils {
BigDecimal b2 = BigDecimal.valueOf(v2); BigDecimal b2 = BigDecimal.valueOf(v2);
return b1.divide(b2, DEF_DIV_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue(); return b1.divide(b2, DEF_DIV_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue();
} }
public static double div2(double v1, double v2) {
BigDecimal b1 = BigDecimal.valueOf(v1);
BigDecimal b2 = BigDecimal.valueOf(v2);
return b1.divide(b2, 2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
public static void main(String[] args) {
// System.out.println("args = " + div(39,64));
System.out.println("args2 = " + div2(39,64));
System.out.println("args = " + mul(div2(39,64),new Double(2)));
}
} }

@ -1,16 +1,14 @@
package org.jeecg.modules.cms.service; package org.jeecg.modules.cms.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.modules.course.entity.SeChapter; import org.jeecg.common.util.ComputeUtils;
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.service.ISeChapterService; import org.jeecg.modules.course.service.ISeChapterService;
import org.jeecg.modules.course.service.ISeCourseService; import org.jeecg.modules.course.service.ISeCourseService;
import org.jeecg.modules.course.service.ISeCourseobjectivesService1; import org.jeecg.modules.course.service.ISeCourseobjectivesService;
import org.jeecg.modules.course.vo.SeChapterVo;
import org.jeecg.modules.course.vo.SeCourseobjectives1;
import org.jeecg.modules.demo.knowcourse.entity.Knowcourse; import org.jeecg.modules.demo.knowcourse.entity.Knowcourse;
import org.jeecg.modules.demo.knowcourse.service.IKnowcourseService; import org.jeecg.modules.demo.knowcourse.service.IKnowcourseService;
import org.jeecg.modules.py.entity.*; import org.jeecg.modules.py.entity.*;
@ -27,6 +25,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -65,7 +64,7 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
private ISeCourseService iSeCourseService; private ISeCourseService iSeCourseService;
@Autowired @Autowired
private ISeCourseobjectivesService1 seCourseobjectivesService1; private ISeCourseobjectivesService seCourseobjectivesService;
@Autowired @Autowired
private ISeChapterService seChapterService; private ISeChapterService seChapterService;
@ -235,53 +234,70 @@ public class CmsHomeTrainingPlanServiceImpl implements ICmsHomeTrainingPlanServi
// 3,行与列对应的坐标值,统计每门课程与每个二级毕业要求的学分 // 3,行与列对应的坐标值,统计每门课程与每个二级毕业要求的学分
/**
* 邱栋:
* 学分这里是算出来的根据学时占比自动计算的
*
* 邱栋:
* 课程知识点支撑课程目标课程知识点有学时安排
*
* 邱栋:
* 支撑某一个课程目标的知识点学时和/总学时=学时占比
*
* 邱栋:
* 学时占比*学分就是该课程目标占的学分它支撑那个毕业要求就支撑多少学分
*/
// 统计培养方案每门课程与每个二级毕业要求的学分 // 统计培养方案每门课程与每个二级毕业要求的学分
if (!ObjectUtils.isEmpty(seCourseList)) { if (!ObjectUtils.isEmpty(seCourseList)) {
for (SeCourse seCourse : seCourseList) { for (SeCourse seCourse : seCourseList) {
//1,该课程的课程目标 //1,该课程的课程目标
List<SeCourseobjectives1> seCourseobjectivesList = seCourseobjectivesService1.list(new LambdaQueryWrapper<SeCourseobjectives1>() List<SeCourseobjectives> seCourseobjectivesList = seCourseobjectivesService.list(new LambdaQueryWrapper<SeCourseobjectives>()
.eq(SeCourseobjectives1::getCourseid, seCourse.getId()) .eq(SeCourseobjectives::getCourseid, seCourse.getId())
.ne(SeCourseobjectives1::getPid, "0")); .eq(SeCourseobjectives::getIsrelated, "1")
.ne(SeCourseobjectives::getPid, "0"));
if (ObjectUtils.isEmpty(seCourseobjectivesList)) continue;
//2,课程对应的章节 //2,课程对应的章节
seChapterService.list(new LambdaQueryWrapper<SeChapter>() // seChapterService.list(new LambdaQueryWrapper<SeChapter>()
.eq(SeChapter::getCourseid, seCourse.getId()) // .eq(SeChapter::getCourseid, seCourse.getId())
.ne(SeChapter::getPid, "0")); // .ne(SeChapter::getPid, "0"));
//3,章节对应的知识点 //3,章节对应的知识点
List<Knowcourse> knowcourseList = knowcourseService.list(new LambdaQueryWrapper<Knowcourse>() List<Knowcourse> knowcourseList = knowcourseService.list(new LambdaQueryWrapper<Knowcourse>()
.eq(Knowcourse::getKcid, seCourse.getId())); .eq(Knowcourse::getKcid, seCourse.getId())
.in(Knowcourse::getKcmbid, seCourseobjectivesList.stream().map(o -> o.getId()).collect(Collectors.toSet()))
);
if (!ObjectUtils.isEmpty(knowcourseList)) { if (!ObjectUtils.isEmpty(knowcourseList)) {
//课程知识点支撑的课程目标 //课程知识点支撑的课程目标
// 【课程目标与课程知识点一对多(一个知识点只能支撑一个课程目标,多个知识点可以共同支撑一个课程目标)】 // 【课程目标与课程知识点一对多(一个知识点只能支撑一个课程目标,多个知识点可以共同支撑一个课程目标)】
//根据课程目标分组统计知识点 //根据课程目标分组统计知识点
Map<String, List<Knowcourse>> mbkcFenzuMap = knowcourseList.stream().collect(Collectors.groupingBy(Knowcourse::getKcmbid)); Map<String, List<Knowcourse>> mbkcFenzuMap = knowcourseList.stream()
.collect(Collectors.groupingBy(Knowcourse::getKcmbid));
//课程总学分
AtomicReference<Double> courseTotalCredit = new AtomicReference<>(new Double(0));
if (!ObjectUtils.isEmpty(mbkcFenzuMap)) { if (!ObjectUtils.isEmpty(mbkcFenzuMap)) {
//TODO
mbkcFenzuMap.forEach((k, v) -> { mbkcFenzuMap.forEach((k, v) -> {
List<Knowcourse> knowcoursegroup = v; /**
long count = knowcoursegroup.stream().map(e -> e.getXs()).count(); * 邱栋:
System.out.println(k+",的学时总数--------------count = " + count); * 学分这里是算出来的根据学时占比自动计算的
*
* 邱栋:
* 课程知识点支撑课程目标课程知识点有学时安排
* 邱栋:
* 支撑某一个课程目标的知识点学时和/总学时=学时占比
*
* 邱栋:
* 学时占比*学分就是该课程目标占的学分它支撑那个毕业要求就支撑多少学分
*/
//某一课程同一课程目标的总学时(支撑某一个课程目标的知识点学时和)
Double totalXs = v.stream().map(e -> e.getXs()).reduce(Double.valueOf(0), Double::sum);
log.info("课程:" + seCourse.getName() + ",的课程目标:" + v.get(0).getKcmb() + ",的总学时数:" + totalXs);
//某一课程同一课程目标的总学时占比
Double kcXueshiBilue = ComputeUtils.div2(totalXs, new Double(seCourse.getClasshours()));
log.info("课程:" + seCourse.getName() + ",的课程目标:" + v.get(0).getKcmb() + ",的学时占比数:" + kcXueshiBilue);
//某一课程同一课程目标的总学时占比学分
double kcXuefen = ComputeUtils.mul(kcXueshiBilue, seCourse.getCredit().doubleValue());
courseTotalCredit.updateAndGet(v1 -> v1 + kcXuefen);
log.info("课程:" + seCourse.getName() + ",的课程目标:" + v.get(0).getKcmb() + ",的学分数:" + kcXuefen);
}); });
log.info("课程:" + seCourse.getName() + ",总学分数:" + courseTotalCredit.get().intValue());
} }
//TODO
} }
} }
} }

Loading…
Cancel
Save