|
|
|
@ -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<SeCourse, ISeCourseService> { |
|
|
|
|
|
|
|
|
|
@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<SeCourse, ISeCourseServi |
|
|
|
|
List<Knowcourse> knowcourses1 = knowcourseService.list(queryWrapper1); |
|
|
|
|
for (Knowcourse knowcourse : knowcourses1) { |
|
|
|
|
knowcourses.add(knowcourse); |
|
|
|
|
System.out.println(knowcourse); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -641,6 +661,224 @@ public class SeCourseController extends JeecgController<SeCourse, ISeCourseServi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**** |
|
|
|
|
* 根据传回的课程ID,生成课程-->章-->节-->知识点的结构的图谱数据。 |
|
|
|
|
* @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<SeChapter> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("courseid", id); |
|
|
|
|
List<SeChapter> chapterList = seChapterMapper.selectList(queryWrapper); |
|
|
|
|
for (int i=0;i<chapterList.size();i++){ |
|
|
|
|
SeKonw seKonw = new SeKonw(); |
|
|
|
|
seKonw.setName(chapterList.get(i).getName()); |
|
|
|
|
//这里的数据自数据字典cck其中2代表的是章节表
|
|
|
|
|
seKonw.setKnowfrom("2"); |
|
|
|
|
seKonw.setInfo("来自课程:"+seCourse.getName()); |
|
|
|
|
seKonw.setFromid(chapterList.get(i).getId()); |
|
|
|
|
seKonw.setCourseid(id); |
|
|
|
|
seKonwService.save(seKonw); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**** |
|
|
|
|
* 将课程抽象成知识点并存储到知识点表中 |
|
|
|
|
* @param request |
|
|
|
|
* @return 提示性信息 |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "开始组装前知识点和后知识点") |
|
|
|
|
@ApiOperation(value = "开始组装前知识点和后知识点", notes = "开始组装前知识点和后知识点") |
|
|
|
|
public void creteprenet(String id) { |
|
|
|
|
//开始组装课程-章结构知识点关系
|
|
|
|
|
cretechaptr(id); |
|
|
|
|
//开始组装章-节知识点
|
|
|
|
|
cretzhangjie(id); |
|
|
|
|
//开始组装节-知识点关系
|
|
|
|
|
cretjieknow(id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//用于在创建前知识点和后知识点的过程中创建课程-章这一层的知识点关系
|
|
|
|
|
public void cretechaptr(String id){ |
|
|
|
|
//开始组装课程-章结构知识点关系
|
|
|
|
|
SeCourse seCourse = seCourseService.getById(id); |
|
|
|
|
QueryWrapper<SeChapter> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("courseid", id).eq("pid","0"); |
|
|
|
|
List<SeChapter> chapterList = seChapterMapper.selectList(queryWrapper); |
|
|
|
|
if (!chapterList.isEmpty()){ |
|
|
|
|
for (int i=0;i<chapterList.size();i++) { |
|
|
|
|
SeKonwRelationshipMain seKonwRelationshipMain = new SeKonwRelationshipMain(); |
|
|
|
|
//这里的数据自数据字典cck其中1代表的是课程表
|
|
|
|
|
seKonwRelationshipMain.setPerFrom("1"); |
|
|
|
|
seKonwRelationshipMain.setPerName(seCourse.getName()); |
|
|
|
|
System.out.println(seCourse.getName()); |
|
|
|
|
seKonwRelationshipMain.setPerKowId(id); |
|
|
|
|
seKonwRelationshipMain.setPerColor("rgba(254, 241, 0, 1)"); |
|
|
|
|
//这里的数据自数据字典cck其中2代表的是章节表
|
|
|
|
|
seKonwRelationshipMain.setNextFrom("2"); |
|
|
|
|
seKonwRelationshipMain.setNextName(chapterList.get(i).getName()); |
|
|
|
|
seKonwRelationshipMain.setNextKnowId(chapterList.get(i).getId()); |
|
|
|
|
seKonwRelationshipMain.setNextColor("rgba(10, 138, 244, 1)"); |
|
|
|
|
seKonwRelationshipMainService.save(seKonwRelationshipMain); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//用于在创建前知识点和后知识点的过程中创建章-节这一层的知识点关系
|
|
|
|
|
public void cretzhangjie(String id){ |
|
|
|
|
//开始组装课程-章结构知识点关系
|
|
|
|
|
SeCourse seCourse = seCourseService.getById(id); |
|
|
|
|
QueryWrapper<SeChapter> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("courseid", id).eq("pid","0"); |
|
|
|
|
List<SeChapter> chapterListz = seChapterMapper.selectList(queryWrapper); |
|
|
|
|
if (!chapterListz.isEmpty()){ |
|
|
|
|
for (int i=0;i<chapterListz.size();i++) { |
|
|
|
|
QueryWrapper<SeChapter> queryWrapperj = new QueryWrapper<>(); |
|
|
|
|
queryWrapperj.eq("courseid", id).eq("pid",chapterListz.get(i).getId()); |
|
|
|
|
List<SeChapter> 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<SeChapter> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("courseid", id).eq("pid","0"); |
|
|
|
|
List<SeChapter> chapterListz = seChapterMapper.selectList(queryWrapper); |
|
|
|
|
if (!chapterListz.isEmpty()){ |
|
|
|
|
for (int i=0;i<chapterListz.size();i++) { |
|
|
|
|
QueryWrapper<SeChapter> queryWrapperj = new QueryWrapper<>(); |
|
|
|
|
queryWrapperj.eq("courseid", id).eq("pid",chapterListz.get(i).getId()); |
|
|
|
|
List<SeChapter> chapterListj = seChapterMapper.selectList(queryWrapperj); |
|
|
|
|
if (!chapterListj.isEmpty()) { |
|
|
|
|
for (int j = 0; j < chapterListj.size(); j++) { |
|
|
|
|
QueryWrapper<Knowcourse> queryWrapperk = new QueryWrapper<>(); |
|
|
|
|
queryWrapperk.eq("uintid", chapterListj.get(j).getId()); |
|
|
|
|
List<Knowcourse> knowcourseList = knowcourseMapper.selectList(queryWrapperk); |
|
|
|
|
if (!knowcourseList.isEmpty()){ |
|
|
|
|
for (int c=0;c<knowcourseList.size();c++){ |
|
|
|
|
SeKonwRelationshipMain seKonwRelationshipMain = new SeKonwRelationshipMain(); |
|
|
|
|
//这里的数据自数据字典cck其中3代表的是知识点表
|
|
|
|
|
seKonwRelationshipMain.setPerFrom("2"); |
|
|
|
|
seKonwRelationshipMain.setPerName(seChapterService.getById(knowcourseList.get(c).getUintid()).getName()); |
|
|
|
|
seKonwRelationshipMain.setPerKowId(knowcourseList.get(c).getUintid()); |
|
|
|
|
seKonwRelationshipMain.setPerColor("rgba(254, 241, 0, 1)"); |
|
|
|
|
seKonwRelationshipMain.setNextFrom("3"); |
|
|
|
|
seKonwRelationshipMain.setNextName(knowcourseList.get(c).getKnow()); |
|
|
|
|
seKonwRelationshipMain.setNextKnowId(knowcourseList.get(c).getKnowid()); |
|
|
|
|
seKonwRelationshipMain.setNextColor("rgba(10, 138, 244, 1)"); |
|
|
|
|
seKonwRelationshipMainService.save(seKonwRelationshipMain); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|