zhangxiaomeng 1 year ago
parent
commit
c53d062dc3
  1. 9
      kcui/src/api/twdelete.js
  2. BIN
      kcui/src/assets/img/delete.png
  3. BIN
      kcui/src/assets/img/left1.png
  4. BIN
      kcui/src/assets/img/left12.png
  5. BIN
      kcui/src/assets/img/left2.png
  6. BIN
      kcui/src/assets/img/left22.png
  7. BIN
      kcui/src/assets/img/left3.png
  8. BIN
      kcui/src/assets/img/left32.png
  9. BIN
      kcui/src/assets/img/left4.png
  10. BIN
      kcui/src/assets/img/left42.png
  11. BIN
      kcui/src/assets/img/left5.png
  12. BIN
      kcui/src/assets/img/left52.png
  13. BIN
      kcui/src/assets/img/left6.png
  14. BIN
      kcui/src/assets/img/left62.png
  15. BIN
      kcui/src/assets/img/mulubg.png
  16. 314
      kcui/src/view/Graph.vue
  17. 45
      kcui/src/view/Mulu.vue
  18. 83
      kcui/src/view/SpInfo.vue
  19. 4
      kcui/src/view/SpInfoXq.vue
  20. 44
      kcui/src/view/TWInfo.vue
  21. 127
      kcui/src/view/TWInfoXq.vue
  22. 15
      src/main/java/com/main/woka/Web/Controller/KcInfoController.java
  23. 318
      src/main/java/com/main/woka/Web/Controller/KcTlFileController.java
  24. 29
      src/main/java/com/main/woka/Web/Controller/TwDeleteController.java
  25. 10
      src/main/java/com/main/woka/Web/Mapper/TwDeleteMapper.java
  26. 20
      src/main/java/com/main/woka/Web/Service/TwDeleteService.java
  27. 4
      src/main/resources/Mapper/KcFileMapper.xml

9
kcui/src/api/twdelete.js

@ -0,0 +1,9 @@
import request from '@/utils/request';
export function twdelete(id){
return request({
url: `/twdelete/${id}`, // 使用模板字符串来包含变量
method: 'delete',
});
}

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 933 KiB

314
kcui/src/view/Graph.vue

@ -84,13 +84,7 @@
</el-option>
</el-select>
</div>
</div>
</div>
<div class="rightList">
@ -104,14 +98,13 @@
</div>
<!-- 弹窗 -->
<el-dialog
:visible.sync="isModalVisible"
title="添加分支内容"
width="30%"
top="15vh"
:visible.sync="isModalVisible"
append-to-body
top="4vh"
custom-class="custom-dialog"
>
<el-form label-width="80px">
<el-form label-width="90px">
<el-form-item label="fileId">
<el-input v-model="newBranchFileId"></el-input>
</el-form-item>
@ -126,10 +119,45 @@
<el-form-item label="节点名称">
<el-input v-model="newBranchContent"></el-input>
</el-form-item>
<el-form-item label="节点内容">
<el-input type="textarea" v-model="newBranchValue"></el-input>
<el-form-item style="position: relative ;" label="节点内容" v-if="this.typeValue=='tw'">
<Editor v-model="newBranchValue" style="height: 10vw;"></Editor>
</el-form-item>
<el-form-item label="父级节点ID">
<el-form-item label="上传视频" prop="spUrl" v-if="this.typeValue=='sp'">
<el-upload
class="avatar-uploader el-upload--text"
multiple
:headers="videoUpload.headers"
:action="videoUpload.url"
:file-list="videoFileList"
:show-file-list="false"
accept=".mp4"
:on-success="handleVideoSuccess"
:before-upload="beforeUploadVideo"
:on-progress="uploadVideoProcess"
:on-remove="handleVideoRemove"
>
<div v-if="!videoFlag && showVideoPath" style="display: flex; flex-wrap: wrap; gap: 10px;">
<div v-for="(url, index) in showVideoPath.split(',')" :key="url"
style="position: relative; flex: 1 1 calc(33.333% - 20px); min-width: 200px; margin-bottom: 10px;">
<video :src="`${videoUpload.url2}${url}`" style="width:90%; height: auto;border-radius: 0.5vw;" class="avatar video-avatar" controls>
您的浏览器不支持视频播放
</video>
<img
src="../assets/img/delete.png"
@click.stop="handleVideoRemove(videoFileList[index])"
style="width: 35px; height: 35px;position: absolute; top: 5px; left: 5px; cursor: pointer; z-index: 999;"
alt="删除"
/>
</div>
</div>
<el-progress :stroke-width="10" class="progressType" v-if="videoFlag"
type="circle" :percentage="videoUploadPercent" style="margin-top:30px;"></el-progress>
<el-button style="z-index: 999;" class="video-btn" slot="trigger" size="small" type="primary">点击上传视频</el-button>
</el-upload>
</el-form-item>
<el-form-item label="父级节点ID" style="margin-top: 4vw;">
<el-input v-model="newBranchParentId" disabled></el-input>
</el-form-item>
<el-form-item label="关系">
@ -158,17 +186,19 @@
<script>
import headInfo from '@/components/Head.vue';
import Foot from "@/components/Foot.vue";
import {getDocList, getTwInfo} from "@/api/kcInfo";
import {getDocList, getInfo, getTwInfo} from "@/api/kcInfo";
import {getgraphInfo, test} from "@/api/login";
import VisGraph from '@/assets/js/graphvis.min.20241008.js'
import LayoutFactory from '@/assets/js/graphvis.layout.min.js'
import {config} from '@/assets/defaultConfig.js'
import {addFile, addNode, getFileIdByDocId} from "@/api/file";
import Editor from "@/components/Editor.vue";
import {getToken} from "@/utils/auth";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'TWInfo',
components: {Foot, headInfo},
components: {Editor, Foot, headInfo},
data() {
return {
userName: "",
@ -269,6 +299,24 @@ export default {
label: '北京烤鸭'
}],
value3: '',
//
//
videoUpload: {
//
headers: {Authorization: "Bearer " + getToken()},
//
url: "http://127.0.0.1:10031/fileUpdate/upload",
url2: "http://127.0.0.1:10031",
},
videoFlag: false, //
videoUploadPercent: "", //
isShowUploadVideo: false, //
videoFileList:[],
showVideoPath: "",
uploadUrl: "",//
form:{},
}
},
@ -458,10 +506,11 @@ export default {
async showPopup(node) {
this.selectedNode = node;
this.newBranchParentId = node.properties.docId;
this.newBranchLevel = parseInt(node.properties.level) + 1;
this.newBranchLevel = parseInt(node.properties.leve) + 1;
try {
const response = await this.getFileIdByDocId({docId: node.properties.docId});
this.newBranchFileId = response.fileId;
} catch (error) {
console.error('Failed to fetch file ID:', error);
@ -480,50 +529,101 @@ export default {
this.selectedNode = null;
},
async addNewBranch() {
const content = this.newBranchContent.trim();
const value = this.newBranchValue.trim();
const fileId = this.newBranchFileId.trim();
const relation = this.newBranchRelation.trim();
if (this.selectedNode && content && value) {
//
const data = {
fileId: fileId,
txtName: content,
TxtValue: value,
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel
};
if(this.typeValue=='tw'){
const content = this.newBranchContent.trim();
const value = this.newBranchValue.trim();
const fileId = this.newBranchFileId.trim();
const relation = this.newBranchRelation.trim();
if (this.selectedNode && content && value) {
//
const data = {
fileId: fileId,
txtName: content,
TxtValue: value,
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel,
nodeType:'tw'
};
try {
await addNode(data);
try {
await addNode(data);
//
const newNodeId = Date.now().toString(); // 使ID
const newNode = {
id: newNodeId,
label: content,
properties: {name: content, docId: newNodeId, level: this.newBranchLevel},
...this.getNodeStyle(this.newBranchLevel) //
};
const newLink = {
source: this.selectedNode.id,
target: newNodeId,
type: '',
};
this.graphData.nodes.push(newNode);
this.graphData.links.push(newLink);
//
this.visGraph.drawData(this.graphData);
this.reLayout();
this.closeModal(); //
} catch (error) {
console.error('Failed to add new branch:', error);
alert('Failed to add new branch. Please try again.');
}
}
}
//
const newNodeId = Date.now().toString(); // 使ID
const newNode = {
id: newNodeId,
label: content,
properties: {name: content, docId: newNodeId, level: this.newBranchLevel},
...this.getNodeStyle(this.newBranchLevel) //
};
const newLink = {
source: this.selectedNode.id,
target: newNodeId,
type: '',
if(this.typeValue=='sp'){
console.log(this.videoFileList[0].url)
const content = this.newBranchContent.trim();
const relation = this.newBranchRelation.trim();
if (this.selectedNode && content ) {
//
const data = {
nodeType:this.typeValue,
txtName: content,
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel,
spUrl:this.videoFileList[0].url
};
this.graphData.nodes.push(newNode);
this.graphData.links.push(newLink);
//
this.visGraph.drawData(this.graphData);
this.reLayout();
this.closeModal(); //
} catch (error) {
console.error('Failed to add new branch:', error);
alert('Failed to add new branch. Please try again.');
try {
await addNode(data);
//
const newNodeId = Date.now().toString(); // 使ID
const newNode = {
id: newNodeId,
label: content,
properties: {name: content, docId: newNodeId, level: this.newBranchLevel},
...this.getNodeStyle(this.newBranchLevel) //
};
const newLink = {
source: this.selectedNode.id,
target: newNodeId,
type: '',
};
this.graphData.nodes.push(newNode);
this.graphData.links.push(newLink);
//
this.visGraph.drawData(this.graphData);
this.reLayout();
this.closeModal(); //
} catch (error) {
console.error('Failed to add new branch:', error);
alert('Failed to add new branch. Please try again.');
}
}
}
},
//
reLayout(alpha) {
@ -635,7 +735,81 @@ export default {
test().then((res) => {
console.log(res);
})
}
},
//
//
beforeUploadVideo(file) {
const isLt1024M = (file.size / 1024 / 1024) < 1024;
this.form.videoSize = file.size / 1024 / 1024;
//MP4
if (['video/mp4'].indexOf(file.type) === -1) {
this.$message.error('请上传正确的视频格式');
return false;
}
//1024M
if (!isLt1024M) {
this.$message.error('上传视频大小不能超过1024MB哦!');
return false;
}
return true;
},
// eslint-disable-next-line no-unused-vars
uploadVideoProcess(event, file, fileList) {
this.videoFlag = true;
this.videoUploadPercent = file.percentage.toFixed(0) * 1;
},
updateCourseUrl() {
this.form.courseUrl = this.showVideoPath;
console.log('Updated courseUrl:', this.form.courseUrl);
},
//
// eslint-disable-next-line no-unused-vars
handleVideoSuccess(response, file, fileList) {
console.log(response.data.url)
try {
// res
if (!response.data.url || typeof response.data.url !== 'string') {
this.$message.error('视频上传失败,请检查服务器响应');
return;
}
const videoUrl = response.data.url.trim();
if (videoUrl === '') {
this.$message.error('收到无效的视频URL,请检查服务器响应');
return;
}
//
if (this.videoFileList.some(video => video.url === videoUrl)) {
this.$message.warning('该视频已存在于列表中');
return;
}
this.videoFileList.push({ url: videoUrl, name: file.name });
this.showVideoPath = this.videoFileList.map(f => f.url).join(',');
this.updateCourseUrl();
this.$message.success('视频上传成功');
console.log('Updated videoFileList:', this.videoFileList);
console.log('Updated showVideoPath:', this.showVideoPath);
this.$nextTick(() => {
this.videoFlag = false;
});
} catch (error) {
this.$message.error('处理上传响应时发生错误:' + error.message);
console.error('Error in handleVideoSuccess:', error);
}
},
handleVideoRemove(video) {
if (!video) return;
// 使uid
const index = this.videoFileList.findIndex(item => item.uid === video.uid);
if (index > -1) { // UI
this.videoFileList.splice(index, 1);
this.showVideoPath = this.videoFileList.map(f => f.url).join(',');
this.updateCourseUrl();
}
},
},
mounted() {
@ -643,7 +817,32 @@ export default {
this.userName = localStorage.getItem("name");
this.getContentList();
this.getInfo();
},
created() {
var that = this;
//
this.config.node.onClick = function (event, node) {
console.log(node.properties);
var data = {
'id': node.properties.docId,
}
getInfo(data).then((res) => {
var type = res.data.data.type;
if(type==1){
that.$router.push({path: '/TwInfoXq', query: {id: res.data.data.id, level: res.data.data.level, type: "tw"}})
console.log("查看文章详情")
}
if(type==2){
that.$router.push({path: '/SpInfoXq', query: {id: res.data.data.id,type: "sp"}})
}
});
};
}
}
</script>
<style scoped>
@ -790,4 +989,7 @@ export default {
flex-direction: row;
color: #ffffff;
}
.custom-dialog{
margin-top: 0vh !important;
}
</style>

45
kcui/src/view/Mulu.vue

@ -1,11 +1,27 @@
<template>
<div style="width: 100%;height: 100%;">
<img style="width: 100%;height: 100%;position: absolute;z-index:99;" src="../assets/img/mulubg.png">
<img src="../assets/img/mululist.png" style="width: 100%;height: 100%;position: absolute;z-index:100;">
<headInfo style="position: absolute;z-index: 100"></headInfo>
<div class="mululist">
<div v-for="item in mulu" :key="item" style="width: 100%;height: 10%;" @click="goPage(item.info)">
{{item.name}}
<img v-if="item.name=='图文认知' && muluName!='图文认知'" :src="item.url" style="width: 14vw;height: 19vw;" @mouseenter="changeInfo(item.name)">
<img v-if="item.name=='图文认知' && muluName=='图文认知'" :src="item.urlChoose" style="width: 20vw;height: 25vw;margin-top: -3vw;" >
<img v-if="item.name=='视频资源' && muluName!='视频资源'" :src="item.url" style="width: 13vw;height: 16vw;margin-top: 1.5vw;" @mouseenter="changeInfo(item.name)">
<img v-if="item.name=='视频资源' && muluName=='视频资源'" :src="item.urlChoose" style="width: 19vw;height: 22vw;margin-top: -1.5vw;" >
<img v-if="item.name=='动画显示' && muluName!='动画显示'" :src="item.url" style="width: 12vw;height: 14.5vw;margin-top: 2.3vw;" @mouseenter="changeInfo(item.name)">
<img v-if="item.name=='动画显示' && muluName=='动画显示'" :src="item.urlChoose" style="width: 18vw;height: 20.5vw;margin-top: -1vw;" >
<img v-if="item.name=='计算模块' && muluName!='计算模块'" :src="item.url" style="width: 12vw;height: 14.5vw;margin-top: 2.3vw;" @mouseenter="changeInfo(item.name)">
<img v-if="item.name=='计算模块' && muluName=='计算模块'" :src="item.urlChoose" style="width: 18vw;height: 20.5vw;margin-top: -1vw;" >
<img v-if="item.name=='知识图谱' && muluName!='知识图谱'" :src="item.url" style="width: 13vw;height: 16vw;margin-top: 1.5vw;" @mouseenter="changeInfo(item.name)">
<img v-if="item.name=='知识图谱' && muluName=='知识图谱'" :src="item.urlChoose" style="width: 19vw;height: 22vw;margin-top: -1.5vw;" >
<img v-if="item.name=='帮助文档' && muluName!='帮助文档'" :src="item.url" style="width: 14vw;height: 19vw;" @mouseenter="changeInfo(item.name)">
<img v-if="item.name=='帮助文档' && muluName=='帮助文档'" :src="item.urlChoose" style="width: 20vw;height: 25vw;margin-top: -3vw;" >
</div>
</div>
@ -25,17 +41,21 @@ export default {
components: {Foot, headInfo},
data() {
return{
muluName:"",
mulu:[
{id:0,name:"图文认知",info:"TwInfo"},
{id:1,name:"视频资源",info:"SpInfo"},
{id:2,name:"动画显示",info:"DhInfo"},
{id:3,name:"计算模块",info:"JsInfo"},
{id:4,name:"知识图谱",info:"Graph"},
{id:4,name:"帮助文档",info:"Help"},
{id:0,name:"图文认知",info:"TwInfo",url:require("../assets/img/left1.png"),urlChoose:require("../assets/img/left12.png")},
{id:1,name:"视频资源",info:"SpInfo",url:require("../assets/img/left2.png"),urlChoose:require("../assets/img/left22.png")},
{id:2,name:"动画显示",info:"DhInfo",url:require("../assets/img/left3.png"),urlChoose:require("../assets/img/left32.png")},
{id:3,name:"计算模块",info:"JsInfo",url:require("../assets/img/left4.png"),urlChoose:require("../assets/img/left42.png")},
{id:4,name:"知识图谱",info:"Graph",url:require("../assets/img/left5.png"),urlChoose:require("../assets/img/left52.png")},
{id:4,name:"帮助文档",info:"Help",url:require("../assets/img/left6.png"),urlChoose:require("../assets/img/left62.png")},
]
}
},
methods:{
changeInfo(name){
this.muluName = name;
},
goPage(info){
this.$router.push('/'+info)
}
@ -49,15 +69,16 @@ export default {
<style scoped>
.mululist{
display: flex;
flex-direction: column;
flex-direction: row;
justify-content: space-around;
width: 10%;
width: 94%;
height: 50%;
//background-color: #42b983;
position: absolute;
top: 25%;
top: 33%;
z-index: 110;
left: 15%;
left: 3%;
text-align: center;
font-size: 1.2vw;
color: #ffffff;

83
kcui/src/view/SpInfo.vue

@ -58,9 +58,10 @@
<div v-for="item in typeList" :key="item" style="position: relative;margin-right: 1vw;"
@click="changeType(item)">
<img v-if="spType==item" src="../assets/img/typeHeadChoose.png" style="width: 7vw;object-fit: contain;">
<img v-if="spType1==item" src="../assets/img/typeHeadChoose.png" style="width: 7vw;object-fit: contain;">
<img v-else src="../assets/img/typeHead.png" style="width: 7vw;object-fit: contain;">
<div style="position: absolute;z-index: 12121;width: 100%;text-align: center;color: white;top: 15%;">
<div style="position: absolute;z-index: 12121;width: 100%;text-align: center;color: white;top: 15%;" >
{{ item }}
</div>
</div>
@ -111,7 +112,7 @@
<div style="width: 8%;">{{ item.id }}</div>
<div style="width: 22%;">{{ item.name }}</div>
<div style="width: 60%;display: flex;flex-direction: row;justify-content: space-around;">
<Video1 style="height: 100%; object-fit:contain" :src="item.spUrl"
<Video1 style="height: 90%; object-fit:contain" :src="item.spUrl"
:second="3"/>
</div>
@ -121,7 +122,7 @@
<div
style="width: 9%;text-decoration: underline;font-style: italic;display: flex;justify-content: space-around;margin-left: 1%;">
<div @click="editTw(item.id)">修改</div>
<div @click="deleteTw(item.id)">删除</div>
<!-- <div @click="deleteTw(item.id)">删除</div>-->
</div>
</div>
</div>
@ -145,11 +146,21 @@
<foot></foot>
</div>
<el-dialog :visible.sync="openInfo" title="视频">
<el-dialog :visible.sync="openInfo" title="视频" top="3vw">
<el-form :model="form" label-width="80px">
<el-form-item label="视频名称">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item style="position: relative ;" label="选择类别">
<el-select v-model="form.spType" placeholder="请选择类别">
<el-option
v-for="item in typeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="上传视频" prop="courseUrl">
<el-upload
class="avatar-uploader el-upload--text"
@ -165,14 +176,13 @@
:on-remove="handleVideoRemove"
>
<div v-if="!videoFlag && showVideoPath" style="display: flex; flex-wrap: wrap; gap: 10px;">
<div v-for="(url, index) in showVideoPath.split(',')" :key="url"
style="position: relative; flex: 1 1 calc(33.333% - 20px); min-width: 200px; margin-bottom: 10px;">
<video :src="`${videoUpload.url2}${url}`" style="width:90%; height: auto;border-radius: 0.5vw;" class="avatar video-avatar" controls>
<div style="position: relative; flex: 1 1 calc(33.333% - 20px); min-width: 200px; margin-bottom: 10px;">
<video :src="showVideoPath" style="width:90%; height: auto;border-radius: 0.5vw;" class="avatar video-avatar" controls>
您的浏览器不支持视频播放
</video>
<img
src="../assets/img/delete.png"
@click.stop="handleVideoRemove(videoFileList[index])"
@click.stop="handleVideoRemove(videoFileList[0])"
style="width: 35px; height: 35px;position: absolute; top: 5px; left: 5px; cursor: pointer; z-index: 999;"
alt="删除"
/>
@ -203,7 +213,7 @@ import Foot from "@/components/Foot.vue";
import {editInfo, getSpList, getInfo} from "@/api/kcInfo";
import {getToken} from "@/utils/auth";
import Video1 from "@/components/Video1.vue";
import {twdelete} from "@/api/twdelete";
export default {
// eslint-disable-next-line vue/multi-word-component-names
@ -226,9 +236,10 @@ export default {
{id: 4, name: "帮助文档", info: "Help"}
],
page: "视频资源",
typeList: ["起降", "飞行", "通信载荷使用", "探测载荷使用", "攻击载荷使用"],
typeList: ["全部","起降", "飞行", "通信载荷使用", "探测载荷使用", "攻击载荷使用"],
contentList: [],
selectName: "",
spType1:"全部",
spType: "",
pageSize: 6,
pageNum: 1,
@ -242,6 +253,7 @@ export default {
form: {
name: "",
contentInfo: "",
spType:"",
},
TxtValue: "",
id: 0,
@ -272,7 +284,12 @@ export default {
this.$router.push('/' + info)
},
changeType(item) {
this.spType = item;
this.spType1 = item;
if(this.spType1=="全部"){
this.spType = "";
}else {
this.spType = this.spType1
}
this.getContentList();
},
choosePage(item) {
@ -297,20 +314,33 @@ export default {
var aaa = 0;
this.onePagesList = [];
this.pagesList = [];
if (this.pageNum < this.totalPage - 3) {
for (let i = this.pageNum; i <= this.totalPage; i++) {
if(this.totalPage>3){
if (this.pageNum < this.totalPage - 3) {
for (let i = this.pageNum; i <= this.totalPage; i++) {
this.pagesList.push(i);
this.onePagesList.push(i);
aaa = aaa + 1;
console.log(aaa);
if (aaa == 4) {
break;
}
}
}
}else {
for (let i = 1; i <= this.totalPage; i++) {
this.pagesList.push(i);
this.onePagesList.push(i);
aaa = aaa + 1;
console.log(aaa);
if (aaa == 4) {
if (aaa == 3) {
break;
}
}
}
console.log(this.onePagesList)
})
@ -323,7 +353,10 @@ export default {
//
deleteTw() {
//
deleteTw(id){
twdelete(id);
this.getContentList();
console.log("这是删除操作")
},
editTw(id) {
@ -334,11 +367,17 @@ export default {
getInfo(data).then((res) => {
this.openInfo = true;
this.form.name = res.data.data.name
this.form.name = res.data.data.name;
this.form.spType = res.data.data.spType
this.id = id;
this.videoFileList = [];
this.showVideoPath = "";
if (res.data.data.spUrl != null) {
this.videoFileList.push({ url: res.data.data.spUrl,name: res.data.data.name });
this.showVideoPath = res.data.data.spUrl;
}
console.log(res);
})
@ -423,12 +462,16 @@ export default {
},
submitInfo() {
console.log(this.videoFileList);
if(this.form.spType=="全部"){
this.form.spType = "";
}
var urlStr = this.videoFileList[0];
var data = {
name: this.form.name,
spUrl:urlStr.url,
type:2,
id: this.id
id: this.id,
spType:this.form.spType
}
editInfo(data).then((res) => {
console.log(res);

4
kcui/src/view/SpInfoXq.vue

@ -221,4 +221,8 @@ export default {
justify-content: space-around;
}
.m-video{
background: none !important;
}
</style>

44
kcui/src/view/TWInfo.vue

@ -51,7 +51,7 @@
@keyup.enter = "getContentList()"
/>
</div>
<div style="width: 7%;height: 70%;float: right;margin-right: 15%;" @click="getContentList()">
<div style="width: 6%;height: 70%;float: right;margin-right: 18%;margin-top: 1%;" @click="getContentList()">
<img src="../assets/img/look.png" style="width: 100%;height: 100%;">
</div>
@ -61,9 +61,9 @@
<div v-for="item in typeList" :key="item" style="position: relative;margin-right: 1vw;"
@click="changeType(item)">
<img v-if="twType==item" src="../assets/img/typeHeadChoose.png" style="width: 7vw;object-fit: contain;">
<img v-if="twType1==item" src="../assets/img/typeHeadChoose.png" style="width: 7vw;object-fit: contain;">
<img v-else src="../assets/img/typeHead.png" style="width: 7vw;object-fit: contain;">
<div style="position: absolute;z-index: 12121;color: #ffffff;top: 0.3vw;left: 1.7vw;font-size: 0.9vw;">
<div style="position: absolute;z-index: 12121;width: 100%;text-align: center;color: white;top: 15%;">
{{ item }}
</div>
</div>
@ -122,7 +122,7 @@
<div
style="width: 9%;text-decoration: underline;font-style: italic;display: flex;justify-content: space-around;margin-left: 1%;">
<div @click="editTw(item.id)">修改</div>
<div @click="deleteTw(item.id)">删除</div>
<!-- <div @click="deleteTw(item.id)">删除</div>-->
</div>
</div>
</div>
@ -146,15 +146,25 @@
<foot></foot>
</div>
<el-dialog :visible.sync="openInfo" title="文章修改">
<el-dialog :visible.sync="openInfo" title="文章修改" top="2vw">
<el-form :model="form" label-width="80px">
<el-form-item label="活动名称">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item style="position: relative ;" label="知识内容">
<Editor v-if="form.contentInfo!=''" v-model="TxtValue" style="height: 15vw;"></Editor>
<Editor v-if="form.contentInfo!=''" v-model="TxtValue" style="height: 11vw;"></Editor>
</el-form-item>
<el-form-item style="position: relative;margin-top: 5vw;" label="相关图片">
<el-form-item style="position: relative ;margin-top: 5vw;" label="选择类别">
<el-select v-model="form.twType" placeholder="请选择类别">
<el-option
v-for="item in typeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative;" label="相关图片">
<el-upload
action="http://127.0.0.1:10031/fileUpdate/upload"
list-type="picture-card"
@ -208,10 +218,11 @@ export default {
{id: 4, name: "帮助文档", info: "Help"}
],
page: "图文认知",
typeList: ["海洋大气", "海洋文学", "海洋地理", "复杂水声", "复杂电磁"],
typeList: ["全部","海洋大气", "海洋文学", "海洋地理", "复杂水声", "复杂电磁"],
contentList: [],
selectName: "",
twType: "",
twType1:"全部",
pageSize: 6,
pageNum: 1,
total: 0,
@ -224,6 +235,7 @@ export default {
form: {
name: "",
contentInfo: "",
twType:"",
},
TxtValue: "",
id: 0,
@ -238,7 +250,12 @@ export default {
this.$router.push('/' + info)
},
changeType(item) {
this.twType = item;
this.twType1 = item;
if(this.twType1=="全部"){
this.twType = "";
}else {
this.twType = this.twType1
}
this.getContentList();
},
choosePage(item) {
@ -270,15 +287,12 @@ export default {
this.pagesList.push(i);
this.onePagesList.push(i);
aaa = aaa + 1;
console.log(aaa);
if (aaa == 4) {
break;
}
}
}
console.log(this.onePagesList)
})
},
goXq(id) {
@ -305,10 +319,12 @@ export default {
this.openInfo = true;
this.form.contentInfo = res.data.data.contentInfo
this.form.name = res.data.data.name
this.form.twType = res.data.data.twType
this.TxtValue = res.data.data.contentInfo;
this.id = id;
var imgs = res.data.data.imgList;
console.log(imgs)
this.fileList =[];
for (let j = 0; j < imgs.length; j++) {
var ii = {
@ -383,12 +399,16 @@ export default {
}
}
if(this.form.twType=="全部"){
this.form.twType = "";
}
var data = {
name: this.form.name,
contentInfo: this.TxtValue,
imgs: urlStr,
id: this.id,
type:1,
twType:this.form.twType,
}
editInfo(data).then((res) => {
console.log(res);

127
kcui/src/view/TWInfoXq.vue

@ -1,7 +1,8 @@
<template>
<div style="width: 100%;height: 100%;">
<img style="width: 100%;height: 100%;position: absolute;z-index:-1;" src="../assets/img/twbg1.jpg">
<headInfo style="position: absolute;z-index: 100"></headInfo>
<img style="width: 100%;height: 100%;position: absolute;z-index:-1;" src="../assets/img/twbg.png">
<headInfo></headInfo>
<div class="content">
<div class="leftContent">
<div class="leftBox1">
@ -12,22 +13,22 @@
</div>
<div class="leftBox2">
<div class="muluBox">
<img src="../assets/img/leftBox.png" style="width: 100%;object-fit: contain;z-index: 1;position: absolute;">
<div class="muluList">
<div v-for="item in mulu" :key="item">
<div class="oneMulu" v-if="page!=item" @click="goInfo(item.info)">
<div style="width: 80%;text-align: center;">{{ item.name }}</div>
<img src="../assets/img/jiantou.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 13%;">
</div>
<div class="oneMuluXuan" v-else>
<div class="oneMuluXuan" v-if="item.name === '图文资源'">
<img src="../assets/img/twCircle.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 7%;">
<div style="width: 55%;text-align: center;">
{{ item.name }}
</div>
{{ item.name }}</div>
<img src="../assets/img/jiantouchoose.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 7%;">
<img src="../assets/img/muluchoose.png"
style="width: 19vw;height: 6vw;position: absolute;bottom: -3vw;left: -3.5vw;z-index: -1;"/>
</div>
<div class="oneMulu" v-else @click="goInfo(item.info)">
<div style="width: 80%;text-align: center;">{{ item.name }}</div>
<img src="../assets/img/jiantou.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 8%;">
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 13%;">
</div>
</div>
</div>
@ -36,13 +37,18 @@
</div>
<div class="rightContent">
<div class="contentInfo">
<div class="contentTitle">{{ contentInfo.title }}</div>
<div class="contentTitle">
<!-- <div class="back-button" @click="goBack">-->
<!-- <img src="../assets/img/jiantouchoose.png" alt="返回">-->
<!-- </div>-->
{{contentInfo.title}}</div>
<div class="contentText" v-html="contentInfo.content"></div>
</div>
</div>
</div>
<div style="width: 100%;height: 3%;position: fixed;bottom: 0px;z-index: 100">
<foot></foot>
</div>
@ -54,17 +60,16 @@
import headInfo from "@/components/Head.vue";
import Foot from "@/components/Foot.vue";
import {getInfo} from "@/api/kcInfo";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'TWInfoXq',
components: {Foot, headInfo},
data() {
return {
docId: undefined,
level: 0,
url: "",
userName: "",
return{
docId:undefined,
level:0,
url:"",
userName:"",
mulu: [
{id: 0, name: "图文资源", info: "TwInfo"},
{id: 1, name: "视频资源", info: "SpInfo"},
@ -73,23 +78,23 @@ export default {
{id: 4, name: "知识图谱", info: "Graph"},
{id: 4, name: "帮助文档", info: "Help"}
],
contentInfo: {
title: "",
content: ""
contentInfo:{
title:"",
content:""
},
}
},
methods: {
methods:{
goInfo(info) {
console.log(info)
this.$router.push('/' + info)
},
getInfo() {
getInfo(){
var data = {
id: this.docId
id:this.docId
}
getInfo(data).then((res) => {
getInfo(data).then((res)=>{
this.contentInfo.title = res.data.data.name
this.contentInfo.content = res.data.data.contentInfo
@ -114,25 +119,22 @@ export default {
width: 14%;
height: 100%;
float: left;
margin-top: 4.4%;
}
.leftBox1 {
width: 100%;
height: 10%;
margin-top: 12%;
margin-top: 5%;
color: #7cdeff;
}
.leftBox2 {
width: 100%;
height: 90%;
}
.muluBox {
margin: 3% 14%;
margin: 0 14%;
height: 92%;
width: 72%;
position: relative;
@ -156,24 +158,26 @@ export default {
height: 2.5vw;
line-height: 2.5vw;
font-size: 0.9vw;
border-bottom: 1px solid #0d3455;
border-bottom: 1px solid rgba(112, 192, 227, 0.47);
margin-left: 10%;
color: #d1d3d7;
display: flex;
flex-direction: row;
}
.oneMuluXuan {
background-image: url("../assets/img/xuan.png");
width: 90%;
height: 2.5vw;
line-height: 2.5vw;
line-height: 2.1vw;
font-size: 0.9vw;
color: #13ffff;
display: flex;
flex-direction: row;
padding-left: 10%;
position: relative;
}
@ -184,38 +188,59 @@ export default {
position: relative;
}
.contentInfo {
.contentInfo{
width: 100%;
height: 96%;
background-color: rgba(20, 119, 208, 0.82);
position: absolute;
z-index: 101;
margin-top: 7%;
margin-top: 2%;
border-radius: 1vw;
}
.contentTitle {
.contentTitle{
width: 100%;
height: 8%;
height: 5%;
margin-top: 0.5%;
font-size: 1.5vw;
color: #ffffff;
color: #03f7f7;
text-align: center;
letter-spacing: 5px;
line-height: 3vw;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.contentText {
width: 96%;
height: 89%;
margin-top: 1%;
font-size: 1vw;
margin-left: 2%;
.contentText{
width: 86%;
height: 86%;
font-size: 1.2vw;
text-indent: 2em;
font-weight: lighter;
letter-spacing: 0.15vw;
line-height: 2.25;
margin: 2% 0 2% 0;
padding: 0 5% 0 8%;
overflow-y: scroll;
color: #ffffff;
}
.contentText::-webkit-scrollbar {
width: 6px;
height: 6px;
}
.contentText::-webkit-scrollbar-thumb {
background-color: #03f7f7;
border-radius: 10px;
}
.contentText::-webkit-scrollbar-track {
background: transparent;
}
.contentText::-webkit-scrollbar-button {
display: none;
}
</style>

15
src/main/java/com/main/woka/Web/Controller/KcInfoController.java

@ -99,8 +99,6 @@ public class KcInfoController extends BaseController {
if (aa.getType() == 1) {
List<KcTwImg> list = twImgMapper.getKcTwImgList(aa.getId());
aa.setImgList(list);
String path = aa.getTwUrl();
File file = new File(path);
String string = txt2String(file);
@ -146,10 +144,13 @@ public class KcInfoController extends BaseController {
list.add(twimg);
}
} else {
KcTwImg twimg = new KcTwImg();
twimg.setTwId(id);
twimg.setImgUrl(imgs);
list.add(twimg);
if(!imgs.equals("")){
KcTwImg twimg = new KcTwImg();
twimg.setTwId(id);
twimg.setImgUrl(imgs);
list.add(twimg);
}
}
@ -173,6 +174,7 @@ public class KcInfoController extends BaseController {
info.setId(id);
info.setName(name);
info.setTwUrl(String.valueOf(newPath));
info.setTwType(kcInfo.getTwType());
int a = kcFileMapper.updateDocById(info);
if (a > 0) {
return AjaxResult.success();
@ -189,6 +191,7 @@ public class KcInfoController extends BaseController {
KcInfo aa = kcFileMapper.selectById(id);
aa.setSpUrl(spUrl);
aa.setName(name);
aa.setSpType(kcInfo.getSpType());
int a = kcFileMapper.updateDocById(aa);
if (a > 0) {
return AjaxResult.success();

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

@ -123,126 +123,254 @@ public class KcTlFileController extends BaseController {
public AjaxResult addNode(@RequestBody Map<String, String> requestBody) throws IOException {
System.out.println(requestBody);
String nodeType = requestBody.get("nodeType");
if(nodeType.equals("tw")){
Integer fileId = Integer.valueOf(requestBody.get("fileId"));
String txtName = requestBody.get("txtName");
String TxtValue = requestBody.get("TxtValue");
String relation = requestBody.get("relation");
Long parentId = Long.valueOf(requestBody.get("parentId"));
Long level = Long.valueOf(requestBody.get("level"));
KcTlFile kcTlFile = kcFileMapper.getFileById(fileId);
String url = kcTlFile.getFileUrl();
int lastBackslashIndex = url.lastIndexOf('\\');
String pathPart = url.substring(0, lastBackslashIndex + 1);
String result = pathPart + "wordSplitter";
String txtUrl = createTxtFile(result, txtName, TxtValue);
KcInfo kcInfo = new KcInfo();
kcInfo.setFileId(fileId);
kcInfo.setCreateTime(new Date());
kcInfo.setTwUrl(txtUrl);
kcInfo.setName(txtName);
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setType(1l);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
kcFileMapper.insertDoc(kcInfo);
//创建图谱
String cql = "create (doc: Doc{";
List<Map> listNew = new ArrayList<>();
if (kcInfo.getId() != null) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "docId");
bb.put("value", String.valueOf(kcInfo.getId()));
listNew.add(bb);
}
if (kcInfo.getName() != null && !kcInfo.getName().equals("")) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "name");
bb.put("value", String.valueOf(kcInfo.getName()));
listNew.add(bb);
}
if (kcInfo.getType() != null ) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "type");
bb.put("value", String.valueOf(kcInfo.getType()));
listNew.add(bb);
}
if (kcInfo.getLevel() != null) {
Map<String, String> bb = new HashMap<>();
if (kcInfo.getLevel() == 1) {
bb.put("key", "leve");
bb.put("value", "leve1");
}
if (kcInfo.getLevel() == 2) {
bb.put("key", "leve");
bb.put("value", "leve2");
}
if (kcInfo.getLevel() == 3) {
bb.put("key", "leve");
bb.put("value", "leve3");
}
if (kcInfo.getLevel() == 4) {
bb.put("key", "leve");
bb.put("value", "leve4");
}
if (kcInfo.getLevel() == 5) {
bb.put("key", "leve");
bb.put("value", "leve5");
}
if (kcInfo.getLevel() == 6) {
bb.put("key", "leve");
bb.put("value", "leve6");
}
listNew.add(bb);
}
Integer fileId = Integer.valueOf(requestBody.get("fileId"));
String txtName = requestBody.get("txtName");
String TxtValue = requestBody.get("TxtValue");
for (int a = 0; a < listNew.size(); a++) {
String relation = requestBody.get("relation");
Long parentId = Long.valueOf(requestBody.get("parentId"));
Long level = Long.valueOf(requestBody.get("level"));
KcTlFile kcTlFile = kcFileMapper.getFileById(fileId);
String url = kcTlFile.getFileUrl();
int lastBackslashIndex = url.lastIndexOf('\\');
String pathPart = url.substring(0, lastBackslashIndex + 1);
String result = pathPart + "wordSplitter";
String txtUrl = createTxtFile(result, txtName, TxtValue);
if (listNew.get(a).size() > 1) {
if (a == 0) {
cql = cql + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'";
} else if (a == (listNew.size() - 1)) {
cql = cql + "," + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'})";
} else {
cql = cql + "," + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'";
}
} else {
cql = cql + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'}) return doc";
}
}
StatementResult result1 = neo4jUtil.excuteCypherSql(cql);
int yy = kcFileMapper.updateGraphStatus(kcInfo.getId());
KcInfo kcInfo = new KcInfo();
kcInfo.setFileId(fileId);
kcInfo.setCreateTime(new Date());
kcInfo.setTwUrl(txtUrl);
kcInfo.setName(txtName);
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
kcFileMapper.insertDoc(kcInfo);
//创建关系
KcInfoRelation zz = new KcInfoRelation();
zz.setRelation(relation);
zz.setSourceId(parentId);
zz.setTargetId(kcInfo.getId());
//查询上级
KcInfo zz1 = new KcInfo();
zz1.setId(parentId);
KcInfo oldDoc = kcFileMapper.selectDocById(zz1);
zz.setSourceName(oldDoc.getName());
zz.setTargetName(txtName);
zz.setCreateTime(new Date());
kcInfoRelationMapper.insertKcRelationship(zz);
//创建图谱
String cql = "create (doc: Doc{";
//创建图谱
String cqr = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + zz.getSourceId() + "' AND b.docId = '" + zz.getTargetId() + "'CREATE (a)-[r:" + zz.getRelation() + "] -> (b) RETURN r";
StatementResult result2 = neo4jUtil.excuteCypherSql(cqr);
List<Map> listNew = new ArrayList<>();
if (kcInfo.getId() != null) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "docId");
bb.put("value", String.valueOf(kcInfo.getId()));
listNew.add(bb);
}
if (kcInfo.getName() != null && !kcInfo.getName().equals("")) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "name");
bb.put("value", String.valueOf(kcInfo.getName()));
listNew.add(bb);
zz.setIsGraph(1l);
int yy1 = kcInfoRelationMapper.updateKcRelationship(zz);
}
if (kcInfo.getLevel() != null) {
Map<String, String> bb = new HashMap<>();
if (kcInfo.getLevel() == 1) {
bb.put("key", "leve");
bb.put("value", "leve1");
}
if (kcInfo.getLevel() == 2) {
bb.put("key", "leve");
bb.put("value", "leve2");
if(nodeType.equals("sp")){
String spUrl = requestBody.get("spUrl");
String txtName = requestBody.get("txtName");
String relation = requestBody.get("relation");
Long parentId = Long.valueOf(requestBody.get("parentId"));
Long level = Long.valueOf(requestBody.get("level"));
KcInfo kcInfo = new KcInfo();
kcInfo.setCreateTime(new Date());
kcInfo.setSpUrl(spUrl);
kcInfo.setName(txtName);
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setType(2l);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
kcFileMapper.insertDoc(kcInfo);
//创建图谱
String cql = "create (doc: Doc{";
List<Map> listNew = new ArrayList<>();
if (kcInfo.getId() != null) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "docId");
bb.put("value", String.valueOf(kcInfo.getId()));
listNew.add(bb);
}
if (kcInfo.getLevel() == 3) {
bb.put("key", "leve");
bb.put("value", "leve3");
if (kcInfo.getName() != null && !kcInfo.getName().equals("")) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "name");
bb.put("value", String.valueOf(kcInfo.getName()));
listNew.add(bb);
}
if (kcInfo.getLevel() == 4) {
bb.put("key", "leve");
bb.put("value", "leve4");
if (kcInfo.getType() != null ) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "type");
bb.put("value", String.valueOf(kcInfo.getType()));
listNew.add(bb);
}
if (kcInfo.getLevel() == 5) {
bb.put("key", "leve");
bb.put("value", "leve5");
if (kcInfo.getSpUrl() != null && !kcInfo.getSpUrl().equals("")) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "spUrl");
bb.put("value", String.valueOf(kcInfo.getSpUrl()));
listNew.add(bb);
}
if (kcInfo.getLevel() == 6) {
bb.put("key", "leve");
bb.put("value", "leve6");
if (kcInfo.getLevel() != null) {
Map<String, String> bb = new HashMap<>();
if (kcInfo.getLevel() == 1) {
bb.put("key", "leve");
bb.put("value", "leve1");
}
if (kcInfo.getLevel() == 2) {
bb.put("key", "leve");
bb.put("value", "leve2");
}
if (kcInfo.getLevel() == 3) {
bb.put("key", "leve");
bb.put("value", "leve3");
}
if (kcInfo.getLevel() == 4) {
bb.put("key", "leve");
bb.put("value", "leve4");
}
if (kcInfo.getLevel() == 5) {
bb.put("key", "leve");
bb.put("value", "leve5");
}
if (kcInfo.getLevel() == 6) {
bb.put("key", "leve");
bb.put("value", "leve6");
}
listNew.add(bb);
}
listNew.add(bb);
}
for (int a = 0; a < listNew.size(); a++) {
for (int a = 0; a < listNew.size(); a++) {
if (listNew.get(a).size() > 1) {
if (a == 0) {
cql = cql + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'";
} else if (a == (listNew.size() - 1)) {
cql = cql + "," + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'})";
if (listNew.get(a).size() > 1) {
if (a == 0) {
cql = cql + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'";
} else if (a == (listNew.size() - 1)) {
cql = cql + "," + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'})";
} else {
cql = cql + "," + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'";
}
} else {
cql = cql + "," + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'";
cql = cql + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'}) return doc";
}
} else {
cql = cql + listNew.get(a).get("key") + ":'" + listNew.get(a).get("value") + "'}) return doc";
}
StatementResult result1 = neo4jUtil.excuteCypherSql(cql);
int yy = kcFileMapper.updateGraphStatus(kcInfo.getId());
//创建关系
KcInfoRelation zz = new KcInfoRelation();
zz.setRelation(relation);
zz.setSourceId(parentId);
zz.setTargetId(kcInfo.getId());
//查询上级
KcInfo zz1 = new KcInfo();
zz1.setId(parentId);
KcInfo oldDoc = kcFileMapper.selectDocById(zz1);
zz.setSourceName(oldDoc.getName());
zz.setTargetName(txtName);
zz.setCreateTime(new Date());
kcInfoRelationMapper.insertKcRelationship(zz);
//创建图谱
String cqr = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + zz.getSourceId() + "' AND b.docId = '" + zz.getTargetId() + "'CREATE (a)-[r:" + zz.getRelation() + "] -> (b) RETURN r";
StatementResult result2 = neo4jUtil.excuteCypherSql(cqr);
zz.setIsGraph(1l);
int yy1 = kcInfoRelationMapper.updateKcRelationship(zz);
}
StatementResult result1 = neo4jUtil.excuteCypherSql(cql);
int yy = kcFileMapper.updateGraphStatus(kcInfo.getId());
//创建关系
KcInfoRelation zz = new KcInfoRelation();
zz.setRelation(relation);
zz.setSourceId(parentId);
zz.setTargetId(kcInfo.getId());
//查询上级
KcInfo zz1 = new KcInfo();
zz1.setId(parentId);
KcInfo oldDoc = kcFileMapper.selectDocById(zz1);
zz.setSourceName(oldDoc.getName());
zz.setTargetName(txtName);
zz.setCreateTime(new Date());
kcInfoRelationMapper.insertKcRelationship(zz);
//创建图谱
String cqr = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + zz.getSourceId() + "' AND b.docId = '" + zz.getTargetId() + "'CREATE (a)-[r:" + zz.getRelation() + "] -> (b) RETURN r";
StatementResult result2 = neo4jUtil.excuteCypherSql(cqr);
zz.setIsGraph(1l);
int yy1 = kcInfoRelationMapper.updateKcRelationship(zz);
return AjaxResult.success();

29
src/main/java/com/main/woka/Web/Controller/TwDeleteController.java

@ -0,0 +1,29 @@
package com.main.woka.Web.Controller;
import com.main.woka.Common.core.AjaxResult;
import com.main.woka.Web.Service.TwDeleteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/twdelete")
public class TwDeleteController extends BaseController {
@Autowired
private TwDeleteService twDeleteService;
@DeleteMapping("/{id}")
public AjaxResult deleteItem(@PathVariable Long id) {
try {
// 调用服务层方法进行删除操作
twDeleteService.deleteItem(id);
return AjaxResult.success();
} catch (Exception e) {
// 返回错误信息
e.printStackTrace();
return AjaxResult.error("删除失败");
}
}
}

10
src/main/java/com/main/woka/Web/Mapper/TwDeleteMapper.java

@ -0,0 +1,10 @@
package com.main.woka.Web.Mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TwDeleteMapper {
@Delete("DELETE FROM kc_info WHERE id = #{id}")
void deleteById(Long id); // 根据ID删除记录
}

20
src/main/java/com/main/woka/Web/Service/TwDeleteService.java

@ -0,0 +1,20 @@
package com.main.woka.Web.Service;
import com.main.woka.Web.Mapper.TwDeleteMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class TwDeleteService {
private final TwDeleteMapper twDeleteMapper;
@Autowired
public TwDeleteService(TwDeleteMapper twDeleteMapper) {
this.twDeleteMapper = twDeleteMapper;
}
public void deleteItem(Long id) {
// 调用Mapper执行数据库删除操作
twDeleteMapper.deleteById(id);
}
}

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

@ -123,6 +123,10 @@
<if test="twUrl != null and twUrl != ''">tw_url = #{twUrl},</if>
<if test="spUrl != null and spUrl != ''">sp_url = #{spUrl},</if>
<if test="jsInfo != null and jsInfo != ''">js_info = #{jsInfo},</if>
<if test="twType != null and twType != ''">tw_type = #{twType},</if>
<if test="spType != null and spType != ''">sp_type = #{spType},</if>
<if test="dwType != null and dwType != ''">dw_info = #{dwType},</if>
<if test="jsType != null and jsType != ''">js_type = #{jsType},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="level != null">level = #{level},</if>
update_time = sysdate()

Loading…
Cancel
Save