Browse Source

yangshi

small-tupu
菅振宇 7 months ago
parent
commit
57cbcffc89
  1. 21
      gyxtp/src/view/graphPageCopy.vue
  2. 6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java
  3. 84
      ruoyi-api/src/main/java/com/ruoyi/api/controller/EsTestController.java

21
gyxtp/src/view/graphPageCopy.vue

@ -531,33 +531,40 @@ export default {
},
getNodeClass(name) {
console.log(name)
// console.log(name)
// this.heightLight.nodes
const nodes = this.heightLight.nodes;
const nodes1 = this.heightLight.nodes1;
if (!Array.isArray(nodes) || nodes.length === 0||!Array.isArray(nodes1) || nodes1.length === 0) {
if (nodes==undefined){
return "";
}
if (nodes.length === 0&&nodes1.length === 0) {
return "";
}
console.log(name)
// id
const targetId = String(name).trim();
console.log(targetId)
// nodes id targetId
let found = nodes.some(node => {
const nodeId = node.sourceAsMap.abstracts
return nodeId === targetId;
});
found = nodes1.some(node => {
let found2 = nodes1.some(node => {
console.log("2222222")
const nodeId = node.docTitle
return nodeId === targetId;
});
found = found || found2
// 'nodeclass' ''
return found ? 'nodeclass' : '';
},
getLinesClass(id) {
const lines = this.heightLight.links;
console.log(this.heightLight)
if (lines == undefined){
return ""
}
@ -1001,7 +1008,7 @@ export default {
}
});
});
console.log(lineList)
// 线
lineList.forEach(line => {
let style=""
@ -1010,8 +1017,6 @@ export default {
style=this.getLinesClass(line.DbId)
num=10
}
console.log(line)
links.push({
from: line.source,
to: line.target,

6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java

@ -1185,8 +1185,14 @@ public class ZhyFileManageController extends BaseController {
.addField("abstracts")
.addField("data")
.build();
try {
elasticSearchUtil.createIndex("nodes",mappings);
elasticSearchUtil.createIndex("links",mappings);
}catch (Exception e){
}
List<ESDao> esDaos=new ArrayList<>();
List<ESDao> esDaos1=new ArrayList<>();
for (int i=0;i<list.size();i++){

84
ruoyi-api/src/main/java/com/ruoyi/api/controller/EsTestController.java

@ -149,48 +149,48 @@ public class EsTestController {
.build();
elasticSearchUtil.createIndex("nodes",mappings);
elasticSearchUtil.createIndex("links",mappings);
List<ESDao> bookList = new ArrayList<>();
List<ZhyDocApi> docList = zhyDocApiMapper.selectAllDoc1();
for (int i=0;i<docList.size();i++){
String abstracts = docList.get(i).getDocTitle();
String id = String.valueOf(docList.get(i).getId());
ESDao esDao = new ESDao();
esDao.id = id;
esDao.DBid = id;
esDao.type = "node";
esDao.abstracts = abstracts;
esDao.data = null;
bookList.add(esDao);
}
elasticSearchUtil.addDocBatch("nodes", bookList, ESDao.class, "id");
List<ESDao> bookList2 = new ArrayList<>();
ZhyArticle zhyArticle = new ZhyArticle();
List<ZhyArticle> lineList = zhyArticleMapper.selectZhyArticleList(zhyArticle);
for (int i=0;i<lineList.size();i++){
String abstracts = lineList.get(i).getName()+lineList.get(i).getKeywords()+lineList.get(i).getSummary();
System.out.println(abstracts);
String id = String.valueOf(lineList.get(i).getId());
ZhyDocRelation zhyDocRelation = new ZhyDocRelation();
zhyDocRelation.setArticleId(lineList.get(i).getId());
List<Map> a = zhyDocRelationMapper.selectZhyRelationshipArticle(zhyDocRelation);
List<String> ids = new ArrayList<>();
for (int j = 0;j<a.size();j++){
ids.add(String.valueOf(a.get(j).get("id")));
}
ESDao esDao = new ESDao();
esDao.id = id;
esDao.DBid = id;
esDao.type = "line";
esDao.abstracts = abstracts;
esDao.data = ids.toString();
bookList2.add(esDao);
System.out.println(bookList2);
}
elasticSearchUtil.addDocBatch("links", bookList2, ESDao.class, "id");
//
// List<ESDao> bookList = new ArrayList<>();
//
// List<ZhyDocApi> docList = zhyDocApiMapper.selectAllDoc1();
// for (int i=0;i<docList.size();i++){
// String abstracts = docList.get(i).getDocTitle();
// String id = String.valueOf(docList.get(i).getId());
//
// ESDao esDao = new ESDao();
// esDao.id = id;
// esDao.DBid = id;
// esDao.type = "node";
// esDao.abstracts = abstracts;
// esDao.data = null;
// bookList.add(esDao);
// }
// elasticSearchUtil.addDocBatch("nodes", bookList, ESDao.class, "id");
//
// List<ESDao> bookList2 = new ArrayList<>();
// ZhyArticle zhyArticle = new ZhyArticle();
// List<ZhyArticle> lineList = zhyArticleMapper.selectZhyArticleList(zhyArticle);
// for (int i=0;i<lineList.size();i++){
// String abstracts = lineList.get(i).getName()+lineList.get(i).getKeywords()+lineList.get(i).getSummary();
// System.out.println(abstracts);
// String id = String.valueOf(lineList.get(i).getId());
// ZhyDocRelation zhyDocRelation = new ZhyDocRelation();
// zhyDocRelation.setArticleId(lineList.get(i).getId());
// List<Map> a = zhyDocRelationMapper.selectZhyRelationshipArticle(zhyDocRelation);
// List<String> ids = new ArrayList<>();
// for (int j = 0;j<a.size();j++){
// ids.add(String.valueOf(a.get(j).get("id")));
// }
// ESDao esDao = new ESDao();
// esDao.id = id;
// esDao.DBid = id;
// esDao.type = "line";
// esDao.abstracts = abstracts;
// esDao.data = ids.toString();
// bookList2.add(esDao);
// System.out.println(bookList2);
// }
// elasticSearchUtil.addDocBatch("links", bookList2, ESDao.class, "id");
return null;
}

Loading…
Cancel
Save