|
|
@ -3,6 +3,9 @@ package com.ruoyi.web.controller.system; |
|
|
import com.alibaba.fastjson2.JSON; |
|
|
import com.alibaba.fastjson2.JSON; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.ruoyi.TxtFileReader; |
|
|
import com.ruoyi.TxtFileReader; |
|
|
|
|
|
import com.ruoyi.api.ElasticsearchUtils.builders.ESCreateBuilder; |
|
|
|
|
|
import com.ruoyi.api.ElasticsearchUtils.builders.Mappings; |
|
|
|
|
|
import com.ruoyi.api.ElasticsearchUtils.impl.ElasticSearchUtilImpl; |
|
|
import com.ruoyi.api.domain.ESDao; |
|
|
import com.ruoyi.api.domain.ESDao; |
|
|
import com.ruoyi.api.domain.ZhyDocApi; |
|
|
import com.ruoyi.api.domain.ZhyDocApi; |
|
|
import com.ruoyi.api.service.impl.ESService; |
|
|
import com.ruoyi.api.service.impl.ESService; |
|
|
@ -99,6 +102,9 @@ public class ZhyFileManageController extends BaseController { |
|
|
ZhyDocmubanMapper zhyDocmubanMapper; |
|
|
ZhyDocmubanMapper zhyDocmubanMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
ESService esService; |
|
|
ESService esService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
ElasticSearchUtilImpl elasticSearchUtil; |
|
|
|
|
|
|
|
|
@PostMapping("/exportList") |
|
|
@PostMapping("/exportList") |
|
|
public void export(HttpServletResponse response) |
|
|
public void export(HttpServletResponse response) |
|
|
{ |
|
|
{ |
|
|
@ -1172,8 +1178,17 @@ public class ZhyFileManageController extends BaseController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//创建索引
|
|
|
//创建索引
|
|
|
|
|
|
Mappings mappings = new ESCreateBuilder.Builder() |
|
|
|
|
|
.addField("id") |
|
|
|
|
|
.addField("DBid") |
|
|
|
|
|
.addField("type") |
|
|
|
|
|
.addField("abstracts") |
|
|
|
|
|
.addField("data") |
|
|
|
|
|
.build(); |
|
|
|
|
|
elasticSearchUtil.createIndex("nodes",mappings); |
|
|
|
|
|
elasticSearchUtil.createIndex("links",mappings); |
|
|
List<ESDao> esDaos=new ArrayList<>(); |
|
|
List<ESDao> esDaos=new ArrayList<>(); |
|
|
|
|
|
List<ESDao> esDaos1=new ArrayList<>(); |
|
|
for (int i=0;i<list.size();i++){ |
|
|
for (int i=0;i<list.size();i++){ |
|
|
String abstracts = list.get(i).getDocTitle(); |
|
|
String abstracts = list.get(i).getDocTitle(); |
|
|
String id = String.valueOf(list.get(i).getId()); |
|
|
String id = String.valueOf(list.get(i).getId()); |
|
|
@ -1187,6 +1202,7 @@ public class ZhyFileManageController extends BaseController { |
|
|
esDaos.add(esDao); |
|
|
esDaos.add(esDao); |
|
|
} |
|
|
} |
|
|
esService.insertDocsById("nodes",esDaos); |
|
|
esService.insertDocsById("nodes",esDaos); |
|
|
|
|
|
|
|
|
//获取所有关系
|
|
|
//获取所有关系
|
|
|
List<ZhyDocRelation> listR = zhyDocRelationMapper.getAllRelation(); |
|
|
List<ZhyDocRelation> listR = zhyDocRelationMapper.getAllRelation(); |
|
|
|
|
|
|
|
|
|