临时提交
parent
33d0f8b1d1
commit
849277cc01
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.task;
|
||||
|
||||
import com.ruoyi.biemo.business.domain.DocInfo;
|
||||
import com.ruoyi.biemo.business.service.DocInfoService;
|
||||
import com.ruoyi.biemo.mongodb.bean.Page;
|
||||
import com.ruoyi.biemo.mongodb.utils.CriteriaAndWrapper;
|
||||
import com.ruoyi.biemo.mongodb.utils.MongoHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@Component("syncData")
|
||||
public class SyncData {
|
||||
@Autowired
|
||||
MongoHelper mongoHelper;
|
||||
@Autowired
|
||||
DocInfoService docInfoService;
|
||||
|
||||
public void mongoToEs(){
|
||||
Page<DocInfo> page = new Page();
|
||||
Page<DocInfo> pageInfo = mongoHelper.findPage(new CriteriaAndWrapper().eq(DocInfo::getIsSync,0),page, DocInfo.class);
|
||||
List<DocInfo> docInfos = pageInfo.getList();
|
||||
if(docInfos!=null&& docInfos.size()>0){
|
||||
docInfos.forEach(docInfo -> {
|
||||
docInfo.setCreatedBy(1L);
|
||||
docInfo.setUpdatedBy(1L);
|
||||
docInfoService.insertEs(docInfo);
|
||||
docInfo.setIsSync(1);
|
||||
docInfoService.insertOrUpdateDocInfo(docInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.ruoyi.biemo.elasticsearch.config;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestClientBuilder;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class EsRestClientConfiguration {
|
||||
/** 协议 */
|
||||
@Value("${elasticsearch.schema:http}")
|
||||
private String schema;
|
||||
|
||||
/** 集群地址,如果有多个用“,”隔开 */
|
||||
@Value("${elasticsearch.address}")
|
||||
private String address;
|
||||
|
||||
/** 连接超时时间 */
|
||||
@Value("${elasticsearch.connectTimeout}")
|
||||
private int connectTimeout;
|
||||
|
||||
/** Socket 连接超时时间 */
|
||||
@Value("${elasticsearch.socketTimeout}")
|
||||
private int socketTimeout;
|
||||
|
||||
/** 获取连接的超时时间 */
|
||||
@Value("${elasticsearch.connectionRequestTimeout}")
|
||||
private int connectionRequestTimeout;
|
||||
|
||||
/** 最大连接数 */
|
||||
@Value("${elasticsearch.maxConnectNum}")
|
||||
private int maxConnectNum;
|
||||
|
||||
/** 最大路由连接数 */
|
||||
@Value("${elasticsearch.maxConnectPerRoute}")
|
||||
private int maxConnectPerRoute;
|
||||
|
||||
@Bean(name = "restHighLevelClient")
|
||||
public RestHighLevelClient restHighLevelClient(){
|
||||
List<HttpHost> hostList = new ArrayList<>();
|
||||
String[] addressArray = address.split(",");
|
||||
for (String address : addressArray) {
|
||||
String host = address.split(":")[0];
|
||||
Integer port = Integer.parseInt(address.split(":")[1]);
|
||||
hostList.add(new HttpHost(host, port, schema));
|
||||
}
|
||||
|
||||
HttpHost[] httpPosts = hostList.toArray(new HttpHost[]{});
|
||||
RestClientBuilder builder = RestClient.builder(httpPosts);
|
||||
|
||||
// 异步连接延时配置
|
||||
builder.setRequestConfigCallback(requestConfigBuilder -> {
|
||||
requestConfigBuilder.setConnectTimeout(connectTimeout);
|
||||
requestConfigBuilder.setSocketTimeout(socketTimeout);
|
||||
requestConfigBuilder.setConnectionRequestTimeout(connectionRequestTimeout);
|
||||
return requestConfigBuilder;
|
||||
});
|
||||
|
||||
// 异步连接数配置
|
||||
builder.setHttpClientConfigCallback(httpClientBuilder -> {
|
||||
httpClientBuilder.setMaxConnTotal(maxConnectNum);
|
||||
httpClientBuilder.setMaxConnPerRoute(maxConnectPerRoute);
|
||||
return httpClientBuilder;
|
||||
});
|
||||
|
||||
return new RestHighLevelClient(builder);
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
* {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
body {
|
||||
font: 13px 'Helvetica Neue',Helvetica,Arial,sans-serif;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.neo4jd3-graph {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.neo4jd3-info {
|
||||
font-size: 16px;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
}
|
||||
.neo4jd3-info a {
|
||||
border: 1px solid;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 1.428571429;
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
.neo4jd3-info a.class {
|
||||
color: white;
|
||||
}
|
||||
.neo4jd3-info a.property {
|
||||
background-color: #fff;
|
||||
border-color: #ccc;
|
||||
color: #333;
|
||||
}
|
||||
.neo4jd3-info a.btn {
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
opacity: 1;
|
||||
}
|
||||
.neo4jd3-info a.info {
|
||||
background-color: #a5abb6;
|
||||
border: 1px solid #9aa1ac;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.node.node-highlighted .ring {
|
||||
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)';
|
||||
filter: alpha(opacity=50);
|
||||
opacity: .5;
|
||||
stroke: #888;
|
||||
stroke-width: 12px;
|
||||
}
|
||||
.node .outline {
|
||||
cursor: pointer;
|
||||
fill: #a5abb6;
|
||||
pointer-events: all;
|
||||
stroke: #9aa1ac;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
.node .ring {
|
||||
fill: none;
|
||||
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
stroke: #6ac6ff;
|
||||
stroke-width: 8px;
|
||||
}
|
||||
.node .text.icon {
|
||||
font-family: FontAwesome;
|
||||
}
|
||||
|
||||
.node.selected .ring,
|
||||
.node:hover .ring {
|
||||
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=30)';
|
||||
filter: alpha(opacity=30);
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
.relationship {
|
||||
cursor: default;
|
||||
}
|
||||
.relationship line {
|
||||
stroke: #aaa;
|
||||
}
|
||||
.relationship .outline {
|
||||
cursor: default;
|
||||
}
|
||||
.relationship .overlay {
|
||||
cursor: default;
|
||||
fill: #6ac6ff;
|
||||
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
}
|
||||
.relationship text {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.relationship.selected .overlay,
|
||||
.relationship:hover .overlay {
|
||||
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=30)';
|
||||
filter: alpha(opacity=30);
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
svg {
|
||||
cursor: move;
|
||||
}
|
@ -0,0 +1 @@
|
||||
*{margin:0;padding:0}body{font:13px Helvetica Neue,Helvetica,Arial,sans-serif;font-size:20px}.neo4jd3-graph{border:1px solid #ddd;border-radius:5px}.neo4jd3-info{font-size:16px;padding:10px;position:absolute}.neo4jd3-info a{border:1px solid;display:inline-block;font-size:14px;line-height:1.428571429;margin-left:5px;margin-top:5px;padding:6px 12px}.neo4jd3-info a.class{color:#fff}.neo4jd3-info a.property{background-color:#fff;border-color:#ccc;color:#333}.neo4jd3-info a.btn{margin-left:5px;margin-top:5px;opacity:1}.neo4jd3-info a.info{background-color:#a5abb6;border:1px solid #9aa1ac;color:#fff}.node.node-highlighted .ring{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter:alpha(opacity=50);opacity:.5;stroke:#888;stroke-width:12px}.node .outline{cursor:pointer;fill:#a5abb6;pointer-events:all;stroke:#9aa1ac;stroke-width:2px}.node .ring{fill:none;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;stroke:#6ac6ff;stroke-width:8px}.node .text.icon{font-family:FontAwesome}.node.selected .ring,.node:hover .ring{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";filter:alpha(opacity=30);opacity:.3}.relationship{cursor:default}.relationship line{stroke:#aaa}.relationship .outline{cursor:default}.relationship .overlay{cursor:default;fill:#6ac6ff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0}.relationship text{cursor:default}.relationship.selected .overlay,.relationship:hover .overlay{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";filter:alpha(opacity=30);opacity:.3}svg{cursor:move}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1,138 @@
|
||||
图谱浏览
|
||||
<template>
|
||||
<div id="neo4jd3"></div>
|
||||
</template>
|
||||
<script>
|
||||
import { getDocInfo } from "@/api/biemo/docInfo";
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
docInfo: {},
|
||||
isOpen: true
|
||||
}
|
||||
},
|
||||
props: ["id"],
|
||||
created(){
|
||||
this.getDocInfoById(this.id);
|
||||
this.init();
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
getDocInfoById(id){
|
||||
getDocInfo(id).then(response=>{
|
||||
this.docInfo = response.data;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
var neo4jd3 = new Neo4jd3('#neo4jd3', {
|
||||
highlight: [
|
||||
{
|
||||
class: 'Project',
|
||||
property: 'name',
|
||||
value: 'neo4jd3'
|
||||
}, {
|
||||
class: 'User',
|
||||
property: 'userId',
|
||||
value: 'eisman'
|
||||
}
|
||||
],
|
||||
icons: {
|
||||
// 'Address': 'home',
|
||||
'Api': 'gear',
|
||||
// 'BirthDate': 'birthday-cake',
|
||||
'Cookie': 'paw',
|
||||
// 'CreditCard': 'credit-card',
|
||||
// 'Device': 'laptop',
|
||||
'Email': 'at',
|
||||
'Git': 'git',
|
||||
'Github': 'github',
|
||||
'Google': 'google',
|
||||
// 'icons': 'font-awesome',
|
||||
'Ip': 'map-marker',
|
||||
'Issues': 'exclamation-circle',
|
||||
'Language': 'language',
|
||||
'Options': 'sliders',
|
||||
'Password': 'lock',
|
||||
'Phone': 'phone',
|
||||
'Project': 'folder-open',
|
||||
'SecurityChallengeAnswer': 'commenting',
|
||||
'User': 'user',
|
||||
'zoomFit': 'arrows-alt',
|
||||
'zoomIn': 'search-plus',
|
||||
'zoomOut': 'search-minus'
|
||||
},
|
||||
images: {
|
||||
'Address': 'img/twemoji/1f3e0.svg',
|
||||
// 'Api': 'img/twemoji/1f527.svg',
|
||||
'BirthDate': 'img/twemoji/1f382.svg',
|
||||
'Cookie': 'img/twemoji/1f36a.svg',
|
||||
'CreditCard': 'img/twemoji/1f4b3.svg',
|
||||
'Device': 'img/twemoji/1f4bb.svg',
|
||||
'Email': 'img/twemoji/2709.svg',
|
||||
'Git': 'img/twemoji/1f5c3.svg',
|
||||
'Github': 'img/twemoji/1f5c4.svg',
|
||||
'icons': 'img/twemoji/1f38f.svg',
|
||||
'Ip': 'img/twemoji/1f4cd.svg',
|
||||
'Issues': 'img/twemoji/1f4a9.svg',
|
||||
'Language': 'img/twemoji/1f1f1-1f1f7.svg',
|
||||
'Options': 'img/twemoji/2699.svg',
|
||||
'Password': 'img/twemoji/1f511.svg',
|
||||
// 'Phone': 'img/twemoji/1f4de.svg',
|
||||
'Project': 'img/twemoji/2198.svg',
|
||||
'Project|name|neo4jd3': 'img/twemoji/2196.svg',
|
||||
// 'SecurityChallengeAnswer': 'img/twemoji/1f4ac.svg',
|
||||
'User': 'img/twemoji/1f600.svg'
|
||||
// 'zoomFit': 'img/twemoji/2194.svg',
|
||||
// 'zoomIn': 'img/twemoji/1f50d.svg',
|
||||
// 'zoomOut': 'img/twemoji/1f50e.svg'
|
||||
},
|
||||
minCollision: 60,
|
||||
neo4jDataUrl: 'json/neo4jData.json',
|
||||
nodeRadius: 25,
|
||||
onNodeDoubleClick: function(node) {
|
||||
switch(node.id) {
|
||||
case '25':
|
||||
// Google
|
||||
window.open(node.properties.url, '_blank');
|
||||
break;
|
||||
default:
|
||||
var maxNodes = 5,
|
||||
data = neo4jd3.randomD3Data(node, maxNodes);
|
||||
neo4jd3.updateWithD3Data(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
onRelationshipDoubleClick: function(relationship) {
|
||||
console.log('double click on relationship: ' + JSON.stringify(relationship));
|
||||
},
|
||||
zoomFit: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.newsinfo-container {
|
||||
padding: 0 4px;
|
||||
.title {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
margin: 15px 0;
|
||||
color: #000000;
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 16px;
|
||||
color: #090909;
|
||||
display: flex;
|
||||
justify-content: center ;
|
||||
}
|
||||
.content {
|
||||
width: 100%;
|
||||
justify-content: center ;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue