diff --git a/ant-design-vue-jeecg/src/views/course/SeCourseList.vue b/ant-design-vue-jeecg/src/views/course/SeCourseList.vue index df16a0e..f65ecc4 100644 --- a/ant-design-vue-jeecg/src/views/course/SeCourseList.vue +++ b/ant-design-vue-jeecg/src/views/course/SeCourseList.vue @@ -120,8 +120,10 @@ 课程标准 学时分配 - - 添加知识点 + + 生成图谱 + { +/* this.$nextTick(() => { this.form.setFieldsValue(pick(this.model, 'img', 'depid', 'majorid', 'category', 'nature', 'programid', 'name', 'code', 'semester', 'credit', 'classhours', 'theoryhours', 'practicehours', 'experimenthours', 'otherhours', 'weeks', 'assessmenttype', 'assessmentway', 'advancedplacement', 'teacher', 'maker', 'writer', 'teachingandoffice', 'verifier', 'teacherway', 'teachermethod', 'assessmentrules', 'contentdistribution', 'achievement')) - }) + }) */ }, close() { this.$emit('close'); diff --git a/ant-design-vue-jeecg/src/views/know/SeKonwList.vue b/ant-design-vue-jeecg/src/views/know/SeKonwList.vue index e19f9fc..5748a72 100644 --- a/ant-design-vue-jeecg/src/views/know/SeKonwList.vue +++ b/ant-design-vue-jeecg/src/views/know/SeKonwList.vue @@ -170,15 +170,15 @@ dataIndex: 'code' }, { - title:'定义', + title:'知识点来源', align:"center", - dataIndex: 'miaoshu' + dataIndex: 'knowfrom_dictText' }, - { + /* { title:'添加人', align:"center", dataIndex: 'inrealname' - }, + }, */ { title: '操作', dataIndex: 'action', diff --git a/ant-design-vue-jeecg/src/views/know/modules/SeKonwForm.vue b/ant-design-vue-jeecg/src/views/know/modules/SeKonwForm.vue index 0aab4e5..0c21900 100644 --- a/ant-design-vue-jeecg/src/views/know/modules/SeKonwForm.vue +++ b/ant-design-vue-jeecg/src/views/know/modules/SeKonwForm.vue @@ -5,28 +5,32 @@ - + - - - + + + + + + - - - + - - + - - + + @@ -55,7 +59,7 @@ data () { return { model:{ - }, + }, labelCol: { xs: { span: 24 }, sm: { span: 5 }, @@ -66,12 +70,9 @@ }, confirmLoading: false, validatorRules: { - name: [ - { required: true, message: '请输入知识点名称!'}, - ], - miaoshu: [ - { required: true, message: '请输入定义!'}, - ], + name: [ + { required: true, message: '请输入知识点名称!'}, + ], }, url: { add: "/konw/seKonw/add", @@ -86,7 +87,7 @@ }, }, created () { - //备份model原始值 + //备份model原始值 this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { @@ -110,7 +111,7 @@ method = 'post'; }else{ httpurl+=this.url.edit; - method = 'put'; + method = 'put'; } httpAction(httpurl,this.model,method).then((res)=>{ if(res.success){ 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 c7e9989..56bf21d 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 @@ -19,11 +19,17 @@ import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.course.entity.SeChapter; 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.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.mapper.KnowcourseMapper; import org.jeecg.modules.demo.knowcourse.service.IKnowcourseService; +import org.jeecg.modules.demo.seknowgroup.entity.SeKnowGroup; +import org.jeecg.modules.demo.seknowgroup.service.ISeKnowGroupService; +import org.jeecg.modules.demo.sekonwrelationshipmain.entity.SeKonwRelationshipMain; +import org.jeecg.modules.demo.sekonwrelationshipmain.service.ISeKonwRelationshipMainService; import org.jeecg.modules.ex.utils.SelectRole; import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysUserService; @@ -48,6 +54,19 @@ import java.util.*; @Slf4j public class SeCourseController extends JeecgController { + @Autowired + KnowcourseMapper knowcourseMapper; + + @Autowired + private ISeKonwRelationshipMainService seKonwRelationshipMainService; + + @Autowired + private ISeKnowGroupService seKnowGroupService; + + @Autowired + private SeChapterMapper seChapterMapper; + + @Autowired private ISeCourseService seCourseService; @Autowired @@ -312,6 +331,7 @@ public class SeCourseController extends JeecgController knowcourses1 = knowcourseService.list(queryWrapper1); for (Knowcourse knowcourse : knowcourses1) { knowcourses.add(knowcourse); + System.out.println(knowcourse); } } } @@ -641,6 +661,224 @@ public class SeCourseController extends JeecgController章-->节-->知识点的结构的图谱数据。 + * @param request + * @return 提示性信息 + */ + @AutoLog(value = "用于生成图谱") + @ApiOperation(value = "生成图谱", notes = "生成图谱") + @GetMapping(value = "/cretegroup") + public Result cretegroup(String id) { + //在知识图谱表填写一条数据 + cretegroupinfo(id); + //将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y + updateiscreategroup(id); + //将课程抽象成知识点并存储到知识点表中 + classtoknow(id); + //开始将章节抽象成知识点存储到知识点表 + chaptertoknoe(id); + //开始组装前后知识点 + creteprenet(id); + return Result.ok("图谱生成成功!"); + } + + + + /**** + * 在知识图谱表填写一条数据。 + * @param request + * @return 提示性信息 + */ + @AutoLog(value = "将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y") + @ApiOperation(value = "将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y", notes = "将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y") + public void cretegroupinfo(String id) { + //根据传回的id查询课程名称 + SeCourse seCourse = seCourseService.getById(id); + SeKnowGroup seKnowGroup = new SeKnowGroup(); + seKnowGroup.setCourseid(id); + seKnowGroup.setName(seCourse.getName()); + seKnowGroup.setKnowPoint(seCourse.getName()); + seKnowGroupService.save(seKnowGroup); + } + + /**** + * 将课程表中的是否已经生成图谱(iscreategroup)的状态改成Y + * @param request + * @return 提示性信息 + */ + @AutoLog(value = "在知识图谱表填写一条数据") + @ApiOperation(value = "在知识图谱表填写一条数据", notes = "在知识图谱表填写一条数据") + public void updateiscreategroup(String id) { + SeCourse seCourse = seCourseService.getById(id); + seCourse.setIscreategroup("Y"); + seCourseService.updateById(seCourse); + } + + /**** + * 将课程抽象成知识点并存储到知识点表中 + * @param request + * @return 提示性信息 + */ + @AutoLog(value = "将课程抽象成知识点并存储到知识点表中") + @ApiOperation(value = "将课程抽象成知识点并存储到知识点表中", notes = "将课程抽象成知识点并存储到知识点表中") + public void classtoknow(String id) { + SeCourse seCourse = seCourseService.getById(id); + SeKonw seKonw = new SeKonw(); + seKonw.setName(seCourse.getName()); + seKonw.setCode("课程:"+seCourse.getCode()); + //这里的数据自数据字典cck其中1代表的是课程表 + seKonw.setKnowfrom("1"); + seKonw.setFromid(id); + seKonw.setCourseid(id); + seKonwService.save(seKonw); + + } + + + /**** + * 将课程抽象成知识点并存储到知识点表中 + * @param request + * @return 提示性信息 + */ + @AutoLog(value = "将章节抽象成知识点存储到知识点表") + @ApiOperation(value = "将章节抽象成知识点存储到知识点表", notes = "将章节抽象成知识点存储到知识点表") + public void chaptertoknoe(String id) { + SeCourse seCourse = seCourseService.getById(id); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("courseid", id); + List chapterList = seChapterMapper.selectList(queryWrapper); + for (int i=0;i queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("courseid", id).eq("pid","0"); + List chapterList = seChapterMapper.selectList(queryWrapper); + if (!chapterList.isEmpty()){ + for (int i=0;i queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("courseid", id).eq("pid","0"); + List chapterListz = seChapterMapper.selectList(queryWrapper); + if (!chapterListz.isEmpty()){ + for (int i=0;i queryWrapperj = new QueryWrapper<>(); + queryWrapperj.eq("courseid", id).eq("pid",chapterListz.get(i).getId()); + List chapterListj = seChapterMapper.selectList(queryWrapperj); + if (!chapterListj.isEmpty()) { + for (int j = 0; j < chapterListj.size(); j++) { + SeKonwRelationshipMain seKonwRelationshipMain = new SeKonwRelationshipMain(); + //这里的数据自数据字典cck其中2代表的是章节表 + seKonwRelationshipMain.setPerFrom("2"); + seKonwRelationshipMain.setPerName(chapterListz.get(i).getName()); + seKonwRelationshipMain.setPerKowId(chapterListz.get(i).getId()); + seKonwRelationshipMain.setPerColor("rgba(254, 241, 0, 1)"); + seKonwRelationshipMain.setNextFrom("2"); + seKonwRelationshipMain.setNextName(chapterListj.get(j).getName()); + seKonwRelationshipMain.setNextKnowId(chapterListj.get(j).getId()); + seKonwRelationshipMain.setNextColor("rgba(10, 138, 244, 1)"); + seKonwRelationshipMainService.save(seKonwRelationshipMain); + } + } + } + } + + } + + //用于在创建前知识点和后知识点的过程中创建章-节这一层的知识点关系 + public void cretjieknow(String id){ + //开始组装课程-章结构知识点关系 + SeCourse seCourse = seCourseService.getById(id); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("courseid", id).eq("pid","0"); + List chapterListz = seChapterMapper.selectList(queryWrapper); + if (!chapterListz.isEmpty()){ + for (int i=0;i queryWrapperj = new QueryWrapper<>(); + queryWrapperj.eq("courseid", id).eq("pid",chapterListz.get(i).getId()); + List chapterListj = seChapterMapper.selectList(queryWrapperj); + if (!chapterListj.isEmpty()) { + for (int j = 0; j < chapterListj.size(); j++) { + QueryWrapper queryWrapperk = new QueryWrapper<>(); + queryWrapperk.eq("uintid", chapterListj.get(j).getId()); + List knowcourseList = knowcourseMapper.selectList(queryWrapperk); + if (!knowcourseList.isEmpty()){ + for (int c=0;c { @Select("select id from se_course where name = #{a} ") String getcourse(String a); + + @Select("SELECT * FROM se_course WHERE id==#{id}") + SeCourse getByIdcou(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeCourseService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeCourseService.java index a5d64c5..8b6c47b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeCourseService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/ISeCourseService.java @@ -21,4 +21,5 @@ public interface ISeCourseService extends IService { String getcourse(String a); + SeCourse getByIdcou(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeCourseServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeCourseServiceImpl.java index bb3e677..bd47728 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeCourseServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/course/service/impl/SeCourseServiceImpl.java @@ -36,4 +36,9 @@ public class SeCourseServiceImpl extends ServiceImpl i public String getcourse(String a) { return seCourseMapper.getcourse(a); } + + @Override + public SeCourse getByIdcou(String id) { + return seCourseMapper.getByIdcou(id); + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/entity/SeKonw.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/entity/SeKonw.java index ee2d0a0..c05306b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/entity/SeKonw.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/know/entity/SeKonw.java @@ -31,46 +31,57 @@ import lombok.experimental.Accessors; public class SeKonw implements Serializable { private static final long serialVersionUID = 1L; - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "主键") - private String id; - /**创建人*/ + private java.lang.String id; + /**创建人*/ @ApiModelProperty(value = "创建人") - private String createBy; - /**创建日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "创建日期") - private Date createTime; - /**更新人*/ + private java.util.Date createTime; + /**更新人*/ @ApiModelProperty(value = "更新人") - private String updateBy; - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "更新日期") - private Date updateTime; - /**所属部门*/ + private java.util.Date updateTime; + /**所属部门*/ @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - /**知识点名称*/ - @Excel(name = "知识点名称", width = 15) + private java.lang.String sysOrgCode; + /**知识点名称*/ + @Excel(name = "知识点名称", width = 15) @ApiModelProperty(value = "知识点名称") - private String name; - /**知识点代码*/ - @Excel(name = "知识点代码", width = 15) + private java.lang.String name; + /**知识点代码*/ + @Excel(name = "知识点代码", width = 15) @ApiModelProperty(value = "知识点代码") - private String code; - /**描述*/ - @Excel(name = "定义", width = 15) - @ApiModelProperty(value = "定义") - private String miaoshu; - /**简介*/ - @Excel(name = "简介", width = 15) + private java.lang.String code; + /**简介*/ + @Excel(name = "简介", width = 15) @ApiModelProperty(value = "简介") - private String info; + private java.lang.String info; + /**定义*/ + @Excel(name = "定义", width = 15) + @ApiModelProperty(value = "定义") + private java.lang.String miaoshu; /**添加人真实名称*/ - @ApiModelProperty(value = "添加人") - private String inrealname; + @Excel(name = "添加人真实名称", width = 15) + @ApiModelProperty(value = "添加人真实名称") + private java.lang.String inrealname; + /**知识点来源*/ + @Excel(name = "知识点来源", width = 15, dicCode = "cck") + @Dict(dicCode = "cck") + @ApiModelProperty(value = "知识点来源") + private java.lang.String knowfrom; + + @ApiModelProperty(value = "来源表ID") + private java.lang.String fromid; + @ApiModelProperty(value = "来源表ID") + private java.lang.String courseid; } 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 a0952e0..ef06a18 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 @@ -407,6 +407,55 @@ public class KnowcourseController extends JeecgController tableData (SeCourseobjectives seCourseobjectives, + HttpServletRequest request) { + //获取课程ID + String courseid = request.getParameter("id"); + //组装数据 + /*首先根据课程ID获取Knowcourse的数据*/ + List knowcourse = knowcourseService.getlist(courseid); + Double chapterusedxs =0.0; + Double utilsusedxs =0.0; + Double utilzxs = 0.0; + /*根据章节id查询需要的章,并且把knowcourse这个list里面的章的id替换成章的名称, + 最后的kcmuzb这个字段替换成章的学时*/ + for (int i = 0;i { void updatexs(Double bl, String mbid); + @Select("select name from se_chapter where id = #{chapterid}") + String getchaptername(String chapterid); + + @Select("select totalclasshours from se_chapter where id = #{chapterid}") + Double getchapterxs(String chapterid); + + @Select("select name from se_chapter where id = #{untilid}") + String getuntilname(String untilid); + + @Select("SELECT SUM(xs) FROM knowcourse WHERE chapterid =#{chapterid}") + Double getchapterusedxs(String chapterid); + + @Select("SELECT SUM(xs) FROM knowcourse WHERE uintid =#{untilid}") + Double getutilsusedxs(String untilid); + + @Select("SELECT totalclasshours FROM se_chapter WHERE id =#{untilid}") + Double getutilzxs(String untilid); + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/IKnowcourseService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/IKnowcourseService.java index ea26b16..5f4eac9 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/IKnowcourseService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/IKnowcourseService.java @@ -26,4 +26,14 @@ public interface IKnowcourseService extends IService { List getlist(String courseid); void updatexs(Double bl, String mbid); + String getchaptername(String chapterid); + + Double getchapterxs(String chapterid); + String getuntilname(String untilid); + + Double getchapterusedxs(String chapterid); + + Double getutilsusedxs(String untilid); + + Double getutilzxs(String untilid); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/impl/KnowcourseServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/impl/KnowcourseServiceImpl.java index be57651..93d6864 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/impl/KnowcourseServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/knowcourse/service/impl/KnowcourseServiceImpl.java @@ -50,5 +50,35 @@ public class KnowcourseServiceImpl extends ServiceImpl