Compare commits

...

9 Commits

  1. 311
      gyxtp/package-lock.json
  2. 1
      gyxtp/package.json
  3. 4
      gyxtp/public/index.html
  4. 17
      gyxtp/src/view/graphPageCopy0926.vue
  5. 9
      gyxtp/src/view/pointArticleInfo.vue
  6. 20
      gyxtp/src/view/pointInfo.vue
  7. 13
      gyxtp/src/view/small.vue
  8. 700
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java
  9. 41
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyPointController.java
  10. 379
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyRelationshipController.java
  11. 89
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SimpleParagraphSaver.java
  12. 133
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java
  13. 2
      ruoyi-ui/src/views/system/SysPoint/index.vue
  14. 13
      ruoyi-ui/src/views/system/create/index.vue
  15. 6
      ruoyi-ui/src/views/system/fileManage/index.vue
  16. 2
      ruoyi-ui/src/views/system/fileManage/indexNB.vue

311
gyxtp/package-lock.json

@ -19,6 +19,7 @@
"echarts-wordcloud": "^2.0.0",
"element-plus": "^2.8.8",
"fabric": "^6.4.3",
"mammoth": "^1.11.0",
"neovis.js": "^2.1.0",
"pdfjs-dist": "^5.4.149",
"relation-graph-vue3": "^2.2.11",
@ -4185,6 +4186,14 @@
"integrity": "sha512-ztriE8oFOamRrV9opBURDy+JMiyhur2//vOXsC5CgdnYCB0L1Lnaag4NzP8N+NFCj7uNz9JRYtPmAbQMSDLIsQ==",
"dev": true
},
"node_modules/@xmldom/xmldom": {
"version": "0.8.11",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz",
"integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/@xtuc/ieee754": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@ -4506,7 +4515,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmmirror.com/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"dependencies": {
"sprintf-js": "~1.0.2"
}
@ -5721,8 +5729,7 @@
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"dev": true
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"node_modules/cosmiconfig": {
"version": "7.1.0",
@ -6375,6 +6382,11 @@
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
"dev": true
},
"node_modules/dingbat-to-unicode": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dingbat-to-unicode/-/dingbat-to-unicode-1.0.1.tgz",
"integrity": "sha512-98l0sW87ZT58pU4i61wa2OHwxbiYSbuxsCBozaVnYX2iCnr3bLM3fIes1/ej7h1YdOKuKt/MLs706TVnALA65w=="
},
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz",
@ -6522,6 +6534,14 @@
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==",
"dev": true
},
"node_modules/duck": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/duck/-/duck-0.1.12.tgz",
"integrity": "sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg==",
"dependencies": {
"underscore": "^1.13.1"
}
},
"node_modules/duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmmirror.com/duplexer/-/duplexer-0.1.2.tgz",
@ -8847,6 +8867,11 @@
"node": ">=0.10.0"
}
},
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"node_modules/immutable": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.3.tgz",
@ -8911,8 +8936,7 @@
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"devOptional": true
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/ip-address": {
"version": "9.0.5",
@ -9142,8 +9166,7 @@
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"node_modules/isexe": {
"version": "2.0.0",
@ -9386,6 +9409,44 @@
"graceful-fs": "^4.1.6"
}
},
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
"node_modules/jszip/node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/jszip/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/jszip/node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/keycharm": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/keycharm/-/keycharm-0.4.0.tgz",
@ -9527,6 +9588,14 @@
"node": ">= 0.8.0"
}
},
"node_modules/lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/lilconfig": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-2.1.0.tgz",
@ -9832,6 +9901,16 @@
"node": ">=4"
}
},
"node_modules/lop": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/lop/-/lop-0.4.2.tgz",
"integrity": "sha512-RefILVDQ4DKoRZsJ4Pj22TxE3omDO47yFpkIBoDKzkqPRISs5U1cnAdg/5583YPkWPaLIYHOKRMQSvjFsO26cw==",
"dependencies": {
"duck": "^0.1.12",
"option": "~0.2.1",
"underscore": "^1.13.1"
}
},
"node_modules/lower-case": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/lower-case/-/lower-case-2.0.2.tgz",
@ -9927,6 +10006,34 @@
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/mammoth": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/mammoth/-/mammoth-1.11.0.tgz",
"integrity": "sha512-BcEqqY/BOwIcI1iR5tqyVlqc3KIaMRa4egSoK83YAVrBf6+yqdAAbtUcFDCWX8Zef8/fgNZ6rl4VUv+vVX8ddQ==",
"dependencies": {
"@xmldom/xmldom": "^0.8.6",
"argparse": "~1.0.3",
"base64-js": "^1.5.1",
"bluebird": "~3.4.0",
"dingbat-to-unicode": "^1.0.1",
"jszip": "^3.7.1",
"lop": "^0.4.2",
"path-is-absolute": "^1.0.0",
"underscore": "^1.13.1",
"xmlbuilder": "^10.0.0"
},
"bin": {
"mammoth": "bin/mammoth"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/mammoth/node_modules/bluebird": {
"version": "3.4.7",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz",
"integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="
},
"node_modules/map-obj": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/map-obj/-/map-obj-4.3.0.tgz",
@ -11224,6 +11331,11 @@
"opener": "bin/opener-bin.js"
}
},
"node_modules/option": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/option/-/option-0.2.4.tgz",
"integrity": "sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A=="
},
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmmirror.com/optionator/-/optionator-0.9.4.tgz",
@ -11364,6 +11476,11 @@
"node": ">=6"
}
},
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
},
"node_modules/param-case": {
"version": "3.0.4",
"resolved": "https://registry.npmmirror.com/param-case/-/param-case-3.0.4.tgz",
@ -11466,7 +11583,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"devOptional": true,
"engines": {
"node": ">=0.10.0"
}
@ -12221,8 +12337,7 @@
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"dev": true
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"node_modules/progress": {
"version": "2.0.3",
@ -13370,6 +13485,11 @@
"node": ">= 0.4"
}
},
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz",
@ -13659,8 +13779,7 @@
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
},
"node_modules/ssri": {
"version": "8.0.1",
@ -14391,6 +14510,11 @@
"integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==",
"dev": true
},
"node_modules/underscore": {
"version": "1.13.7",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz",
"integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g=="
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz",
@ -14733,8 +14857,7 @@
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"devOptional": true
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/utila": {
"version": "0.4.0",
@ -15696,6 +15819,14 @@
"node": ">=12"
}
},
"node_modules/xmlbuilder": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.1.tgz",
"integrity": "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg==",
"engines": {
"node": ">=4.0"
}
},
"node_modules/xmlchars": {
"version": "2.2.0",
"resolved": "https://registry.npmmirror.com/xmlchars/-/xmlchars-2.2.0.tgz",
@ -18781,6 +18912,11 @@
"integrity": "sha512-ztriE8oFOamRrV9opBURDy+JMiyhur2//vOXsC5CgdnYCB0L1Lnaag4NzP8N+NFCj7uNz9JRYtPmAbQMSDLIsQ==",
"dev": true
},
"@xmldom/xmldom": {
"version": "0.8.11",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz",
"integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw=="
},
"@xtuc/ieee754": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@ -19016,7 +19152,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmmirror.com/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
@ -19911,8 +20046,7 @@
"core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"dev": true
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"cosmiconfig": {
"version": "7.1.0",
@ -20372,6 +20506,11 @@
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
"dev": true
},
"dingbat-to-unicode": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dingbat-to-unicode/-/dingbat-to-unicode-1.0.1.tgz",
"integrity": "sha512-98l0sW87ZT58pU4i61wa2OHwxbiYSbuxsCBozaVnYX2iCnr3bLM3fIes1/ej7h1YdOKuKt/MLs706TVnALA65w=="
},
"dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-3.0.1.tgz",
@ -20484,6 +20623,14 @@
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==",
"dev": true
},
"duck": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/duck/-/duck-0.1.12.tgz",
"integrity": "sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg==",
"requires": {
"underscore": "^1.13.1"
}
},
"duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmmirror.com/duplexer/-/duplexer-0.1.2.tgz",
@ -22218,6 +22365,11 @@
"dev": true,
"optional": true
},
"immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"immutable": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.3.tgz",
@ -22269,8 +22421,7 @@
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"devOptional": true
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ip-address": {
"version": "9.0.5",
@ -22442,8 +22593,7 @@
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"isexe": {
"version": "2.0.0",
@ -22644,6 +22794,46 @@
"universalify": "^2.0.0"
}
},
"jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"requires": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
},
"dependencies": {
"readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"keycharm": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/keycharm/-/keycharm-0.4.0.tgz",
@ -22745,6 +22935,14 @@
"type-check": "~0.4.0"
}
},
"lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"requires": {
"immediate": "~3.0.5"
}
},
"lilconfig": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-2.1.0.tgz",
@ -22989,6 +23187,16 @@
}
}
},
"lop": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/lop/-/lop-0.4.2.tgz",
"integrity": "sha512-RefILVDQ4DKoRZsJ4Pj22TxE3omDO47yFpkIBoDKzkqPRISs5U1cnAdg/5583YPkWPaLIYHOKRMQSvjFsO26cw==",
"requires": {
"duck": "^0.1.12",
"option": "~0.2.1",
"underscore": "^1.13.1"
}
},
"lower-case": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/lower-case/-/lower-case-2.0.2.tgz",
@ -23071,6 +23279,30 @@
}
}
},
"mammoth": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/mammoth/-/mammoth-1.11.0.tgz",
"integrity": "sha512-BcEqqY/BOwIcI1iR5tqyVlqc3KIaMRa4egSoK83YAVrBf6+yqdAAbtUcFDCWX8Zef8/fgNZ6rl4VUv+vVX8ddQ==",
"requires": {
"@xmldom/xmldom": "^0.8.6",
"argparse": "~1.0.3",
"base64-js": "^1.5.1",
"bluebird": "~3.4.0",
"dingbat-to-unicode": "^1.0.1",
"jszip": "^3.7.1",
"lop": "^0.4.2",
"path-is-absolute": "^1.0.0",
"underscore": "^1.13.1",
"xmlbuilder": "^10.0.0"
},
"dependencies": {
"bluebird": {
"version": "3.4.7",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz",
"integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="
}
}
},
"map-obj": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/map-obj/-/map-obj-4.3.0.tgz",
@ -24085,6 +24317,11 @@
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
"dev": true
},
"option": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/option/-/option-0.2.4.tgz",
"integrity": "sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A=="
},
"optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmmirror.com/optionator/-/optionator-0.9.4.tgz",
@ -24187,6 +24424,11 @@
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"dev": true
},
"pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
},
"param-case": {
"version": "3.0.4",
"resolved": "https://registry.npmmirror.com/param-case/-/param-case-3.0.4.tgz",
@ -24272,8 +24514,7 @@
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"devOptional": true
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="
},
"path-key": {
"version": "3.1.1",
@ -24769,8 +25010,7 @@
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"dev": true
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"progress": {
"version": "2.0.3",
@ -25640,6 +25880,11 @@
"has-property-descriptors": "^1.0.2"
}
},
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
},
"setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz",
@ -25865,8 +26110,7 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
},
"ssri": {
"version": "8.0.1",
@ -26423,6 +26667,11 @@
"integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==",
"dev": true
},
"underscore": {
"version": "1.13.7",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz",
"integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g=="
},
"undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz",
@ -26650,8 +26899,7 @@
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"devOptional": true
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"utila": {
"version": "0.4.0",
@ -27334,6 +27582,11 @@
"integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==",
"optional": true
},
"xmlbuilder": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.1.tgz",
"integrity": "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg=="
},
"xmlchars": {
"version": "2.2.0",
"resolved": "https://registry.npmmirror.com/xmlchars/-/xmlchars-2.2.0.tgz",

1
gyxtp/package.json

@ -16,6 +16,7 @@
"echarts-wordcloud": "^2.0.0",
"element-plus": "^2.8.8",
"fabric": "^6.4.3",
"mammoth": "^1.11.0",
"neovis.js": "^2.1.0",
"pdfjs-dist": "^5.4.149",
"relation-graph-vue3": "^2.2.11",

4
gyxtp/public/index.html

@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>天气过程知识图谱</title>
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico">-->
<title>知识图谱系统</title>
</head>
<body>
<noscript>

17
gyxtp/src/view/graphPageCopy0926.vue

@ -438,7 +438,7 @@ export default {
docLevel: 'docLevel',
},
heightlightTable:[],
currentShowLeve:2,
currentShowLeve:4,
lastNodeL:"",
}
@ -483,8 +483,15 @@ export default {
},
changeGroup(groupId){
this.currentGroup = groupId
this.keywords=""
if(groupId==2){
this.currentShowLeve = 2
}else{
this.currentShowLeve = 4
}
this.getAll()
this.getInfo()
this.getInfo2()
},
handleNodeClick(node) {
@ -673,6 +680,7 @@ export default {
},
getInfo() {
if (this.keywords) {
console.log(this.keywords)
let params = {nodename: this.keywords};
getDomainGraphTest(params).then((res) => {
this.zhengl(res.data);
@ -697,6 +705,11 @@ export default {
})
})
}else{
this.heightLight = {
"nodes": [],
"links":[],
"nodes1":[]
}
getDomainGraphTest({}).then((res) => {
this.zhengl(res.data);
})

9
gyxtp/src/view/pointArticleInfo.vue

@ -73,10 +73,10 @@
<!-- </div>-->
<!-- </div>-->
<!-- <vue-pdf-embed class="yuanwen" :source=" this.content.uploadUrl" />-->
<vue-pdf-embed class="yuanwen" :source="`http://localhost/dev-api/api/pdfFile/${srcPdf}`" v-if="!notFound"/>
<vue-pdf-embed class="yuanwen" :source="`http://localhost/dev-api/api/pdfFile/${srcPdf}`" v-if="notFound"/>
<!-- <div class="yuanwen" v-html="content.content"></div>-->
<div v-if="notFound" style=" display: grid;
place-items: center;
<div v-if="notFound == false" style=" display: grid;
place-items: center;AAAAA
height: 80vh;
font-size: 2vw;">本地暂未找到此文献</div>
</div>
@ -985,8 +985,9 @@ export default {
if (response.code === 200) {
this.pdfInfo = response;
this.srcPdf=response.msg
} else {
this.notFound=true
} else {
this.notFound = false
// this.$message.error('' + response.msg);
}
} catch (error) {

20
gyxtp/src/view/pointInfo.vue

@ -50,16 +50,16 @@
<div style="height: 1.5vw;margin-bottom: 7px;">
<img src="../assets/img2/book2.png"
style="height: 100%;object-fit: contain;float: left;margin-right: 0.8vw;">
<div class="articleName" style="margin-right: 2px; " @click="goArticle(item[Object.keys(item)[0]])">{{ Object.keys(item)[0] }}</div>
<div class="articleName" style="margin-right: 2px;"
@click="goArticle(item[Object.keys(item)[0]])">{{ Object.keys(item)[0] }}
({{item[Object.keys(item)[0]][0].source_data}})
</div>
</div>
<div v-if="pointInfo.type=='author'" style="margin-left: 2vw;: 11px 0px;font-size: 1.1vw">
<div style="display: flex">
出处
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.source}}</span>
<div style="font-size: 1.1vw">
<span v-if="item[Object.keys(item)[0]][0].source" >{{item[Object.keys(item)[0]][0].source}}</span>
</div>
</div>
<div style="display: flex">
@ -86,8 +86,8 @@
<div v-if="pointInfo.type=='agency'" style="margin-left: 2vw;: 11px 0px;font-size: 1.1vw">
<div style="display: flex">
出处
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.source}}</span>
<div style="font-size: 1.1vw">
<span v-if="item[Object.keys(item)[0]][0].source" >{{item[Object.keys(item)[0]][0].source}}</span>
</div>
</div>
<div style="display: flex">
@ -113,8 +113,8 @@
<div v-if="pointInfo.type=='keyword'" style="margin-left: 2vw;: 11px 0px;font-size: 1.1vw">
<div style="display: flex">
出处
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.source}}</span>
<div style="font-size: 1.1vw">
<span v-if="item[Object.keys(item)[0]][0].source" >{{item[Object.keys(item)[0]][0].source}}</span>
</div>
</div>
<div style="display: flex">

