youhang20021127 5 months ago
parent b0470ad9f5
commit 125ee55ffa
  1. 2
      src/main/java/com/teaching/backend/model/vo/knowGraph/KnowVO.java
  2. 37
      src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java
  3. 6
      src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java
  4. BIN
      tempFile/19854ab3-b8bc-4660-bb40-b4ee6184cd30/1.组织学绪论.ppt
  5. BIN
      tempFile/2b9dae36-8ef9-45b0-b720-08ba444ba741/上皮组织作业.doc

@ -21,7 +21,7 @@ public class KnowVO implements Serializable {
private String label; private String label;
/** /**
* 信息 * color
*/ */
private String color; private String color;

@ -113,7 +113,7 @@ 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));
Long id1 = node1.id(); Long id1 = node1.id();
String name1 = node1.get("name").asString(); String name1 = node1.get("name").asString();
@ -168,8 +168,8 @@ public class knowServiceImpl implements KnowService {
knowVO = new KnowVO(); knowVO = new KnowVO();
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));
Long id1 = node1.id(); Long id1 = node1.id();
String name1 = node1.get("name").asString(); String name1 = node1.get("name").asString();
@ -225,7 +225,7 @@ 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));
Long id1 = node1.id(); Long id1 = node1.id();
String name1 = node1.get("name").asString(); String name1 = node1.get("name").asString();
@ -748,7 +748,10 @@ 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: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<>(); Map<Long, String> colorChoose = new HashMap<>();
String color[] = new String[10]; 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>> iterator = all.iterator();
Iterator<Map<String, Object>> iterator2 = all2.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;
@ -768,9 +772,8 @@ public class knowServiceImpl implements KnowService {
Map<String, Object> element = iterator.next(); Map<String, Object> element = iterator.next();
knowVO = new KnowVO(); knowVO = new KnowVO();
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) { if (node1 != null) {
Long id1 = node1.id(); Long id1 = node1.id();
String name1 = node1.get("name").asString(); String name1 = node1.get("name").asString();
@ -778,9 +781,29 @@ public class knowServiceImpl implements KnowService {
knowVO.setLabel(name1); knowVO.setLabel(name1);
knowList.add(knowVO); knowList.add(knowVO);
knowVO.setColor(colorChoose.get(group)); 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"); node2 = (List) element.get("r");
if (!node2.isEmpty()) { if (!node2.isEmpty()) {
for (int i = 0; i < node2.size(); i++) { for (int i = 0; i < node2.size(); i++) {

@ -168,7 +168,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
knowVO = new KnowVO(); knowVO = new KnowVO();
knowVO.setId(knowledge.getData().getId()); knowVO.setId(knowledge.getData().getId());
knowVO.setLabel(knowledge.getData().getName()); knowVO.setLabel(knowledge.getData().getName());
knowVO.setColor(knowledge.getData().getInfo()); // knowVO.setColor(knowledge.getData().getInfo());
coursesList.add(knowVO); coursesList.add(knowVO);
} }
} }
@ -182,7 +182,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
knowVO = new KnowVO(); knowVO = new KnowVO();
knowVO.setId(knowledge.getData().getId()); knowVO.setId(knowledge.getData().getId());
knowVO.setLabel(knowledge.getData().getName()); knowVO.setLabel(knowledge.getData().getName());
knowVO.setColor(knowledge.getData().getInfo()); // knowVO.setColor(knowledge.getData().getInfo());
coursesList.add(knowVO); coursesList.add(knowVO);
} }
} }
@ -206,7 +206,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
knowVO = new KnowVO(); knowVO = new KnowVO();
knowVO.setId(knowledge.getData().getId()); knowVO.setId(knowledge.getData().getId());
knowVO.setLabel(knowledge.getData().getName()); knowVO.setLabel(knowledge.getData().getName());
knowVO.setColor(knowledge.getData().getInfo()); // knowVO.setColor(knowledge.getData().getInfo());
coursesList.add(knowVO); coursesList.add(knowVO);
} }
} }

Loading…
Cancel
Save