@ -1,9 +1,25 @@
package com.teaching.backend.service.impl.know ;
package com.teaching.backend.service.impl.know ;
import cn.hutool.json.JSONArray ;
import cn.hutool.json.JSONObject ;
import cn.hutool.json.JSONUtil ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.fasterxml.jackson.core.JsonProcessingException ;
import com.fasterxml.jackson.databind.JsonMappingException ;
import com.fasterxml.jackson.databind.JsonNode ;
import com.fasterxml.jackson.databind.ObjectMapper ;
import com.fasterxml.jackson.databind.node.ArrayNode ;
import com.fasterxml.jackson.databind.node.ObjectNode ;
import com.google.gson.Gson ;
import com.google.gson.GsonBuilder ;
import com.google.gson.JsonObject ;
import com.teaching.backend.common.BaseResponse ;
import com.teaching.backend.common.BaseResponse ;
import com.teaching.backend.common.ErrorCode ;
import com.teaching.backend.common.ErrorCode ;
import com.teaching.backend.common.ResultUtils ;
import com.teaching.backend.common.ResultUtils ;
import com.teaching.backend.controller.Know.Edge ;
import com.teaching.backend.controller.Know.KnowJson ;
import com.teaching.backend.controller.Know.KnowJsonListVO ;
import com.teaching.backend.mapper.Knowtemp.KnowtmpMapper ;
import com.teaching.backend.mapper.chapter.ChapterMapper ;
import com.teaching.backend.mapper.chapter.ChapterMapper ;
import com.teaching.backend.mapper.courses.CoursesMapper ;
import com.teaching.backend.mapper.courses.CoursesMapper ;
import com.teaching.backend.mapper.know.KnowRepository ;
import com.teaching.backend.mapper.know.KnowRepository ;
@ -29,6 +45,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.transaction.annotation.Transactional ;
import javax.annotation.Resource ;
import javax.annotation.Resource ;
import java.io.IOException ;
import java.util.* ;
import java.util.* ;
import java.util.stream.Collectors ;
import java.util.stream.Collectors ;
@ -43,6 +60,9 @@ public class knowServiceImpl implements KnowService {
@Autowired
@Autowired
private KnowRepository knowRepository ;
private KnowRepository knowRepository ;
@Autowired
private KnowtmpMapper knowtmpMapper ;
@Autowired
@Autowired
private ChapterMapper chapterMapper ;
private ChapterMapper chapterMapper ;
@ -51,7 +71,6 @@ public class knowServiceImpl implements KnowService {
private KnowtmpService knowtmpService ;
private KnowtmpService knowtmpService ;
@Autowired
@Autowired
CoursesMapper coursesMapper ;
CoursesMapper coursesMapper ;
@ -59,107 +78,563 @@ public class knowServiceImpl implements KnowService {
private Neo4jClient neo4jClient ;
private Neo4jClient neo4jClient ;
public BaseResponse < String > addRelationshipWithresources ( Long id , Long resourceId ) {
public BaseResponse < String > addRelationshipWithresources ( Long id , Long resourceId ) {
int f = knowRepository . addResourceResourcesKnow ( id , resourceId ) ;
int f = knowRepository . addResourceResourcesKnow ( id , resourceId ) ;
if ( f < = 0 ) {
if ( f < = 0 ) {
throw new RuntimeException ( "添加关系失败" ) ;
throw new RuntimeException ( "添加关系失败" ) ;
}
}
return ResultUtils . success ( "添加关系成功" ) ;
return ResultUtils . success ( "添加关系成功" ) ;
}
}
@Override
public BaseResponse < BaseKnowReturn > getTwoLevelKnows ( Long id ) {
Collection < Map < String , Object > > all =
neo4jClient . query ( "match(n:Know)-[r*0..2]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
Map < Long , String > colorChoose = new
HashMap < > ( ) ;
String color [ ] = new String [ 10 ] ;
String [ ] colorList = { "#91CC75" , "#5470C6" , "#FAC858" , "#EE6666" , "#73C0DE" , "#EA7CCC" , "#5577FF" , "#5577FF" , "#9DBFFF" , "#78A7FF" } ;
for ( int i = 0 ; i < 10 ; i + + ) {
colorChoose . put ( ( long ) i , colorList [ i ] ) ;
}
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
KnowVO knowVO ;
List node2 = new ArrayList < > ( ) ;
Links links ;
int p = 0 ;
while ( iterator . hasNext ( ) ) {
Map < String , Object > element = iterator . next ( ) ;
knowVO = new KnowVO ( ) ;
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
knowVO . setId ( id1 ) ;
knowVO . setLabel ( name1 ) ;
knowList . add ( knowVO ) ;
node2 = ( List ) element . get ( "r" ) ;
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {
InternalRelationship e = ( InternalRelationship ) node2 . get ( i ) ;
links = new Links ( ) ;
links . setId ( e . id ( ) ) ;
links . setSource ( e . startNodeId ( ) ) ;
links . setTarget ( e . endNodeId ( ) ) ;
if ( "contain" . equals ( e . type ( ) ) ) {
links . setLabel ( "包含" ) ;
} else if ( "order" . equals ( e . type ( ) ) ) {
links . setLabel ( "顺序" ) ;
}
linksList . add ( links ) ;
}
}
BaseKnowReturn baseKnowReturn = new BaseKnowReturn ( knowList , linksList ) ;
return ResultUtils . success ( baseKnowReturn ) ;
}
@Override
public BaseResponse < BaseKnowReturn > getThreeLevelKnows ( Long id ) {
Collection < Map < String , Object > > all =
neo4jClient . query ( "match(n:Know)-[r*0..3]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
Map < Long , String > colorChoose = new
HashMap < > ( ) ;
String color [ ] = new String [ 10 ] ;
String [ ] colorList = { "#91CC75" , "#5470C6" , "#FAC858" , "#EE6666" , "#73C0DE" , "#EA7CCC" , "#5577FF" , "#5577FF" , "#9DBFFF" , "#78A7FF" } ;
for ( int i = 0 ; i < 10 ; i + + ) {
colorChoose . put ( ( long ) i , colorList [ i ] ) ;
}
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
KnowVO knowVO ;
List node2 = new ArrayList < > ( ) ;
Links links ;
int p = 0 ;
while ( iterator . hasNext ( ) ) {
Map < String , Object > element = iterator . next ( ) ;
knowVO = new KnowVO ( ) ;
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
knowVO . setId ( id1 ) ;
knowVO . setLabel ( name1 ) ;
knowList . add ( knowVO ) ;
node2 = ( List ) element . get ( "r" ) ;
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {
InternalRelationship e = ( InternalRelationship ) node2 . get ( i ) ;
links = new Links ( ) ;
links . setId ( e . id ( ) ) ;
links . setSource ( e . startNodeId ( ) ) ;
links . setTarget ( e . endNodeId ( ) ) ;
if ( "contain" . equals ( e . type ( ) ) ) {
links . setLabel ( "包含" ) ;
} else if ( "order" . equals ( e . type ( ) ) ) {
links . setLabel ( "顺序" ) ;
}
linksList . add ( links ) ;
}
}
BaseKnowReturn baseKnowReturn = new BaseKnowReturn ( knowList , linksList ) ;
return ResultUtils . success ( baseKnowReturn ) ;
}
@Override
public BaseResponse < BaseKnowReturn > getFourLevelKnows ( Long id ) {
Collection < Map < String , Object > > all =
neo4jClient . query ( "match(n:Know)-[r*0..4]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
Map < Long , String > colorChoose = new
HashMap < > ( ) ;
String color [ ] = new String [ 10 ] ;
String [ ] colorList = { "#91CC75" , "#5470C6" , "#FAC858" , "#EE6666" , "#73C0DE" , "#EA7CCC" , "#5577FF" , "#5577FF" , "#9DBFFF" , "#78A7FF" } ;
for ( int i = 0 ; i < 10 ; i + + ) {
colorChoose . put ( ( long ) i , colorList [ i ] ) ;
}
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
KnowVO knowVO ;
List node2 = new ArrayList < > ( ) ;
Links links ;
int p = 0 ;
while ( iterator . hasNext ( ) ) {
Map < String , Object > element = iterator . next ( ) ;
knowVO = new KnowVO ( ) ;
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
knowVO . setId ( id1 ) ;
knowVO . setLabel ( name1 ) ;
knowList . add ( knowVO ) ;
node2 = ( List ) element . get ( "r" ) ;
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {
InternalRelationship e = ( InternalRelationship ) node2 . get ( i ) ;
links = new Links ( ) ;
links . setId ( e . id ( ) ) ;
links . setSource ( e . startNodeId ( ) ) ;
links . setTarget ( e . endNodeId ( ) ) ;
if ( "contain" . equals ( e . type ( ) ) ) {
links . setLabel ( "包含" ) ;
} else if ( "order" . equals ( e . type ( ) ) ) {
links . setLabel ( "顺序" ) ;
}
linksList . add ( links ) ;
}
}
BaseKnowReturn baseKnowReturn = new BaseKnowReturn ( knowList , linksList ) ;
return ResultUtils . success ( baseKnowReturn ) ;
}
@Override
public BaseResponse < String > showGraphJson ( String courseId ) {
return addInformation ( courseId ) ;
}
@Override
@Override
public BaseResponse < String > addAllKnow ( String courseId ) {
public BaseResponse < String > addAllKnow ( String courseId ) {
try {
try {
addAllKnowTransation ( courseId ) ;
addAllKnowTransation ( courseId ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , e . getMessage ( ) ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , e . getMessage ( ) ) ;
}
}
//6.返回成功信息,关闭事务
//6.返回成功信息,关闭事务
return ResultUtils . success ( "添加成功" ) ;
return ResultUtils . success ( "添加成功" ) ;
}
}
private BaseResponse < String > addInformation ( String courseId ) {
// 创建 JSON 对象数组
JSONArray jsonArrayKnowNode = JSONUtil . createArray ( ) ;
JSONArray jsonArrayCourseNode = JSONUtil . createArray ( ) ;
JSONArray jsonArrayChapterNode = JSONUtil . createArray ( ) ;
//查询数据库-课程
Courses courses = coursesMapper . selectById ( courseId ) ;
JSONObject obj1 = JSONUtil . createObj ( ) ;
obj1 . put ( "courseId" , courseId ) ;
obj1 . put ( "name" , courses . getName ( ) ) ;
obj1 . put ( "info" , courses . getDescription ( ) ) ;
obj1 . put ( "hour" , courses . getClasshours ( ) ) ;
jsonArrayCourseNode . add ( obj1 ) ;
//查询数据库-章-节
List < Chapter > chapterList = new ArrayList < > ( ) ;
List < Chapter > chapterListPID = chapterMapper . selectChapterPIDByCourseId ( courseId ) ;
List < Long > chapterOneIds = new ArrayList < > ( ) ;
List < Long > chapterTwoIds = new ArrayList < > ( ) ;
for ( int i = 0 ; i < chapterListPID . size ( ) ; i + + ) {
chapterList . add ( chapterListPID . get ( i ) ) ;
chapterOneIds . add ( chapterListPID . get ( i ) . getId ( ) ) ;
List < Chapter > chapterListSecond = chapterMapper . selectChapterChildrenOrderByNum ( chapterListPID . get ( i ) . getId ( ) ) ;
for ( int j = 0 ; j < chapterListSecond . size ( ) ; j + + ) {
chapterList . add ( chapterListSecond . get ( j ) ) ;
chapterTwoIds . add ( chapterListSecond . get ( j ) . getId ( ) ) ;
}
}
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
Chapter chapter = chapterList . get ( i ) ;
JSONObject obj2 = JSONUtil . createObj ( ) ;
obj2 . put ( "chapterId" , chapter . getId ( ) ) ;
obj2 . put ( "name" , chapter . getName ( ) ) ;
obj2 . put ( "info" , chapter . getContent ( ) ) ;
obj2 . put ( "hour" , chapter . getTotalClassHours ( ) ) ;
jsonArrayChapterNode . add ( obj2 ) ;
}
//查询数据库-知识点
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
Chapter chapter = chapterList . get ( i ) ;
if ( chapter . getPid ( ) ! = 0 ) {
List < Knowtmp > knowlist = knowtmpService . queryByChapterId ( chapter . getId ( ) ) ;
for ( int j = 0 ; j < knowlist . size ( ) ; j + + ) {
Knowtmp knowtmp = knowlist . get ( j ) ;
JSONObject obj3 = JSONUtil . createObj ( ) ;
obj3 . put ( "knowId" , knowtmp . getId ( ) ) ;
obj3 . put ( "name" , knowtmp . getName ( ) ) ;
obj3 . put ( "info" , knowtmp . getInfo ( ) ) ;
obj3 . put ( "hour" , knowtmp . getHour ( ) ) ;
jsonArrayKnowNode . add ( obj3 ) ;
}
}
}
// =======创建关系
JSONArray edgesArray = JSONUtil . createArray ( ) ;
// 创建边列表
// 课程-章节 父子
for ( int i = 0 ; i < chapterListPID . size ( ) ; i + + ) {
Chapter chapter = chapterListPID . get ( i ) ;
JSONObject edge = JSONUtil . createObj ( ) ;
edge . put ( "source" , courses . getId ( ) ) ;
edge . put ( "target" , chapter . getId ( ) ) ;
edge . put ( "type" , "FatherAndSon" ) ;
edge . put ( "sta" , 1 ) ;
edgesArray . add ( edge ) ;
}
//章-节 父子
for ( int i = 0 ; i < chapterListPID . size ( ) ; i + + ) {
List < Chapter > chapterListSecond = chapterMapper . selectChapterChildrenOrderByNum ( chapterListPID . get ( i ) . getId ( ) ) ;
for ( int j = 0 ; j < chapterListSecond . size ( ) ; j + + ) {
JSONObject edge = JSONUtil . createObj ( ) ;
edge . put ( "source" , chapterListPID . get ( i ) . getId ( ) ) ;
edge . put ( "target" , chapterListSecond . get ( j ) . getId ( ) ) ;
edge . put ( "type" , "FatherAndSon" ) ;
edge . put ( "sta" , 2 ) ;
edgesArray . add ( edge ) ;
}
}
//节与点父子
List < Long > knowIds = new ArrayList < > ( ) ;
for ( int i = 0 ; i < chapterTwoIds . size ( ) ; i + + ) {
List < Knowtmp > knowlist = knowtmpService . queryByChapterId ( chapterTwoIds . get ( i ) ) ;
for ( int j = 0 ; j < knowlist . size ( ) ; j + + ) {
Knowtmp knowtmp = knowlist . get ( j ) ;
JSONObject edge = JSONUtil . createObj ( ) ;
edge . put ( "source" , chapterTwoIds . get ( i ) ) ;
edge . put ( "target" , knowtmp . getId ( ) ) ;
edge . put ( "type" , "FatherAndSon" ) ;
edge . put ( "sta" , 3 ) ;
edgesArray . add ( edge ) ;
knowIds . add ( knowtmp . getId ( ) ) ;
}
}
//章-章 顺序
for ( int i = 0 ; i < chapterOneIds . size ( ) - 1 ; i + + ) {
JSONObject edge = JSONUtil . createObj ( ) ;
edge . put ( "source" , chapterOneIds . get ( i ) ) ;
edge . put ( "target" , chapterOneIds . get ( i + 1 ) ) ;
edge . put ( "type" , "Subsequence" ) ;
edge . put ( "sta" , 2 ) ;
edgesArray . add ( edge ) ;
}
//节与节 顺序
for ( int i = 0 ; i < chapterTwoIds . size ( ) - 1 ; i + + ) {
JSONObject edge = JSONUtil . createObj ( ) ;
edge . put ( "source" , chapterTwoIds . get ( i ) ) ;
edge . put ( "target" , chapterTwoIds . get ( i + 1 ) ) ;
edge . put ( "type" , "Subsequence" ) ;
edge . put ( "sta" , 2 ) ;
edgesArray . add ( edge ) ;
}
//点-点 顺序
for ( int i = 0 ; i < knowIds . size ( ) - 1 ; i + + ) {
JSONObject edge = JSONUtil . createObj ( ) ;
edge . put ( "source" , knowIds . get ( i ) ) ;
edge . put ( "target" , knowIds . get ( i + 1 ) ) ;
edge . put ( "type" , "Subsequence" ) ;
edge . put ( "sta" , 4 ) ;
edgesArray . add ( edge ) ;
}
String jsonNodeKnow = jsonArrayKnowNode . toString ( ) ;
String jsonNodeChapter = jsonArrayChapterNode . toString ( ) ;
String jsonNodeCourse = jsonArrayCourseNode . toString ( ) ;
String jsonEdges = edgesArray . toString ( ) ;
System . out . println ( "json node " + jsonNodeKnow ) ;
System . out . println ( "json jsonNodeChapter " + jsonNodeChapter ) ;
System . out . println ( "json edge " + jsonEdges ) ;
return generateGraph ( jsonNodeCourse , jsonNodeChapter , jsonNodeKnow , jsonEdges ) ;
//将json保存在mysql表中
}
//todo 根据json串生成 图谱 保证事务
private BaseResponse < String > generateGraph ( String jsonNodeCourse , String jsonNodeChapter , String jsonNodeKnow , String jsonEdges ) {
//插入图
JSONArray jsonArrayCourse = JSONUtil . parseArray ( jsonNodeCourse ) ;
for ( Object obj : jsonArrayCourse ) {
JSONObject jsonObject = ( JSONObject ) obj ;
String courseId = jsonObject . getStr ( "courseId" ) ;
String name = jsonObject . getStr ( "name" ) ;
String info = jsonObject . getStr ( "info" ) ;
Integer hour = jsonObject . getInt ( "hour" ) ;
//在图数据库中插入
Long res = knowRepository . addCourse ( courseId , name , info , hour ) ;
if ( res = = null ) {
throw new RuntimeException ( "添加课程失败" ) ;
}
}
//插入章节
JSONArray jsonArray = JSONUtil . parseArray ( jsonNodeChapter ) ;
for ( Object obj : jsonArray ) {
JSONObject jsonObject = ( JSONObject ) obj ;
Long chapterId = jsonObject . getLong ( "chapterId" ) ;
String name = jsonObject . getStr ( "name" ) ;
String info = jsonObject . getStr ( "info" ) ;
double hour = jsonObject . getDouble ( "hour" ) ;
//在图数据库中插入
Long res = knowRepository . addChapter ( chapterId , name , info , hour ) ;
if ( res = = null ) {
throw new RuntimeException ( "添加章节失败" ) ;
}
}
//插入知识点
JSONArray jsonArrayKnow = JSONUtil . parseArray ( jsonNodeKnow ) ;
for ( Object obj : jsonArrayKnow ) {
JSONObject jsonObject = ( JSONObject ) obj ;
Long knowId = jsonObject . getLong ( "knowId" ) ;
String name = jsonObject . getStr ( "name" ) ;
String info = jsonObject . getStr ( "info" ) ;
double hour = jsonObject . getDouble ( "hour" ) ;
//在图数据库中插入
Long res = knowRepository . addKnow ( knowId , name , info , hour ) ;
if ( res = = null ) {
throw new RuntimeException ( "添加知识点失败" ) ;
}
}
//插入关系
JSONArray jsonArrayEdges = JSONUtil . parseArray ( jsonEdges ) ;
for ( Object obj : jsonArrayEdges ) {
JSONObject jsonObject = ( JSONObject ) obj ;
String source = jsonObject . getStr ( "source" ) ;
String target = jsonObject . getStr ( "target" ) ;
String type = jsonObject . getStr ( "type" ) ;
Integer sta = jsonObject . getInt ( "sta" ) ;
//在图数据库中插入
if ( sta ! = null & & sta = = 1 ) {
Long target1 = Long . parseLong ( target ) ;
int res = knowRepository . addCourseRelationship ( source , target1 , type ) ;
if ( res < = 0 ) {
throw new RuntimeException ( "添加关系 1 失败" ) ;
}
} else if ( sta ! = null & & sta = = 2 ) {
Long source1 = Long . parseLong ( source ) ;
Long target1 = Long . parseLong ( target ) ;
int res = knowRepository . addChapterRelationship ( source1 , target1 , type ) ;
if ( res < = 0 ) {
throw new RuntimeException ( "添加关系 2 失败" ) ;
}
} else if ( sta ! = null & & sta = = 3 ) {
Long source1 = Long . parseLong ( source ) ;
Long target1 = Long . parseLong ( target ) ;
int res = knowRepository . addChapterToKnowRelationship ( source1 , target1 , type ) ;
if ( res < = 0 ) {
throw new RuntimeException ( "添加关系 13失败" ) ;
}
} else if ( sta ! = null & & sta = = 4 ) {
Long source1 = Long . parseLong ( source ) ;
Long target1 = Long . parseLong ( target ) ;
int res = knowRepository . addKnowRelationship ( source1 , target1 , type ) ;
if ( res < = 0 ) {
throw new RuntimeException ( "添加关系 4 失败" ) ;
}
} else {
throw new RuntimeException ( "sta 错误" ) ;
}
}
return ResultUtils . success ( "添加节点关系成功" ) ;
}
@Transactional
@Transactional
// todo 事务没有正确使用
public void addAllKnowTransation ( String courseId ) throws Exception {
public void addAllKnowTransation ( String courseId ) throws Exception {
int f ;
//验证章节是否存在
//验证知识点是否存在,避免重复添加
//先添加节点
//后赋值关系
// 2.从课程表查出课程节点 并添加到 neo
// 2.从课程表查出课程节点 并添加到 neo
Courses courses = coursesMapper . selectById ( courseId ) ;
Courses courses = coursesMapper . selectById ( courseId ) ;
int f = knowRepository . addCourse ( courseId , courses . getName ( ) , courses . getDescription ( ) , courses . getClasshours ( ) ) ;
Long KnowCourseId = knowRepository . addCourse ( courseId , courses . getName ( ) , courses . getDescription ( ) , courses . getClasshours ( ) ) ;
if ( f < = 0 ) {
if ( KnowCourseId = = null ) {
throw new RuntimeException ( "添加课程失败" ) ;
throw new RuntimeException ( "添加课程失败" ) ;
}
}
// 3 从章节表查出章节节点 并添加到 neo
// 3 从章节表查出章节节点 并添加到 neo
List < Chapter > chapterList = chapterMapper . selectSectionsByCourseId ( courseId ) ;
List < Chapter > chapterList = new ArrayList < > ( ) ;
List < Chapter > chapterListPID = chapterMapper . selectChapterPIDByCourseId ( courseId ) ;
for ( int i = 0 ; i < chapterListPID . size ( ) ; i + + ) {
chapterList . add ( chapterListPID . get ( i ) ) ;
List < Chapter > chapterListSecond = chapterMapper . selectChapterChildrenOrderByNum ( chapterListPID . get ( i ) . getId ( ) ) ;
for ( int j = 0 ; j < chapterListSecond . size ( ) ; j + + ) {
chapterList . add ( chapterListSecond . get ( j ) ) ;
}
}
//添加节点
List < Long > chapterIds = new ArrayList < > ( ) ;
List < Long > chapterOneIds = new ArrayList < > ( ) ;
List < Long > chapterTwoIds = new ArrayList < > ( ) ;
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
Chapter chapter = chapterList . get ( i ) ;
Chapter chapter = chapterList . get ( i ) ;
f = knowRepository . addChapter ( chapter . getId ( ) , chapter . getName ( ) , chapter . getContent ( ) , chapter . getTotalClassHours ( ) ) ;
Long KnowChapterId = knowRepository . addChapter ( chapter . getId ( ) , chapter . getName ( ) , chapter . getContent ( ) , chapter . getTotalClassHours ( ) ) ;
if ( f < = 0 ) {
if ( chapter . getPid ( ) = = 0 ) {
chapterOneIds . add ( KnowChapterId ) ;
} else {
chapterTwoIds . add ( KnowChapterId ) ;
}
chapterIds . add ( chapter . getId ( ) ) ;
if ( KnowChapterId = = null ) {
throw new RuntimeException ( "添加章节失败" ) ;
throw new RuntimeException ( "添加章节失败" ) ;
}
}
}
}
List < Long > idList = chapterList . stream ( )
. map ( menu - > menu . getId ( ) )
. collect ( Collectors . toList ( ) ) ;
//获取chapterId 查询知识点 返回知识点集合
//获取chapterId 查询知识点 返回知识点集合
List < Knowtmp > knowlist = knowtmpService . queryByChapterIdList ( idList ) ;
List < Long > knowIds = new ArrayList < > ( ) ;
for ( int i = 0 ; i < idList . size ( ) ; i + + ) {
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
List < Knowtmp > knowlist1 = knowtmpService . queryByChapterId ( idList . get ( i ) ) ;
Chapter chapter = chapterList . get ( i ) ;
for ( int j = 0 ; j < knowlist1 . size ( ) ; j + + ) {
if ( chapter . getPid ( ) ! = 0 ) {
Know know = knowRepository . addKnow ( knowlist1 . get ( j ) . getName ( ) , knowlist1 . get ( j ) . getInfo ( ) ) ;
List < Knowtmp > knowlist = knowtmpService . queryByChapterId ( chapter . getId ( ) ) ;
if ( know = = null ) {
for ( int j = 0 ; j < knowlist . size ( ) ; j + + ) {
throw new RuntimeException ( "添加知识点失败" ) ;
Long knowId = knowRepository . addKnow ( knowlist . get ( j ) . getId ( ) , knowlist . get ( j ) . getName ( ) , knowlist . get ( j ) . getInfo ( ) , knowlist . get ( j ) . getHour ( ) ) ;
}
knowIds . add ( knowId ) ;
f = knowRepository . addFatherAndSonWithKnow ( know . getId ( ) , idList . get ( i ) ) ;
if ( knowId = = null ) {
if ( f < = 0 ) {
throw new RuntimeException ( "添加知识点失败" ) ;
throw new RuntimeException ( "添加知识点-章节失败" ) ;
}
//添加知识点关系
f = knowRepository . addContainWithKnow ( knowId , chapterIds . get ( i ) ) ;
if ( f < = 0 ) {
throw new RuntimeException ( "添加知识点-章节失败关系失败" ) ;
}
}
}
}
}
}
}
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
for ( int i = 0 ; i < chapterList . size ( ) ; i + + ) {
Chapter chapter = chapterList . get ( i ) ;
Chapter chapter = chapterList . get ( i ) ;
if ( chapter . getPid ( ) = = 0 ) {
if ( chapter . getPid ( ) = = 0 ) {
f = knowRepository . addFatherAndSonWithCourse ( chapter . getCourseId ( ) , chapter . getId ( ) ) ;
f = knowRepository . addContai nWithCourse ( chapter . getCourseId ( ) , chapter . getId ( ) ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加课程-章节关系失败" ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加课程-章节关系失败" ) ;
} else {
} else {
f = knowRepository . addFatherAndSonWithChapter ( chapter . getId ( ) , chapter . getPid ( ) ) ;
f = knowRepository . addContai nWithChapter ( chapter . getId ( ) , chapter . getPid ( ) ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加章节-章节关系失败" ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加章节-章节关系失败" ) ;
}
}
}
}
// for (int j = 0; j < knowlist.size(); j++) {
//添加顺序关系
// Knowtmp knowtmp = knowlist.get(j);
// f = knowRepository.addFatherAndSonWithKnow(knowtmp.getId(),knowtmp.getChapterid());
// if(f <= 0) throw new RuntimeException("添加章节-知识点关系失败");
// }
}
//给章添加顺序关系
for ( int i = 0 ; i < chapterOneIds . size ( ) - 1 ; i + + ) {
f = knowRepository . addOrderById ( chapterOneIds . get ( i ) , chapterOneIds . get ( i + 1 ) ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加章-章 顺序关系失败" ) ;
}
@Override
//给节添加顺序关系
public BaseResponse < String > addKnow ( KnowRequest knowRequest ) {
for ( int i = 0 ; i < chapterTwoIds . size ( ) - 1 ; i + + ) {
Know know = new Know ( ) ;
f = knowRepository . addOrderById ( chapterTwoIds . get ( i ) , chapterTwoIds . get ( i + 1 ) ) ;
BeanUtils . copyProperties ( knowRequest , know ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加节-节 顺序关系失败" ) ;
Know know1 = knowRepository . addKnow ( know . getName ( ) , know . getInfo ( ) ) ;
}
if ( know1 ! = null ) {
//给知识点添加顺序关系
return ResultUtils . success ( "添加知识点成功" ) ;
for ( int i = 0 ; i < knowIds . size ( ) - 1 ; i + + ) {
} else {
f = knowRepository . addOrderById ( knowIds . get ( i ) , knowIds . get ( i + 1 ) ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "添加知识点失败" ) ;
if ( f < = 0 ) throw new RuntimeException ( "添加知识点-知识点 顺序关系 失败") ;
}
}
}
}
// @Override
// public BaseResponse<String> addKnow(KnowRequest knowRequest) {
// Know know = new Know();
// BeanUtils.copyProperties(knowRequest,know);
// Long know1 = knowRepository.addKnow(know.getName(),know.getInfo());
// if(know1 != null){
// return ResultUtils.success("添加知识点成功");
// }else{
// return ResultUtils.error(ErrorCode.OPERATION_ERROR,"添加知识点失败");
// }
// }
@Override
@Override
public BaseResponse < String > updateKnow ( KnowUpdateRequest knowUpdateRequest ) {
public BaseResponse < String > updateKnow ( KnowUpdateRequest knowUpdateRequest ) {
Know know = new Know ( ) ;
Know know = new Know ( ) ;
BeanUtils . copyProperties ( knowUpdateRequest , know ) ;
BeanUtils . copyProperties ( knowUpdateRequest , know ) ;
int f = knowRepository . updateKnow ( know . getId ( ) , know . getName ( ) , know . getInfo ( ) ) ;
int f = knowRepository . updateKnow ( know . getId ( ) , know . getName ( ) , know . getInfo ( ) ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "修改知识点成功" ) ;
return ResultUtils . success ( "修改知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "修改知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "修改知识点失败" ) ;
}
}
}
}
@ -167,10 +642,10 @@ public class knowServiceImpl implements KnowService {
public BaseResponse < String > deleteKnow ( Long id ) {
public BaseResponse < String > deleteKnow ( Long id ) {
// todo 判断知识点存在否
// todo 判断知识点存在否
int f = knowRepository . deleteKnow ( id ) ;
int f = knowRepository . deleteKnow ( id ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "删除知识点成功" ) ;
return ResultUtils . success ( "删除知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "删除知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "删除知识点失败" ) ;
}
}
}
}
@ -186,24 +661,24 @@ public class knowServiceImpl implements KnowService {
@Override
@Override
public BaseResponse < String > addCourse ( KnowCourseCreateRequest knowCourseCreateRequest ) {
public BaseResponse < String > addCourse ( KnowCourseCreateRequest knowCourseCreateRequest ) {
KnowCourse knowCourse = new KnowCourse ( ) ;
KnowCourse knowCourse = new KnowCourse ( ) ;
BeanUtils . copyProperties ( knowCourseCreateRequest , knowCourse ) ;
BeanUtils . copyProperties ( knowCourseCreateRequest , knowCourse ) ;
int f = knowRepository . addCourse ( knowCourse . getCourseId ( ) , knowCourse . getName ( ) , knowCourse . getInfo ( ) , knowCourse . getHour ( ) ) ;
Long knowCourse1 = knowRepository . addCourse ( knowCourse . getCourseId ( ) , knowCourse . getName ( ) , knowCourse . getInfo ( ) , knowCourse . getHour ( ) ) ;
if ( f > 0 ) {
if ( knowCourse1 ! = null ) {
return ResultUtils . success ( "添加知识点成功" ) ;
return ResultUtils . success ( "添加知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "添加知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "添加知识点失败" ) ;
}
}
}
}
@Override
@Override
public BaseResponse < String > updateCourse ( KnowCourseCreateRequest knowCourseCreateRequest ) {
public BaseResponse < String > updateCourse ( KnowCourseCreateRequest knowCourseCreateRequest ) {
KnowCourse knowCourse = new KnowCourse ( ) ;
KnowCourse knowCourse = new KnowCourse ( ) ;
BeanUtils . copyProperties ( knowCourseCreateRequest , knowCourse ) ;
BeanUtils . copyProperties ( knowCourseCreateRequest , knowCourse ) ;
int f = knowRepository . updateCourse ( knowCourse . getCourseId ( ) , knowCourse . getName ( ) , knowCourse . getInfo ( ) ) ;
int f = knowRepository . updateCourse ( knowCourse . getCourseId ( ) , knowCourse . getName ( ) , knowCourse . getInfo ( ) ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "修改知识点成功" ) ;
return ResultUtils . success ( "修改知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "修改知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "修改知识点失败" ) ;
}
}
}
}
@ -211,10 +686,10 @@ public class knowServiceImpl implements KnowService {
public BaseResponse < String > deleteCourse ( String courseId ) {
public BaseResponse < String > deleteCourse ( String courseId ) {
int f = knowRepository . deleteCourse ( courseId ) ;
int f = knowRepository . deleteCourse ( courseId ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "删除知识点成功" ) ;
return ResultUtils . success ( "删除知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "删除知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "删除知识点失败" ) ;
}
}
}
}
@ -227,44 +702,43 @@ public class knowServiceImpl implements KnowService {
//=========================
//=========================
@Override
@Override
public BaseResponse < String > addChapter ( KnowChapterCreateRequest knowChapterCreateRequest ) {
public BaseResponse < String > addChapter ( KnowChapterCreateRequest knowChapterCreateRequest ) {
KnowChapter knowChapter = new KnowChapter ( ) ;
KnowChapter knowChapter = new KnowChapter ( ) ;
BeanUtils . copyProperties ( knowChapterCreateRequest , knowChapter ) ;
BeanUtils . copyProperties ( knowChapterCreateRequest , knowChapter ) ;
int f = knowRepository . addChapter ( knowChapter . getChapterId ( ) , knowChapter . getName ( ) , knowChapter . getInfo ( ) , knowChapter . getHour ( ) ) ;
Long f = knowRepository . addChapter ( knowChapter . getChapterId ( ) , knowChapter . getName ( ) , knowChapter . getInfo ( ) , knowChapter . getHour ( ) ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "添加章节成功" ) ;
return ResultUtils . success ( "添加章节成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "添加章节失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "添加章节失败" ) ;
}
}
}
}
@Override
@Override
public BaseResponse < String > updateChapter ( KnowChapterCreateRequest knowChapterCreateRequest ) {
public BaseResponse < String > updateChapter ( KnowChapterCreateRequest knowChapterCreateRequest ) {
KnowChapter knowChapter = new KnowChapter ( ) ;
KnowChapter knowChapter = new KnowChapter ( ) ;
BeanUtils . copyProperties ( knowChapterCreateRequest , knowChapter ) ;
BeanUtils . copyProperties ( knowChapterCreateRequest , knowChapter ) ;
int f = knowRepository . updateChapter ( knowChapter . getChapterId ( ) , knowChapter . getName ( ) , knowChapter . getInfo ( ) ) ;
int f = knowRepository . updateChapter ( knowChapter . getChapterId ( ) , knowChapter . getName ( ) , knowChapter . getInfo ( ) ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "修改知识点成功" ) ;
return ResultUtils . success ( "修改知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "修改知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "修改知识点失败" ) ;
}
}
}
}
@Override
@Override
public BaseResponse < String > deleteChapter ( Long chapterId ) {
public BaseResponse < String > deleteChapter ( Long chapterId ) {
int f = knowRepository . deleteChapter ( chapterId ) ;
int f = knowRepository . deleteChapter ( chapterId ) ;
if ( f > 0 ) {
if ( f > 0 ) {
return ResultUtils . success ( "删除知识点成功" ) ;
return ResultUtils . success ( "删除知识点成功" ) ;
} else {
} else {
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "删除知识点失败" ) ;
return ResultUtils . error ( ErrorCode . OPERATION_ERROR , "删除知识点失败" ) ;
}
}
}
}
@Override
@Override
public BaseResponse < KnowChapter > queryChapter ( Long chapterId ) {
public BaseResponse < KnowChapter > queryChapter ( Long chapterId ) {
KnowChapter knowChapter = knowRepository . queryChapter ( chapterId ) ;
KnowChapter knowChapter = knowRepository . queryChapter ( chapterId ) ;
return ResultUtils . success ( knowChapter ) ;
return ResultUtils . success ( knowChapter ) ;
}
}
@ -274,18 +748,18 @@ public class knowServiceImpl implements KnowService {
@Override
@Override
public BaseResponse < BaseKnowReturn > getAllKnowByCourseId ( String id ) {
public BaseResponse < BaseKnowReturn > getAllKnowByCourseId ( String id ) {
Collection < Map < String , Object > > all =
Collection < Map < String , Object > > all =
neo4jClient . query ( "match(n:Know)-[r*0..]->(p:Know) where n.courseId = '" + id + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
neo4jClient . query ( "match(n:Know)-[r:contain *0..4 ]->(p:Know) where n.courseId = '" + id + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
Map < Long , String > colorChoose = new HashMap < > ( ) ;
Map < Long , String > colorChoose = new HashMap < > ( ) ;
String color [ ] = new String [ 10 ] ;
String color [ ] = new String [ 10 ] ;
String [ ] colorList = { "#91CC75" , "#5470C6" , "#FAC858" , "#EE6666" , "#73C0DE" , "#EA7CCC" , "#5577FF" , "#5577FF" , "#9DBFFF" , "#78A7FF" } ;
String [ ] colorList = { "#91CC75" , "#5470C6" , "#FAC858" , "#EE6666" , "#73C0DE" , "#EA7CCC" , "#5577FF" , "#5577FF" , "#9DBFFF" , "#78A7FF" } ;
for ( int i = 0 ; i < 10 ; i + + ) {
for ( int i = 0 ; i < 10 ; i + + ) {
colorChoose . put ( ( long ) i , colorList [ i ] ) ;
colorChoose . put ( ( long ) i , colorList [ i ] ) ;
}
}
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
KnowVO knowVO ;
KnowVO knowVO ;
List node2 = new ArrayList < > ( ) ;
List node2 = new ArrayList < > ( ) ;
Links links ;
Links links ;
@ -296,14 +770,73 @@ public class knowServiceImpl implements KnowService {
Node node1 = ( Node ) element . get ( "p" ) ;
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
// knowVO.setColor(colorChoose.get(group));
if ( node1 ! = null ) {
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
knowVO . setId ( id1 ) ;
knowVO . setLabel ( name1 ) ;
knowList . add ( knowVO ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
}
node2 = ( List ) element . get ( "r" ) ;
if ( ! node2 . isEmpty ( ) ) {
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {
InternalRelationship e = ( InternalRelationship ) node2 . get ( i ) ;
links = new Links ( ) ;
links . setId ( e . id ( ) ) ;
links . setSource ( e . startNodeId ( ) ) ;
links . setTarget ( e . endNodeId ( ) ) ;
if ( "contain" . equals ( e . type ( ) ) ) {
links . setLabel ( "包含" ) ;
} else if ( "order" . equals ( e . type ( ) ) ) {
links . setLabel ( "顺序" ) ;
}
linksList . add ( links ) ;
}
}
}
BaseKnowReturn baseKnowReturn = new BaseKnowReturn ( knowList , linksList ) ;
return ResultUtils . success ( baseKnowReturn ) ;
}
@Override
public BaseResponse < BaseKnowReturn > getsecondKnowsById ( Long id ) {
Collection < Map < String , Object > > all =
neo4jClient . query ( "match(n:Know)-[r*0..2]->(p:Know) where ID(n) = " + id + " return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
Map < Long , String > colorChoose = new HashMap < > ( ) ;
String color [ ] = new String [ 10 ] ;
String [ ] colorList = { "#91CC75" , "#5470C6" , "#FAC858" , "#EE6666" , "#73C0DE" , "#EA7CCC" , "#5577FF" , "#5577FF" , "#9DBFFF" , "#78A7FF" } ;
for ( int i = 0 ; i < 10 ; i + + ) {
colorChoose . put ( ( long ) i , colorList [ i ] ) ;
}
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
KnowVO knowVO ;
List node2 = new ArrayList < > ( ) ;
Links links ;
int p = 0 ;
while ( iterator . hasNext ( ) ) {
Map < String , Object > element = iterator . next ( ) ;
knowVO = new KnowVO ( ) ;
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
Long id1 = node1 . id ( ) ;
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
knowVO . setId ( id1 ) ;
knowVO . setId ( id1 ) ;
knowVO . setLabel ( name1 ) ;
knowVO . setLabel ( name1 ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
knowList . add ( knowVO ) ;
node2 = ( List ) element . get ( "r" ) ;
node2 = ( List ) element . get ( "r" ) ;
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {
@ -312,13 +845,18 @@ public class knowServiceImpl implements KnowService {
links . setId ( e . id ( ) ) ;
links . setId ( e . id ( ) ) ;
links . setSource ( e . startNodeId ( ) ) ;
links . setSource ( e . startNodeId ( ) ) ;
links . setTarget ( e . endNodeId ( ) ) ;
links . setTarget ( e . endNodeId ( ) ) ;
links . setLabel ( e . type ( ) ) ;
if ( "contain" . equals ( e . type ( ) ) ) {
links . setLabel ( "包含" ) ;
} else if ( "order" . equals ( e . type ( ) ) ) {
links . setLabel ( "顺序" ) ;
}
linksList . add ( links ) ;
linksList . add ( links ) ;
}
}
}
}
BaseKnowReturn baseKnowReturn = new BaseKnowReturn ( knowList , linksList ) ;
BaseKnowReturn baseKnowReturn = new BaseKnowReturn ( knowList , linksList ) ;
return ResultUtils . success ( baseKnowReturn ) ;
return ResultUtils . success ( baseKnowReturn ) ;
}
}
@ -326,7 +864,7 @@ public class knowServiceImpl implements KnowService {
@Override
@Override
public BaseResponse < Set < KnowVO1 > > getAllResourcesByCourseId ( String id ) {
public BaseResponse < Set < KnowVO1 > > getAllResourcesByCourseId ( String id ) {
Collection < Map < String , Object > > all =
Collection < Map < String , Object > > all =
neo4jClient . query ( "match(n:Know)-[r*0..]->(p:Know) where n.courseId = '" + id + "' return p as `p`" ) . fetch ( ) . all ( ) ;
neo4jClient . query ( "match(n:Know)-[r*0..]->(p:Know) where n.courseId = '" + id + "' return p as `p`" ) . fetch ( ) . all ( ) ;
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Set < KnowVO1 > knowList = new HashSet < > ( ) ;
Set < KnowVO1 > knowList = new HashSet < > ( ) ;
KnowVO1 knowVO ;
KnowVO1 knowVO ;
@ -344,5 +882,4 @@ public class knowServiceImpl implements KnowService {
}
}
}
}