Browse Source

yangshi

small-tupu
菅振宇 7 months ago
parent
commit
57cbcffc89
  1. 21
      gyxtp/src/view/graphPageCopy.vue
  2. 10
      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) { getNodeClass(name) {
console.log(name) // console.log(name)
// this.heightLight.nodes // this.heightLight.nodes
const nodes = this.heightLight.nodes; const nodes = this.heightLight.nodes;
const nodes1 = this.heightLight.nodes1; const nodes1 = this.heightLight.nodes1;
if (!Array.isArray(nodes) || nodes.length === 0||!Array.isArray(nodes1) || nodes1.length === 0) { if (nodes==undefined){
return ""; return "";
} }
if (nodes.length === 0&&nodes1.length === 0) {
return "";
}
console.log(name)
// id // id
const targetId = String(name).trim(); const targetId = String(name).trim();
console.log(targetId)
// nodes id targetId // nodes id targetId
let found = nodes.some(node => { let found = nodes.some(node => {
const nodeId = node.sourceAsMap.abstracts const nodeId = node.sourceAsMap.abstracts
return nodeId === targetId; return nodeId === targetId;
}); });
found = nodes1.some(node => { let found2 = nodes1.some(node => {
console.log("2222222") console.log("2222222")
const nodeId = node.docTitle const nodeId = node.docTitle
return nodeId === targetId; return nodeId === targetId;
}); });
found = found || found2
// 'nodeclass' '' // 'nodeclass' ''
return found ? 'nodeclass' : ''; return found ? 'nodeclass' : '';
}, },
getLinesClass(id) { getLinesClass(id) {
const lines = this.heightLight.links; const lines = this.heightLight.links;
console.log(this.heightLight)
if (lines == undefined){ if (lines == undefined){
return "" return ""
} }
@ -1001,7 +1008,7 @@ export default {
} }
}); });
}); });
console.log(lineList)
// 线 // 线
lineList.forEach(line => { lineList.forEach(line => {
let style="" let style=""
@ -1010,8 +1017,6 @@ export default {
style=this.getLinesClass(line.DbId) style=this.getLinesClass(line.DbId)
num=10 num=10
} }
console.log(line)
links.push({ links.push({
from: line.source, from: line.source,
to: line.target, to: line.target,

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

@ -1185,8 +1185,14 @@ public class ZhyFileManageController extends BaseController {
.addField("abstracts") .addField("abstracts")
.addField("data") .addField("data")
.build(); .build();
elasticSearchUtil.createIndex("nodes",mappings);
elasticSearchUtil.createIndex("links",mappings); try {
elasticSearchUtil.createIndex("nodes",mappings);
elasticSearchUtil.createIndex("links",mappings);
}catch (Exception e){
}
List<ESDao> esDaos=new ArrayList<>(); List<ESDao> esDaos=new ArrayList<>();
List<ESDao> esDaos1=new ArrayList<>(); List<ESDao> esDaos1=new ArrayList<>();
for (int i=0;i<list.size();i++){ 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(); .build();
elasticSearchUtil.createIndex("nodes",mappings); elasticSearchUtil.createIndex("nodes",mappings);
elasticSearchUtil.createIndex("links",mappings); elasticSearchUtil.createIndex("links",mappings);
//
List<ESDao> bookList = new ArrayList<>(); // List<ESDao> bookList = new ArrayList<>();
//
List<ZhyDocApi> docList = zhyDocApiMapper.selectAllDoc1(); // List<ZhyDocApi> docList = zhyDocApiMapper.selectAllDoc1();
for (int i=0;i<docList.size();i++){ // for (int i=0;i<docList.size();i++){
String abstracts = docList.get(i).getDocTitle(); // String abstracts = docList.get(i).getDocTitle();
String id = String.valueOf(docList.get(i).getId()); // String id = String.valueOf(docList.get(i).getId());
//
ESDao esDao = new ESDao(); // ESDao esDao = new ESDao();
esDao.id = id; // esDao.id = id;
esDao.DBid = id; // esDao.DBid = id;
esDao.type = "node"; // esDao.type = "node";
esDao.abstracts = abstracts; // esDao.abstracts = abstracts;
esDao.data = null; // esDao.data = null;
bookList.add(esDao); // bookList.add(esDao);
} // }
elasticSearchUtil.addDocBatch("nodes", bookList, ESDao.class, "id"); // elasticSearchUtil.addDocBatch("nodes", bookList, ESDao.class, "id");
//
List<ESDao> bookList2 = new ArrayList<>(); // List<ESDao> bookList2 = new ArrayList<>();
ZhyArticle zhyArticle = new ZhyArticle(); // ZhyArticle zhyArticle = new ZhyArticle();
List<ZhyArticle> lineList = zhyArticleMapper.selectZhyArticleList(zhyArticle); // List<ZhyArticle> lineList = zhyArticleMapper.selectZhyArticleList(zhyArticle);
for (int i=0;i<lineList.size();i++){ // for (int i=0;i<lineList.size();i++){
String abstracts = lineList.get(i).getName()+lineList.get(i).getKeywords()+lineList.get(i).getSummary(); // String abstracts = lineList.get(i).getName()+lineList.get(i).getKeywords()+lineList.get(i).getSummary();
System.out.println(abstracts); // System.out.println(abstracts);
String id = String.valueOf(lineList.get(i).getId()); // String id = String.valueOf(lineList.get(i).getId());
ZhyDocRelation zhyDocRelation = new ZhyDocRelation(); // ZhyDocRelation zhyDocRelation = new ZhyDocRelation();
zhyDocRelation.setArticleId(lineList.get(i).getId()); // zhyDocRelation.setArticleId(lineList.get(i).getId());
List<Map> a = zhyDocRelationMapper.selectZhyRelationshipArticle(zhyDocRelation); // List<Map> a = zhyDocRelationMapper.selectZhyRelationshipArticle(zhyDocRelation);
List<String> ids = new ArrayList<>(); // List<String> ids = new ArrayList<>();
for (int j = 0;j<a.size();j++){ // for (int j = 0;j<a.size();j++){
ids.add(String.valueOf(a.get(j).get("id"))); // ids.add(String.valueOf(a.get(j).get("id")));
} // }
ESDao esDao = new ESDao(); // ESDao esDao = new ESDao();
esDao.id = id; // esDao.id = id;
esDao.DBid = id; // esDao.DBid = id;
esDao.type = "line"; // esDao.type = "line";
esDao.abstracts = abstracts; // esDao.abstracts = abstracts;
esDao.data = ids.toString(); // esDao.data = ids.toString();
bookList2.add(esDao); // bookList2.add(esDao);
System.out.println(bookList2); // System.out.println(bookList2);
} // }
elasticSearchUtil.addDocBatch("links", bookList2, ESDao.class, "id"); // elasticSearchUtil.addDocBatch("links", bookList2, ESDao.class, "id");
return null; return null;
} }

Loading…
Cancel
Save