Compare commits

...

2 Commits

  1. 13
      kcui/src/view/DhInfo.vue
  2. 220
      kcui/src/view/Graph.vue
  3. 191
      kcui/src/view/JsInfo.vue
  4. 356
      src/main/java/com/main/woka/Web/Controller/KcInfoController.java
  5. 132
      src/main/java/com/main/woka/Web/Controller/KcTlFileController.java

13
kcui/src/view/DhInfo.vue

@ -134,13 +134,13 @@
<foot></foot>
</div>
<el-dialog :visible.sync="openInfo" title="文章修改">
<el-dialog :visible.sync="openInfo" title="动画修改">
<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 label="类型" >
<el-select v-model="form.dwType" placeholder="请选择飞机类型">
<el-form-item label="动画类型" >
<el-select v-model="form.dwType" placeholder="请选择动画类型">
<el-option
v-for="item in typeList"
:key="item"
@ -247,7 +247,6 @@ export default {
},
methods: {
goInfo(info) {
console.log(info)
this.$router.push('/' + info)
},
changeType(item) {
@ -286,7 +285,9 @@ export default {
id: id
}
getInfo(data).then((res) => {
this.$router.push({path: '/DhInfoXq', query: {id: id, level: res.data.level, type: "tw"}})
//
console.log("--------动画信息--------")
console.log(res.data)
})
},
@ -322,7 +323,7 @@ export default {
}
editInfo(data).then((res) => {
console.log(res);
console.log(res)
this.openInfo = false;
this.getContentList();
})

220
kcui/src/view/Graph.vue

@ -236,12 +236,60 @@
<el-option label="图文" value="tw"></el-option>
<el-option label="视频" value="sp"></el-option>
<el-option label="动画" value="dh"></el-option>
<el-option label="计算模块" value="jsmk"></el-option>
<el-option label="计算模块" value="js"></el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="图文类别" v-if="this.typeValue=='tw'">
<el-select v-model="addTwType" placeholder="请选择类别">
<el-option
v-for="item in twTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="视频类别" v-if="this.typeValue=='sp'">
<el-select v-model="addSpType" placeholder="请选择类别">
<el-option
v-for="item in otherTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="动画类别" v-if="this.typeValue=='dh'">
<el-select v-model="addDhType" placeholder="请选择类别">
<el-option
v-for="item in otherTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="计算类别" v-if="this.typeValue=='js'">
<el-select v-model="addJsType" placeholder="请选择类别">
<el-option
v-for="item in otherTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="节点名称">
<el-input v-model="newBranchContent"></el-input>
</el-form-item>
<el-form-item label="计算模块地址" v-if="this.typeValue=='js'">
<el-input v-model="addJsInfo"></el-input>
</el-form-item>
<el-form-item style="position: relative ;" label="节点内容" v-if="this.typeValue=='tw'">
<Editor v-model="newBranchValue" style="height: 10vw;margin-bottom: 5vw;"></Editor>
</el-form-item>
@ -377,6 +425,62 @@
<el-form-item label="节点名称">
<el-input v-model="editName"></el-input>
</el-form-item>
<!-- 图文类型 -->
<el-form-item style="position: relative ;" label="图文类别" v-if="this.editType=='tw'">
<el-select v-model="editTwType" placeholder="请选择图文类别">
<el-option
v-for="item in twTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="视频类别" v-if="this.editType=='sp'">
<el-select v-model="editSpType" placeholder="请选择视频类别">
<el-option
v-for="item in otherTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="动画类别" v-if="this.editType=='dh'">
<el-select v-model="editDhType" placeholder="请选择类别">
<el-option
v-for="item in otherTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item style="position: relative ;" label="计算模块类别" v-if="this.editType=='js'">
<el-select v-model="editJsType" placeholder="请选择类别">
<el-option
v-for="item in otherTypeList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="计算模块地址" v-if="this.editType=='js'">
<el-input v-model="editJsInfo"></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>
@ -586,7 +690,15 @@ export default {
components: {Editor, Foot, headInfo},
data() {
return {
addTwType:"",
addSpType:"",
addDhType:"",
addJsType:"",
addJsInfo:"",
editJsInfo:"",
editJsType:"",
twTypeList: ["全部", "海洋大气", "海洋文学", "海洋地理", "复杂水声", "复杂电磁"],
otherTypeList: ["全部", "起降", "飞行", "通信载荷使用", "探测载荷使用", "攻击载荷使用"],
//
dhParam:{
fjlx:"",
@ -740,6 +852,11 @@ export default {
showOptions3: false,
selectedOption3: null,
//
editTwType:"",
editSpType:"",
editDhType:"",
}
@ -1081,6 +1198,7 @@ export default {
this.editFileId = res.data.data.fileId;
this.editRelation = res.data.data.relation;
if (this.editType == 'tw') {
this.editTwType = res.data.data.twType;
this.editContent = res.data.data.contentInfo;
var imgs = res.data.data.imgList;
console.log(imgs)
@ -1095,7 +1213,7 @@ export default {
}
}
if (this.editType == 'sp') {
console.log(res.data.data.spUrl)
this.editSpType = res.data.data.spType;
this.videoFileList = [];
this.showVideoPath = "";
if (res.data.data.spUrl != null) {
@ -1104,6 +1222,7 @@ export default {
}
}
if (this.editType == 'dh') {
this.editDhType = res.data.data.dwType;
var dhParam = JSON.parse(res.data.data.dwUrl)
this.editDhParam = {
fjlx:dhParam.fjlx,
@ -1114,7 +1233,11 @@ export default {
sd:dhParam.sd
};
}
if (this.editType == 'js'){
this.editJsInfo = res.data.data.jsInfo;
this.editJsType = res.data.data.jsType;
}
});
},
@ -1155,6 +1278,7 @@ export default {
level: this.editLeve,
type: 1,
imgs: urlStr,
twType:this.editTwType
};
try {
@ -1190,7 +1314,8 @@ export default {
relation: relation,
parentId: this.editParentId,
level: this.editLeve,
spUrl: this.videoFileList[0].url
spUrl: this.videoFileList[0].url,
spType:this.editSpType
};
try {
@ -1221,7 +1346,38 @@ export default {
relation: relation,
parentId: this.editParentId,
level: this.editLeve,
dwUrl: dwurl
dwUrl: dwurl,
dwType:this.editDhType
};
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.');
}
}
if (this.editType == 'js'){
const content = this.editName.trim();
const relation = this.editRelation.trim();
const data = {
id: this.nodeInfo.docId,
type: 4,
name: content,
relation: relation,
parentId: this.editParentId,
level: this.editLeve,
jsInfo: this.editJsInfo,
jsType:this.editJsType
};
try {
editInfoGraph(data).then((res) => {
@ -1335,7 +1491,8 @@ export default {
parentId: this.newBranchParentId,
level: this.newBranchLevel,
nodeType: 'tw',
imgs: urlStr
imgs: urlStr,
twType:this.addTwType
};
try {
@ -1383,7 +1540,8 @@ export default {
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel,
spUrl: this.videoFileList[0].url
spUrl: this.videoFileList[0].url,
spType:this.addSpType
};
try {
@ -1430,7 +1588,54 @@ export default {
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel,
DhParams: dhParamInfo
DhParams: dhParamInfo,
dwType:this.addDhType
};
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.');
}
}
}
if (this.typeValue == 'js'){
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,
jsType:this.addJsType,
jsInfo:this.addJsInfo
};
try {
@ -1680,6 +1885,7 @@ export default {
if (type == 2) {
that.$router.push({path: '/SpInfoXq', query: {id: res.data.data.id, type: "sp"}})
}
});
};
}

191
kcui/src/view/JsInfo.vue

@ -63,7 +63,8 @@
<img v-if="jsType1==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>
@ -76,8 +77,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>
@ -87,8 +88,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>
@ -96,23 +97,23 @@
<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>
style="width: 10%;text-decoration: underline;font-style: italic;display: flex;justify-content: space-around;">
<div @click="editJs(item.id)">修改</div>
</div>
</div>
@ -136,53 +137,43 @@
<foot></foot>
</div>
<el-dialog :visible.sync="openInfo" title="文章修改">
<!-- 计算模块详情修改 -->
<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.jsType" 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;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.jsInfo" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="margin-top: 2vw;">
<el-button @click="openInfo = false"> </el-button>
<el-button type="primary" @click="submitInfo"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import headInfo from '@/components/Head.vue';
import Foot from "@/components/Foot.vue";
import {editInfo, getJsList, getInfo} from "@/api/kcInfo";
import Editor from "@/components/Editor.vue";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'JsInfo',
components: {
Editor,
Foot, headInfo
},
data() {
@ -211,10 +202,10 @@ export default {
onePagesList: [],
openInfo: false,
form: {
name: "",
contentInfo: "",
jsType: "",
jsInfo: "",
},
TxtValue: "",
id: 0,
@ -235,16 +226,9 @@ export default {
} else {
this.jsType = this.jsType1
}
this.getContentList();
},
choosePage(item) {
console.log(item);
this.pageNum = item;
this.getContentList();
},
getContentList() {
console.log("djaksjdklajsdk")
var data = {
name: this.selectName,
jsType: this.jsType,
@ -253,44 +237,15 @@ export default {
}
getJsList(data).then((res) => {
if (res.code != 500) {
if(res.data.list!=undefined){
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;
}
}
}
console.log(this.onePagesList)
}
}else {
if(res.msg=="token无效")
} else {
if (res.msg == "token无效")
localStorage.clear();
this.$router.push('/')
}
@ -308,7 +263,7 @@ export default {
},
editTw(id) {
editJs(id) {
//
var data = {
id: id
@ -316,21 +271,10 @@ export default {
getInfo(data).then((res) => {
this.openInfo = true;
this.form.contentInfo = res.data.data.contentInfo
this.form.jsInfo = res.data.data.jsInfo
this.form.name = res.data.data.name
this.TxtValue = res.data.data.contentInfo;
this.form.jsType = res.data.data.jsType;
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);
})
@ -338,69 +282,16 @@ export default {
},
//
//
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 data = {
id: this.id,
type: 4,
name: this.form.name,
contentInfo: this.TxtValue,
imgs: urlStr,
id: this.id
jsInfo: this.form.jsInfo,
jsType: this.form.jsType,
}
editInfo(data).then((res) => {
console.log(res);

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

@ -197,6 +197,11 @@ public class KcInfoController extends BaseController {
ajax.put("data", aa);
return AjaxResult.success(ajax);
}
if (aa.getType() == 4) {
System.out.println(aa);
ajax.put("data", aa);
return AjaxResult.success(ajax);
}
return AjaxResult.error();
@ -287,7 +292,7 @@ public class KcInfoController extends BaseController {
}
//视频
//动画
if (kcInfo.getType() == 3) {
Long id = kcInfo.getId();
String name = kcInfo.getName();
@ -304,6 +309,23 @@ public class KcInfoController extends BaseController {
}
}
if (kcInfo.getType() == 4){
Long id = kcInfo.getId();
String name = kcInfo.getName();
String jsInfo = kcInfo.getJsInfo();
KcInfo aa = kcFileMapper.selectById(id);
aa.setJsInfo(jsInfo);
aa.setName(name);
aa.setJsType(kcInfo.getJsType());
int a = kcFileMapper.updateDocById(aa);
if (a > 0) {
return AjaxResult.success();
} else {
return AjaxResult.error();
}
}
return AjaxResult.error();
@ -1037,7 +1059,7 @@ public class KcInfoController extends BaseController {
}
//视频
//视频
if (kcInfo.getType() == 3) {
Long id = kcInfo.getId();
@ -1367,6 +1389,336 @@ public class KcInfoController extends BaseController {
}
//计算模块
if (kcInfo.getType() == 4){
Long id = kcInfo.getId();
String name = kcInfo.getName();
String jsInfo = kcInfo.getJsInfo();
KcInfo aa = kcFileMapper.selectById(id);
KcInfo info = new KcInfo();
info.setLevel(kcInfo.getLevel());
info.setId(id);
info.setName(name);
info.setJsInfo(jsInfo);
info.setName(name);
info.setJsType(kcInfo.getJsType());
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();

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

@ -142,6 +142,7 @@ public class KcTlFileController extends BaseController {
String txtName = requestBody.get("txtName");
String TxtValue = requestBody.get("TxtValue");
String relation = requestBody.get("relation");
String twType = requestBody.get("twType");
Long parentId = Long.valueOf(requestBody.get("parentId"));
Long level = Long.valueOf(requestBody.get("level"));
KcTlFile kcTlFile = kcFileMapper.getFileById(fileId);
@ -166,6 +167,7 @@ public class KcTlFileController extends BaseController {
kcInfo.setFileId(fileId);
kcInfo.setCreateTime(new Date());
kcInfo.setTwUrl(txtUrl);
kcInfo.setTwType(twType);
kcInfo.setName(txtName);
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
@ -302,6 +304,7 @@ public class KcTlFileController extends BaseController {
if(nodeType.equals("sp")){
String spUrl = requestBody.get("spUrl");
String spType = requestBody.get("spType");
String txtName = requestBody.get("txtName");
String relation = requestBody.get("relation");
Long parentId = Long.valueOf(requestBody.get("parentId"));
@ -314,6 +317,7 @@ public class KcTlFileController extends BaseController {
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setType(2l);
kcInfo.setSpType(spType);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
kcFileMapper.insertDoc(kcInfo);
@ -427,7 +431,7 @@ public class KcTlFileController extends BaseController {
String relation = requestBody.get("relation");
Long parentId = Long.valueOf(requestBody.get("parentId"));
Long level = Long.valueOf(requestBody.get("level"));
String dwType = requestBody.get("dwType");
String jsonString = requestBody.get("DhParams");
ObjectMapper objectMapper = new ObjectMapper();
@ -441,6 +445,7 @@ public class KcTlFileController extends BaseController {
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setType(3l);
kcInfo.setDwType(dwType);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
@ -582,6 +587,131 @@ public class KcTlFileController extends BaseController {
if(nodeType.equals("js")){
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 jsType = requestBody.get("jsType");
String jsInfo = requestBody.get("jsInfo");
KcInfo kcInfo = new KcInfo();
kcInfo.setCreateTime(new Date());
kcInfo.setName(txtName);
kcInfo.setParentId(parentId);
kcInfo.setLevel(level);
kcInfo.setType(4l);
kcInfo.setJsType(jsType);
kcInfo.setCreateTime(new Date());
kcInfo.setCreateBy(Long.valueOf(String.valueOf(getUserId())));
kcInfo.setJsInfo(jsInfo);
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.getJsInfo() != null && !kcInfo.getJsInfo().equals("")) {
Map<String, String> bb = new HashMap<>();
bb.put("key", "jsInfo");
bb.put("value", String.valueOf(kcInfo.getJsInfo()));
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();
}

Loading…
Cancel
Save