Browse Source

图谱中删除实体

zxm
zhangxiaomeng 1 year ago
parent
commit
3bd8927bea
  1. 13
      kcui/src/api/baogao.js
  2. BIN
      kcui/src/assets/img/Inicon.png
  3. BIN
      kcui/src/assets/img/baoGaobg.png
  4. BIN
      kcui/src/assets/img/exportIn.png
  5. BIN
      kcui/src/assets/img/headLogin.png
  6. BIN
      kcui/src/assets/img/headMulu.png
  7. BIN
      kcui/src/assets/img/shengcheng.png
  8. BIN
      kcui/src/assets/img/shengchengicon.png
  9. 4
      kcui/src/components/Editor.vue
  10. 7
      kcui/src/components/Head.vue
  11. 36
      kcui/src/components/HeadMulu.vue
  12. 172
      kcui/src/view/Graph.vue
  13. 281
      src/main/java/com/main/woka/Web/Controller/BaoGaoController.java
  14. 3
      src/main/java/com/main/woka/Web/Controller/KcTlFileController.java
  15. 9
      src/main/java/com/main/woka/Web/Service/impl/GraphServiceImpl.java
  16. 7
      src/main/java/com/main/woka/Web/Service/impl/KcTlFileServiceImpl.java
  17. 4
      src/main/resources/Mapper/KcFileMapper.xml

13
kcui/src/api/baogao.js

@ -0,0 +1,13 @@
import request from '@/utils/request';
import {getToken} from "@/utils/auth";
export function getBaoGaoInfo(params) {
return request({
url: '/baoGao/getBaoGaoInfo',
method: 'post',
data:params,
headers: {
'Authorization': 'Bearer '+ getToken() // 将 token 放在请求头中
}
})
}

BIN
kcui/src/assets/img/Inicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
kcui/src/assets/img/baoGaobg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
kcui/src/assets/img/exportIn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
kcui/src/assets/img/headLogin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
kcui/src/assets/img/headMulu.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

BIN
kcui/src/assets/img/shengcheng.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
kcui/src/assets/img/shengchengicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

4
kcui/src/components/Editor.vue

@ -196,7 +196,9 @@ export default {
// this.fileToBase64(file)
// console.log(this.fileToBase64(file))
// res.url
quill.insertEmbed(length, "image", res.url);
console.log("k------------")
console.log(res.data.url)
quill.insertEmbed(length, "image", res.data.url);
//
quill.setSelection(length + 1);
} else {

7
kcui/src/components/Head.vue

@ -1,9 +1,10 @@
<template>
<div style="width: 100%;height: 8.8%;">
<img src="../assets/img/head.png" style="width: 100%;object-fit: contain;">
<div style="width: 5vw;height: 1.5vw;background-color: #0f75d5;text-align: center;font-size: 0.9vw;color: white;
line-height: 1.5vw;position: absolute;top: 2.5vw;right: 9vw;" @click="goMulu()">目录</div>
<div style="width: 5vw;height: 1.5vw;background-color: #0f75d5;text-align: center;font-size: 0.9vw;color: white;
<div style="width: 4vw;height: 1.5vw;background-color: #3967a4;text-align: center;font-size: 0.9vw;color: white;box-shadow: 0px 0px 10px #69cbff inset;
line-height: 1.5vw;position: absolute;top: 2.5vw;right: 9vw;" @click="goMulu()">目录
</div>
<div style="width: 5vw;height: 1.5vw;background-color: #3967a4;text-align: center;font-size: 0.9vw;color: white;box-shadow: 0px 0px 10px #69cbff inset;
line-height: 1.5vw;position: absolute;top: 2.5vw;right: 2.6vw;" @click="log()">退出登录</div>
</div>

36
kcui/src/components/HeadMulu.vue

@ -0,0 +1,36 @@
<template>
<div style="width: 100%;height: 8.8%;">
<img src="../assets/img/head.png" style="width: 100%;object-fit: contain;">
<div style="width: 5vw;height: 1.5vw;background-color: #3967a4;text-align: center;font-size: 0.9vw;color: white;box-shadow: 0px 0px 10px #69cbff inset;
line-height: 1.5vw;position: absolute;top: 2.5vw;right: 2.6vw;" @click="log()">退出登录</div>
</div>
</template>
<script>
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'headMulu',
data() {
return{
}
},
methods:{
log(){
localStorage.clear();
this.$router.push('/')
},
goMulu(){
this.$router.push('/Mulu')
}
},
mounted() {
}
}
</script>
<style scoped>
</style>

