zhangxiaomeng 1 year ago
parent
commit
021d7beebb
  1. 28
      kcui/src/App.vue
  2. 114
      kcui/src/components/Pagination/index.vue
  3. 4
      kcui/src/main.js
  4. 58
      kcui/src/utils/scroll-to.js
  5. 269
      kcui/src/view/DhInfo.vue
  6. 328
      kcui/src/view/Graph.vue
  7. 28
      kcui/src/view/JsInfo.vue
  8. 30
      kcui/src/view/SpInfo.vue
  9. 99
      kcui/src/view/TWInfo.vue
  10. 362
      src/main/java/com/main/woka/Web/Controller/KcInfoController.java
  11. 172
      src/main/java/com/main/woka/Web/Controller/KcTlFileController.java
  12. 59
      src/main/java/com/main/woka/Web/Dao/DhParam.java
  13. 9
      src/main/java/com/main/woka/Web/Dao/KcInfo.java
  14. 3
      src/main/resources/Mapper/KcFileMapper.xml

28
kcui/src/App.vue

@ -31,4 +31,32 @@ html{
padding: 0;
height: 100%;
}
.el-pager li {
padding: 0 !important;
background: transparent !important;
font-size: 12px;
min-width: 35.5px;
height: 28px;
line-height: 28px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
text-align: center;
margin: 0px 0px !important;
border-radius: 0px !important;
border: 1px solid #018ffd;
color: #FFFFFF !important;
}
.el-pagination.is-background .btn-next, .el-pagination.is-background .btn-prev{
background-color: transparent !important;
color: #FFFFFF !important;
border: 1px solid #018ffd;
margin: 0 1vw !important;
}
.el-pagination.is-background .el-pager li:not(.disabled):hover {
color: #1fe5ff !important;;
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: #018ffd !important;
}
</style>

114
kcui/src/components/Pagination/index.vue

@ -0,0 +1,114 @@
<template>
<div :class="{'hidden':hidden}" class="pagination-container">
<el-pagination
:background="background"
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:layout="layout"
:page-sizes="pageSizes"
:pager-count="pagerCount"
:total="total"
v-bind="$attrs"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import { scrollTo } from '@/utils/scroll-to'
export default {
name: 'pageInfo',
props: {
total: {
required: true,
type: Number
},
page: {
type: Number,
default: 1
},
limit: {
type: Number,
default: 20
},
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 50]
}
},
// 5
pagerCount: {
type: Number,
default: document.body.clientWidth < 992 ? 5 : 7
},
layout: {
type: String,
default: 'prev, pager, next'
},
background: {
type: Boolean,
default: true
},
autoScroll: {
type: Boolean,
default: true
},
hidden: {
type: Boolean,
default: false
}
},
data() {
return {
};
},
computed: {
currentPage: {
get() {
return this.page
},
set(val) {
this.$emit('update:page', val)
}
},
pageSize: {
get() {
return this.limit
},
set(val) {
this.$emit('update:limit', val)
}
}
},
methods: {
handleSizeChange(val) {
if (this.currentPage * val > this.total) {
this.currentPage = 1
}
this.$emit('pagination', { page: this.currentPage, limit: val })
if (this.autoScroll) {
scrollTo(0, 800)
}
},
handleCurrentChange(val) {
this.$emit('pagination', { page: val, limit: this.pageSize })
if (this.autoScroll) {
scrollTo(0, 800)
}
}
}
}
</script>
<style scoped>
.pagination-container {
background: transparent;
}
.pagination-container.hidden {
display: none;
}
</style>

4
kcui/src/main.js

@ -5,8 +5,8 @@ import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from '../src/router/router.js'
import pageInfo from "@/components/Pagination";
Vue.component('pageInfo', pageInfo)
Vue.config.productionTip = false
Vue.use(ElementUI);

58
kcui/src/utils/scroll-to.js

@ -0,0 +1,58 @@
Math.easeInOutQuad = function(t, b, c, d) {
t /= d / 2
if (t < 1) {
return c / 2 * t * t + b
}
t--
return -c / 2 * (t * (t - 2) - 1) + b
}
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
var requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
})()
/**
* Because it's so fucking difficult to detect the scrolling element, just move them all
* @param {number} amount
*/
function move(amount) {
document.documentElement.scrollTop = amount
document.body.parentNode.scrollTop = amount
document.body.scrollTop = amount
}
function position() {
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
}
/**
* @param {number} to
* @param {number} duration
* @param {Function} callback
*/
export function scrollTo(to, duration, callback) {
const start = position()
const change = to - start
const increment = 20
let currentTime = 0
duration = (typeof (duration) === 'undefined') ? 500 : duration
var animateScroll = function() {
// increment the time
currentTime += increment
// find the value with the quadratic in-out easing function
var val = Math.easeInOutQuad(currentTime, start, change, duration)
// move the document.body
move(val)
// do the animation unless its over
if (currentTime < duration) {
requestAnimFrame(animateScroll)
} else {
if (callback && typeof (callback) === 'function') {
// the animation is done so lets callback
callback()
}
}
}
animateScroll()
}

269
kcui/src/view/DhInfo.vue

