@ -113,7 +113,7 @@ public class knowServiceImpl implements KnowService {
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
// knowVO.setColor(colorChoose.get(group));
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
@ -168,8 +168,8 @@ public class knowServiceImpl implements KnowService {
knowVO = new KnowVO ( ) ;
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
// Long group = (Long) element.get("d");
// knowVO.setColor(colorChoose.get(group));
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
@ -225,7 +225,7 @@ public class knowServiceImpl implements KnowService {
Node node1 = ( Node ) element . get ( "p" ) ;
Long group = ( Long ) element . get ( "d" ) ;
knowVO . setColor ( colorChoose . get ( group ) ) ;
// knowVO.setColor(colorChoose.get(group));
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
@ -748,7 +748,10 @@ public class knowServiceImpl implements KnowService {
@Override
public BaseResponse < BaseKnowReturn > getAllKnowByCourseId ( String id ) {
Collection < Map < String , Object > > 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 ( ) ;
neo4jClient . query ( "match(n:Know)-[r:contain*0..]->(p:Know) where n.courseId = '" + id + "' return n as `n`,r as `r`,p as `p`,length(r) as `d`" ) . fetch ( ) . all ( ) ;
Collection < Map < String , Object > > all2 =
neo4jClient . query ( "match(n:Know)-[r*]->(p:Know) where n.courseId = '" + id + "' return r as `r`" ) . fetch ( ) . all ( ) ;
Map < Long , String > colorChoose = new HashMap < > ( ) ;
String color [ ] = new String [ 10 ] ;
@ -758,6 +761,7 @@ public class knowServiceImpl implements KnowService {
}
Iterator < Map < String , Object > > iterator = all . iterator ( ) ;
Iterator < Map < String , Object > > iterator2 = all2 . iterator ( ) ;
Set < KnowVO > knowList = new HashSet < > ( ) ;
Set < Links > linksList = new HashSet < > ( ) ;
KnowVO knowVO ;
@ -768,9 +772,8 @@ public class knowServiceImpl implements KnowService {
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));
knowVO . setColor ( colorChoose . get ( group ) ) ;
if ( node1 ! = null ) {
Long id1 = node1 . id ( ) ;
String name1 = node1 . get ( "name" ) . asString ( ) ;
@ -778,9 +781,29 @@ public class knowServiceImpl implements KnowService {
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 ) ;
}
}
}
while ( iterator2 . hasNext ( ) ) {
Map < String , Object > element = iterator2 . next ( ) ;
node2 = ( List ) element . get ( "r" ) ;
if ( ! node2 . isEmpty ( ) ) {
for ( int i = 0 ; i < node2 . size ( ) ; i + + ) {