|
|
|
@ -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(); |
|
|
|
|