@ -62,7 +62,7 @@
<img v-if="dhType1==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%;font-size: 0.9vw;">
{{ item }}
</div>
</div>
@ -75,8 +75,8 @@
<div
style="width: 100%;height: 100%;display: flex;flex-direction: row;line-height: 2.9vw;text-align: center;color: #ffffff;">
<div style="width: 10%;">序号</div>
<div style="width: 20%;">标题</div>
<div style="width: 10%;">详情</div>
<div style="width: 30%;">标题</div>
<div style="width: 20%;">详情</div>
<div style="width: 10%;">操作</div>
</div>
</div>
@ -86,8 +86,8 @@
<div
style="width: 100%;height: 100%;display: flex;flex-direction: row;line-height: 2.9vw;text-align: center;color: #ffffff;">
<div style="width: 10%;">序号</div>
<div style="width: 20%;">标题</div>
<div style="width: 10%;">详情</div>
<div style="width: 30%;">标题</div>
<div style="width: 20%;">详情</div>
</div>
</div>
</div>
@ -95,37 +95,35 @@
<div class="rightListContent" v-if="this.userType==0">
<div class="oneRight" v-for="item in contentList" :key="item">
<div style="width: 8%;">{{ item.id }}</div>
<div style="width: 22%;">{{ item.name }}</div>
<div style="width: 10%;text-decoration: underline;font-style: italic;" @click="goXq(item.id)">
<div style="width: 10%;">{{ item.id }}</div>
<div style="width: 30%;">{{ item.name }}</div>
<div style="width: 20%;text-decoration: underline;font-style: italic;" @click="goXq(item.id)">
点击查看详情
</div>
</div>
</div>
<div class="rightListContent" v-if="this.userType==1">
<div class="oneRight" v-for="item in contentList" :key="item">
<div style="width: 8%;">{{ item.id }}</div>
<div style="width: 22%;">{{ item.name }}</div>
<div style="width: 10%;text-decoration: underline;font-style: italic;" @click="goXq(item.id)">
<div style="width: 10%;">{{ item.id }}</div>
<div style="width: 30%;">{{ item.name }}</div>
<div style="width: 20%;text-decoration: underline;font-style: italic;" @click="goXq(item.id)">
点击查看详情
</div>
<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>
style="width: 10%;text-decoration: underline;font-style: italic;display: flex;justify-content: space-around;">
<div @click="editDh(item.id)">修改</div>
</div>
</div>
</div>
<div class="pageList">
<div style="float: left;margin-right: 0.1vw;" @click="choosePage(onePagesList[0]-1)">...</div>
<div v-for="item in onePagesList" :key="item" @click="choosePage(item)" style="margin-left: 1vw;">
<img src="../assets/img/pageChoose.png" style="position: absolute;z-index: -1">
<div style="width: 1.2vw;height: 1.2vw;margin-top: 0.15vw;font-size: 0.5vw;
text-align: center;line-height: 1.2vw;margin-right: 1vw;">
{{ item }}
</div>
</div>
<div style="float: left;margin-left: 0.1vw;">...</div>
<page-info
style="margin-left: 1vw;"
v-show="total>0"
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="getContentList()"
/>
</div>
</div>
</div>
@ -138,26 +136,48 @@
<el-dialog :visible.sync="openInfo" title="文章修改">
<el-form :model="form" label-width="80px">
<el-form-item label="动名称">
<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>
<el-form-item label="类型" >
<el-select v-model="form.dwType" 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="飞机类型" >
<el-select v-model="form.dhParam.fjlx" placeholder="请选择飞机类型">
<el-option label="直9" value="直9"></el-option>
<el-option label="直9-C" value="直9-C"></el-option>
<el-option label="卡式机" value="卡式机"></el-option>
</el-select>
</el-form-item>
<el-form-item label="飞机任务" >
<el-select v-model="form.dhParam.rwlx" placeholder="请选择任务类型">
<el-option label="侦察" value="侦察"></el-option>
<el-option label="巡逻" value="巡逻"></el-option>
<el-option label="作战" value="作战"></el-option>
</el-select>
</el-form-item>
<el-form-item label="飞机载荷">
<el-select v-model="form.dhParam.zhlx" placeholder="请选择载荷类型">
<el-option label="鱼雷" value="鱼雷"></el-option>
<el-option label="侦察设备" value="侦察设备"></el-option>
<el-option label="导弹" value="导弹"></el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative;margin-top: 5vw;" label="相关图片">
<el-upload
action="http://127.0.0.1:10031/fileUpdate/upload"
list-type="picture-card"
:on-remove="handleRemove"
:file-list="fileList"
:multiple="true"
:limit="9"
:on-exceed="handleExceed"
:before-upload="beforeUpload"
:on-success="handleSuccess"
:on-error="handleError">
<i class="el-icon-plus"></i>
</el-upload>
<el-form-item label="风速">
<el-input v-model="form.dhParam.fs" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="能见度">
<el-input v-model="form.dhParam.njd" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="湿度">
<el-input v-model="form.dhParam.sd" autocomplete="off"></el-input>
</el-form-item>
</el-form>
@ -176,13 +196,11 @@
import headInfo from '@/components/Head.vue';
import Foot from "@/components/Foot.vue";
import {editInfo, getDhList, getInfo} from "@/api/kcInfo";
import Editor from "@/components/Editor.vue";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'DhInfo',
components: {
Editor,
Foot, headInfo
},
data() {
@ -213,13 +231,17 @@ export default {
form: {
name: "",
contentInfo: "",
dwType:"",
dhParam: {
fjlx:"",
rwlx:"",
zhlx:"",
fs:"",
njd:"",
sd:"",
},
},
TxtValue: "",
id: 0,
fileList: [], //
isUpload:0,
}
},
@ -237,16 +259,10 @@ export default {
}
this.getContentList();
},
choosePage(item) {
console.log(item);
this.pageNum = item;
this.getContentList();
},
getContentList() {
console.log("djaksjdklajsdk")
var data = {
name: this.selectName,
dhType: this.dhType,
dwType: this.dhType,
pageNum: this.pageNum,
pageSize: this.pageSize
}
@ -257,46 +273,12 @@ export default {
this.contentList = res.data.list;
this.total = res.data.total;
this.totalPage = res.data.totalPages;
var aaa = 0;
this.onePagesList = [];
this.pagesList = [];
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 == 3) {
break;
}
}
}
}
}else {
if(res.msg=="token无效")
localStorage.clear();
this.$router.push('/')
}
})
},
goXq(id) {
@ -308,104 +290,36 @@ export default {
})
},
//
deleteTw() {
console.log("这是删除操作")
},
editTw(id) {
editDh(id) {
//
var data = {
id: id
}
getInfo(data).then((res) => {
var dhParam = JSON.parse(res.data.data.dwUrl)
this.openInfo = true;
this.form.contentInfo = res.data.data.contentInfo
this.form.name = res.data.data.name
this.TxtValue = res.data.data.contentInfo;
this.form.name = res.data.data.name;
this.form.dwType = res.data.data.dwType;
this.form.dhParam.fjlx = dhParam.fjlx;
this.form.dhParam.rwlx = dhParam.rwlx;
this.form.dhParam.zhlx = dhParam.zhlx;
this.form.dhParam.fs = dhParam.fs;
this.form.dhParam.njd = dhParam.njd;
this.form.dhParam.sd = dhParam.sd;
this.id = id;
var imgs = res.data.data.imgList;
console.log(imgs)
for (let j = 0; j < imgs.length; j++) {
var ii = {
uuid:imgs[j].imgId,
url:imgs[j].imgUrl
}
this.fileList.push(ii)
}
console.log(res);
})
},
//
//
handleRemove(file, fileList) {
console.log('File removed:', file);
console.log('Current fileList:', fileList);
},
//
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 9 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
//
beforeUpload(file) {
const isJPGorPNG = file.type === 'image/jpeg' || file.type === 'image/png';
const isLt2M = file.size / 1024 / 1024 < 10; // 2MB
if (!isJPGorPNG) {
this.$message.error('上传图片只能是 JPG/PNG 格式!');
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 2MB!');
}
return isJPGorPNG && isLt2M;
},
//
handleSuccess(response, file, fileList) {
console.log('Upload success:', response);
// fileList
console.log(fileList)
this.fileList = fileList;
this.isUpload = 1;
},
//
// eslint-disable-next-line no-unused-vars
handleError(err, file, fileList) {
console.log('Upload error:', err);
this.$message.error('上传失败,请重试!');
},
submitInfo() {
console.log(this.fileList);
var urlStr = "";
for (let f = 0; f < this.fileList.length; f++) {
if (f == 0) {
if(this.fileList[f].response!=null){
urlStr = this.fileList[f].response.data.url
}else {
urlStr = this.fileList[f].url
}
} else {
if(this.fileList[f].response!=null){
urlStr = urlStr + "," + this.fileList[f].response.data.url
}else {
urlStr = urlStr + "," + this.fileList[f].url
}
}
}
var dhParamInfo = JSON.stringify(this.form.dhParam);
var data = {
name: this.form.name,
contentInfo: this.TxtValue,
imgs: urlStr,
id: this.id
id: this.id,
type: 3,
dwType: this.form.dwType,
dwUrl:dhParamInfo,
}
editInfo(data).then((res) => {
console.log(res);
@ -540,16 +454,15 @@ export default {
}
.pageList {
height: 1.5vw;
width: 20%;
//background-color: pink;
margin: 1% 40%;
height: 2vw;
width: 100%;
position: absolute;
z-index: 2;
bottom: -0.5%;
bottom: 0.2vw;
display: flex;
flex-direction: row;
color: #ffffff;
justify-content: center;
}
.password-input-container {

328
kcui/src/view/Graph.vue

@ -300,6 +300,41 @@
</el-upload>
</el-form-item>
<el-form-item label="飞机类型" v-if="this.typeValue=='dh'">
<el-select v-model="dhParam.fjlx" placeholder="请选择飞机类型">
<el-option label="直9" value="直9"></el-option>
<el-option label="直9-C" value="直9-C"></el-option>
<el-option label="卡式机" value="卡式机"></el-option>
</el-select>
</el-form-item>
<el-form-item label="飞机任务" v-if="this.typeValue=='dh'">
<el-select v-model="dhParam.rwlx" placeholder="请选择任务类型">
<el-option label="侦察" value="侦察"></el-option>
<el-option label="巡逻" value="巡逻"></el-option>
<el-option label="作战" value="作战"></el-option>
</el-select>
</el-form-item>
<el-form-item label="飞机载荷" v-if="this.typeValue=='dh'">
<el-select v-model="dhParam.zhlx" placeholder="请选择载荷类型">
<el-option label="鱼雷" value="鱼雷"></el-option>
<el-option label="侦察设备" value="侦察设备"></el-option>
<el-option label="导弹" value="导弹"></el-option>
</el-select>
</el-form-item>
<el-form-item label="风速" v-if="this.typeValue=='dh'">
<el-input v-model="dhParam.fs"></el-input>
</el-form-item>
<el-form-item label="能见度" v-if="this.typeValue=='dh'">
<el-input v-model="dhParam.njd"></el-input>
</el-form-item>
<el-form-item label="湿度" v-if="this.typeValue=='dh'">
<el-input v-model="dhParam.sd"></el-input>
</el-form-item>
<el-form-item label="父级节点ID" style="margin-top: 4vw;">
<el-input v-model="newBranchParentId" disabled></el-input>
</el-form-item>
@ -342,6 +377,37 @@
<el-form-item label="节点名称">
<el-input v-model="editName"></el-input>
</el-form-item>
<el-form-item label="飞机类型" v-if="this.editType=='dh'">
<el-select v-model="editDhParam.fjlx" placeholder="请选择飞机类型">
<el-option label="直9" value="直9"></el-option>
<el-option label="直9-C" value="直9-C"></el-option>
<el-option label="卡式机" value="卡式机"></el-option>
</el-select>
</el-form-item>
<el-form-item label="飞机任务" v-if="this.editType=='dh'">
<el-select v-model="editDhParam.rwlx" placeholder="请选择任务类型">
<el-option label="侦察" value="侦察"></el-option>
<el-option label="巡逻" value="巡逻"></el-option>
<el-option label="作战" value="作战"></el-option>
</el-select>
</el-form-item>
<el-form-item label="飞机载荷" v-if="this.editType=='dh'">
<el-select v-model="editDhParam.zhlx" placeholder="请选择载荷类型">
<el-option label="鱼雷" value="鱼雷"></el-option>
<el-option label="侦察设备" value="侦察设备"></el-option>
<el-option label="导弹" value="导弹"></el-option>
</el-select>
</el-form-item>
<el-form-item label="风速" v-if="this.editType=='dh'">
<el-input v-model="editDhParam.fs"></el-input>
</el-form-item>
<el-form-item label="能见度" v-if="this.editType=='dh'">
<el-input v-model="editDhParam.njd"></el-input>
</el-form-item>
<el-form-item label="湿度" v-if="this.editType=='dh'">
<el-input v-model="editDhParam.sd"></el-input>
</el-form-item>
<el-form-item style="position: relative ;margin-bottom: 5vw;" label="节点内容" v-if="this.editType=='tw'">
<Editor v-model="this.editContent" style="height: 6vw;"></Editor>
</el-form-item>
@ -502,7 +568,7 @@
<script>
import headInfo from '@/components/Head.vue';
import Foot from "@/components/Foot.vue";
import {editInfoGraph, getDocList, getInfo, getTwInfo} from "@/api/kcInfo";
import {editInfoGraph,getInfo} from "@/api/kcInfo";
import {getgraphInfo} from "@/api/login";
import VisGraph from '@/assets/js/graphvis.min.20241008.js'
import LayoutFactory from '@/assets/js/graphvis.layout.min.js'
@ -512,14 +578,7 @@ import Editor from "@/components/Editor.vue";
import {getToken} from "@/utils/auth";
import {twdelete} from "@/api/twdelete";
import {exportToWord, getBaoGaoInfo} from "@/api/baogao";
import Docxtemplater from "docxtemplater"
import PizZip from "pizzip"
import PizZipUtils from "pizzip/utils/index.js"
import {saveAs} from "file-saver"
function loadFile(url, callback) {
PizZipUtils.getBinaryContent(url, callback)
}
export default {
// eslint-disable-next-line vue/multi-word-component-names
@ -527,6 +586,18 @@ export default {
components: {Editor, Foot, headInfo},
data() {
return {
twTypeList: ["全部", "海洋大气", "海洋文学", "海洋地理", "复杂水声", "复杂电磁"],
//
dhParam:{
fjlx:"",
rwlx:"",
zhlx:"",
fs:0,
njd:0,
sd:0
},
clickEdit: 0,
typePic1: 0,
@ -544,8 +615,6 @@ export default {
{id: 5, name: "帮助文档", info: "Help"}
],
page: "知识图谱",
typeList: ["海洋大气", "海洋文学", "海洋地理", "复杂水声", "复杂电磁"],
contentList: [],
selectName: "",
twType: "",
pageSize: 6,
@ -611,7 +680,7 @@ export default {
label: '导弹'
}, {
value: '2',
label: '侦察'
label: '侦察设备'
}],
value3: '',
@ -646,6 +715,7 @@ export default {
editFileId: 0,
editContent: 0,
editRelation: "",
editDhParam:{},
//
@ -729,7 +799,6 @@ export default {
"content": this.baoContent,
}
exportToWord(data).then((res) => {
console.log(res);
const link = document.createElement('a');
link.href = res.url;
document.body.appendChild(link);
@ -738,51 +807,7 @@ export default {
window.URL.revokeObjectURL(res.url);
})
},
downLoadWord1() {
this.clickEdit = 2;
console.log(this)
this.contentData.content = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"></head>" + this.baoContent + "</html>";
let self = this.contentData
loadFile(
"moban.docx",
function (error, content) {
console.log(content)
if (error) {
throw error
}
const zip = new PizZip(content)
const doc = new Docxtemplater(zip, {
paragraphLoop: true,
linebreaks: true,
})
// render the document (replace all occurences of {first_name} by John, {last_name} by Doe, ...)
doc.render({
content: self.content,
})
const out = doc.getZip().generate({
type: "blob",
mimeType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
})
let formData = new FormData() //formdata
const chunkfile = new File([out], '数据统计.docx')
formData.append('file', chunkfile) //
//formData api
saveAs(out, "output.docx")
// exportBaoGaoFile(formData).then(res => {
// console.log(res);
// if (res.data.code == 200) {
// console.log(res);
// }
// })
// Output the document using Data-URI
// saveAs(out, "output.docx")
}
)
},
cancelBaoGao() {
this.editBaoGao = false;
this.shengOpen = true;
@ -875,44 +900,16 @@ export default {
"five": five,
"six": six,
"seven": seven
}
//
getBaoGaoInfo(data).then((res) => {
console.log(res);
this.baoContent = res;
})
},
changeType1() {
if (this.typePic1 == 0) {
this.typePic1 = 1;
} else {
this.typePic1 = 0
}
},
changeType2() {
if (this.typePic2 == 0) {
this.typePic2 = 1;
} else {
this.typePic2 = 0
}
},
changeType3() {
if (this.typePic3 == 0) {
this.typePic3 = 1;
} else {
this.typePic3 = 0
}
},
//
selectGraph() {
console.log("jksajdklaj-----走这里")
},
openFileInput() {
//
@ -947,58 +944,6 @@ export default {
console.log(info)
this.$router.push('/' + info)
},
changeType(item) {
this.twType = item;
this.getContentList();
},
choosePage(item) {
console.log(item);
this.pageNum = item;
this.getContentList();
},
getContentList() {
var data = {
name: this.selectName,
twType: this.twType,
pageNum: this.pageNum,
pageSize: this.pageSize
}
getDocList(data).then((res) => {
console.log(res);
this.contentList = res.data.list;
this.total = res.data.total;
this.totalPage = res.data.totalPages;
var aaa = 0;
this.onePagesList = [];
this.pagesList = [];
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;
}
}
}
console.log(this.onePagesList)
})
},
goXq(id) {
var data = {
id: id
}
getTwInfo(data).then((res) => {
this.$router.push({path: '/TwInfoXq', query: {id: id, level: res.data.level, type: "tw"}})
})
},
//
deleteTw() {
@ -1015,17 +960,6 @@ export default {
}
})
},
editTw(id) {
//
var data = {
id: id
}
getTwInfo(data).then((res) => {
console.log(res.data)
})
},
onCreated(editor) {
this.editor = Object.seal(editor) // Object.seal()
},
@ -1048,8 +982,6 @@ export default {
this.zhengl(res.data);
})
}
},
getInfo1() {
this.graphData = undefined;
@ -1064,17 +996,13 @@ export default {
this.zhengl(res.data);
})
} else {
this.visGraph.clearAll();
let params = {};
getgraphInfo(params).then((res) => {
this.zhengl(res.data);
})
}
},
async drawGraphData() {
this.graphData = this.demoData;
if (this.visGraph === null) {
@ -1090,7 +1018,6 @@ export default {
this.reLayout();
}
this.loading = false;
},
//
createGraph() {
@ -1111,16 +1038,12 @@ export default {
// eslint-disable-next-line no-unused-vars
async showPopup(node) {
this.isModalVisible = true; //
this.nodeInfo = node.properties;
},
async openAdd() {
this.selectedNode = this.nodeInfo;
this.newBranchParentId = this.nodeInfo.docId;
this.newBranchLevel = parseInt(this.nodeInfo.leve) + 1;
try {
const response = await this.getFileIdByDocId({docId: this.nodeInfo.docId});
@ -1180,6 +1103,17 @@ export default {
this.showVideoPath = res.data.data.spUrl;
}
}
if (this.editType == 'dh') {
var dhParam = JSON.parse(res.data.data.dwUrl)
this.editDhParam = {
fjlx:dhParam.fjlx,
rwlx:dhParam.rwlx,
zhlx:dhParam.zhlx,
fs:dhParam.fs,
njd:dhParam.njd,
sd:dhParam.sd
};
}
});
@ -1275,6 +1209,36 @@ export default {
}
}
if (this.editType == 'dh'){
const content = this.editName.trim();
const relation = this.editRelation.trim();
var dwurl = JSON.stringify(this.editDhParam);
const data = {
id: this.nodeInfo.docId,
type: 3,
name: content,
relation: relation,
parentId: this.editParentId,
level: this.editLeve,
dwUrl: dwurl
};
try {
editInfoGraph(data).then((res) => {
console.log(res);
this.isModalVisible2 = false;
})
//
this.visGraph.drawData(this.graphData);
this.reLayout();
} catch (error) {
console.error('Failed to add new branch:', error);
alert('Failed to add new branch. Please try again.');
}
}
},
@ -1452,6 +1416,53 @@ export default {
}
}
//
if (this.typeValue == 'dh'){
const content = this.newBranchContent.trim();
const relation = this.newBranchRelation.trim();
var dhParamInfo = JSON.stringify(this.dhParam);
if (this.selectedNode && content) {
//
const data = {
nodeType: this.typeValue,
txtName: content,
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel,
DhParams: dhParamInfo
};
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) {
@ -1645,7 +1656,6 @@ export default {
mounted() {
this.userType = localStorage.getItem("type");
this.userName = localStorage.getItem("name");
this.getContentList();
this.getInfo();
},
created() {

28
kcui/src/view/JsInfo.vue

@ -118,15 +118,14 @@
</div>
</div>
<div class="pageList">
<div style="float: left;margin-right: 0.1vw;" @click="choosePage(onePagesList[0]-1)">...</div>
<div v-for="item in onePagesList" :key="item" @click="choosePage(item)" style="margin-left: 1vw;">
<img src="../assets/img/pageChoose.png" style="position: absolute;z-index: -1">
<div style="width: 1.2vw;height: 1.2vw;margin-top: 0.15vw;font-size: 0.5vw;
text-align: center;line-height: 1.2vw;margin-right: 1vw;">
{{ item }}
</div>
</div>
<div style="float: left;margin-left: 0.1vw;">...</div>
<page-info
style="margin-left: 1vw;"
v-show="total>0"
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="getContentList()"
/>
</div>
</div>
</div>
@ -536,16 +535,15 @@ export default {
}
.pageList {
height: 1.5vw;
width: 20%;
//background-color: pink;
margin: 1% 40%;
height: 2vw;
width: 100%;
position: absolute;
z-index: 2;
bottom: -0.5%;
bottom: 0.2vw;
display: flex;
flex-direction: row;
color: #ffffff;
justify-content: center;
}

30
kcui/src/view/SpInfo.vue

@ -62,7 +62,7 @@
<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%;font-size: 0.9vw;">
{{ item }}
</div>
</div>
@ -128,15 +128,14 @@
</div>
</div>
<div class="pageList">
<div style="float: left;margin-right: 0.1vw;" @click="choosePage(onePagesList[0]-1)">...</div>
<div v-for="item in onePagesList" :key="item" @click="choosePage(item)" style="margin-left: 1vw;">
<img src="../assets/img/pageChoose.png" style="position: absolute;z-index: -1">
<div style="width: 1.2vw;height: 1.2vw;margin-top: 0.15vw;font-size: 0.5vw;
text-align: center;line-height: 1.2vw;margin-right: 1vw;">
{{ item }}
</div>
</div>
<div style="float: left;margin-left: 0.1vw;">...</div>
<page-info
style="margin-left: 1vw;"
v-show="total>0"
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="getContentList()"
/>
</div>
</div>
</div>
@ -619,16 +618,15 @@ export default {
}
.pageList {
height: 1.5vw;
width: 20%;
//background-color: pink;
margin: 1% 40%;
height: 2vw;
width: 100%;
position: absolute;
z-index: 2;
bottom: -0.5%;
bottom: 0.2vw;
display: flex;
flex-direction: row;
color: #ffffff;
justify-content: center;
}

99
kcui/src/view/TWInfo.vue

@ -14,7 +14,7 @@
<div class="leftBox2">
<div class="muluBox">
<div class="muluList">
<div v-for="item in mulu" :key="item">
<div v-for="item in mulu" :key="item.id">
<div class="oneMulu" v-if="page!=item.name" @click="goInfo(item.info)">
<div style="width: 80%;text-align: center;">{{ item.name }}</div>
<img src="../assets/img/jiantou.png"
@ -64,7 +64,7 @@
<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;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%;font-size: 0.9vw;">
{{ item }}
</div>
</div>
@ -113,7 +113,7 @@
</div>
</div>
<div class="rightListContent" v-if="this.userType==1">
<div class="oneRight" v-for="item in contentList" :key="item">
<div class="oneRight" v-for="item in contentList" :key="item.id">
<div style="width: 8%;">{{ item.id }}</div>
<div style="width: 22%;">{{ item.name }}</div>
<div style="width: 60%;display: flex;flex-direction: row;">
@ -132,21 +132,29 @@
</div>
</div>
</div>
<div class="pageList">
<div style="float: left;margin-right: 0.1vw;" @click="choosePage(onePagesList[0]-1)">...</div>
<div v-for="item in onePagesList" :key="item" @click="choosePage(item)" style="margin-left: 1vw;">
<img src="../assets/img/pageChoose.png" style="position: absolute;z-index: -1">
<div style="width: 1.2vw;height: 1.2vw;margin-top: 0.15vw;font-size: 0.5vw;
text-align: center;line-height: 1.2vw;margin-right: 1vw;">
{{ item }}
</div>
</div>
<div style="float: left;margin-left: 0.1vw;">...</div>
<page-info
style="margin-left: 1vw;"
v-show="total>0"
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="getContentList()"
/>
</div>
</div>
</div>
</div>
<!-- <div style="float: left;margin-right: 0.1vw;" @click="choosePage(onePagesList[0]-1)">...</div>-->
<!-- <div v-for="item in onePagesList" :key="item" @click="choosePage(item)" style="margin-left: 1vw;">-->
<!-- <img src="../assets/img/pageChoose.png" style="position: absolute;z-index: -1">-->
<!-- <div style="width: 1.2vw;height: 1.2vw;margin-top: 0.15vw;font-size: 0.5vw;-->
<!-- text-align: center;line-height: 1.2vw;margin-right: 1vw;">-->
<!-- {{ item }}-->
<!-- </div>-->
<!-- </div>-->
<!-- <div style="float: left;margin-left: 0.1vw;">...</div>-->
<div style="width: 100%;height: 3%;position: fixed;bottom: 0px;">
<foot></foot>
@ -264,13 +272,8 @@ export default {
}
this.getContentList();
},
choosePage(item) {
console.log(item);
this.pageNum = item;
this.getContentList();
},
getContentList() {
console.log("djaksjdklajsdk")
var data = {
name: this.selectName,
twType: this.twType,
@ -279,49 +282,16 @@ export default {
}
getDocList(data).then((res) => {
if (res.code != 500) {
if(res.data.list!=undefined){
this.contentList = res.data.list;
this.total = res.data.total;
this.totalPage = res.data.totalPages;
var aaa = 0;
this.onePagesList = [];
this.pagesList = [];
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 == 3) {
break;
}
}
}
}
}else {
if(res.msg=="token无效")
localStorage.clear();
this.$router.push('/')
}
})
},
goXq(id) {
@ -333,18 +303,12 @@ export default {
})
},
//
deleteTw() {
console.log("这是删除操作")
},
editTw(id) {
//
var data = {
id: id
}
getInfo(data).then((res) => {
this.openInfo = true;
this.form.contentInfo = res.data.data.contentInfo
this.form.name = res.data.data.name
@ -354,7 +318,6 @@ export default {
var imgs = res.data.data.imgList;
console.log(imgs)
this.fileList = [];
for (let j = 0; j < imgs.length; j++) {
var ii = {
uuid: imgs[j].imgId,
@ -362,7 +325,6 @@ export default {
}
this.fileList.push(ii)
}
console.log(res);
})
@ -395,7 +357,6 @@ export default {
},
//
handleSuccess(response, file, fileList) {
console.log('Upload success:', response);
// fileList
console.log(fileList)
@ -409,7 +370,7 @@ export default {
this.$message.error('上传失败,请重试!');
},
submitInfo() {
console.log(this.fileList);
var urlStr = "";
for (let f = 0; f < this.fileList.length; f++) {
if (f == 0) {
@ -573,16 +534,15 @@ export default {
}
.pageList {
height: 1.5vw;
width: 20%;
//background-color: pink;
margin: 1% 40%;
height: 2vw;
width: 100%;
position: absolute;
z-index: 2;
bottom: -0.5%;
bottom: 0.2vw;
display: flex;
flex-direction: row;
color: #ffffff;
justify-content: center;
}
@ -613,4 +573,7 @@ input::placeholder {
opacity: 1; /* Firefox 默认将 placeholder 的透明度设置为 0.54 */
}
el-pagination is-background .number{
background-color: transparent !important;
}
</style>

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

@ -191,6 +191,13 @@ public class KcInfoController extends BaseController {
return AjaxResult.success(ajax);
}
if (aa.getType() == 3) {
System.out.println(aa);
ajax.put("data", aa);
return AjaxResult.success(ajax);
}
return AjaxResult.error();
@ -279,6 +286,24 @@ public class KcInfoController extends BaseController {
}
}
//视频
if (kcInfo.getType() == 3) {
Long id = kcInfo.getId();
String name = kcInfo.getName();
String dwUrl = kcInfo.getDwUrl();
KcInfo aa = kcFileMapper.selectById(id);
aa.setDwUrl(dwUrl);
aa.setName(name);
aa.setDwType(kcInfo.getDwType());
int a = kcFileMapper.updateDocById(aa);
if (a > 0) {
return AjaxResult.success();
} else {
return AjaxResult.error();
}
}
return AjaxResult.error();
@ -690,15 +715,15 @@ public class KcInfoController extends BaseController {
String name = kcInfo.getName();
String spUrl = kcInfo.getSpUrl();
KcInfo aa = kcFileMapper.selectById(id);
aa.setSpUrl(spUrl);
aa.setName(name);
aa.setSpType(kcInfo.getSpType());
KcInfo info = new KcInfo();
info.setLevel(kcInfo.getLevel());
info.setId(id);
info.setName(name);
info.setSpUrl(spUrl);
info.setSpType(kcInfo.getSpType());
String cql = "match (r{docId:'" + id + "'}) SET r.name = '" + name + "'";
@ -1012,6 +1037,337 @@ public class KcInfoController extends BaseController {
}
//视频
if (kcInfo.getType() == 3) {
Long id = kcInfo.getId();
String name = kcInfo.getName();
String dwUrl = kcInfo.getDwUrl();
KcInfo aa = kcFileMapper.selectById(id);
KcInfo info = new KcInfo();
info.setLevel(kcInfo.getLevel());
info.setId(id);
info.setName(name);
info.setDwUrl(dwUrl);
info.setName(name);
info.setDwType(kcInfo.getDwType());
String cql = "match (r{docId:'" + id + "'}) SET r.name = '" + name + "'";
StatementResult result1 = neo4jUtil.excuteCypherSql(cql);
//判断层级是不是修改
Long oldLevel = aa.getLevel();
if (oldLevel!=kcInfo.getLevel()) {
//查询下级
Long jj = kcInfo.getLevel() - oldLevel;
String newLevel = "leve" + kcInfo.getLevel();
List<KcInfo> list1 = kcFileMapper.getOneHeader(kcInfo.getId());
String cqlLevel = "match (r{docId:'" + kcInfo.getId() + "'}) SET r.leve = '" + newLevel + "'";
StatementResult resultLevel = neo4jUtil.excuteCypherSql(cqlLevel);
if (list1.size() != 0) {
for (int j = 0; j < list1.size(); j++) {
String newl = "";
if (list1.get(j).getLevel() == 1) {
newl = "leve" + (1 + jj);
}
if (list1.get(j).getLevel() == 2) {
newl = "leve" + (2 + jj);
}
if (list1.get(j).getLevel() == 3) {
newl = "leve" + (3 + jj);
}
if (list1.get(j).getLevel() == 4) {
newl = "leve" + (4 + jj);
}
if (list1.get(j).getLevel() == 5) {
newl = "leve" + (5 + jj);
}
if (list1.get(j).getLevel() == 6) {
newl = "leve" + (6 + jj);
}
if (list1.get(j).getLevel() == 7) {
newl = "leve" + (7 + jj);
}
String cqlLevel1 = "match (r{docId:'" + list1.get(j).getId() + "'}) SET r.leve = '" + newl + "'";
StatementResult resultLevel1 = neo4jUtil.excuteCypherSql(cqlLevel1);
list1.get(j).setLevel(list1.get(j).getLevel() + jj);
int a = kcFileMapper.updateDocById(list1.get(j));
List<KcInfo> list2 = kcFileMapper.getOneHeader(list1.get(j).getId());
if (list2.size() != 0) {
for (int j1 = 0; j1 < list2.size(); j1++) {
String newl1 = "";
if (list2.get(j1).getLevel() == 1) {
newl1 = "leve" + (1 + jj);
}
if (list2.get(j1).getLevel() == 2) {
newl1 = "leve" + (2 + jj);
}
if (list2.get(j1).getLevel() == 3) {
newl1 = "leve" + (3 + jj);
}
if (list2.get(j1).getLevel() == 4) {
newl1 = "leve" + (4 + jj);
}
if (list2.get(j1).getLevel() == 5) {
newl1 = "leve" + (5 + jj);
}
if (list2.get(j1).getLevel() == 6) {
newl1 = "leve" + (6 + jj);
}
if (list2.get(j1).getLevel() == 7) {
newl1 = "leve" + (7 + jj);
}
String cqlLevel2 = "match (r{docId:'" + list2.get(j1).getId() + "'}) SET r.leve = '" + newl1 + "'";
StatementResult resultLevel2 = neo4jUtil.excuteCypherSql(cqlLevel2);
list2.get(j1).setLevel(list2.get(j1).getLevel() + jj);
int a2 = kcFileMapper.updateDocById(list2.get(j1));
List<KcInfo> list3 = kcFileMapper.getOneHeader(list2.get(j1).getId());
if (list3.size() != 0) {
for (int j2 = 0; j2 < list3.size(); j2++) {
String newl2 = "";
if (list3.get(j2).getLevel() == 1) {
newl2 = "leve" + (1 + jj);
}
if (list3.get(j2).getLevel() == 2) {
newl2 = "leve" + (2 + jj);
}
if (list3.get(j2).getLevel() == 3) {
newl2 = "leve" + (3 + jj);
}
if (list3.get(j2).getLevel() == 4) {
newl2 = "leve" + (4 + jj);
}
if (list3.get(j2).getLevel() == 5) {
newl2 = "leve" + (5 + jj);
}
if (list3.get(j2).getLevel() == 6) {
newl2 = "leve" + (6 + jj);
}
if (list3.get(j2).getLevel() == 7) {
newl2 = "leve" + (7 + jj);
}
String cqlLevel3 = "match (r{docId:'" + list3.get(j2).getId() + "'}) SET r.leve = '" + newl2 + "'";
StatementResult resultLevel3 = neo4jUtil.excuteCypherSql(cqlLevel3);
list3.get(j2).setLevel(list3.get(j2).getLevel() + jj);
int a3 = kcFileMapper.updateDocById(list3.get(j2));
List<KcInfo> list4 = kcFileMapper.getOneHeader(list3.get(j2).getId());
if (list4.size() != 0) {
for (int j3 = 0; j3 < list4.size(); j3++) {
String newl3 = "";
if (list4.get(j3).getLevel() == 1) {
newl3 = "leve" + (1 + jj);
}
if (list4.get(j3).getLevel() == 2) {
newl3 = "leve" + (2 + jj);
}
if (list4.get(j3).getLevel() == 3) {
newl3 = "leve" + (3 + jj);
}
if (list4.get(j3).getLevel() == 4) {
newl3 = "leve" + (4 + jj);
}
if (list4.get(j3).getLevel() == 5) {
newl3 = "leve" + (5 + jj);
}
if (list4.get(j3).getLevel() == 6) {
newl3 = "leve" + (6 + jj);
}
if (list4.get(j3).getLevel() == 7) {
newl3 = "leve" + (7 + jj);
}
String cqlLevel4 = "match (r{docId:'" + list4.get(j3).getId() + "'}) SET r.leve = '" + newl3 + "'";
StatementResult resultLevel4 = neo4jUtil.excuteCypherSql(cqlLevel4);
list4.get(j3).setLevel(list4.get(j3).getLevel() + jj);
int a4 = kcFileMapper.updateDocById(list4.get(j3));
List<KcInfo> list5 = kcFileMapper.getOneHeader(list4.get(j3).getId());
if (list5.size() != 0) {
for (int j4 = 0; j4 < list5.size(); j4++) {
String newl4 = "";
if (list5.get(j4).getLevel() == 1) {
newl4 = "leve" + (1 + jj);
}
if (list5.get(j4).getLevel() == 2) {
newl4 = "leve" + (2 + jj);
}
if (list5.get(j4).getLevel() == 3) {
newl4 = "leve" + (3 + jj);
}
if (list5.get(j4).getLevel() == 4) {
newl4 = "leve" + (4 + jj);
}
if (list5.get(j4).getLevel() == 5) {
newl4 = "leve" + (5 + jj);
}
if (list5.get(j4).getLevel() == 6) {
newl4 = "leve" + (6 + jj);
}
if (list5.get(j4).getLevel() == 7) {
newl4 = "leve" + (7 + jj);
}
String cqlLevel5 = "match (r{docId:'" + list5.get(j4).getId() + "'}) SET r.leve = '" + newl4 + "'";
StatementResult resultLevel5 = neo4jUtil.excuteCypherSql(cqlLevel5);
list5.get(j4).setLevel(list5.get(j4).getLevel() + jj);
int a5 = kcFileMapper.updateDocById(list5.get(j4));
List<KcInfo> list6 = kcFileMapper.getOneHeader(list5.get(j4).getId());
if (list6.size() != 0) {
for (int j5 = 0; j5 < list6.size(); j5++) {
String newl5 = "";
if (list6.get(j5).getLevel() == 1) {
newl5 = "leve" + (1 + jj);
}
if (list6.get(j5).getLevel() == 2) {
newl5 = "leve" + (2 + jj);
}
if (list6.get(j5).getLevel() == 3) {
newl5 = "leve" + (3 + jj);
}
if (list6.get(j5).getLevel() == 4) {
newl5 = "leve" + (4 + jj);
}
if (list6.get(j5).getLevel() == 5) {
newl5 = "leve" + (5 + jj);
}
if (list6.get(j5).getLevel() == 6) {
newl5 = "leve" + (6 + jj);
}
if (list6.get(j5).getLevel() == 7) {
newl5 = "leve" + (7 + jj);
}
String cqlLevel6 = "match (r{docId:'" + list6.get(j5).getId() + "'}) SET r.leve = '" + newl5 + "'";
StatementResult resultLevel6 = neo4jUtil.excuteCypherSql(cqlLevel6);
list6.get(j5).setLevel(list6.get(j5).getLevel() + jj);
int a6 = kcFileMapper.updateDocById(list6.get(j5));
List<KcInfo> list7 = kcFileMapper.getOneHeader(list6.get(j5).getId());
if (list7.size() != 0) {
for (int j6 = 0; j6 < list7.size(); j6++) {
String newl6 = "";
if (list7.get(j6).getLevel() == 1) {
newl6 = "leve" + (1 + jj);
}
if (list7.get(j6).getLevel() == 2) {
newl6 = "leve" + (2 + jj);
}
if (list7.get(j6).getLevel() == 3) {
newl6 = "leve" + (3 + jj);
}
if (list7.get(j6).getLevel() == 4) {
newl6 = "leve" + (4 + jj);
}
if (list7.get(j6).getLevel() == 5) {
newl6 = "leve" + (5 + jj);
}
if (list7.get(j6).getLevel() == 6) {
newl6 = "leve" + (6 + jj);
}
if (list7.get(j6).getLevel() == 7) {
newl6 = "leve" + (7 + jj);
}
String cqlLevel7 = "match (r{docId:'" + list7.get(j6).getId() + "'}) SET r.docLeve = '" + newl6 + "'";
StatementResult resultLevel7 = neo4jUtil.excuteCypherSql(cqlLevel7);
list7.get(j6).setLevel(list7.get(j6).getLevel() + jj);
int a7 = kcFileMapper.updateDocById(list7.get(j6));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (aa.getParentId() != kcInfo.getParentId()) {
//修改上级
//修改relation
KcInfo zp = kcFileMapper.selectDocByIdId(kcInfo.getParentId());
KcInfoRelation r = new KcInfoRelation();
r.setSourceId(aa.getParentId());
r.setTargetId(id);
List<KcInfoRelation> aa1 = kcInfoRelationMapper.selectKcRelationshipList(r);
KcInfoRelation qq = aa1.get(0);
qq.setSourceId(kcInfo.getParentId());
qq.setSourceName(zp.getName());
qq.setRelation(kcInfo.getRelation());
int g = kcInfoRelationMapper.updateKcRelationship(qq);
//删除过去的这个关系
String cqrD = "MATCH (n:Doc{docId:'" + aa.getParentId() + "'})-[r]-(n2:Doc{docId:'" + id + "'}) DELETE r";
StatementResult resultD = neo4jUtil.excuteCypherSql(cqrD);
if (kcInfo.getRelation() != null && !kcInfo.getRelation().equals("")) {
String cqrC = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + kcInfo.getParentId() + "' AND b.docId = '" + kcInfo.getId() + "'CREATE (a)-[r:"+kcInfo.getRelation()+"{ name: '"+kcInfo.getRelation()+"'}] -> (b) RETURN r";
StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC);
} else {
String cqrC = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + kcInfo.getParentId() + "' AND b.docId = '" + kcInfo.getId() + "'CREATE (a)-[r:"+"属于"+"{ name: '属于'}] -> (b) RETURN r";
StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC);
}
}
else {
KcInfo zp = kcFileMapper.selectDocByIdId(kcInfo.getParentId());
KcInfoRelation r = new KcInfoRelation();
r.setSourceId(aa.getParentId());
r.setTargetId(id);
List<KcInfoRelation> aa1 = kcInfoRelationMapper.selectKcRelationshipList(r);
KcInfoRelation qq = aa1.get(0);
if(!qq.getRelation().equals(kcInfo.getRelation())){
qq.setSourceId(kcInfo.getParentId());
qq.setTargetId(kcInfo.getId());
qq.setRelation(kcInfo.getRelation());
int g = kcInfoRelationMapper.updateKcRelationship(qq);
//删除过去的这个关系
String cqrD = "MATCH (n:Doc{docId:'" + kcInfo.getParentId() + "'})-[r]-(n2:Doc{docId:'" + kcInfo.getId() + "'}) DELETE r";
StatementResult resultD = neo4jUtil.excuteCypherSql(cqrD);
if (kcInfo.getRelation() != null && !kcInfo.getRelation().equals("")) {
String cqrC = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + kcInfo.getParentId() + "' AND b.docId = '" + kcInfo.getId() + "'CREATE (a)-[r:"+kcInfo.getRelation()+"{ name: '"+kcInfo.getRelation()+"'}] -> (b) RETURN r";
StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC);
} else {
String cqrC = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + kcInfo.getParentId() + "' AND b.docId = '" + kcInfo.getId() + "'CREATE (a)-[r:"+"属于"+"{ name: '属于'}] -> (b) RETURN r";
StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC);
}
}
}
int a = kcFileMapper.updateDocById(info);
if (a > 0) {
return AjaxResult.success();
} else {
return AjaxResult.error();
}
}
return AjaxResult.error();

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

@ -1,12 +1,13 @@
package com.main.woka.Web.Controller;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.main.woka.Common.core.AjaxResult;
import com.main.woka.Common.util.Neo4jUtil;
import com.main.woka.Common.util.WebSocket;
import com.main.woka.Web.Dao.KcInfo;
import com.main.woka.Web.Dao.KcInfoRelation;
import com.main.woka.Web.Dao.KcTlFile;
import com.main.woka.Web.Dao.KcTwImg;
import com.main.woka.Web.Dao.*;
import com.main.woka.Web.Mapper.KcFileMapper;
import com.main.woka.Web.Mapper.KcInfoRelationMapper;
import com.main.woka.Web.Mapper.TwImgMapper;
@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.json.Json;
import javax.json.JsonObject;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
@ -417,6 +420,167 @@ public class KcTlFileController extends BaseController {
}
if(nodeType.equals("dh")){
String txtName = requestBody.get("txtName");
String relation = requestBody.get("relation");
Long parentId = Long.valueOf(requestBody.get("parentId"));
Long level = Long.valueOf(requestBody.get("level"));
String jsonString = requestBody.get("DhParams");
ObjectMapper objectMapper = new ObjectMapper();
KcInfo kcInfo = new KcInfo();
kcInfo.setCreateTime(new Date());
kcInfo.setName(txtName);
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setType(3l);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
try {
JsonNode jsonNode = objectMapper.readTree(jsonString);
String fjlx = jsonNode.get("fjlx").asText();
String rwlx = jsonNode.get("rwlx").asText();
String zhlx = jsonNode.get("zhlx").asText();
Double fs = jsonNode.get("fs").asDouble();
Double njd = jsonNode.get("njd").asDouble();
Double sd = jsonNode.get("sd").asDouble();
DhParam dp = new DhParam();
dp.setFjlx(fjlx);
dp.setRwlx(rwlx);
dp.setZhlx(zhlx);
dp.setFs(fs);
dp.setNjd(njd);
dp.setSd(sd);
String dhInfo = "";
ObjectMapper objectMapper1 = new ObjectMapper();
try {
String personString = objectMapper1.writeValueAsString(dp);
dhInfo = personString; // 输出类似: {"name":"John","age":30}
} catch (Exception e) {
e.printStackTrace();
}
kcInfo.setDwUrl(dhInfo);
kcFileMapper.insertDoc(kcInfo);
} catch (Exception e) {
e.printStackTrace();
}
//创建图谱
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.getDwUrl() != null && !kcInfo.getDwUrl().equals("")) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "dwUrl");
bb.put("value", String.valueOf(kcInfo.getDwUrl()));
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);
}
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") + "'})";
} 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());
//创建关系
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:"+relation+"{ name: '"+relation+"'}] -> (b) RETURN r";
StatementResult result2 = neo4jUtil.excuteCypherSql(cqr);
zz.setIsGraph(1l);
int yy1 = kcInfoRelationMapper.updateKcRelationship(zz);
}
return AjaxResult.success();
}

59
src/main/java/com/main/woka/Web/Dao/DhParam.java

@ -0,0 +1,59 @@
package com.main.woka.Web.Dao;
public class DhParam {
private String fjlx;
private String rwlx;
private String zhlx;
private Double fs;
private Double njd;
private Double sd;
public String getFjlx() {
return fjlx;
}
public void setFjlx(String fjlx) {
this.fjlx = fjlx;
}
public String getRwlx() {
return rwlx;
}
public void setRwlx(String rwlx) {
this.rwlx = rwlx;
}
public String getZhlx() {
return zhlx;
}
public void setZhlx(String zhlx) {
this.zhlx = zhlx;
}
public Double getFs() {
return fs;
}
public void setFs(Double fs) {
this.fs = fs;
}
public Double getNjd() {
return njd;
}
public void setNjd(Double njd) {
this.njd = njd;
}
public Double getSd() {
return sd;
}
public void setSd(Double sd) {
this.sd = sd;
}
}

9
src/main/java/com/main/woka/Web/Dao/KcInfo.java

@ -46,6 +46,15 @@ public class KcInfo {
//与上级关系
private String relation;
private String dhParam;
public String getDhParam() {
return dhParam;
}
public void setDhParam(String dhParam) {
this.dhParam = dhParam;
}
public String getRelation() {
return relation;

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

@ -123,10 +123,11 @@
<if test="type != null ">type = #{type},</if>
<if test="twUrl != null and twUrl != ''">tw_url = #{twUrl},</if>
<if test="spUrl != null and spUrl != ''">sp_url = #{spUrl},</if>
<if test="dwUrl != null and dwUrl != ''">dw_url = #{dwUrl},</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="dwType != null and dwType != ''">dw_type = #{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>

Loading…
Cancel
Save