172
kcui/src/view/Graph.vue

@ -144,18 +144,34 @@
</div>
</div>
<!-- <div style="width: 100%;display: flex;flex-direction: column;justify-content: space-around;">-->
<!-- <div style="margin-left: 1vw;" v-if="userType==1">-->
<!-- <el-button type="primary" plain icon="el-icon-upload2" size="mini" @click="openFileInput">导入</el-button>-->
<!-- <input-->
<!-- ref="fileInput"-->
<!-- type="file"-->
<!-- accept=".doc, .docx"-->
<!-- style="display: none;"-->
<!-- @change="handleFileChange"-->
<!-- />-->
<!-- </div>-->
<!-- </div>-->
<div style="width: 15%;display: flex;flex-direction: row;justify-content: flex-start;position: absolute;height: 1vw;right: 3vw;z-index: 4444;">
<div style="margin-left: 2vw;width: 35%;margin-top: 0.6vw;" v-if="userType==1">
<div style="height: 1.5vw;width: 4.2vw;background-color: transparent;border-radius: 1vw;display: flex;flex-direction: row;justify-content: center;padding: 0 0.1vw;border: 1px #2ed0d6 solid;" @click="openFileInput">
<img src="../assets/img/Inicon.png" style="height: 1vw;object-fit: contain;margin-top: 0.2vw;" >
<div style="line-height: 1.5vw;color: #FFFFFF;margin-left: 0.25vw;">导入</div>
</div>
<input
ref="fileInput"
type="file"
accept=".doc, .docx"
style="display: none;"
@change="handleFileChange"
/>
</div>
<div style="margin-left: 0.5vw;width: 35%;margin-top: 0.6vw;" >
<div style="height: 1.5vw;width: 5.5vw;background-color: #2ed0d6;border-radius: 1vw;display: flex;flex-direction: row;justify-content: center;padding: 0 0.1vw;border: 1px #2ed0d6 solid;" @click="shengcheng()">
<img src="../assets/img/shengchengicon.png" style="height: 1vw;object-fit: contain;margin-top: 0.2vw;" >
<div style="line-height: 1.5vw;color: #FFFFFF;margin-left: 0.25vw;">生成报告</div>
</div>
<input
ref="fileInput"
type="file"
accept=".doc, .docx"
style="display: none;"
@change="handleFileChange"
/>
</div>
</div>
<div class="rightContent">
<div class="rightList">
@ -385,19 +401,25 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeModal1"> </el-button>
<el-button type="primary" @click="editSubmit"> </el-button>
</span>
<el-button @click="closeModal1"> </el-button>
<el-button type="primary" @click="editSubmit"> </el-button>
</span>
</el-dialog>
</div>
</div>
</div>
<!-- <div @click="getInfo1"-->
<!-- style="width: 5vw;height: 1.5vw;background-color: #7ffffd;text-align: center;border-radius:1vw;line-height: 1.5vw;bottom: 1vw;position: absolute;right: 1vw;z-index: 3333;">-->
<!-- 生成报告-->
<!-- </div>-->
</div>
<!-- v-if="shengOpen"-->
<div style="width: 100%;height: 100%;position: absolute;background-color: rgba(0,0,0,0.3);z-index: 8000;top: 0vw;" v-if="shengOpen">
<div class="bgBao">
<div style="font-size: 1.2vw;font-weight: 500;width: 100%;text-align: center;">报告标题</div>
<div v-html="baoContent"></div>
</div>
</div>
<div style="width: 100%;height: 3%;position: fixed;bottom: 0px;">
<foot></foot>
</div>
@ -416,6 +438,7 @@ import {addFile, addNode, getFileIdByDocId} from "@/api/file";
import Editor from "@/components/Editor.vue";
import {getToken} from "@/utils/auth";
import {twdelete} from "@/api/twdelete";
import {getBaoGaoInfo} from "@/api/baogao";
export default {
// eslint-disable-next-line vue/multi-word-component-names
@ -540,10 +563,106 @@ export default {
editFileId: 0,
editContent: 0,
editRelation: "",
//
shengOpen:true,
baoContent:"",
}
},
methods: {
shengcheng(){
console.log("这里是生成报告的按钮")
this.shengOpen = true;
console.log(this.graphData.nodes)
//
var one = "";
var two = "";
var three = "";
var four = "";
var five = "";
var six = "";
var seven = "";
for(let a=0;a<this.graphData.nodes.length;a++){
var level = this.graphData.nodes[a].properties.leve
if(level=='1'){
if(one==""){
one = this.graphData.nodes[a].properties.docId
}else {
one = one+","+this.graphData.nodes[a].properties.docId
}
}
if(level=='2'){
if(two==""){
two = this.graphData.nodes[a].properties.docId
}else {
two = two+","+this.graphData.nodes[a].properties.docId
}
}
if(level=='3'){
if(three==""){
three = this.graphData.nodes[a].properties.docId
}else {
three = three+","+this.graphData.nodes[a].properties.docId
}
}
if(level=='4'){
if(four==""){
four = this.graphData.nodes[a].properties.docId
}else {
four = four+","+this.graphData.nodes[a].properties.docId
}
}
if(level=='5'){
if(five==""){
five = this.graphData.nodes[a].properties.docId
}else {
five = five+","+this.graphData.nodes[a].properties.docId
}
}
if(level=='6'){
if(six==""){
six = this.graphData.nodes[a].properties.docId
}else {
six = six+","+this.graphData.nodes[a].properties.docId
}
}
if(level=='7'){
if(seven==""){
seven = this.graphData.nodes[a].properties.docId
}else {
seven = seven+","+this.graphData.nodes[a].properties.docId
}
}
}
var data = {
"one":one,
"two":two,
"three":three,
"four":four,
"five":five,
"six":six,
"seven":seven
}
//
getBaoGaoInfo(data).then((res)=>{
console.log(res);
this.baoContent = res;
})
},
changeType1() {
if (this.typePic1 == 0) {
this.typePic1 = 1;
@ -1171,7 +1290,7 @@ export default {
nodes.push({
id: nodeList[a].id,
label: nodeList[a].name,
properties: {name: nodeList[a].name, docId: nodeList[a].docId, parent: allOne, leve: nodeList[a].group},
properties: {name: nodeList[a].name, docId: nodeList[a].docId, parent: allOne, leve: nodeList[a].group, type:nodeList[a].type},
...style // style
});
}
@ -1543,5 +1662,16 @@ option:hover {
background: #EBCCD1;
}
.bgBao{
width: 35vw;
height: 42vw;
border-radius: 1vw;
background-color: #FFFFFF;
position: absolute;
z-index: 5001;
left: 32%;
top: 10%;
}
</style>

281
src/main/java/com/main/woka/Web/Controller/BaoGaoController.java

@ -0,0 +1,281 @@
package com.main.woka.Web.Controller;
import com.main.woka.Web.Dao.KcInfo;
import com.main.woka.Web.Mapper.KcFileMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.*;
@RestController
@RequestMapping("/baoGao")
public class BaoGaoController extends BaseController{
@Autowired
KcFileMapper kcFileMapper;
@PostMapping(value = "/getBaoGaoInfo")
public String getBaoGaoInfo(@RequestBody Map<String,String> requestBody){
String one = requestBody.get("one");
String two = requestBody.get("two");
String three = requestBody.get("three");
String four = requestBody.get("four");
String five = requestBody.get("five");
String six = requestBody.get("six");
String seven = requestBody.get("seven");
String contentInfo = "";
if(one!=null && !one.equals("")){
if(one.contains(",")){
String[] ids = one.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(one));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
if(two!=null && !two.equals("")){
if(two.contains(",")){
String[] ids = two.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(two));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
if(three!=null && !three.equals("")){
if(three.contains(",")){
String[] ids = three.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(three));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
if(four!=null && !four.equals("")){
if(four.contains(",")){
String[] ids = four.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(four));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
if(five!=null && !five.equals("")){
if(five.contains(",")){
String[] ids = five.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(five));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
if(six!=null && !six.equals("")){
if(six.contains(",")){
String[] ids = six.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(six));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
if(seven!=null && !seven.equals("")){
if(seven.contains(",")){
String[] ids = seven.split(",");
for(int a=0;a<ids.length;a++){
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(ids[a]));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}else {
KcInfo kk = kcFileMapper.selectDocByIdId(Long.valueOf(seven));
String url = kk.getTwUrl();
File file = new File(url);
String content = txt2String(file);
if(contentInfo==""){
contentInfo = "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}else {
contentInfo = contentInfo+ "<p>"+kk.getName()+"</p>"+"<p>"+content+"</p>";
}
}
}
contentInfo = contentInfo.replaceAll("img","img style='width:60%;height:auto;object-fit: contain;'");
//一层一层查询这个关系
// if(one!=null && !one.equals("")){
// if(one.contains(",")){
// String[] ids = one.split(",");
// for()
// List<KcInfo> listone = kcFileMapper.getOneHeader(Long.valueOf(ids));
//
// }else {
//
// List<KcInfo> listone = kcFileMapper.getOneHeader(Long.valueOf(one));
//
// }
//
//
// }
return contentInfo;
}
public static String txt2String(File file) {
StringBuilder result = new StringBuilder();
try {
// 构造一个BufferedReader类来读取文件
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
// BufferedReader br = new BufferedReader(new FileReader(file));
String s = null;
// 使用readLine方法,一次读一行
while ((s = br.readLine()) != null) {
result.append(System.lineSeparator() + s);
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
}

3
src/main/java/com/main/woka/Web/Controller/KcTlFileController.java

@ -146,6 +146,9 @@ public class KcTlFileController extends BaseController {
int lastBackslashIndex = url.lastIndexOf('\\');
String pathPart = url.substring(0, lastBackslashIndex + 1);
String result = pathPart + "wordSplitter";
String txtUrl = createTxtFile(result, txtName, TxtValue);
String imgs = "";

9
src/main/java/com/main/woka/Web/Service/impl/GraphServiceImpl.java

@ -433,6 +433,7 @@ public class GraphServiceImpl implements GraphService {
aa.put("name",nno.get(a).get("name"));
aa.put("docId",nno.get(a).get("docId"));
aa.put("parentId",nno.get(a).get("parentId"));
aa.put("type",nno.get(a).get("type"));
if(nno.get(a).get("leve").equals("leve0")){
aa.put("group","0");
}
@ -494,7 +495,8 @@ public class GraphServiceImpl implements GraphService {
aa.put("id",nodeItem.get(a).get("docId"));
aa.put("name",nodeItem.get(a).get("name"));
aa.put("parentId",nodeItem.get(a).get("parentId"));
System.out.println(nodeItem.get(a).get("type"));
aa.put("type",nodeItem.get(a).get("type"));
if(nodeItem.get(a).get("leve").equals("leve0")){
aa.put("group",nodeItem.get(a).get("0"));
}
@ -531,15 +533,14 @@ public class GraphServiceImpl implements GraphService {
query.getPageSize());
List<HashMap<String, Object>> graphNode = neo4jUtil.getGraphNode(nodeSql);
List<HashMap<String, Object>> newnodeitem = new ArrayList<>();
System.out.println("09-------------00-0-0-aaaaa");
System.out.println(graphNode.get(0));
for(int a=0;a<graphNode.size();a++){
HashMap<String, Object> aa = new HashMap<>();
aa.put("id",graphNode.get(a).get("uuid"));
aa.put("name",graphNode.get(a).get("name"));
aa.put("docId",graphNode.get(a).get("docId"));
aa.put("parentId",graphNode.get(a).get("parentId"));
aa.put("type",graphNode.get(a).get("type"));
if(graphNode.get(a).get("leve").equals("leve0")){
aa.put("group","0");
}

7
src/main/java/com/main/woka/Web/Service/impl/KcTlFileServiceImpl.java

@ -509,6 +509,13 @@ public class KcTlFileServiceImpl {
listNew.add(bb);
}
if(fieldName.equals("type")){
bb.put("key","type");
bb.put("value", String.valueOf(info.getType()));
listNew.add(bb);
}
if(fieldName.equals("level")){
if(info.getLevel()==1){
bb.put("key","leve");

4
src/main/resources/Mapper/KcFileMapper.xml

@ -151,10 +151,10 @@
<insert id="insertDocList" parameterType="java.util.List">
INSERT INTO kcfz.kc_info
(file_id,name,level,tw_url)
(file_id,name,level,tw_url,type)
VALUES
<foreach collection="list" separator="," item="item">
(#{item.fileId},#{item.name},#{item.level},#{item.twUrl})
(#{item.fileId},#{item.name},#{item.level},#{item.twUrl},1)
</foreach>
</insert>

Loading…
Cancel
Save