13
gyxtp/src/view/small.vue

@ -163,7 +163,7 @@ export default {
},
data() {
return {
ciyun:1,
ciyun:0,
chart: null,
words: [
],
@ -647,7 +647,7 @@ export default {
}
},
mounted() {
this.initChart()
// this.initChart()
this.getPointData()
getTitleBySamll().then((res)=>{
let data = res
@ -655,12 +655,12 @@ export default {
data.mxMap["docTitle"] = data.mxMap["name"]
data.zbMap["level"] = 1
data.zbMap["docTitle"] = data.zbMap["name"]
data.zhibMap["level"] = 1
data.zhibMap["docTitle"] = data.zhibMap["name"]
// data.zhibMap["level"] = 1
// data.zhibMap["docTitle"] = data.zhibMap["name"]
this.data1 = []
this.data1.push(data.mxMap)
this.data1.push(data.zbMap)
this.data1.push(data.zhibMap)
// this.data1.push(data.zhibMap)
})
},
@ -1272,4 +1272,7 @@ tr {
.rel-graph-loading{
background-color: transparent!important;
}
.relation-graph .rel-toolbar-v {
width: 45px;
}
</style>

700
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java

@ -275,168 +275,168 @@ public class ZhyFileManageController extends BaseController {
// 默认 fallback
return isDefinitelyUtf8 ? "UTF-8" : "GBK";
}
// @PostMapping("/insertRelationByFile")
// public AjaxResult insertRelationByFile(MultipartFile file) throws Throwable {
// // 1. 校验文件是否为空
// if (file.isEmpty()) {
// return AjaxResult.error("上传的文件为空");
// }
// String filePath1 =ARTICLE_DIR;
// // 2. 读取 CSV 文件(使用 GBK 编码)
// List<Map<String, String>> dataList = new ArrayList<>();
// String[] headers = null;
//
// InputStream inputStream = null;
// BufferedReader reader = null;
// try {
// inputStream = file.getInputStream();
//
// // 🔍 第一步:探测编码
// String encoding = detectCsvEncoding(inputStream);
// System.out.println("自动检测到编码: " + encoding);
//
// // 重新打开流(因为探测时已读取部分数据)
// inputStream.close();
// inputStream = file.getInputStream();
//
// reader = new BufferedReader(new InputStreamReader(inputStream, encoding));
//
// String line;
// int lineNumber = 0;
//
// while ((line = reader.readLine()) != null) {
// lineNumber++;
//
// // 去除 BOM(如果存在)
// if (lineNumber == 1 && line.startsWith("\uFEFF")) {
// line = line.substring(1);
// }
//
// // ✅ 替换 split(",") 为能处理引号内逗号的解析方法
// String[] row = parseCsvLine(line);
// for (int i = 0; i < row.length; i++) {
// row[i] = row[i].trim(); // 去空格
// }
//
// if (lineNumber == 1) {
// // 第一行是表头
// headers = row;
// continue; // 跳过第一行,不加入数据
// }
//
// // 将每一行转为 Map<String, String>
// Map<String, String> rowMap = new HashMap<>();
// for (int i = 0; i < headers.length && i < row.length; i++) {
// String key = headers[i].trim();
// // 只保留你需要的字段
// if (Arrays.asList("ck", "main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
// rowMap.put(key, row[i]);
// }
// }
// dataList.add(rowMap);
// }
//
// } catch (IOException e) {
// return AjaxResult.error("读取文件时发生错误:" + e.getMessage());
// } finally {
// try {
// if (reader != null) reader.close();
// if (inputStream != null) inputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// List<ZhyDocRelation> allRelation=new ArrayList<>();
// // 3. 处理每一行数据(和你原来逻辑一致)
// for (Map<String, String> data : dataList) {
// System.out.println("44444444444444");
// System.out.println(data);
// String mainKeyword = data.get("main_keyword");
// Pattern pattern = Pattern.compile("'([^']*)'");
// Matcher matcher = pattern.matcher(mainKeyword);
//
// ArrayList<String> mainKeywordList = new ArrayList<>();
// while (matcher.find()) {
// mainKeywordList.add(matcher.group(1)); // 提取引号内的内容
// }
//
//// System.out.println(mainKeywordList);
// Map mapLevel=new HashMap();
// for (int i=0;i<mainKeywordList.size();i++){
//// System.out.println(mainKeywordList.get(i));
// ZhyDoc doc=test1Mapper.selectDocByTitle(mainKeywordList.get(i));
// if(doc!=null){
// if(doc.getDocLevel()==1l){
// mapLevel.put("l1",mainKeywordList.get(i));
// }
// if(doc.getDocLevel()==2l){
// mapLevel.put("l2",mainKeywordList.get(i));
// }
// if(doc.getDocLevel()==3l){
// mapLevel.put("l3",mainKeywordList.get(i));
// }
// if(doc.getDocLevel()==4l){
// mapLevel.put("l4",mainKeywordList.get(i));
// }
// if(doc.getDocLevel()==5l){
// mapLevel.put("l5",mainKeywordList.get(i));
// }
// if(doc.getDocLevel()==6l){
// mapLevel.put("l6",mainKeywordList.get(i));
// }
//
//
// }
// }
//// System.out.println(mapLevel);
// //如果选择了l1,则看是否选择l2、l3、l4、l5、l6
// String[] levels = {"l1", "l2", "l3", "l4", "l5", "l6"};
// int n = levels.length;
//
// for (int i = 0; i < n - 1; i++) {
// String parentKey = levels[i];
// if (mapLevel.containsKey(parentKey)) {
// String parentValue = mapLevel.get(parentKey).toString();
// for (int j = i + 1; j < n; j++) {
// String childKey = levels[j];
// if (mapLevel.containsKey(childKey)) {
// String childValue = mapLevel.get(childKey).toString();
//
// ZhyDocRelation relation=new ZhyDocRelation();
// relation.setSourceName(parentValue);
// relation.setTargetName(childValue);
// List<Map> relations=zhyDocRelationMapper.selectZhyRelationshipArticle(relation);
//// System.out.println(relations);
// if(relations.size()>0){
// boolean flag=false;
// for (int p=0;p<relations.size();p++){
// if(relations.get(p).get("articleName").equals(data.get("title"))) {
// flag=true;
// break;
// }
// }
// if(!flag){
// createRelation(parentValue, childValue,data,filePath1);
//
// }
// }else{
// //插入关系
//
// createRelation(parentValue, childValue,data,filePath1);
//
// }
//
//
// }
// }
// }
// }
////
// }
//
@PostMapping("/insertRelationByFile")
public AjaxResult insertRelationByFile(MultipartFile file) throws Throwable {
// 1. 校验文件是否为空
if (file.isEmpty()) {
return AjaxResult.error("上传的文件为空");
}
String filePath1 =ARTICLE_DIR;
// 2. 读取 CSV 文件(使用 GBK 编码)
List<Map<String, String>> dataList = new ArrayList<>();
String[] headers = null;
InputStream inputStream = null;
BufferedReader reader = null;
try {
inputStream = file.getInputStream();
// 🔍 第一步:探测编码
String encoding = detectCsvEncoding(inputStream);
System.out.println("自动检测到编码: " + encoding);
// 重新打开流(因为探测时已读取部分数据)
inputStream.close();
inputStream = file.getInputStream();
reader = new BufferedReader(new InputStreamReader(inputStream, encoding));
String line;
int lineNumber = 0;
while ((line = reader.readLine()) != null) {
lineNumber++;
// 去除 BOM(如果存在)
if (lineNumber == 1 && line.startsWith("\uFEFF")) {
line = line.substring(1);
}
// ✅ 替换 split(",") 为能处理引号内逗号的解析方法
String[] row = parseCsvLine(line);
for (int i = 0; i < row.length; i++) {
row[i] = row[i].trim(); // 去空格
}
if (lineNumber == 1) {
// 第一行是表头
headers = row;
continue; // 跳过第一行,不加入数据
}
// 将每一行转为 Map<String, String>
Map<String, String> rowMap = new HashMap<>();
for (int i = 0; i < headers.length && i < row.length; i++) {
String key = headers[i].trim();
// 只保留你需要的字段
if (Arrays.asList("ck", "main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
rowMap.put(key, row[i]);
}
}
dataList.add(rowMap);
}
} catch (IOException e) {
return AjaxResult.error("读取文件时发生错误:" + e.getMessage());
} finally {
try {
if (reader != null) reader.close();
if (inputStream != null) inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
List<ZhyDocRelation> allRelation=new ArrayList<>();
// 3. 处理每一行数据(和你原来逻辑一致)
for (Map<String, String> data : dataList) {
System.out.println("44444444444444");
System.out.println(data);
String mainKeyword = data.get("main_keyword");
Pattern pattern = Pattern.compile("'([^']*)'");
Matcher matcher = pattern.matcher(mainKeyword);
ArrayList<String> mainKeywordList = new ArrayList<>();
while (matcher.find()) {
mainKeywordList.add(matcher.group(1)); // 提取引号内的内容
}
// System.out.println(mainKeywordList);
Map mapLevel=new HashMap();
for (int i=0;i<mainKeywordList.size();i++){
// System.out.println(mainKeywordList.get(i));
ZhyDoc doc=test1Mapper.selectDocByTitle(mainKeywordList.get(i));
if(doc!=null){
if(doc.getDocLevel()==1l){
mapLevel.put("l1",mainKeywordList.get(i));
}
if(doc.getDocLevel()==2l){
mapLevel.put("l2",mainKeywordList.get(i));
}
if(doc.getDocLevel()==3l){
mapLevel.put("l3",mainKeywordList.get(i));
}
if(doc.getDocLevel()==4l){
mapLevel.put("l4",mainKeywordList.get(i));
}
if(doc.getDocLevel()==5l){
mapLevel.put("l5",mainKeywordList.get(i));
}
if(doc.getDocLevel()==6l){
mapLevel.put("l6",mainKeywordList.get(i));
}
}
}
// System.out.println(mapLevel);
//如果选择了l1,则看是否选择l2、l3、l4、l5、l6
String[] levels = {"l1", "l2", "l3", "l4", "l5", "l6"};
int n = levels.length;
for (int i = 0; i < n - 1; i++) {
String parentKey = levels[i];
if (mapLevel.containsKey(parentKey)) {
String parentValue = mapLevel.get(parentKey).toString();
for (int j = i + 1; j < n; j++) {
String childKey = levels[j];
if (mapLevel.containsKey(childKey)) {
String childValue = mapLevel.get(childKey).toString();
ZhyDocRelation relation=new ZhyDocRelation();
relation.setSourceName(parentValue);
relation.setTargetName(childValue);
List<Map> relations=zhyDocRelationMapper.selectZhyRelationshipArticle(relation);
// System.out.println(relations);
if(relations.size()>0){
boolean flag=false;
for (int p=0;p<relations.size();p++){
if(relations.get(p).get("articleName").equals(data.get("title"))) {
flag=true;
break;
}
}
if(!flag){
createRelation(parentValue, childValue,data,filePath1);
}
}else{
//插入关系
createRelation(parentValue, childValue,data,filePath1);
}
}
}
}
}
//
// return AjaxResult.success().put("msg", "成功");
// }
}
return AjaxResult.success().put("msg", "成功");
}
public void createRelation(String parentValue,String childValue,Map<String, String> data,String local) throws IOException {
ZhyDoc doc1 = test1Mapper.selectDocByTitle(parentValue);
ZhyDoc doc2 = test1Mapper.selectDocByTitle(childValue);
@ -527,198 +527,198 @@ public class ZhyFileManageController extends BaseController {
}
}
@PostMapping("/insertRelationByFile")
public AjaxResult insertRelationByFile(MultipartFile file) throws Throwable {
// 1. 校验文件是否为空
if (file.isEmpty()) {
return AjaxResult.error("上传的文件为空");
}
// 2. 校验是否为 CSV 文件
String fileName = file.getOriginalFilename();
if (fileName == null || !fileName.toLowerCase().endsWith(".csv")) {
return AjaxResult.error("仅支持上传 CSV 格式的文件");
}
// 3. 自动检测编码并读取 CSV 文件(支持 GBK / UTF-8)
List<Map<String, String>> dataList = new ArrayList<>();
String[] headers = null;
InputStream inputStream = null;
BufferedReader reader = null;
try {
inputStream = file.getInputStream();
// 🔍 第一步:探测编码
String encoding = detectCsvEncoding(inputStream);
System.out.println("自动检测到编码: " + encoding);
// 重新打开流(因为探测时已读取部分数据)
inputStream.close();
inputStream = file.getInputStream();
reader = new BufferedReader(new InputStreamReader(inputStream, encoding));
String line;
int lineNumber = 0;
while ((line = reader.readLine()) != null) {
lineNumber++;
// 去除 BOM(如果存在)
if (lineNumber == 1 && line.startsWith("\uFEFF")) {
line = line.substring(1);
}
// ✅ 替换 split(",") 为能处理引号内逗号的解析方法
String[] row = parseCsvLine(line);
for (int i = 0; i < row.length; i++) {
row[i] = row[i].trim(); // 去空格
}
if (lineNumber == 1) {
// 第一行是表头
headers = row;
continue; // 跳过第一行,不加入数据
}
// 将每一行转为 Map<String, String>
Map<String, String> rowMap = new HashMap<>();
for (int i = 0; i < headers.length && i < row.length; i++) {
String key = headers[i].trim();
// 只保留你需要的字段
if (Arrays.asList("ck", "main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
rowMap.put(key, row[i]);
}
}
dataList.add(rowMap);
}
} catch (IOException e) {
return AjaxResult.error("读取文件时发生错误:" + e.getMessage());
} finally {
try {
if (reader != null) reader.close();
if (inputStream != null) inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("共读取到 " + dataList.size() + " 条数据:");
for (int i = 0; i < dataList.size(); i++) {
Map<String, String> data = dataList.get(i);
String title1=data.get("main_keyword");
String mainKeyword = data.get("main_keyword");
Pattern pattern = Pattern.compile("'([^']*)'");
Matcher matcher = pattern.matcher(mainKeyword);
ArrayList<String> mainKeywordList = new ArrayList<>();
while (matcher.find()) {
mainKeywordList.add(matcher.group(1)); // 提取引号内的内容
}
System.out.println(title1);
String title2=data.get("sub_keyword");
System.out.println(title2);
//关联父节点
ZhyDoc doc1=test1Mapper.selectDocByTitle(title1);
ZhyDoc doc2=test1Mapper.selectDocByTitle(title2);
System.out.println("33333333333333333");
System.out.println(doc1);
System.out.println(doc2);
if(doc1!=null&doc2!=null){
List<ZhyDoc> list = test1Mapper.selectAllDoc1();
ZhyArticle article=new ZhyArticle();
article.setName(data.get("title"));
article.setOpenUrl(data.get("url"));
article.setAuthors(data.get("authors"));
article.setKeywords(data.get("keywords"));
article.setSummary(data.get("abstract"));
article.setUrls(data.get("urls"));
File file1 = new File(ARTICLE_PDF_DIR, sanitizeFilenameStrict(article.getName())+".pdf");
article.setLocalUrl(file1.getAbsolutePath());
article.setSourceId(doc1.getId());
article.setSourceName(doc1.getDocTitle());
article.setTargetId(doc2.getId());
article.setTagertName(doc2.getDocTitle());
zhyArticleMapper.insertZhyArticle(article);
System.out.println("sssssssssssss");
System.out.println(article.getId());
// for(int a=0;a<list.size();a++){
// test1Mapper.updateParentId(list.get(a));
// @PostMapping("/insertRelationByFile")
// public AjaxResult insertRelationByFile(MultipartFile file) throws Throwable {
// // 1. 校验文件是否为空
// if (file.isEmpty()) {
// return AjaxResult.error("上传的文件为空");
// }
//// 2. 校验是否为 CSV 文件
// String fileName = file.getOriginalFilename();
// if (fileName == null || !fileName.toLowerCase().endsWith(".csv")) {
// return AjaxResult.error("仅支持上传 CSV 格式的文件");
// }
//
//// 3. 自动检测编码并读取 CSV 文件(支持 GBK / UTF-8)
// List<Map<String, String>> dataList = new ArrayList<>();
// String[] headers = null;
//
// InputStream inputStream = null;
// BufferedReader reader = null;
// try {
// inputStream = file.getInputStream();
//
// // 🔍 第一步:探测编码
// String encoding = detectCsvEncoding(inputStream);
// System.out.println("自动检测到编码: " + encoding);
//
// // 重新打开流(因为探测时已读取部分数据)
// inputStream.close();
// inputStream = file.getInputStream();
//
// reader = new BufferedReader(new InputStreamReader(inputStream, encoding));
//
// String line;
// int lineNumber = 0;
//
// while ((line = reader.readLine()) != null) {
// lineNumber++;
//
// // 去除 BOM(如果存在)
// if (lineNumber == 1 && line.startsWith("\uFEFF")) {
// line = line.substring(1);
// }
//
// // ✅ 替换 split(",") 为能处理引号内逗号的解析方法
// String[] row = parseCsvLine(line);
// for (int i = 0; i < row.length; i++) {
// row[i] = row[i].trim(); // 去空格
// }
//
// if (lineNumber == 1) {
// // 第一行是表头
// headers = row;
// continue; // 跳过第一行,不加入数据
// }
// test1Mapper.insertDocList(list);
ZhyDocRelation zz = new ZhyDocRelation();
zz.setRelationship(relation);
zz.setSource(doc1.getId());
zz.setTarget(doc2.getId());
zz.setSourceName(doc1.getDocTitle());
zz.setTargetName(doc2.getDocTitle());
zz.setCreateTime(new Date());
zz.setArticleId(article.getId());
zhyDocRelationMapper.insertZhyRelationship(zz);
List<String> ids = new ArrayList<>();
ids.add(String.valueOf(zz.getId()));
ESDao esDao = new ESDao();
esDao.id = article.getId().toString();
esDao.DBid = article.getId().toString();
esDao.type = "line";
if(article.getLocalUrl()!=null){
System.out.println("333333");
try {
String txt=article.getLocalUrl().replace("pdf", "txt");
List<String> content = extractContentUntilSecondPage(txt);
if (content != null) {
// 打印结果
for (String line : content) {
System.out.println(line);
}
String result = String.join("", content);
esDao.abstracts = result;
} else {
System.out.println("未找到相关内容或文件不存在。");
esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
}
} catch (IOException e) {
e.printStackTrace();
esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
}
}else{
esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
}
esDao.data = ids.toString();
esService.insertDocById("links",esDao);
}
}
//获取所有关系
List<ZhyDocRelation> listR = zhyDocRelationMapper.getAllRelation();
// List<String> ids = new ArrayList<>();
//创建
for(int i=0;i<listR.size();i++){
// ids.add(String.valueOf(listR.get(i).getId()));
String cql = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '"+listR.get(i).getSource() +"' AND " + "b.docId = '"+listR.get(i).getTarget()+"'";
cql = cql + " CREATE (a)-[r:"+String.valueOf(listR.get(i).getRelationship())+"{ name: '"+String.valueOf(listR.get(i).getRelationship())+"', DbId: '"+String.valueOf(listR.get(i).getId())+"' }] -> (b) RETURN r";
neo4jUtil.excuteCypherSql(cql);
test1Mapper.updateGraphRelation(listR.get(i));
}
// for (ZhyDocRelation rel : listR) {
// ZhyArticle article=zhyArticleMapper.selectZhyArticleById(rel.getArticleId());
// ESDao esDao = new ESDao();
// esDao.id = article.getId().toString();
// esDao.DBid = article.getId().toString();
// esDao.type = "line";
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// esDao.data = ids.toString();
//
// // 将每一行转为 Map<String, String>
// Map<String, String> rowMap = new HashMap<>();
// for (int i = 0; i < headers.length && i < row.length; i++) {
// String key = headers[i].trim();
// // 只保留你需要的字段
// if (Arrays.asList("ck", "main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
// rowMap.put(key, row[i]);
// }
// }
// dataList.add(rowMap);
// }
//
// } catch (IOException e) {
// return AjaxResult.error("读取文件时发生错误:" + e.getMessage());
// } finally {
// try {
// if (reader != null) reader.close();
// if (inputStream != null) inputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
return AjaxResult.success().put("msg", "成功");
}
//
// System.out.println("共读取到 " + dataList.size() + " 条数据:");
// for (int i = 0; i < dataList.size(); i++) {
// Map<String, String> data = dataList.get(i);
//
// String title1=data.get("main_keyword");
// String mainKeyword = data.get("main_keyword");
// Pattern pattern = Pattern.compile("'([^']*)'");
// Matcher matcher = pattern.matcher(mainKeyword);
//
// ArrayList<String> mainKeywordList = new ArrayList<>();
// while (matcher.find()) {
// mainKeywordList.add(matcher.group(1)); // 提取引号内的内容
// }
// System.out.println(title1);
// String title2=data.get("sub_keyword");
// System.out.println(title2);
// //关联父节点
// ZhyDoc doc1=test1Mapper.selectDocByTitle(title1);
// ZhyDoc doc2=test1Mapper.selectDocByTitle(title2);
// System.out.println("33333333333333333");
// System.out.println(doc1);
// System.out.println(doc2);
// if(doc1!=null&doc2!=null){
// List<ZhyDoc> list = test1Mapper.selectAllDoc1();
// ZhyArticle article=new ZhyArticle();
//
// article.setName(data.get("title"));
// article.setOpenUrl(data.get("url"));
// article.setAuthors(data.get("authors"));
// article.setKeywords(data.get("keywords"));
// article.setSummary(data.get("abstract"));
// article.setUrls(data.get("urls"));
//
// File file1 = new File(ARTICLE_PDF_DIR, sanitizeFilenameStrict(article.getName())+".pdf");
//
// article.setLocalUrl(file1.getAbsolutePath());
// article.setSourceId(doc1.getId());
// article.setSourceName(doc1.getDocTitle());
// article.setTargetId(doc2.getId());
// article.setTagertName(doc2.getDocTitle());
//
// zhyArticleMapper.insertZhyArticle(article);
// System.out.println("sssssssssssss");
// System.out.println(article.getId());
//// for(int a=0;a<list.size();a++){
//// test1Mapper.updateParentId(list.get(a));
//// }
//// test1Mapper.insertDocList(list);
// ZhyDocRelation zz = new ZhyDocRelation();
// zz.setRelationship(relation);
// zz.setSource(doc1.getId());
// zz.setTarget(doc2.getId());
// zz.setSourceName(doc1.getDocTitle());
// zz.setTargetName(doc2.getDocTitle());
// zz.setCreateTime(new Date());
// zz.setArticleId(article.getId());
// zhyDocRelationMapper.insertZhyRelationship(zz);
// List<String> ids = new ArrayList<>();
// ids.add(String.valueOf(zz.getId()));
// ESDao esDao = new ESDao();
// esDao.id = article.getId().toString();
// esDao.DBid = article.getId().toString();
// esDao.type = "line";
// if(article.getLocalUrl()!=null){
// System.out.println("333333");
// try {
// String txt=article.getLocalUrl().replace("pdf", "txt");
// List<String> content = extractContentUntilSecondPage(txt);
// if (content != null) {
// // 打印结果
// for (String line : content) {
// System.out.println(line);
// }
// String result = String.join("", content);
// esDao.abstracts = result;
// } else {
// System.out.println("未找到相关内容或文件不存在。");
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// }
// } catch (IOException e) {
// e.printStackTrace();
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// }
// }else{
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// }
// esDao.data = ids.toString();
// esService.insertDocById("links",esDao);
// }
// }
//
// //获取所有关系
// List<ZhyDocRelation> listR = zhyDocRelationMapper.getAllRelation();
//// List<String> ids = new ArrayList<>();
// //创建
// for(int i=0;i<listR.size();i++){
//// ids.add(String.valueOf(listR.get(i).getId()));
// String cql = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '"+listR.get(i).getSource() +"' AND " + "b.docId = '"+listR.get(i).getTarget()+"'";
// cql = cql + " CREATE (a)-[r:"+String.valueOf(listR.get(i).getRelationship())+"{ name: '"+String.valueOf(listR.get(i).getRelationship())+"', DbId: '"+String.valueOf(listR.get(i).getId())+"' }] -> (b) RETURN r";
// neo4jUtil.excuteCypherSql(cql);
// test1Mapper.updateGraphRelation(listR.get(i));
// }
//// for (ZhyDocRelation rel : listR) {
//// ZhyArticle article=zhyArticleMapper.selectZhyArticleById(rel.getArticleId());
//// ESDao esDao = new ESDao();
//// esDao.id = article.getId().toString();
//// esDao.DBid = article.getId().toString();
//// esDao.type = "line";
//// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
//// esDao.data = ids.toString();
////
//// }
//
// return AjaxResult.success().put("msg", "成功");
// }
public List<String> extractContentUntilSecondPage(String filePath) throws IOException {
File file = new File(filePath);

41
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyPointController.java

@ -1,12 +1,11 @@
package com.ruoyi.web.controller.system;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -69,30 +68,31 @@ public class ZhyPointController extends BaseController
if (file.isEmpty()) {
return AjaxResult.error("上传的文件为空");
}
// 2. 校验是否为 CSV 文件
String fileName = file.getOriginalFilename();
if (fileName == null || !fileName.toLowerCase().endsWith(".csv")) {
return AjaxResult.error("仅支持上传 CSV 格式的文件");
}
// 3. 自动检测编码并读取 CSV 文件(支持 GBK / UTF-8)
// 3. 自动检测编码并读取 CSV 文件(支持 GBK / UTF-8)
List<Map<String, String>> dataList = new ArrayList<>();
String[] headers = null;
InputStream inputStream = null;
BufferedReader reader = null;
try {
inputStream = file.getInputStream();
// ✅ 关键修改:先将整个文件读入内存(byte[]),避免流只能读一次的问题
byte[] fileBytes = file.getBytes(); // ✅ 使用 MultipartFile.getBytes() 安全读取全部字节
// 🔍 第一步:探测编码
String encoding = detectCsvEncoding(inputStream);
// 🔍 第一步:使用字节数组探测编码(不会破坏流)
String encoding = detectCsvEncoding(new ByteArrayInputStream(fileBytes));
System.out.println("自动检测到编码: " + encoding);
// 重新打开流(因为探测时已读取部分数据)
inputStream.close();
inputStream = file.getInputStream();
reader = new BufferedReader(new InputStreamReader(inputStream, encoding));
// ✅ 使用字节数组创建新的 InputStream,确保内容完整
InputStream decodedInputStream = new ByteArrayInputStream(fileBytes);
reader = new BufferedReader(new InputStreamReader(decodedInputStream, encoding));
String line;
int lineNumber = 0;
@ -100,7 +100,7 @@ public class ZhyPointController extends BaseController
while ((line = reader.readLine()) != null) {
lineNumber++;
// 去除 BOM(如果存在)
// 去除 BOM(如果存在,仅第一行
if (lineNumber == 1 && line.startsWith("\uFEFF")) {
line = line.substring(1);
}
@ -108,7 +108,7 @@ public class ZhyPointController extends BaseController
// ✅ 替换 split(",") 为能处理引号内逗号的解析方法
String[] row = parseCsvLine(line);
for (int i = 0; i < row.length; i++) {
row[i] = row[i].trim(); // 去空格
row[i] = row[i] != null ? row[i].trim() : ""; // 防空指针
}
if (lineNumber == 1) {
@ -130,16 +130,25 @@ public class ZhyPointController extends BaseController
}
} catch (IOException e) {
e.printStackTrace();
return AjaxResult.error("读取文件时发生错误:" + e.getMessage());
} finally {
try {
if (reader != null) reader.close();
if (inputStream != null) inputStream.close();
// inputStream 由 byte[] 创建,无需额外 close MultipartFile 流(Spring 会管理)
} catch (IOException e) {
e.printStackTrace();
}
}
for (Map<String, String> data : dataList) {
String mainKeyword = data.get("main_keyword");
Pattern pattern = Pattern.compile("'([^']*)'");
Matcher matcher = pattern.matcher(mainKeyword);
while (matcher.find()) {
data.put("main_keyword", matcher.group(1));
}
}
pointService.buildPoint(dataList);
return AjaxResult.success();

379
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyRelationshipController.java

@ -124,10 +124,380 @@ public class ZhyRelationshipController extends BaseController
zhyDocRelation.setGroupId(groupId);
return success(zhyDocRelation);
}
/**
private static void add(List<ZhyDocRelation> list, String model, String indicator) {
ZhyDocRelation rel = new ZhyDocRelation();
rel.setSourceName(model);
rel.setTargetName(indicator);
list.add(rel);
} /**
* 新增文章关系
*/
//public AjaxResult add(@RequestBody ZhyDocRelation zhyRelationship) throws IOException {
//
//
// List<ZhyDocRelation> relationships = new ArrayList<>();
//
// // 1. 演化博弈推演决策模型
// // 用于多智能体对抗下的策略演化,影响平台行为与安全
// add(relationships, "演化博弈推演决策模型", "补给舰航行安全风险指数");
// add(relationships, "演化博弈推演决策模型", "导弹艇航行安全风险指数");
// add(relationships, "演化博弈推演决策模型", "驱逐舰航行安全风险指数");
// add(relationships, "演化博弈推演决策模型", "攻击型潜艇航行安全风险指数");
// add(relationships, "演化博弈推演决策模型", "护卫舰航行安全风险指数");
// add(relationships, "演化博弈推演决策模型", "水面舰艇综合效能影响指数");
//
// // 2. 多属性群决策模型
// // 用于融合多专家/多传感器意见,评估武器系统效能
// add(relationships, "多属性群决策模型", "舰炮打击效能影响指数");
// add(relationships, "多属性群决策模型", "舰射鱼雷打击效能影响指数");
// add(relationships, "多属性群决策模型", "舰载反舰导弹打击效能影响指数");
// add(relationships, "多属性群决策模型", "舰载防空导弹打击效能影响指数");
// add(relationships, "多属性群决策模型", "舰载雷达探测效能影响指数");
// add(relationships, "多属性群决策模型", "舰载声纳探测效能影响指数");
// add(relationships, "多属性群决策模型", "水面舰艇综合效能影响指数");
// add(relationships, "多属性群决策模型", "巡航导弹效能影响指数");
// add(relationships, "多属性群决策模型", "防空导弹效能影响指数");
//
// // 3. 高维稀疏数据聚类与复杂目标识别模型
// // 用于雷达/声纳目标识别,影响探测效能与航行安全
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "舰载雷达探测效能影响指数");
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "舰载声纳探测效能影响指数");
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "补给舰航行安全风险指数");
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "导弹艇航行安全风险指数");
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "驱逐舰航行安全风险指数");
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "攻击型潜艇航行安全风险指数");
// add(relationships, "高维稀疏数据聚类与复杂目标识别模型", "护卫舰航行安全风险指数");
//
// // 4. 自适应可排序无监督聚类区划模型
// // 用于海域动态分区,影响航行安全
// add(relationships, "自适应可排序无监督聚类区划模型", "补给舰航行安全风险指数");
// add(relationships, "自适应可排序无监督聚类区划模型", "导弹艇航行安全风险指数");
// add(relationships, "自适应可排序无监督聚类区划模型", "驱逐舰航行安全风险指数");
// add(relationships, "自适应可排序无监督聚类区划模型", "攻击型潜艇航行安全风险指数");
// add(relationships, "自适应可排序无监督聚类区划模型", "护卫舰航行安全风险指数");
//
// // 5. 贝叶斯推理综合决策模型
// // 用于动态更新风险概率,适用于所有不确定性评估
// add(relationships, "贝叶斯推理综合决策模型", "舰载机飞行安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "舰载直升机起飞安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "舰载直升机降落安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "补给舰航行安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "导弹艇航行安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "驱逐舰航行安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "攻击型潜艇航行安全风险指数");
// add(relationships, "贝叶斯推理综合决策模型", "护卫舰航行安全风险指数");
//
// // 6. 模糊综合评价方法
// // 用于处理模糊性语言评价,适用于所有“效能影响指数”
// add(relationships, "模糊综合评价方法", "舰炮打击效能影响指数");
// add(relationships, "模糊综合评价方法", "舰射鱼雷打击效能影响指数");
// add(relationships, "模糊综合评价方法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "模糊综合评价方法", "舰载防空导弹打击效能影响指数");
// add(relationships, "模糊综合评价方法", "舰载雷达探测效能影响指数");
// add(relationships, "模糊综合评价方法", "舰载声纳探测效能影响指数");
// add(relationships, "模糊综合评价方法", "舰艇机动效能影响指数");
// add(relationships, "模糊综合评价方法", "水面舰艇综合效能影响指数");
// add(relationships, "模糊综合评价方法", "巡航导弹效能影响指数");
// add(relationships, "模糊综合评价方法", "防空导弹效能影响指数");
//
// // 7. 可拓综合评价方法
// // 用于解决矛盾评价问题,适用于武器系统效能评估
// add(relationships, "可拓综合评价方法", "舰炮打击效能影响指数");
// add(relationships, "可拓综合评价方法", "舰射鱼雷打击效能影响指数");
// add(relationships, "可拓综合评价方法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "可拓综合评价方法", "舰载防空导弹打击效能影响指数");
// add(relationships, "可拓综合评价方法", "舰载雷达探测效能影响指数");
// add(relationships, "可拓综合评价方法", "舰载声纳探测效能影响指数");
// add(relationships, "可拓综合评价方法", "水面舰艇综合效能影响指数");
// add(relationships, "可拓综合评价方法", "巡航导弹效能影响指数");
// add(relationships, "可拓综合评价方法", "防空导弹效能影响指数");
//
// // 8. 灰色关联评估方法
// // 用于小样本下分析因素关联度,适用于效能评估
// add(relationships, "灰色关联评估方法", "舰炮打击效能影响指数");
// add(relationships, "灰色关联评估方法", "舰射鱼雷打击效能影响指数");
// add(relationships, "灰色关联评估方法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "灰色关联评估方法", "舰载防空导弹打击效能影响指数");
// add(relationships, "灰色关联评估方法", "舰载雷达探测效能影响指数");
// add(relationships, "灰色关联评估方法", "舰载声纳探测效能影响指数");
// add(relationships, "灰色关联评估方法", "水面舰艇综合效能影响指数");
// add(relationships, "灰色关联评估方法", "巡航导弹效能影响指数");
// add(relationships, "灰色关联评估方法", "防空导弹效能影响指数");
//
// // 9. 最佳理想解逼近评估方法
// add(relationships, "最佳理想解逼近评估方法", "舰炮打击效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "舰射鱼雷打击效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "舰载防空导弹打击效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "舰载雷达探测效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "舰载声纳探测效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "水面舰艇综合效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "巡航导弹效能影响指数");
// add(relationships, "最佳理想解逼近评估方法", "防空导弹效能影响指数");
//
// // 10. 数据包络评估方法
// // 用于效率评估,适用于系统级效能
// add(relationships, "数据包络评估方法", "水面舰艇综合效能影响指数");
// add(relationships, "数据包络评估方法", "舰艇声呐效能影响指数");
// add(relationships, "数据包络评估方法", "巡航导弹效能影响指数");
// add(relationships, "数据包络评估方法", "防空导弹效能影响指数");
//
// // 11. 云模型语义综合评估方法
// // 用于语言变量量化,适用于所有“效能影响指数”和“风险指数”
// add(relationships, "云模型语义综合评估方法", "舰炮打击效能影响指数");
// add(relationships, "云模型语义综合评估方法", "舰射鱼雷打击效能影响指数");
// add(relationships, "云模型语义综合评估方法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "云模型语义综合评估方法", "舰载防空导弹打击效能影响指数");
// add(relationships, "云模型语义综合评估方法", "舰载雷达探测效能影响指数");
// add(relationships, "云模型语义综合评估方法", "舰载声纳探测效能影响指数");
// add(relationships, "云模型语义综合评估方法", "舰载直升机起飞安全风险指数");
// add(relationships, "云模型语义综合评估方法", "舰载直升机降落安全风险指数");
// add(relationships, "云模型语义综合评估方法", "水面舰艇综合效能影响指数");
// add(relationships, "云模型语义综合评估方法", "巡航导弹效能影响指数");
// add(relationships, "云模型语义综合评估方法", "防空导弹效能影响指数");
//
// // 12. 层次分析法
// // 用于确定权重,支撑所有指标的综合评估
// add(relationships, "层次分析法", "补给舰航行安全风险指数");
// add(relationships, "层次分析法", "导弹艇航行安全风险指数");
// add(relationships, "层次分析法", "驱逐舰航行安全风险指数");
// add(relationships, "层次分析法", "攻击型潜艇航行安全风险指数");
// add(relationships, "层次分析法", "护卫舰航行安全风险指数");
// add(relationships, "层次分析法", "舰炮打击效能影响指数");
// add(relationships, "层次分析法", "舰射鱼雷打击效能影响指数");
// add(relationships, "层次分析法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "层次分析法", "舰载防空导弹打击效能影响指数");
// add(relationships, "层次分析法", "舰载机飞行安全风险指数");
// add(relationships, "层次分析法", "舰载雷达探测效能影响指数");
// add(relationships, "层次分析法", "舰载声纳探测效能影响指数");
// add(relationships, "层次分析法", "舰载直升机起飞安全风险指数");
// add(relationships, "层次分析法", "舰载直升机降落安全风险指数");
// add(relationships, "层次分析法", "湿热指数");
// add(relationships, "层次分析法", "风寒指数");
// add(relationships, "层次分析法", "水面舰艇综合效能影响指数");
// add(relationships, "层次分析法", "舰艇机动效能影响指数");
// add(relationships, "层次分析法", "舰艇声呐效能影响指数");
// add(relationships, "层次分析法", "巡航导弹效能影响指数");
// add(relationships, "层次分析法", "防空导弹效能影响指数");
//
// // 13. 湿热指数计算方法
// add(relationships, "湿热指数计算方法", "湿热指数");
//
// // 14. 风寒指数计算方法
// add(relationships, "风寒指数计算方法", "风寒指数");
//
// // 15. 小样本信息扩散模型
// // 用于增强小样本下的评估鲁棒性,适用于所有风险与效能指标
// add(relationships, "小样本信息扩散模型", "补给舰航行安全风险指数");
// add(relationships, "小样本信息扩散模型", "导弹艇航行安全风险指数");
// add(relationships, "小样本信息扩散模型", "驱逐舰航行安全风险指数");
// add(relationships, "小样本信息扩散模型", "攻击型潜艇航行安全风险指数");
// add(relationships, "小样本信息扩散模型", "护卫舰航行安全风险指数");
// add(relationships, "小样本信息扩散模型", "舰载机飞行安全风险指数");
// add(relationships, "小样本信息扩散模型", "舰载直升机起飞安全风险指数");
// add(relationships, "小样本信息扩散模型", "舰载直升机降落安全风险指数");
// add(relationships, "小样本信息扩散模型", "水面舰艇综合效能影响指数");
//
// // 16. 高维知识点集映射模型
// // 用于知识关联,支撑所有指标的语义理解
// add(relationships, "高维知识点集映射模型", "补给舰航行安全风险指数");
// add(relationships, "高维知识点集映射模型", "导弹艇航行安全风险指数");
// add(relationships, "高维知识点集映射模型", "驱逐舰航行安全风险指数");
// add(relationships, "高维知识点集映射模型", "攻击型潜艇航行安全风险指数");
// add(relationships, "高维知识点集映射模型", "护卫舰航行安全风险指数");
// add(relationships, "高维知识点集映射模型", "舰炮打击效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰射鱼雷打击效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰载反舰导弹打击效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰载防空导弹打击效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰载机飞行安全风险指数");
// add(relationships, "高维知识点集映射模型", "舰载雷达探测效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰载声纳探测效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰载直升机起飞安全风险指数");
// add(relationships, "高维知识点集映射模型", "舰载直升机降落安全风险指数");
// add(relationships, "高维知识点集映射模型", "湿热指数");
// add(relationships, "高维知识点集映射模型", "风寒指数");
// add(relationships, "高维知识点集映射模型", "水面舰艇综合效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰艇机动效能影响指数");
// add(relationships, "高维知识点集映射模型", "舰艇声呐效能影响指数");
// add(relationships, "高维知识点集映射模型", "巡航导弹效能影响指数");
// add(relationships, "高维知识点集映射模型", "防空导弹效能影响指数");
//
// // 17. 舰船倾覆概率计算方法
// add(relationships, "舰船倾覆概率计算方法", "补给舰航行安全风险指数");
// add(relationships, "舰船倾覆概率计算方法", "导弹艇航行安全风险指数");
// add(relationships, "舰船倾覆概率计算方法", "驱逐舰航行安全风险指数");
// add(relationships, "舰船倾覆概率计算方法", "攻击型潜艇航行安全风险指数");
// add(relationships, "舰船倾覆概率计算方法", "护卫舰航行安全风险指数");
//
// // 18. 飞机颠簸计算方法
// add(relationships, "飞机颠簸计算方法", "舰载机飞行安全风险指数");
//
// // 19. 飞机积冰计算方法
// add(relationships, "飞机积冰计算方法", "舰载机飞行安全风险指数");
//
// // 20. 马尔科夫决策方法
// // 用于状态转移建模,影响航行与飞行安全
// add(relationships, "马尔科夫决策方法", "补给舰航行安全风险指数");
// add(relationships, "马尔科夫决策方法", "攻击型潜艇航行安全风险指数");
// add(relationships, "马尔科夫决策方法", "舰载机飞行安全风险指数");
// add(relationships, "马尔科夫决策方法", "水面舰艇综合效能影响指数");
//
// // 21. 效用分析决策方法
// // 用于方案优选,影响武器系统效能评估
// add(relationships, "效用分析决策方法", "舰炮打击效能影响指数");
// add(relationships, "效用分析决策方法", "舰射鱼雷打击效能影响指数");
// add(relationships, "效用分析决策方法", "舰载反舰导弹打击效能影响指数");
// add(relationships, "效用分析决策方法", "舰载防空导弹打击效能影响指数");
// add(relationships, "效用分析决策方法", "水面舰艇综合效能影响指数");
// add(relationships, "效用分析决策方法", "巡航导弹效能影响指数");
// add(relationships, "效用分析决策方法", "防空导弹效能影响指数");
//// 添加 大类 → 小类 关系
// add(relationships, "基础地理数据", "地形数据");
// add(relationships, "基础地理数据", "水文数据");
// add(relationships, "基础地理数据", "重要的岛屿港口");
//
// add(relationships, "气象观测数据", "实时气象数据");
// add(relationships, "气象观测数据", "历史气象数据");
//
// add(relationships, "海洋环境数据", "海洋水文数据");
// add(relationships, "海洋环境数据", "海洋气象数据");
//
// add(relationships, "战场环境数据", "电磁环境数据");
// add(relationships, "战场环境数据", "核生化数据");
//
// add(relationships, "装备性能数据", "武器系统参数");
// add(relationships, "装备性能数据", "平台机动数据");
//
// add(relationships, "作战任务数据", "任务规划数据");
// add(relationships, "作战任务数据", "兵力部署数据");
//
// add(relationships, "影响评估数据", "气象影响案例");
// add(relationships, "影响评估数据", "海洋影响案例");
//
// add(relationships, "决策规则数据", "军事规则库");
// add(relationships, "决策规则数据", "专家知识库");
//
// add(relationships, "实时动态数据", "卫星遥感数据");
// add(relationships, "实时动态数据", "无人平台数据");
// add(relationships, "实时动态数据", "民用设施数据");
// add(relationships, "实时动态数据", "人口密度数据");
//
// for(int j=0;j<relationships.size();j++){
// zhyRelationship=relationships.get(j);
// Long sid=test1Mapper.selectDocByTitle(zhyRelationship.getSourceName()).getId();
// Long tid=test1Mapper.selectDocByTitle(zhyRelationship.getTargetName()).getId();
// zhyRelationship.setTarget(tid);
// zhyRelationship.setSource(sid);
// zhyRelationship.setGroupId(2l);
// zhyRelationship.setFileList(new ArrayList<>());
// List<ZhyDoc> docs=test1Mapper.selectAllDoc1();
// if(zhyRelationship.getFileList().size()>0){
// for(int i=0;i<zhyRelationship.getFileList().size();i++){
// ZhyArticle article=new ZhyArticle();
// article.setName(removePdfSuffix(zhyRelationship.getFileList().get(i)));
// article.setSourceId(zhyRelationship.getSource());
// article.setTargetId(zhyRelationship.getTarget());
// article.setSourceName(zhyRelationship.getSourceName());
// article.setTagertName(zhyRelationship.getTargetName());
// article.setLocalUrl(ARTICLE_PDF_DIR+"/"+zhyRelationship.getFileList().get(i));
// articleService.insertZhyArticle(article);
// zhyRelationship.setArticleId(article.getId());
//
// zhyRelationship.setCreateTime(DateUtils.getNowDate());
// ZhyDoc vv = new ZhyDoc();
// vv.setId(zhyRelationship.getSource());
// ZhyDoc dd = test1Mapper.selectDocById(vv);
//
// if(dd==null){
// ZhyFileManage fileManage=test1Mapper.getFileById(docs.get(0).getFileId());
// zhyRelationship.setSourceName(fileManage.getFileName().replaceAll("(?i)\\.docx$", ""));
// }else{
// zhyRelationship.setSourceName(dd.getDocTitle());
// }
//
// vv.setId(zhyRelationship.getTarget());
// ZhyDoc dd2 = test1Mapper.selectDocById(vv);
// if(dd2==null){
// ZhyFileManage fileManage=test1Mapper.getFileById(docs.get(0).getFileId());
// zhyRelationship.setTargetName(fileManage.getFileName().replaceAll("(?i)\\.docx$", ""));
// }else{
// zhyRelationship.setTargetName(dd2.getDocTitle());
// }
// zhyRelationship.setTargetName(dd2.getDocTitle());
// zhyRelationship.setIsgraph(1l);
// zhyRelationship.setRelationship("相关");
// zhyRelationshipMapper.insertZhyRelationship(zhyRelationship);
// String cqr = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '"+zhyRelationship.getSource()+"' AND b.docId = '"+zhyRelationship.getTarget()+"'CREATE (a)-[r:"+zhyRelationship.getRelationship()+"{ name: '"+zhyRelationship.getRelationship()+ "', DbId: '"+zhyRelationship.getId()+"' }] -> (b) RETURN r";
// neo4jUtil.excuteCypherSql(cqr);
//
// List<String> ids = new ArrayList<>();
// ids.add(String.valueOf(zhyRelationship.getId()));
// ESDao esDao = new ESDao();
// esDao.id = article.getId().toString();
// esDao.DBid = article.getId().toString();
// esDao.type = "line";
// if(article.getLocalUrl()!=null){
// System.out.println("333333");
// try {
// String txt=article.getLocalUrl().replace("pdf", "txt");
// List<String> content = extractContentUntilSecondPage(txt);
// if (content != null) {
// // 打印结果
// for (String line : content) {
// System.out.println(line);
// }
// String result = String.join("", content);
// esDao.abstracts = result;
// } else {
// System.out.println("未找到相关内容或文件不存在。");
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// }
// } catch (IOException e) {
// e.printStackTrace();
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// }
// }else{
// esDao.abstracts = article.getName()+article.getKeywords()+article.getSummary();
// }
// esDao.data = ids.toString();
// esService.insertDocById("links",esDao);
// }
// }else{
// zhyRelationship.setCreateTime(DateUtils.getNowDate());
// ZhyDoc vv = new ZhyDoc();
// vv.setId(zhyRelationship.getSource());
// ZhyDoc dd = test1Mapper.selectDocById(vv);
// if(dd==null){
// ZhyFileManage fileManage=test1Mapper.getFileById(docs.get(0).getFileId());
// zhyRelationship.setSourceName(fileManage.getFileName().replaceAll("(?i)\\.docx$", ""));
// }else{
// zhyRelationship.setSourceName(dd.getDocTitle());
// }
//// zhyRelationship.setSourceName(dd.getDocTitle());
// vv.setId(zhyRelationship.getTarget());
// ZhyDoc dd2 = test1Mapper.selectDocById(vv);
// zhyRelationship.setTargetName(dd2.getDocTitle());
// zhyRelationship.setIsgraph(1l);
// zhyRelationship.setRelationship("相关");
// zhyRelationshipMapper.insertZhyRelationship(zhyRelationship);
// String cqr = "MATCH (a:Doc),(b:Doc) WHERE a.docId = '"+zhyRelationship.getSource()+"' AND b.docId = '"+zhyRelationship.getTarget()+"'CREATE (a)-[r:"+zhyRelationship.getRelationship()+"{ name: '"+zhyRelationship.getRelationship()+ "', DbId: '"+zhyRelationship.getId()+"' }] -> (b) RETURN r";
// neo4jUtil.excuteCypherSql(cqr);
// }
// }
//
//
//
//
//
//
//
//
//
//
//
//
// return toAjax(1);
//}
// @PreAuthorize("@ss.hasPermi('system:relationship:add')")
@Log(title = "文章关系", businessType = BusinessType.INSERT)
@PostMapping
@ -232,6 +602,11 @@ public class ZhyRelationshipController extends BaseController
return toAjax(1);
}
public List<String> extractContentUntilSecondPage(String filePath) throws IOException {

89
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SimpleParagraphSaver.java

@ -0,0 +1,89 @@
package com.ruoyi.system.service.impl;
import lombok.var;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.springframework.stereotype.Service;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
import java.util.List;
/**
* 极简工具将一个段落保存为独立的 .docx 文件
*/
@Service
public class SimpleParagraphSaver {
public static void saveAsDocx(XWPFDocument sourceDoc, String filePath) throws IOException {
XWPFDocument newDoc = new XWPFDocument();
boolean hasContent = false;
int paraIndex = 0;
for (XWPFParagraph srcPara : sourceDoc.getParagraphs()) {
String text = srcPara.getText();
System.out.println("处理段落 " + paraIndex++ + ": \"" + srcPara.getText() + "\"");
if (text == null || text.trim().isEmpty()) {
continue; // 跳过空段落(可选)
}
XWPFParagraph newPara = newDoc.createParagraph();
for (XWPFRun run : srcPara.getRuns()) {
XWPFRun newRun = newPara.createRun();
String runText = run.getText(0);
if (runText != null && !runText.isEmpty()) {
newRun.setText(runText);
hasContent = true;
}
// 复制基础格式(避免 setSubscript 报错)
newRun.setBold(run.isBold());
newRun.setItalic(run.isItalic());
newRun.setUnderline(run.getUnderline());
newRun.setColor(run.getColor());
newRun.setFontFamily(run.getFontFamily());
newRun.setFontSize(run.getFontSize());
newRun.setStrikeThrough(run.isStrikeThrough());
}
}
if (!hasContent) {
// 防止保存完全空白的文档
XWPFParagraph para = newDoc.createParagraph();
para.createRun().setText("(本节无有效内容)");
}
try (FileOutputStream fos = new FileOutputStream(filePath)) {
newDoc.write(fos); // ✅ 必须调用 write
} finally {
newDoc.close();
}
}
public void copyParagraph(XWPFParagraph srcPara, XWPFDocument destDoc) {
// 创建新段落
XWPFParagraph newPara = destDoc.createParagraph();
newPara.getCTP().set(srcPara.getCTP()); // ✅ 关键:直接复制底层 CTP XML
}
/**
* 将整个文档的某一段落保存为新文件含公式
*/
public XWPFDocument saveParagraphAsDocx(XWPFParagraph srcPara) throws Exception {
XWPFDocument newDoc = new XWPFDocument();
// 复制段落(含公式、图片)
copyParagraph(srcPara, newDoc);
return newDoc;
}
}

133
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java

@ -12,8 +12,10 @@ import com.ruoyi.system.domain.ZhySetInfo;
import com.ruoyi.system.mapper.Test1Mapper;
import com.ruoyi.system.mapper.ZhyBattleMapper;
import com.ruoyi.system.mapper.ZhySetInfoMapper;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -60,17 +62,22 @@ public class WordSplitter {
String picSize = info.get(0).getContent();
try {
byte[] fileBytes = IOUtils.toByteArray(fileInputStream);
// 创建文件输入流
FileInputStream fis = fileInputStream;
// System.out.println(fis);
XWPFDocument document = new XWPFDocument(fis);
XWPFDocument document = new XWPFDocument(new ByteArrayInputStream(fileBytes));
XWPFDocument document1 = new XWPFDocument(new ByteArrayInputStream(fileBytes));
// 遍历段落,寻找标题并拆分
List<XWPFParagraph> paragraphs = document.getParagraphs();
List<XWPFParagraph> paragraphs1 = document1.getParagraphs();
String currentSectionTitle = "";
String realTitle = "";
String realleve = "";
XWPFDocument currentSection = new XWPFDocument();
XWPFDocument currentSection1 = new XWPFDocument();
List<String> currentSectionImages = new ArrayList<>();
@ -142,9 +149,12 @@ public class WordSplitter {
}
}
}
List<String> useImgs = new ArrayList<>();
for (int c = 0; c < paragraphs.size(); c++) {
System.out.println(paragraphs1.get(c).getText());
System.out.println(paragraphs.get(c).getText());
XWPFParagraph paragraph = paragraphs.get(c);
@ -172,6 +182,10 @@ public class WordSplitter {
String type = String.valueOf(startsWithHeading1(textss,fileUploadDTO).get("type"));
String title = String.valueOf(startsWithHeading1(textss,fileUploadDTO).get("title"));
String url = String.valueOf(startsWithHeading1(textss,fileUploadDTO).get("docUrl"));
@ -201,7 +215,14 @@ public class WordSplitter {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
// simpleParagraphSaver.saveAsDocx(currentSection1,outputFolder + "\\" + currentSectionTitle+".docx");
try (FileOutputStream fos = new FileOutputStream(outputFolder + "\\" + currentSectionTitle + ".docx")) {
currentSection1.write(fos);
} finally {
currentSection1.close();
}
currentSection = new XWPFDocument();
currentSection1 = new XWPFDocument();
}
useImgs = new ArrayList<>();
@ -242,8 +263,14 @@ public class WordSplitter {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
// simpleParagraphSaver.saveAsDocx(currentSection1,outputFolder + "\\" + currentSectionTitle+".docx");
try (FileOutputStream fos = new FileOutputStream(outputFolder + "\\" + currentSectionTitle + ".docx")) {
currentSection1.write(fos);
} finally {
currentSection1.close();
}
currentSection = new XWPFDocument();
currentSection1 = new XWPFDocument();
}
useImgs = new ArrayList<>();
currentSectionTitle = paragraph.getText().trim().replaceAll("[/\\\\:*?|]", "&");
@ -286,8 +313,14 @@ public class WordSplitter {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
// simpleParagraphSaver.saveAsDocx(currentSection1,outputFolder + "\\" + currentSectionTitle+".docx");
try (FileOutputStream fos = new FileOutputStream(outputFolder + "\\" + currentSectionTitle + ".docx")) {
currentSection1.write(fos);
} finally {
currentSection1.close();
}
currentSection = new XWPFDocument();
currentSection1 = new XWPFDocument();
}
useImgs = new ArrayList<>();
currentSectionTitle = paragraph.getText().trim().replaceAll("[/\\\\:*?|]", "&");
@ -327,8 +360,14 @@ public class WordSplitter {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
// simpleParagraphSaver.saveAsDocx(currentSection1,outputFolder + "\\" + currentSectionTitle+".docx");
try (FileOutputStream fos = new FileOutputStream(outputFolder + "\\" + currentSectionTitle + ".docx")) {
currentSection1.write(fos);
} finally {
currentSection1.close();
}
currentSection = new XWPFDocument();
currentSection1 = new XWPFDocument();
}
useImgs = new ArrayList<>();
currentSectionTitle = paragraph.getText().trim().replaceAll("[/\\\\:*?|]", "&");;
@ -367,8 +406,14 @@ public class WordSplitter {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
// simpleParagraphSaver.saveAsDocx(currentSection1,outputFolder + "\\" + currentSectionTitle+".docx");
try (FileOutputStream fos = new FileOutputStream(outputFolder + "\\" + currentSectionTitle + ".docx")) {
currentSection1.write(fos);
} finally {
currentSection1.close();
}
currentSection = new XWPFDocument();
currentSection1 = new XWPFDocument();
}
useImgs = new ArrayList<>();
currentSectionTitle = paragraph.getText().trim().replaceAll("[/\\\\:*?|]", "&");;
@ -407,8 +452,14 @@ public class WordSplitter {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
// simpleParagraphSaver.saveAsDocx(currentSection1,outputFolder + "\\" + currentSectionTitle+".docx");
try (FileOutputStream fos = new FileOutputStream(outputFolder + "\\" + currentSectionTitle + ".docx")) {
currentSection1.write(fos);
} finally {
currentSection1.close();
}
currentSection = new XWPFDocument();
currentSection1 = new XWPFDocument();
}
useImgs = new ArrayList<>();
currentSectionTitle = paragraph.getText().trim().replaceAll("[/\\\\:*?|]", "&");;
@ -437,6 +488,46 @@ public class WordSplitter {
System.out.println("aaaaaaaaaaaaa--------saa");
System.out.println(useImgs.size());
XWPFParagraph newPara = currentSection1.createParagraph();
newPara.getCTP().set(paragraphs1.get(c).getCTP());
// 3. 遍历原段落中的图片并修复
for (XWPFRun run1 : paragraphs1.get(c).getRuns()) {
for (XWPFPicture picture : run1.getEmbeddedPictures()) {
try {
byte[] imgData = picture.getPictureData().getData();
int imgType = picture.getPictureData().getPictureType();
// 添加图片到新文档
String newRid = currentSection1.addPictureData(
new ByteArrayInputStream(imgData),
imgType
);
// 获取原 rId
String oldRid = picture.getCTPicture().getBlipFill().getBlip().getEmbed();
// 替换 XML 中的关系 ID
String xml = newPara.getCTP().toString();
if (xml.contains("r:embed=\"" + oldRid + "\"")) {
xml = xml.replace("r:embed=\"" + oldRid + "\"",
"r:embed=\"" + newRid + "\"");
CTP repaired = CTP.Factory.parse(xml);
newPara.getCTP().set(repaired);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
//正文
XWPFParagraph newParagraph = currentSection.createParagraph();
newParagraph.setAlignment(paragraph.getAlignment());
@ -473,11 +564,12 @@ public class WordSplitter {
realleve = type;
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, type, outputFilePath, realTitle,outputFolder,fileId,currentSectionImages);
currentSectionImages = new ArrayList<>();
}
levelList = list;
// 关闭资源
fis.close();
// fis.close();
int a = test1Mapper.insertDocList(docList);
docList = new ArrayList<>();
getLevelInfo();
@ -485,13 +577,15 @@ public class WordSplitter {
e.printStackTrace();
} catch (InvalidExtensionException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Autowired
SimpleParagraphSaver simpleParagraphSaver;
public void testWordOneOld(FileInputStream fileInputStream, String outputFolder, Integer fileId) {
levelList = new ArrayList<>();
List<Map> list = new ArrayList<>();
@ -622,6 +716,12 @@ public class WordSplitter {
String title = String.valueOf(startsWithHeadingOld(textss).get("title"));
String url = String.valueOf(startsWithHeadingOld(textss).get("docUrl"));
//判断文件是否为空
if (!textss.equals("")) {
//判断为几级标题
@ -645,6 +745,7 @@ public class WordSplitter {
if (!currentSectionTitle.isEmpty()) {
currentSectionTitle = currentSectionTitle.replace(" ","");
String outputFilePath = outputFolder + "\\" + currentSectionTitle + ".txt";
saveSection(currentSection, outputFolder, currentSectionTitle, realleve, outputFilePath, realTitle,outputFolder,fileId,useImgs);
currentSection = new XWPFDocument();
@ -2268,7 +2369,7 @@ public class WordSplitter {
zz.setDocLevel(1l);
ZhyDoc zhy = test1Mapper.selectDoc(zz);
zhy.setDocParentId(0l);
zhy.setGroupId(0l);
zhy.setGroupId(-1l);
updateList.add(zhy);
@ -2287,7 +2388,7 @@ public class WordSplitter {
aa.setDocUrl(String.valueOf(ll.get(a).get("docUrl")));
aa.setDocParentId(TopId);
aa.setCreateTime(new Date());
aa.setGroupId(0l);
aa.setGroupId(-1l);
updateList.add(aa);
} else {
int aaaaa = 0;
@ -2318,7 +2419,7 @@ public class WordSplitter {
newDoc.setCreateTime(new Date());
newDoc.setDocParentId(zhy1.getId());
System.out.println(newDoc);
newDoc.setGroupId(0l);
newDoc.setGroupId(-1l);
updateList.add(newDoc);
aaaaa = 1;
break;
@ -2334,7 +2435,7 @@ public class WordSplitter {
aa.setDocUrl(String.valueOf(ll.get(a).get("docUrl")));
aa.setDocParentId(TopId);
aa.setCreateTime(new Date());
aa.setGroupId(0l);
aa.setGroupId(-1l);
System.out.println(aa);
updateList.add(aa);
}

2
ruoyi-ui/src/views/system/SysPoint/index.vue

@ -223,7 +223,7 @@ export default {
typeOptions: [
{ label: '作者', value: 'author' },
{ label: '机构', value: 'agency' },
{ label: '关键词', value: 'keyword' }
// { label: '', value: 'keyword' }
],
//
loading: true,

13
ruoyi-ui/src/views/system/create/index.vue

@ -510,11 +510,11 @@ export default {
docTitle: res.mxMap.name,
children: res.mxMap.children
},
{
id: res.zhibMap.id,
docTitle: res.zhibMap.name,
children: res.zhibMap.children
},
// {
// id: res.zhibMap.id,
// docTitle: res.zhibMap.name,
// children: res.zhibMap.children
// },
]
})
@ -1023,5 +1023,8 @@ export default {
position: absolute;
right: 2px;
}
.el-cascader-menu__wrap {
height: 170px;
}
</style>

6
ruoyi-ui/src/views/system/fileManage/index.vue

@ -207,8 +207,8 @@
<!-- (scope.row.groupId==2&&scope.row.docLevel<2)-->
<!--"-->
<!-- @click="openAddTxt(scope.row)">添加</el-button>-->
<el-button v-hasPermi="['system:fileManage:edit']" style="font-size: 0.8vw;" type="text" @click="editDoc(scope.row)">编辑</el-button>
<el-button v-hasPermi="['system:fileManage:remove']" style="font-size: 0.8vw;" type="text" @click="deleteTxt(scope.row)">删除</el-button>
<el-button v-hasPermi="['system:tupupoint:edit']" style="font-size: 0.8vw;" type="text" @click="editDoc(scope.row)">编辑</el-button>
<el-button v-hasPermi="['system:tupupoint:delete']" style="font-size: 0.8vw;" type="text" @click="deleteTxt(scope.row)">删除</el-button>
</template>
</el-table-column>
@ -341,7 +341,7 @@
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入docdocx格式文件</span>
<span>仅允许导入docx格式文件</span>
<span>{{ upload.tip }}</span>
</div>
</el-upload>

2
ruoyi-ui/src/views/system/fileManage/indexNB.vue

@ -224,7 +224,7 @@
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入docdocx格式文件</span>
<span>仅允许导入docx格式文件</span>
<span>{{ upload.tip }}</span>
</div>
</el-upload>

Loading…
Cancel
Save