diff --git a/ant-design-vue-jeecg/package.json b/ant-design-vue-jeecg/package.json index 07e655d..ccd9620 100644 --- a/ant-design-vue-jeecg/package.json +++ b/ant-design-vue-jeecg/package.json @@ -10,6 +10,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "element-ui": "^2.15.6", "3d-force-graph": "^1.73.3", "@antv/data-set": "^0.11.4", "@jeecg/antd-online-mini": "2.4.5-RC", diff --git a/ant-design-vue-jeecg/src/config/router.config.js b/ant-design-vue-jeecg/src/config/router.config.js index 79918d5..e7e1a4d 100644 --- a/ant-design-vue-jeecg/src/config/router.config.js +++ b/ant-design-vue-jeecg/src/config/router.config.js @@ -387,4 +387,23 @@ export const constantRouterMap = [ component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404') }, + { + + path: '/chapterManage', + component: () => import(/* webpackChunkName: "fail" */ '@/views/course/modules/yjjk/chapterManage') + }, + + { + + path: '/knowledgeManage', + component: () => import(/* webpackChunkName: "fail" */ '@/views/course/modules/yjjk/knowledgeManage') + }, + + { + + path: '/TestWay', + component: () => import(/* webpackChunkName: "fail" */ '@/views/course/modules/yjjk/TestWay') + }, + + ] diff --git a/ant-design-vue-jeecg/src/views/course/SeCourseList.vue b/ant-design-vue-jeecg/src/views/course/SeCourseList.vue index f65ecc4..6cf306f 100644 --- a/ant-design-vue-jeecg/src/views/course/SeCourseList.vue +++ b/ant-design-vue-jeecg/src/views/course/SeCourseList.vue @@ -106,8 +106,8 @@ - + 建课 + 编辑 diff --git a/ant-design-vue-jeecg/src/views/course/modules/yjjk/courseGoal.vue b/ant-design-vue-jeecg/src/views/course/modules/yjjk/courseGoal.vue index 0310482..7320341 100644 --- a/ant-design-vue-jeecg/src/views/course/modules/yjjk/courseGoal.vue +++ b/ant-design-vue-jeecg/src/views/course/modules/yjjk/courseGoal.vue @@ -225,7 +225,7 @@ export default { if (this.setNum<3){ this.setNum++ this.$router.push({ - path:'./chapterManage', + path:'/chapterManage', query:this.tokenid }) } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/SeCourseController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/SeCourseController.java index 32da74f..98bee1b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/SeCourseController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/SeCourseController.java @@ -21,6 +21,8 @@ import org.jeecg.modules.course.entity.SeCourse; import org.jeecg.modules.course.entity.SeCourseobjectives; import org.jeecg.modules.course.mapper.SeChapterMapper; import org.jeecg.modules.course.service.*; +import org.jeecg.modules.course.vo.SeChapterVo; +import org.jeecg.modules.course.vo.SeChildChapterVo; import org.jeecg.modules.demo.know.entity.SeKonw; import org.jeecg.modules.demo.know.service.ISeKonwService; import org.jeecg.modules.demo.knowcourse.entity.Knowcourse; @@ -884,6 +886,107 @@ public class SeCourseController extends JeecgController listSeChapterByCourseId(SeCourse course, HttpServletRequest req) { + List seChapterVos = seChapterService.chapterList(course.getId(), "0"); + //查询课程的总学时,总章节,总小节,总知识点 + //总学时 + SeCourse seCourse = seCourseService.getById(course.getId()); + Integer classhours = seCourse.getClasshours(); + //总章节 + QueryWrapper chapterQueryWrapper = new QueryWrapper<>(); + chapterQueryWrapper.eq("pid", 0); + chapterQueryWrapper.eq("courseid", course.getId()); + int chapterCount = seChapterService.count(chapterQueryWrapper); + //总小节 + QueryWrapper childChapterQw = new QueryWrapper<>(); + childChapterQw.ne("pid", 0); + childChapterQw.eq("courseid", course.getId()); + int childChapterCount = seChapterService.count(childChapterQw); + //总知识点 + QueryWrapper knowcourseQueryWrapper = new QueryWrapper<>(); + knowcourseQueryWrapper.eq("kcid", course.getId()); + int knowCounts = knowcourseService.count(knowcourseQueryWrapper); + + //遍历章节 + int size = seChapterVos.size(); + for (int i = 0; i < size; i++) { + Double used = 0.0; + List childList = seChapterService.childChapterList(seChapterVos.get(i).getId()); + //遍历本章的小节 + for (SeChildChapterVo childChapterVo : childList) { + //计算本章已分配的学时 + used += childChapterVo.getTotalclasshours(); + //把知识点放到小节里 + QueryWrapper knowcourseQueryWrapper1 = new QueryWrapper<>(); + knowcourseQueryWrapper1.eq("uintid", childChapterVo.getId()); + List list = knowcourseService.list(knowcourseQueryWrapper1); + Double usedKnow = 0.0; + for (Knowcourse knowcourse : list) { + usedKnow += knowcourse.getXs(); + } + childChapterVo.setUsedKnow(usedKnow); + childChapterVo.setKonwLeave((double) Math.round((childChapterVo.getTotalclasshours() - usedKnow) * 1000) / 1000.0); + childChapterVo.setKnowcourses(list); + childChapterVo.setShowList(false); + } + seChapterVos.get(i).setChildCount(childList.size()); + seChapterVos.get(i).setLeaveKonw((double) Math.round((seChapterVos.get(i).getTotalclasshours() - used) * 1000) / 1000.0); + seChapterVos.get(i).setUsedKnow(used); + seChapterVos.get(i).setChildChapter(childList); + seChapterVos.get(i).setShowList(false); + } + HashMap hashMap = new HashMap<>(); + hashMap.put("chapterList", seChapterVos); + hashMap.put("classhours", classhours); + hashMap.put("chapterCount", chapterCount); + hashMap.put("childChapterCount", childChapterCount); + hashMap.put("knowCounts", knowCounts); + + return Result.ok(hashMap); + } + + + @AutoLog(value = "课程目标-通过课程查询") + @ApiOperation(value = "课程目标-通过课程查询", notes = "课程目标-通过课程查询") + @GetMapping(value = "/listByCourseId") + public Result listByCourseId(@RequestParam(name = "courseid", required = true) String courseid) { + QueryWrapper seCourseobjectivesQueryWrapper = new QueryWrapper<>(); + seCourseobjectivesQueryWrapper.eq("courseid", courseid); + List list = seCourseobjectivesService.list(seCourseobjectivesQueryWrapper); + return Result.ok(list); + } + + /** + * 修改内容和细则 + * + * @param seCourse + * @return + */ + @AutoLog(value = "修改内容和细则") + @ApiOperation(value = "修改内容和细则", notes = "修改内容和细则") + @PutMapping(value = "/editnrxz") + public Result editnrxz(@RequestBody SeCourse seCourse) { + SeCourse sc = seCourseService.getById(seCourse.getId()); + sc.setContentdistribution(seCourse.getContentdistribution()); + sc.setAssessmentrules(seCourse.getAssessmentrules()); + seCourseService.updateById(sc); + return Result.ok("成功!"); + } + @AutoLog(value = "考核目标-分页列表查询") + @ApiOperation(value = "考核目标-分页列表查询", notes = "考核目标-分页列表查询") + @GetMapping(value = "/getnrxz") + public Result getnrxz(@RequestParam(name = "id", required = true)String id) { + SeCourse sc = seCourseService.getById(id); + return Result.ok(sc); + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/XinsecourseController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/XinsecourseController.java index d0b76bc..cfec544 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/XinsecourseController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/controller/XinsecourseController.java @@ -1,9 +1,26 @@ package org.jeecg.modules.course.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.course.entity.SeCoureseType; +import org.jeecg.modules.course.entity.SeCourseobjectives; +import org.jeecg.modules.course.service.ISeCourseobjectivesService; +import org.jeecg.modules.course.service.ISeCourseobjectivesService1; +import org.jeecg.modules.course.service.ISecourseMethodService; +import org.jeecg.modules.course.vo.SeCourseobjectives1; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; @Api(tags = "新课程") @RestController @@ -11,5 +28,99 @@ import org.springframework.web.bind.annotation.*; @Slf4j public class XinsecourseController { - + @Autowired + private ISeCourseobjectivesService1 seCourseobjectivesService1; + @Autowired + private ISecourseMethodService iSecourseMethodService; + @AutoLog(value = "课程目标-分页列表查询") + @ApiOperation(value = "课程目标-分页列表查询", notes = "课程目标-分页列表查询") + @GetMapping(value = "/rootList") + public Result queryPageList(SeCourseobjectives seCourseobjectives, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + System.out.println(seCourseobjectives.toString()); + SeCourseobjectives sp=seCourseobjectivesService1.findParent(seCourseobjectives.getCourseid(),seCourseobjectives.getPid()); + HashMap hashMap=new HashMap<>(); + hashMap.put("parent",sp); + if(sp==null){ + hashMap.put("child",null); + return Result.ok(hashMap); + } + + List list=seCourseobjectivesService1.findchild(sp.getId()); + hashMap.put("child",list); + return Result.ok(hashMap); + } + @AutoLog(value = "Main-添加or修改") + @ApiOperation(value = "Main-添加or修改", notes = "Main-添加or修改") + @PostMapping(value = "/mainadd") + public Result mainadd(@RequestBody SeCourseobjectives1 seCourseobjectives1){ + System.out.println(seCourseobjectives1.toString()); + if(seCourseobjectives1.getId()==null||seCourseobjectives1.getId().equals("")){ + int a=seCourseobjectivesService1.selectcout(seCourseobjectives1.getCourseid()); + if(a>=1) + return Result.error("数据库已存在,新增失败"); + seCourseobjectivesService1.save(seCourseobjectives1); + return Result.ok("新增成功"); + }else{ + seCourseobjectivesService1.updateById(seCourseobjectives1); + return Result.ok("修改成功"); + } + } + @AutoLog(value = "Child-添加or修改") + @ApiOperation(value = "Child-添加or修改", notes = "Child-添加or修改") + @PostMapping(value = "/childadd") + public Result childadd(@RequestBody SeCourseobjectives1 seCourseobjectives1){ + System.out.println(seCourseobjectives1.toString()); + if(seCourseobjectives1.getId()==null||seCourseobjectives1.getId().equals("")){ + if(seCourseobjectives1.getPid()==null||seCourseobjectives1.getPid().equals("")) + return Result.error("总体目标尚未确定,请先添加总体目标!!"); + seCourseobjectivesService1.save(seCourseobjectives1); + seCourseobjectivesService1.updateChildSize(seCourseobjectives1.getPid()); + return Result.ok("新增成功"); + }else{ + seCourseobjectivesService1.updateById(seCourseobjectives1); + return Result.ok("修改成功"); + } + } + @AutoLog(value = "Child-删除") + @ApiOperation(value = "Child-删除", notes = "Child-删除") + @DeleteMapping(value = "/childdelete") + public Result childdelete(@RequestParam(name = "id", required = true)String id){ + seCourseobjectivesService1.deleteChild(id); + return Result.ok("删除成功!"); + } + + //考核方式************************* + @AutoLog(value = "考核-添加or修改") + @ApiOperation(value = "考核-添加or修改", notes = "考核-添加or修改") + @PostMapping(value = "/methodadd") + public Result methodAdd(@RequestBody SeCoureseType seCoureseType){ + System.out.println(seCoureseType.toString()); + if(Integer.valueOf(seCoureseType.getFinalExam())+Integer.valueOf(seCoureseType.getProcessAssessment())!=100) + return Result.error("比例划分错误"); + if(seCoureseType.getId()==null||seCoureseType.getId().equals("")){ + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("name",seCoureseType.getName()); + int a=iSecourseMethodService.count(queryWrapper); + if(a>0) + return Result.error("已存在比例划分"); + iSecourseMethodService.save(seCoureseType); + return Result.ok("新增成功!!!"); + } + else { + iSecourseMethodService.updateById(seCoureseType); + return Result.ok("修改成功!!!"); + } + } + @AutoLog(value = "考核目标-分页列表查询") + @ApiOperation(value = "考核目标-分页列表查询", notes = "考核目标-分页列表查询") + @GetMapping(value = "/methodList") + public Result queryMethod(@RequestParam(name = "id", required = true)String id) { + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("name",id); + SeCoureseType seCoureseType=iSecourseMethodService.getOne(queryWrapper); + return Result.ok(seCoureseType); + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/mapper/SeChapterMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/mapper/SeChapterMapper.java index f06c345..626d09c 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/mapper/SeChapterMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/mapper/SeChapterMapper.java @@ -4,6 +4,9 @@ package org.jeecg.modules.course.mapper; import org.apache.ibatis.annotations.Select; import org.jeecg.modules.course.entity.SeChapter; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.course.vo.SeChapterVo; + +import java.util.List; /** @@ -22,4 +25,10 @@ public interface SeChapterMapper extends BaseMapper { @Select("select courseid from se_chapter where id = #{c}") String getkcid(String c); + + @Select("select * from se_chapter where courseid = #{courseId} and pid = #{pid}") + List chapterList(String courseId, String pid); + + @Select("select * from se_chapter where pid = #{pid}") + List childChapterList(String pid); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeChapterService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeChapterService.java index 437ae67..62b979d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeChapterService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeChapterService.java @@ -23,5 +23,8 @@ public interface ISeChapterService extends IService { String getchapterid(String c); String getkcid(String c); + List chapterList(String courseId,String pid); + + List childChapterList(String pid); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeChapterServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeChapterServiceImpl.java index 2c3a373..165416e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeChapterServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeChapterServiceImpl.java @@ -37,4 +37,14 @@ public class SeChapterServiceImpl extends ServiceImpl chapterList(String courseId, String pid) { + return seChapterMapper.chapterList(courseId,pid); + } + + @Override + public List childChapterList(String pid) { + return seChapterMapper.childChapterList(pid); + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/vo/SeChildChapterVo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/vo/SeChildChapterVo.java index 5ce935f..4101dd4 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/vo/SeChildChapterVo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/vo/SeChildChapterVo.java @@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.jeecg.common.aspect.annotation.Dict; - +import org.jeecg.modules.demo.knowcourse.entity.Knowcourse; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; @@ -139,5 +139,5 @@ public class SeChildChapterVo implements Serializable { private Boolean showList; - + private List Knowcourses; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/controller/KnowcourseController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/controller/KnowcourseController.java index ef06a18..45854db 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/controller/KnowcourseController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/controller/KnowcourseController.java @@ -23,6 +23,8 @@ import org.jeecg.modules.course.service.ISeChapterService; import org.jeecg.modules.course.service.ISeCourseService; import org.jeecg.modules.course.service.ISeCourseobjectivesService; +import org.jeecg.modules.demo.know.entity.SeKonw; +import org.jeecg.modules.demo.know.service.ISeKonwService; import org.jeecg.modules.demo.knowcourse.entity.Knowcourse; import org.jeecg.modules.demo.knowcourse.service.IKnowcourseService; @@ -68,6 +70,9 @@ public class KnowcourseController extends JeecgController add1(@RequestBody Knowcourse knowcourse) { + + //知识点库里没有的情况,先向知识点库里添加 + if (knowcourse.getKnowid().equals("")|| knowcourse.getKnowid() == ""){ + SeKonw seKonw = new SeKonw(); + seKonw.setName(knowcourse.getKnow()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String getrealname =sysUser.getRealname(); + seKonw.setInrealname(getrealname); + seKonwService.save(seKonw); + knowcourse.setKnowid(seKonw.getId()); + } + + //设置课程目标 名称 + if (knowcourse.getKcmb().equals("")|| knowcourse.getKcmb().equals(null)){ + SeCourseobjectives mb = seCourseobjectivesService.getById(knowcourse.getKcmbid()); + knowcourse.setKcmb(mb.getName()); + } + + //判断知识点的学时是否大于小节总学时 + SeChapter chapter = seChapterService.getById(knowcourse.getUintid()); + Double totalclasshours = chapter.getTotalclasshours(); + if (totalclasshours < knowcourse.getXs() ){ + return Result.error("知识点学时大于本小节学时"); + } + QueryWrapper seChapterQueryWrapper = new QueryWrapper<>(); + seChapterQueryWrapper.eq("uintid",knowcourse.getUintid()); + List list = knowcourseService.list(seChapterQueryWrapper); + Double toutalXs = 0.0; + for (Knowcourse knowcourse1 : list){ + toutalXs += knowcourse1.getXs(); + } + if (totalclasshours-toutalXs < knowcourse.getXs()){ + return Result.error("知识点的学时超过本小节的学时,本节共有" + totalclasshours + "学时。所有知识点已经占有" + toutalXs + "学时。请仔细检查"); + } + knowcourseService.save(knowcourse); + return Result.ok("添加成功!"); + } + + + /** + * + * @param knowcourse + * @return + */ + @AutoLog(value = "知识点课程目标-修改课程知识点") + @ApiOperation(value = "知识点课程目标-修改课程知识点", notes = "知识点课程目标-修改课程知识点") + @PutMapping(value = "/edit1") + public Result edit1(@RequestBody Knowcourse knowcourse) { + + //设置课程目标 名称 + if (knowcourse.getKcmb().equals("")|| knowcourse.getKcmb().equals(null)){ + SeCourseobjectives mb = seCourseobjectivesService.getById(knowcourse.getKcmbid()); + knowcourse.setKcmb(mb.getName()); + } + + //看知识点的学时是否大于小节总学时 + SeChapter chapter = seChapterService.getById(knowcourse.getUintid()); + Double totalclasshours = chapter.getTotalclasshours(); + if (totalclasshours < knowcourse.getXs() ){ + return Result.error("知识点学时大于本小节学时"); + } + QueryWrapper seChapterQueryWrapper = new QueryWrapper<>(); + seChapterQueryWrapper.eq("uintid",knowcourse.getUintid()); + List list = knowcourseService.list(seChapterQueryWrapper); + Double toutalXs = 0.0; + for (Knowcourse knowcourse1 : list){ + toutalXs += knowcourse1.getXs(); + } + if (totalclasshours-toutalXs < knowcourse.getXs()){ + return Result.error("知识点的学时超过本小节的学时,本节共有" + totalclasshours + "学时。所有知识点已经占有" + toutalXs + "学时。请仔细检查"); + } + knowcourseService.updateById(knowcourse); + return Result.ok("编辑成功!"); + } + }