|
|
|
@ -31,6 +31,7 @@ import com.ruoyi.system.service.IZhyArticleService; |
|
|
|
import com.ruoyi.system.service.impl.LuceneUtil; |
|
|
|
import com.ruoyi.system.service.impl.ZhyFileManageServiceImpl; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.var; |
|
|
|
import org.apache.poi.util.Units; |
|
|
|
import org.apache.poi.xwpf.usermodel.ParagraphAlignment; |
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument; |
|
|
|
@ -78,7 +79,15 @@ import java.util.regex.Pattern; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
import static com.ruoyi.common.constant.Constants.*; |
|
|
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.*; |
|
|
|
import org.jsoup.Jsoup; |
|
|
|
import org.jsoup.nodes.Document; |
|
|
|
import org.jsoup.nodes.Element; |
|
|
|
import org.jsoup.nodes.Node; |
|
|
|
import org.jsoup.nodes.TextNode; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
@RestController |
|
|
|
@RequestMapping("/system/fileManage") |
|
|
|
public class ZhyFileManageController extends BaseController { |
|
|
|
@ -286,6 +295,7 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
List<Map<String, String>> dataList = new ArrayList<>(); |
|
|
|
String[] headers = null; |
|
|
|
|
|
|
|
|
|
|
|
InputStream inputStream = null; |
|
|
|
BufferedReader reader = null; |
|
|
|
try { |
|
|
|
@ -2613,6 +2623,166 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void generateDocxFromHtml(String htmlContent, Path outputPath) throws Exception { |
|
|
|
// 1. 创建空的 .docx 文档
|
|
|
|
XWPFDocument document = new XWPFDocument(); |
|
|
|
|
|
|
|
// 2. 解析 HTML
|
|
|
|
Document doc = Jsoup.parse(htmlContent); |
|
|
|
org.jsoup.nodes.Element body = doc.body(); |
|
|
|
|
|
|
|
// 3. 遍历 HTML 元素
|
|
|
|
for (Node node : body.childNodes()) { |
|
|
|
processNode(node, document); |
|
|
|
} |
|
|
|
|
|
|
|
// 4. 保存到文件(覆盖原路径)
|
|
|
|
try (var out = Files.newOutputStream(outputPath)) { |
|
|
|
document.write(out); |
|
|
|
} |
|
|
|
document.close(); |
|
|
|
} |
|
|
|
|
|
|
|
private void processNode(Node node, XWPFDocument document) { |
|
|
|
if (node instanceof TextNode) { |
|
|
|
// 普通文本
|
|
|
|
String text = ((TextNode) node).text().trim(); |
|
|
|
if (!text.isEmpty()) { |
|
|
|
XWPFParagraph p = document.createParagraph(); |
|
|
|
XWPFRun run = p.createRun(); |
|
|
|
run.setText(text); |
|
|
|
} |
|
|
|
} else if (node instanceof Element) { |
|
|
|
Element elem = (Element) node; |
|
|
|
String tagName = elem.tagName().toLowerCase(); |
|
|
|
|
|
|
|
XWPFParagraph p = document.createParagraph(); |
|
|
|
XWPFRun run = p.createRun(); |
|
|
|
//
|
|
|
|
switch (tagName) { |
|
|
|
case "p": |
|
|
|
// 段落
|
|
|
|
for (Node child : elem.childNodes()) { |
|
|
|
if (child instanceof TextNode) { |
|
|
|
run.setText(((TextNode) child).text()); |
|
|
|
} else if (child instanceof Element) { |
|
|
|
processInlineElement((Element) child, run); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case "h1": |
|
|
|
case "h2": |
|
|
|
case "h3": |
|
|
|
run.setText(elem.text()); |
|
|
|
p.setStyle(tagName.toUpperCase()); // 可选:设置样式
|
|
|
|
break; |
|
|
|
|
|
|
|
case "strong": |
|
|
|
case "b": |
|
|
|
run.setText(elem.text()); |
|
|
|
run.setBold(true); |
|
|
|
break; |
|
|
|
|
|
|
|
case "em": |
|
|
|
case "i": |
|
|
|
run.setText(elem.text()); |
|
|
|
run.setItalic(true); |
|
|
|
break; |
|
|
|
|
|
|
|
case "u": |
|
|
|
run.setText(elem.text()); |
|
|
|
run.setUnderline(UnderlinePatterns.SINGLE); |
|
|
|
break; |
|
|
|
|
|
|
|
case "br": |
|
|
|
run.setText("\n"); |
|
|
|
break; |
|
|
|
|
|
|
|
case "img": |
|
|
|
String src = elem.outerHtml(); |
|
|
|
if (src != null && !src.trim().isEmpty()) { |
|
|
|
// 方案1:显示为 "[图片] 链接地址"
|
|
|
|
XWPFParagraph liP = document.createParagraph(); |
|
|
|
liP.setIndentFromLeft(400); |
|
|
|
XWPFRun liRun = liP.createRun(); |
|
|
|
liRun.setText(src); |
|
|
|
} |
|
|
|
break; |
|
|
|
case "ul": |
|
|
|
for (Element li : elem.select("li")) { |
|
|
|
XWPFParagraph liP = document.createParagraph(); |
|
|
|
liP.setIndentFromLeft(400); |
|
|
|
XWPFRun liRun = liP.createRun(); |
|
|
|
liRun.setText("• " + li.text()); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case "ol": |
|
|
|
int num = 1; |
|
|
|
for (Element li : elem.select("li")) { |
|
|
|
XWPFParagraph liP = document.createParagraph(); |
|
|
|
liP.setIndentFromLeft(400); |
|
|
|
XWPFRun liRun = liP.createRun(); |
|
|
|
liRun.setText((num++) + ". " + li.text()); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
run.setText(elem.text()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 处理内联标签(如 <b>、<i> 在段落内)
|
|
|
|
private void processInlineElement(Element elem, XWPFRun run) { |
|
|
|
String tagName = elem.tagName().toLowerCase(); |
|
|
|
boolean bold = run.isBold(); |
|
|
|
boolean italic = run.isItalic(); |
|
|
|
UnderlinePatterns underline = run.getUnderline(); |
|
|
|
|
|
|
|
System.out.println(tagName); |
|
|
|
|
|
|
|
switch (tagName) { |
|
|
|
case "strong": |
|
|
|
case "b": |
|
|
|
run.setBold(true); |
|
|
|
run.setText(elem.text()); |
|
|
|
run.setBold(bold); // 恢复状态(实际中建议拆分 run)
|
|
|
|
break; |
|
|
|
case "em": |
|
|
|
case "i": |
|
|
|
run.setItalic(true); |
|
|
|
run.setText(elem.text()); |
|
|
|
run.setItalic(italic); |
|
|
|
break; |
|
|
|
case "u": |
|
|
|
run.setUnderline(UnderlinePatterns.SINGLE); |
|
|
|
run.setText(elem.text()); |
|
|
|
break; |
|
|
|
case "img": |
|
|
|
String src = elem.outerHtml(); |
|
|
|
if (src != null && !src.trim().isEmpty()) { |
|
|
|
run.setText(src); |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
run.setText(elem.text()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 从 src 提取图片字节(支持 data:image/base64)
|
|
|
|
private byte[] getImageBytesFromSrc(String src) { |
|
|
|
if (src.startsWith("data:image")) { |
|
|
|
String base64Data = src.substring(src.indexOf(",") + 1); |
|
|
|
return java.util.Base64.getDecoder().decode(base64Data); |
|
|
|
} |
|
|
|
// 可扩展:从 URL 或服务器路径加载
|
|
|
|
return null; |
|
|
|
} |
|
|
|
@PostMapping("/updateTxt") |
|
|
|
public AjaxResult updateTxt(@RequestBody Map<String, String> requestBody) { |
|
|
|
String filePath = requestBody.get("url"); |
|
|
|
@ -2622,15 +2792,7 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
String videoUrl = requestBody.get("videoUrl"); |
|
|
|
String imgs = requestBody.get("imgs"); |
|
|
|
String prodectName = requestBody.get("prodectName"); |
|
|
|
Long groupId = Long.valueOf(requestBody.get("groupId")); |
|
|
|
// Long parentInd = Long.valueOf(requestBody.get("parentInd"));
|
|
|
|
// ZhyDoc docParent=test1Mapper.selectDocByIdId(parentInd);
|
|
|
|
// Long groupId=0l;
|
|
|
|
// if(docParent!=null){
|
|
|
|
// groupId=docParent.getGroupId();
|
|
|
|
// }
|
|
|
|
System.out.println("ddddddddddddd"); |
|
|
|
System.out.println(groupId); |
|
|
|
Long parentInd = Long.valueOf(requestBody.get("parentInd")); |
|
|
|
Long docLevelNew = Long.valueOf(requestBody.get("docLevel")); |
|
|
|
String relation1 = requestBody.get("realtion"); |
|
|
|
if(relation1 == null ||relation1.equals("")){ |
|
|
|
@ -2644,14 +2806,43 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
String aurl = filePath; |
|
|
|
String[] urls = aurl.split("\\\\"); |
|
|
|
aurl = urls[urls.length - 1]; |
|
|
|
aurl = aurl.replace(".txt",".docx"); |
|
|
|
|
|
|
|
Path newPath = currentPath.getParent().resolve(aurl); |
|
|
|
|
|
|
|
try { |
|
|
|
// Rename the file
|
|
|
|
Files.move(currentPath, newPath, StandardCopyOption.REPLACE_EXISTING); |
|
|
|
|
|
|
|
// Update the file with new content
|
|
|
|
Files.write(newPath, content.getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
|
|
|
|
|
|
generateDocxFromHtml(content, newPath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // Rename the file
|
|
|
|
// Files.move(currentPath, newPath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
|
//
|
|
|
|
// // Update the file with new content
|
|
|
|
// Files.write(newPath, content.getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ZhyDoc zhyDoc = new ZhyDoc(); |
|
|
|
ZhyDoc oldZhyDoc = test1Mapper.selectDocByIdId(id); |
|
|
|
@ -2660,32 +2851,38 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
zhyDoc.setDocUrl(String.valueOf(newPath)); |
|
|
|
zhyDoc.setDocVideo(videoUrl); |
|
|
|
zhyDoc.setDocImgs(imgs); |
|
|
|
// zhyDoc.setDocParentId(parentInd);
|
|
|
|
zhyDoc.setGroupId(groupId); |
|
|
|
zhyDoc.setDocParentId(parentInd); |
|
|
|
zhyDoc.setDocLevel(docLevelNew); |
|
|
|
zhyDoc.setProdectName(prodectName); |
|
|
|
test1Mapper.updateDocById(zhyDoc); |
|
|
|
|
|
|
|
ESDao esDao = new ESDao(); |
|
|
|
esDao.id = id.toString(); |
|
|
|
esDao.DBid = id.toString(); |
|
|
|
esDao.type = "node"; |
|
|
|
esDao.abstracts = name1; |
|
|
|
esDao.data = null; |
|
|
|
System.out.println("ssssss"); |
|
|
|
System.out.println(esDao); |
|
|
|
esService.deleteDocById("nodes",id.toString()); |
|
|
|
esService.insertDocById("nodes",esDao); |
|
|
|
// luceneUtil.deleteIndexByUrl(String.valueOf(id));
|
|
|
|
// luceneUtil.createSingleIndex1(String.valueOf(newPath), id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String cql = "match (r{docId:'" + id + "'}) SET r.docTitle = '" + name1 + "'"; |
|
|
|
|
|
|
|
neo4jUtil.excuteCypherSql(cql); |
|
|
|
String cql1 = "match (r{docId:'" + id + "'}) SET r.groupId = '" + groupId + "'"; |
|
|
|
StatementResult result1 = neo4jUtil.excuteCypherSql(cql); |
|
|
|
|
|
|
|
neo4jUtil.excuteCypherSql(cql1); |
|
|
|
|
|
|
|
//判断这个文章的层级是不是变化了
|
|
|
|
Long oldLevel = oldZhyDoc.getDocLevel(); |
|
|
|
@ -2694,290 +2891,287 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
//查询下级
|
|
|
|
Long jj = docLevelNew - oldLevel; |
|
|
|
String newLevel = "leve" + docLevelNew; |
|
|
|
// List<ZhyDoc> list1 = test1Mapper.getOneHeader(oldZhyDoc.getId());
|
|
|
|
List<ZhyDoc> list1 = test1Mapper.getOneHeader(oldZhyDoc.getId()); |
|
|
|
String cqlLevel = "match (r{docId:'" + oldZhyDoc.getId() + "'}) SET r.docLeve = '" + newLevel + "'"; |
|
|
|
neo4jUtil.excuteCypherSql(cqlLevel); |
|
|
|
|
|
|
|
// if (list1.size() != 0) {
|
|
|
|
// for (int j = 0; j < list1.size(); j++) {
|
|
|
|
// String newl = "";
|
|
|
|
// if (list1.get(j).getDocLevel() == 1) {
|
|
|
|
// newl = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list1.get(j).getDocLevel() == 2) {
|
|
|
|
// newl = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list1.get(j).getDocLevel() == 3) {
|
|
|
|
// newl = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list1.get(j).getDocLevel() == 4) {
|
|
|
|
// newl = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list1.get(j).getDocLevel() == 5) {
|
|
|
|
// newl = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list1.get(j).getDocLevel() == 6) {
|
|
|
|
// newl = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list1.get(j).getDocLevel() == 7) {
|
|
|
|
// newl = "leve" + (7 + jj);
|
|
|
|
// }
|
|
|
|
// String cqlLevel1 = "match (r{docId:'" + list1.get(j).getId() + "'}) SET r.docLeve = '" + newl + "'";
|
|
|
|
// neo4jUtil.excuteCypherSql(cqlLevel1);
|
|
|
|
// list1.get(j).setDocLevel(list1.get(j).getDocLevel() + jj);
|
|
|
|
// int a = test1Mapper.updateDocById(list1.get(j));
|
|
|
|
//
|
|
|
|
// List<ZhyDoc> list2 = test1Mapper.getOneHeader(list1.get(j).getId());
|
|
|
|
// if (list2.size() != 0) {
|
|
|
|
// for (int j1 = 0; j1 < list2.size(); j1++) {
|
|
|
|
// String newl1 = "";
|
|
|
|
// if (list2.get(j1).getDocLevel() == 1) {
|
|
|
|
// newl1 = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list2.get(j1).getDocLevel() == 2) {
|
|
|
|
// newl1 = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list2.get(j1).getDocLevel() == 3) {
|
|
|
|
// newl1 = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list2.get(j1).getDocLevel() == 4) {
|
|
|
|
// newl1 = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list2.get(j1).getDocLevel() == 5) {
|
|
|
|
// newl1 = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list2.get(j1).getDocLevel() == 6) {
|
|
|
|
// newl1 = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list2.get(j1).getDocLevel() == 7) {
|
|
|
|
// newl1 = "leve" + (7 + jj);
|
|
|
|
// }
|
|
|
|
// String cqlLevel2 = "match (r{docId:'" + list2.get(j1).getId() + "'}) SET r.docLeve = '" + newl1 + "'";
|
|
|
|
// StatementResult resultLevel2 = neo4jUtil.excuteCypherSql(cqlLevel2);
|
|
|
|
// list2.get(j1).setDocLevel(list2.get(j1).getDocLevel() + jj);
|
|
|
|
// int a2 = test1Mapper.updateDocById(list2.get(j1));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// List<ZhyDoc> list3 = test1Mapper.getOneHeader(list2.get(j1).getId());
|
|
|
|
// if (list3.size() != 0) {
|
|
|
|
// for (int j2 = 0; j2 < list3.size(); j2++) {
|
|
|
|
// String newl2 = "";
|
|
|
|
// if (list3.get(j2).getDocLevel() == 1) {
|
|
|
|
// newl2 = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list3.get(j2).getDocLevel() == 2) {
|
|
|
|
// newl2 = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list3.get(j2).getDocLevel() == 3) {
|
|
|
|
// newl2 = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list3.get(j2).getDocLevel() == 4) {
|
|
|
|
// newl2 = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list3.get(j2).getDocLevel() == 5) {
|
|
|
|
// newl2 = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list3.get(j2).getDocLevel() == 6) {
|
|
|
|
// newl2 = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list3.get(j2).getDocLevel() == 7) {
|
|
|
|
// newl2 = "leve" + (7 + jj);
|
|
|
|
// }
|
|
|
|
// String cqlLevel3 = "match (r{docId:'" + list3.get(j2).getId() + "'}) SET r.docLeve = '" + newl2 + "'";
|
|
|
|
// StatementResult resultLevel3 = neo4jUtil.excuteCypherSql(cqlLevel3);
|
|
|
|
// list3.get(j2).setDocLevel(list3.get(j2).getDocLevel() + jj);
|
|
|
|
// int a3 = test1Mapper.updateDocById(list3.get(j2));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// List<ZhyDoc> list4 = test1Mapper.getOneHeader(list3.get(j2).getId());
|
|
|
|
// if (list4.size() != 0) {
|
|
|
|
// for (int j3 = 0; j3 < list4.size(); j3++) {
|
|
|
|
// String newl3 = "";
|
|
|
|
// if (list4.get(j3).getDocLevel() == 1) {
|
|
|
|
// newl3 = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list4.get(j3).getDocLevel() == 2) {
|
|
|
|
// newl3 = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list4.get(j3).getDocLevel() == 3) {
|
|
|
|
// newl3 = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list4.get(j3).getDocLevel() == 4) {
|
|
|
|
// newl3 = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list4.get(j3).getDocLevel() == 5) {
|
|
|
|
// newl3 = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list4.get(j3).getDocLevel() == 6) {
|
|
|
|
// newl3 = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list4.get(j3).getDocLevel() == 7) {
|
|
|
|
// newl3 = "leve" + (7 + jj);
|
|
|
|
// }
|
|
|
|
// String cqlLevel4 = "match (r{docId:'" + list4.get(j3).getId() + "'}) SET r.docLeve = '" + newl3 + "'";
|
|
|
|
// StatementResult resultLevel4 = neo4jUtil.excuteCypherSql(cqlLevel4);
|
|
|
|
// list4.get(j3).setDocLevel(list4.get(j3).getDocLevel() + jj);
|
|
|
|
// int a4 = test1Mapper.updateDocById(list4.get(j3));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// List<ZhyDoc> list5 = test1Mapper.getOneHeader(list4.get(j3).getId());
|
|
|
|
// if (list5.size() != 0) {
|
|
|
|
// for (int j4 = 0; j4 < list5.size(); j4++) {
|
|
|
|
// String newl4 = "";
|
|
|
|
// if (list5.get(j4).getDocLevel() == 1) {
|
|
|
|
// newl4 = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list5.get(j4).getDocLevel() == 2) {
|
|
|
|
// newl4 = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list5.get(j4).getDocLevel() == 3) {
|
|
|
|
// newl4 = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list5.get(j4).getDocLevel() == 4) {
|
|
|
|
// newl4 = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list5.get(j4).getDocLevel() == 5) {
|
|
|
|
// newl4 = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list5.get(j4).getDocLevel() == 6) {
|
|
|
|
// newl4 = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list5.get(j4).getDocLevel() == 7) {
|
|
|
|
// newl4 = "leve" + (7 + jj);
|
|
|
|
// }
|
|
|
|
// String cqlLevel5 = "match (r{docId:'" + list5.get(j4).getId() + "'}) SET r.docLeve = '" + newl4 + "'";
|
|
|
|
// StatementResult resultLevel5 = neo4jUtil.excuteCypherSql(cqlLevel5);
|
|
|
|
// list5.get(j4).setDocLevel(list5.get(j4).getDocLevel() + jj);
|
|
|
|
// int a5 = test1Mapper.updateDocById(list5.get(j4));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// List<ZhyDoc> list6 = test1Mapper.getOneHeader(list5.get(j4).getId());
|
|
|
|
// if (list6.size() != 0) {
|
|
|
|
// for (int j5 = 0; j5 < list6.size(); j5++) {
|
|
|
|
// String newl5 = "";
|
|
|
|
// if (list6.get(j5).getDocLevel() == 1) {
|
|
|
|
// newl5 = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list6.get(j5).getDocLevel() == 2) {
|
|
|
|
// newl5 = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list6.get(j5).getDocLevel() == 3) {
|
|
|
|
// newl5 = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list6.get(j5).getDocLevel() == 4) {
|
|
|
|
// newl5 = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list6.get(j5).getDocLevel() == 5) {
|
|
|
|
// newl5 = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list6.get(j5).getDocLevel() == 6) {
|
|
|
|
// newl5 = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list6.get(j5).getDocLevel() == 7) {
|
|
|
|
// newl5 = "leve" + (7 + jj);
|
|
|
|
// }
|
|
|
|
// String cqlLevel6 = "match (r{docId:'" + list6.get(j5).getId() + "'}) SET r.docLeve = '" + newl5 + "'";
|
|
|
|
// StatementResult resultLevel6 = neo4jUtil.excuteCypherSql(cqlLevel6);
|
|
|
|
// list6.get(j5).setDocLevel(list6.get(j5).getDocLevel() + jj);
|
|
|
|
// int a6 = test1Mapper.updateDocById(list6.get(j5));
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// List<ZhyDoc> list7 = test1Mapper.getOneHeader(list6.get(j5).getId());
|
|
|
|
// if (list7.size() != 0) {
|
|
|
|
// for (int j6 = 0; j6 < list7.size(); j6++) {
|
|
|
|
// String newl6 = "";
|
|
|
|
// if (list7.get(j6).getDocLevel() == 1) {
|
|
|
|
// newl6 = "leve" + (1 + jj);
|
|
|
|
// }
|
|
|
|
// if (list7.get(j6).getDocLevel() == 2) {
|
|
|
|
// newl6 = "leve" + (2 + jj);
|
|
|
|
// }
|
|
|
|
// if (list7.get(j6).getDocLevel() == 3) {
|
|
|
|
// newl6 = "leve" + (3 + jj);
|
|
|
|
// }
|
|
|
|
// if (list7.get(j6).getDocLevel() == 4) {
|
|
|
|
// newl6 = "leve" + (4 + jj);
|
|
|
|
// }
|
|
|
|
// if (list7.get(j6).getDocLevel() == 5) {
|
|
|
|
// newl6 = "leve" + (5 + jj);
|
|
|
|
// }
|
|
|
|
// if (list7.get(j6).getDocLevel() == 6) {
|
|
|
|
// newl6 = "leve" + (6 + jj);
|
|
|
|
// }
|
|
|
|
// if (list7.get(j6).getDocLevel() == 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).setDocLevel(list7.get(j6).getDocLevel() + jj);
|
|
|
|
// int a7 = test1Mapper.updateDocById(list7.get(j6));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|
if (list1.size() != 0) { |
|
|
|
for (int j = 0; j < list1.size(); j++) { |
|
|
|
String newl = ""; |
|
|
|
if (list1.get(j).getDocLevel() == 1) { |
|
|
|
newl = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list1.get(j).getDocLevel() == 2) { |
|
|
|
newl = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list1.get(j).getDocLevel() == 3) { |
|
|
|
newl = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list1.get(j).getDocLevel() == 4) { |
|
|
|
newl = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list1.get(j).getDocLevel() == 5) { |
|
|
|
newl = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list1.get(j).getDocLevel() == 6) { |
|
|
|
newl = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list1.get(j).getDocLevel() == 7) { |
|
|
|
newl = "leve" + (7 + jj); |
|
|
|
} |
|
|
|
String cqlLevel1 = "match (r{docId:'" + list1.get(j).getId() + "'}) SET r.docLeve = '" + newl + "'"; |
|
|
|
neo4jUtil.excuteCypherSql(cqlLevel1); |
|
|
|
list1.get(j).setDocLevel(list1.get(j).getDocLevel() + jj); |
|
|
|
int a = test1Mapper.updateDocById(list1.get(j)); |
|
|
|
|
|
|
|
List<ZhyDoc> list2 = test1Mapper.getOneHeader(list1.get(j).getId()); |
|
|
|
if (list2.size() != 0) { |
|
|
|
for (int j1 = 0; j1 < list2.size(); j1++) { |
|
|
|
String newl1 = ""; |
|
|
|
if (list2.get(j1).getDocLevel() == 1) { |
|
|
|
newl1 = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list2.get(j1).getDocLevel() == 2) { |
|
|
|
newl1 = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list2.get(j1).getDocLevel() == 3) { |
|
|
|
newl1 = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list2.get(j1).getDocLevel() == 4) { |
|
|
|
newl1 = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list2.get(j1).getDocLevel() == 5) { |
|
|
|
newl1 = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list2.get(j1).getDocLevel() == 6) { |
|
|
|
newl1 = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list2.get(j1).getDocLevel() == 7) { |
|
|
|
newl1 = "leve" + (7 + jj); |
|
|
|
} |
|
|
|
String cqlLevel2 = "match (r{docId:'" + list2.get(j1).getId() + "'}) SET r.docLeve = '" + newl1 + "'"; |
|
|
|
StatementResult resultLevel2 = neo4jUtil.excuteCypherSql(cqlLevel2); |
|
|
|
list2.get(j1).setDocLevel(list2.get(j1).getDocLevel() + jj); |
|
|
|
int a2 = test1Mapper.updateDocById(list2.get(j1)); |
|
|
|
|
|
|
|
|
|
|
|
List<ZhyDoc> list3 = test1Mapper.getOneHeader(list2.get(j1).getId()); |
|
|
|
if (list3.size() != 0) { |
|
|
|
for (int j2 = 0; j2 < list3.size(); j2++) { |
|
|
|
String newl2 = ""; |
|
|
|
if (list3.get(j2).getDocLevel() == 1) { |
|
|
|
newl2 = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list3.get(j2).getDocLevel() == 2) { |
|
|
|
newl2 = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list3.get(j2).getDocLevel() == 3) { |
|
|
|
newl2 = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list3.get(j2).getDocLevel() == 4) { |
|
|
|
newl2 = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list3.get(j2).getDocLevel() == 5) { |
|
|
|
newl2 = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list3.get(j2).getDocLevel() == 6) { |
|
|
|
newl2 = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list3.get(j2).getDocLevel() == 7) { |
|
|
|
newl2 = "leve" + (7 + jj); |
|
|
|
} |
|
|
|
String cqlLevel3 = "match (r{docId:'" + list3.get(j2).getId() + "'}) SET r.docLeve = '" + newl2 + "'"; |
|
|
|
StatementResult resultLevel3 = neo4jUtil.excuteCypherSql(cqlLevel3); |
|
|
|
list3.get(j2).setDocLevel(list3.get(j2).getDocLevel() + jj); |
|
|
|
int a3 = test1Mapper.updateDocById(list3.get(j2)); |
|
|
|
|
|
|
|
|
|
|
|
List<ZhyDoc> list4 = test1Mapper.getOneHeader(list3.get(j2).getId()); |
|
|
|
if (list4.size() != 0) { |
|
|
|
for (int j3 = 0; j3 < list4.size(); j3++) { |
|
|
|
String newl3 = ""; |
|
|
|
if (list4.get(j3).getDocLevel() == 1) { |
|
|
|
newl3 = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list4.get(j3).getDocLevel() == 2) { |
|
|
|
newl3 = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list4.get(j3).getDocLevel() == 3) { |
|
|
|
newl3 = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list4.get(j3).getDocLevel() == 4) { |
|
|
|
newl3 = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list4.get(j3).getDocLevel() == 5) { |
|
|
|
newl3 = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list4.get(j3).getDocLevel() == 6) { |
|
|
|
newl3 = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list4.get(j3).getDocLevel() == 7) { |
|
|
|
newl3 = "leve" + (7 + jj); |
|
|
|
} |
|
|
|
String cqlLevel4 = "match (r{docId:'" + list4.get(j3).getId() + "'}) SET r.docLeve = '" + newl3 + "'"; |
|
|
|
StatementResult resultLevel4 = neo4jUtil.excuteCypherSql(cqlLevel4); |
|
|
|
list4.get(j3).setDocLevel(list4.get(j3).getDocLevel() + jj); |
|
|
|
int a4 = test1Mapper.updateDocById(list4.get(j3)); |
|
|
|
|
|
|
|
|
|
|
|
List<ZhyDoc> list5 = test1Mapper.getOneHeader(list4.get(j3).getId()); |
|
|
|
if (list5.size() != 0) { |
|
|
|
for (int j4 = 0; j4 < list5.size(); j4++) { |
|
|
|
String newl4 = ""; |
|
|
|
if (list5.get(j4).getDocLevel() == 1) { |
|
|
|
newl4 = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list5.get(j4).getDocLevel() == 2) { |
|
|
|
newl4 = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list5.get(j4).getDocLevel() == 3) { |
|
|
|
newl4 = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list5.get(j4).getDocLevel() == 4) { |
|
|
|
newl4 = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list5.get(j4).getDocLevel() == 5) { |
|
|
|
newl4 = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list5.get(j4).getDocLevel() == 6) { |
|
|
|
newl4 = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list5.get(j4).getDocLevel() == 7) { |
|
|
|
newl4 = "leve" + (7 + jj); |
|
|
|
} |
|
|
|
String cqlLevel5 = "match (r{docId:'" + list5.get(j4).getId() + "'}) SET r.docLeve = '" + newl4 + "'"; |
|
|
|
StatementResult resultLevel5 = neo4jUtil.excuteCypherSql(cqlLevel5); |
|
|
|
list5.get(j4).setDocLevel(list5.get(j4).getDocLevel() + jj); |
|
|
|
int a5 = test1Mapper.updateDocById(list5.get(j4)); |
|
|
|
|
|
|
|
|
|
|
|
List<ZhyDoc> list6 = test1Mapper.getOneHeader(list5.get(j4).getId()); |
|
|
|
if (list6.size() != 0) { |
|
|
|
for (int j5 = 0; j5 < list6.size(); j5++) { |
|
|
|
String newl5 = ""; |
|
|
|
if (list6.get(j5).getDocLevel() == 1) { |
|
|
|
newl5 = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list6.get(j5).getDocLevel() == 2) { |
|
|
|
newl5 = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list6.get(j5).getDocLevel() == 3) { |
|
|
|
newl5 = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list6.get(j5).getDocLevel() == 4) { |
|
|
|
newl5 = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list6.get(j5).getDocLevel() == 5) { |
|
|
|
newl5 = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list6.get(j5).getDocLevel() == 6) { |
|
|
|
newl5 = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list6.get(j5).getDocLevel() == 7) { |
|
|
|
newl5 = "leve" + (7 + jj); |
|
|
|
} |
|
|
|
String cqlLevel6 = "match (r{docId:'" + list6.get(j5).getId() + "'}) SET r.docLeve = '" + newl5 + "'"; |
|
|
|
StatementResult resultLevel6 = neo4jUtil.excuteCypherSql(cqlLevel6); |
|
|
|
list6.get(j5).setDocLevel(list6.get(j5).getDocLevel() + jj); |
|
|
|
int a6 = test1Mapper.updateDocById(list6.get(j5)); |
|
|
|
|
|
|
|
|
|
|
|
List<ZhyDoc> list7 = test1Mapper.getOneHeader(list6.get(j5).getId()); |
|
|
|
if (list7.size() != 0) { |
|
|
|
for (int j6 = 0; j6 < list7.size(); j6++) { |
|
|
|
String newl6 = ""; |
|
|
|
if (list7.get(j6).getDocLevel() == 1) { |
|
|
|
newl6 = "leve" + (1 + jj); |
|
|
|
} |
|
|
|
if (list7.get(j6).getDocLevel() == 2) { |
|
|
|
newl6 = "leve" + (2 + jj); |
|
|
|
} |
|
|
|
if (list7.get(j6).getDocLevel() == 3) { |
|
|
|
newl6 = "leve" + (3 + jj); |
|
|
|
} |
|
|
|
if (list7.get(j6).getDocLevel() == 4) { |
|
|
|
newl6 = "leve" + (4 + jj); |
|
|
|
} |
|
|
|
if (list7.get(j6).getDocLevel() == 5) { |
|
|
|
newl6 = "leve" + (5 + jj); |
|
|
|
} |
|
|
|
if (list7.get(j6).getDocLevel() == 6) { |
|
|
|
newl6 = "leve" + (6 + jj); |
|
|
|
} |
|
|
|
if (list7.get(j6).getDocLevel() == 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).setDocLevel(list7.get(j6).getDocLevel() + jj); |
|
|
|
int a7 = test1Mapper.updateDocById(list7.get(j6)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ZhyFileManage fileManage=test1Mapper.getFileByName(name+".docx"); |
|
|
|
//判断这个知识点的上级是否进行修改
|
|
|
|
// Long oldpp = oldZhyDoc.getDocParentId();
|
|
|
|
// if (oldpp != parentInd) {
|
|
|
|
//
|
|
|
|
// //修改上级
|
|
|
|
// //修改relation
|
|
|
|
// ZhyDoc zp = test1Mapper.selectDocByIdId(parentInd);
|
|
|
|
// ZhyDocRelation r = new ZhyDocRelation();
|
|
|
|
// if(oldpp==0){
|
|
|
|
// oldpp=fileManage.getId().longValue();
|
|
|
|
// }
|
|
|
|
// r.setSource(oldpp);
|
|
|
|
// r.setTarget(id);
|
|
|
|
// List<ZhyDocRelation> aa = zhyDocRelationMapper.selectZhyRelationshipList(r);
|
|
|
|
// ZhyDocRelation qq = aa.get(0);
|
|
|
|
// if(parentInd==0){
|
|
|
|
// qq.setSourceName(name);
|
|
|
|
// parentInd=fileManage.getId().longValue();
|
|
|
|
//
|
|
|
|
// }else{
|
|
|
|
// qq.setSourceName(zp.getDocTitle());
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// qq.setSource(parentInd);
|
|
|
|
// qq.setRelationship(relation1);
|
|
|
|
// int g = zhyDocRelationMapper.updateZhyRelationship(qq);
|
|
|
|
//
|
|
|
|
// //删除过去的这个关系
|
|
|
|
// String cqrD = "MATCH (n:Doc{docId:'" + oldpp + "'})-[r]-(n2:Doc{docId:'" + id + "'}) DELETE r";
|
|
|
|
// StatementResult resultD = neo4jUtil.excuteCypherSql(cqrD);
|
|
|
|
// if (relation1 != null && !relation1.equals("")) {
|
|
|
|
// String cqrC = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + parentInd + "' AND b.docId = '" + id + "' CREATE (a)-[r:" + relation1 + " { name: '" + relation1+"', DbId: '' }] -> (b) RETURN r";
|
|
|
|
// StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC);
|
|
|
|
// } else {
|
|
|
|
// String cqrC = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + parentInd + "' AND b.docId = '" + id + "' CREATE (a)-[r:" + relation + " { name: '" + relation+ "', DbId: '' }] -> (b) RETURN r";
|
|
|
|
// StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
Long oldpp = oldZhyDoc.getDocParentId(); |
|
|
|
if (oldpp != parentInd) { |
|
|
|
|
|
|
|
//修改上级
|
|
|
|
//修改relation
|
|
|
|
ZhyDoc zp = test1Mapper.selectDocByIdId(parentInd); |
|
|
|
ZhyDocRelation r = new ZhyDocRelation(); |
|
|
|
if(oldpp==0){ |
|
|
|
oldpp=fileManage.getId().longValue(); |
|
|
|
} |
|
|
|
r.setSource(oldpp); |
|
|
|
r.setTarget(id); |
|
|
|
List<ZhyDocRelation> aa = zhyDocRelationMapper.selectZhyRelationshipList(r); |
|
|
|
ZhyDocRelation qq = aa.get(0); |
|
|
|
if(parentInd==0){ |
|
|
|
qq.setSourceName(name); |
|
|
|
parentInd=fileManage.getId().longValue(); |
|
|
|
|
|
|
|
// int g = zhyDocRelationMapper.updateZhyRelationship(qq);
|
|
|
|
}else{ |
|
|
|
qq.setSourceName(zp.getDocTitle()); |
|
|
|
} |
|
|
|
|
|
|
|
qq.setSource(parentInd); |
|
|
|
qq.setRelationship(relation1); |
|
|
|
int g = zhyDocRelationMapper.updateZhyRelationship(qq); |
|
|
|
|
|
|
|
//删除过去的这个关系
|
|
|
|
String cqrD = "MATCH (n:Local{docId:'" + oldpp + "'})-[r]-(n2:Local{docId:'" + id + "'}) DELETE r"; |
|
|
|
StatementResult resultD = neo4jUtil.excuteCypherSql(cqrD); |
|
|
|
if (relation1 != null && !relation1.equals("")) { |
|
|
|
String cqrC = "MATCH (a:Local),(b:Local) WHERE a.docId = '" + parentInd + "' AND b.docId = '" + id + "' CREATE (a)-[r:" + relation1 + " { name: '" + relation1+ "' }] -> (b) RETURN r"; |
|
|
|
StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC); |
|
|
|
} else { |
|
|
|
String cqrC = "MATCH (a:Local),(b:Local) WHERE a.docId = '" + parentInd + "' AND b.docId = '" + id + "' CREATE (a)-[r:" + relation + " { name: '" + relation+ "' }] -> (b) RETURN r"; |
|
|
|
StatementResult resultC = neo4jUtil.excuteCypherSql(cqrC); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// int g = zhyDocRelationMapper.updateZhyRelationship(qq);
|
|
|
|
return AjaxResult.success("File renamed and updated successfully"); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return AjaxResult.error("Error renaming or updating the file: " + e.getMessage()); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
@PostMapping("/updateTxt1") |
|
|
|
@ -3438,18 +3632,18 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
zhyFileManage.setCreateBy(getUserId()); |
|
|
|
zhyFileManageService.insertFile(zhyFileManage); |
|
|
|
fileId=zhyFileManage.getId(); |
|
|
|
String sql="create (doc: Doc{docId:'"+zhyFileManage.getId()+"',docTitle:'"+name+"',docLeve:'leve0',fileId:'"+zhyFileManage.getId()+"'})"; |
|
|
|
String sql="create (doc: Local{docId:'"+zhyFileManage.getId()+"',docTitle:'"+name+"',docLeve:'leve0',fileId:'"+zhyFileManage.getId()+"'})"; |
|
|
|
neo4jUtil.excuteCypherSql(sql); |
|
|
|
} |
|
|
|
} |
|
|
|
String txtName = requestBody.get("txtName"); |
|
|
|
String TxtValue = requestBody.get("TxtValue"); |
|
|
|
|
|
|
|
String docParentId=requestBody.get("docParentId"); |
|
|
|
String relation1 = requestBody.get("relation"); |
|
|
|
if(relation1.equals("")){ |
|
|
|
relation1=relation; |
|
|
|
} |
|
|
|
Long groupId = Long.valueOf(requestBody.get("groupId")); |
|
|
|
Long groupId = -1l; |
|
|
|
|
|
|
|
Long docLevel = Long.valueOf(requestBody.get("docLevel")); |
|
|
|
ZhyFileManage zhyFileManage = test1Mapper.getFileById(fileId); |
|
|
|
@ -3470,17 +3664,10 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
zhyDoc.setCreateTime(new Date()); |
|
|
|
zhyDoc.setCreateBy(String.valueOf(getUserId())); |
|
|
|
zhyDoc.setGroupId(groupId); |
|
|
|
zhyDoc.setDocParentId(Long.valueOf(docParentId)); |
|
|
|
test1Mapper.insertDoc(zhyDoc); |
|
|
|
ESDao esDao = new ESDao(); |
|
|
|
esDao.id = zhyDoc.getId().toString(); |
|
|
|
esDao.DBid = zhyDoc.getId().toString(); |
|
|
|
esDao.type = "node"; |
|
|
|
esDao.abstracts = txtName; |
|
|
|
esDao.data = null; |
|
|
|
System.out.println("ssssss"); |
|
|
|
System.out.println(esDao); |
|
|
|
esService.insertDocById("nodes",esDao); |
|
|
|
String cql = "create (doc: Doc{"; |
|
|
|
|
|
|
|
String cql = "create (doc: Local{"; |
|
|
|
|
|
|
|
List<Map> listNew = new ArrayList<>(); |
|
|
|
if (zhyDoc.getId() != null) { |
|
|
|
@ -3556,7 +3743,6 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
|
|
|
|
if(zhyDoc.getDocLevel()==1){ |
|
|
|
//创建关系
|
|
|
|
|
|
|
|
ZhyDocRelation zz = new ZhyDocRelation(); |
|
|
|
zz.setRelationship(relation1); |
|
|
|
zz.setSource(fileId.longValue()); |
|
|
|
@ -3569,7 +3755,7 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
|
|
|
|
|
|
|
|
//创建图谱
|
|
|
|
String cqr = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '" + zz.getSource() + "' AND b.docId = '" + zz.getTarget() + "' CREATE (a)-[r:" + zz.getRelationship() + " { name: '" + zz.getRelationship() + "', DbId: '' }] -> (b) RETURN r"; |
|
|
|
String cqr = "MATCH (a:Local),(b:Local) WHERE a.docId = '" + zz.getSource() + "' AND b.docId = '" + zz.getTarget() + "' CREATE (a)-[r:" + zz.getRelationship() + " { name: '" + zz.getRelationship() + "', DbId: '' }] -> (b) RETURN r"; |
|
|
|
neo4jUtil.excuteCypherSql(cqr); |
|
|
|
|
|
|
|
zz.setIsgraph(1l); |
|
|
|
@ -3641,6 +3827,15 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
zhyDoc.setCreateBy(String.valueOf(getUserId())); |
|
|
|
zhyDoc.setGroupId(groupId); |
|
|
|
test1Mapper.insertDoc(zhyDoc); |
|
|
|
ESDao esDao = new ESDao(); |
|
|
|
esDao.id = zhyDoc.getId().toString(); |
|
|
|
esDao.DBid = zhyDoc.getId().toString(); |
|
|
|
esDao.type = "node"; |
|
|
|
esDao.abstracts = txtName; |
|
|
|
esDao.data = null; |
|
|
|
System.out.println("ssssss"); |
|
|
|
System.out.println(esDao); |
|
|
|
esService.insertDocById("nodes",esDao); |
|
|
|
// luceneUtil.createSingleIndex2(zhyDoc.getDocUrl(), zhyDoc.getId(), zhyDoc.getDocTitle());
|
|
|
|
//创建完索引
|
|
|
|
//创建图谱
|
|
|
|
@ -3790,7 +3985,7 @@ public class ZhyFileManageController extends BaseController { |
|
|
|
esService.deleteDocById("nodes",id.toString()); |
|
|
|
// luceneUtil.deleteIndexByUrl(String.valueOf(id));
|
|
|
|
//删除指定的实体
|
|
|
|
String cql = "MATCH (n:Doc{docId:'" + id + "'}) DETACH delete n"; |
|
|
|
String cql = "MATCH (n:Local{docId:'" + id + "'}) DETACH delete n"; |
|
|
|
System.out.println(cql); |
|
|
|
StatementResult result1 = neo4jUtil.excuteCypherSql(cql); |
|
|
|
|
|
|
|
|