From d7d27b5e711b2e37a77a050e9fe05acea1d336f3 Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Sat, 4 Nov 2023 18:58:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E9=97=BB=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +- readme.md | 19 +- .../app/news/NewsAppController.java | 17 +- .../systemcity/service/news/INewsService.java | 5 + .../service/news/impl/NewsServiceImpl.java | 19 +- .../com/cm/systemcity/utils/RichTextUtil.java | 28 ++ src/main/resources/application-btgxq.yml | 2 +- .../mybatis/mapper/news/news-mapper.xml | 8 +- .../bindingdepartment/bindingdepartment.html | 4 +- .../static/route/community/list-tree.html | 4 +- .../static/route/dict/list-tree.html | 4 +- .../static/route/news/list_daily.html | 2 +- .../static/route/news/list_manual.html | 278 ++++++++++++++++++ .../static/route/news/list_notice.html | 2 +- .../static/route/news/list_propaganda.html | 2 +- .../static/route/news/save_daily.html | 12 +- .../static/route/news/save_manual.html | 151 ++++++++++ .../static/route/news/save_notice.html | 16 +- .../static/route/news/save_propaganda.html | 12 +- .../static/route/news/update_daily.html | 12 +- .../static/route/news/update_manual.html | 171 +++++++++++ .../static/route/news/update_notice.html | 18 +- .../static/route/news/update_propaganda.html | 12 +- 23 files changed, 747 insertions(+), 59 deletions(-) create mode 100644 src/main/java/com/cm/systemcity/utils/RichTextUtil.java create mode 100644 src/main/resources/static/route/news/list_manual.html create mode 100644 src/main/resources/static/route/news/save_manual.html create mode 100644 src/main/resources/static/route/news/update_manual.html diff --git a/pom.xml b/pom.xml index db1bbc0..c839305 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.cm system-city 1.0.0.RELEASE - systemcity + system-city 城市管理系统 @@ -165,6 +165,12 @@ 4.1.0 + + org.jsoup + jsoup + 1.14.3 + + junit junit diff --git a/readme.md b/readme.md index 410a49f..dd1e3c0 100644 --- a/readme.md +++ b/readme.md @@ -16,11 +16,10 @@ ### 菜单调整 -社区(村)管理: - + @@ -37,14 +36,26 @@ - + + - + + + + + + + + + + + +
名称 变更前 变更后
list.html数据管理 / 社区(村)管理/list.html list-tree.html/list-tree.html
信息发布 / 操作手册/list_manual.html/api/news/resource/news/route/news
diff --git a/src/main/java/com/cm/systemcity/controller/app/news/NewsAppController.java b/src/main/java/com/cm/systemcity/controller/app/news/NewsAppController.java index ead2a4f..4b62d6a 100644 --- a/src/main/java/com/cm/systemcity/controller/app/news/NewsAppController.java +++ b/src/main/java/com/cm/systemcity/controller/app/news/NewsAppController.java @@ -50,7 +50,8 @@ public class NewsAppController extends AbstractController { public SuccessResultList> listPageNoticeNews(@RequestHeader("token") String token, @PathVariable("newsType") String newsType, ListPage page) throws SearchException, ParamsException { if (!StringUtils.equals(INewsService.NEWS_TYPE_DAILY, newsType) && !StringUtils.equals(INewsService.NEWS_TYPE_NOTICE, newsType) && - !StringUtils.equals(INewsService.NEWS_TYPE_PROPAGANDA, newsType)) { + !StringUtils.equals(INewsService.NEWS_TYPE_PROPAGANDA, newsType) && + !StringUtils.equals(INewsService.NEWS_TYPE_MANUAL, newsType)) { throw new ParamsException("新闻类型错误"); } Map params = requestParams(); @@ -60,4 +61,18 @@ public class NewsAppController extends AbstractController { } + + @ApiOperation(value = "咨询详情", notes = "咨询详情接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "newsId", value = "咨询ID", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("get/{newsId}") + public NewsDTO getNews(@RequestHeader("token") String token, @PathVariable("newsId") String newsId) throws SearchException { + Map params = getParams(); + params.put("newsId", newsId); + return newsService.getNews(token, params); + } + + } diff --git a/src/main/java/com/cm/systemcity/service/news/INewsService.java b/src/main/java/com/cm/systemcity/service/news/INewsService.java index e1c3796..9d92db9 100755 --- a/src/main/java/com/cm/systemcity/service/news/INewsService.java +++ b/src/main/java/com/cm/systemcity/service/news/INewsService.java @@ -33,6 +33,7 @@ public interface INewsService { * 每日通报类型 */ String NEWS_TYPE_DAILY = "daily"; + String NEWS_TYPE_MANUAL = "manual"; /** * 新增咨询 @@ -79,6 +80,9 @@ public interface INewsService { */ NewsDTO getNews(Map params) throws SearchException; + NewsDTO getNews(String token, Map params); + + /** * 咨询分页列表 * @@ -112,4 +116,5 @@ public interface INewsService { * @throws SearchException */ int countOfNews(Map params) throws SearchException; + } diff --git a/src/main/java/com/cm/systemcity/service/news/impl/NewsServiceImpl.java b/src/main/java/com/cm/systemcity/service/news/impl/NewsServiceImpl.java index 1a7741e..b628e5e 100755 --- a/src/main/java/com/cm/systemcity/service/news/impl/NewsServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/news/impl/NewsServiceImpl.java @@ -13,10 +13,12 @@ import com.cm.common.utils.UUIDUtil; import com.cm.systemcity.dao.news.INewsDao; import com.cm.systemcity.pojo.dtos.news.NewsDTO; import com.cm.systemcity.service.news.INewsService; +import com.cm.systemcity.utils.RichTextUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.Arrays; @@ -37,6 +39,8 @@ public class NewsServiceImpl extends AbstractService implements INewsService { private SecurityComponent securityComponent; @Autowired private INewsDao newsDao; + @Value("${server.url}") + private String serverUrl; @Override public SuccessResult saveNews(Map params) throws SaveException { @@ -71,7 +75,18 @@ public class NewsServiceImpl extends AbstractService implements INewsService { @Override public NewsDTO getNews(Map params) throws SearchException { - return newsDao.getNews(params); + NewsDTO newsDTO = newsDao.getNews(params); + if (newsDTO == null) { + throw new SearchException("数据不存在"); + } + return newsDTO; + } + + @Override + public NewsDTO getNews(String token, Map params) { + NewsDTO newsDTO = getNews(params); + newsDTO.setNewsContent(RichTextUtil.fillImgSrc(serverUrl, newsDTO.getNewsContent())); + return newsDTO; } @Override @@ -95,6 +110,8 @@ public class NewsServiceImpl extends AbstractService implements INewsService { page.getParams().put("newsType", "073fd635-caf0-47dc-a0e8-266430d91b20"); } else if (StringUtils.equals(NEWS_TYPE_PROPAGANDA, page.getParams().get("newsType").toString())) { page.getParams().put("newsType", "63ea8f10-7454-47e4-8810-9684143b1acd"); + } else if (StringUtils.equals(NEWS_TYPE_MANUAL, page.getParams().get("newsType").toString())) { + page.getParams().put("newsType", "9ec9989b-1814-4c15-9cbb-4f815ab4459a"); } return listPageNews(page); } diff --git a/src/main/java/com/cm/systemcity/utils/RichTextUtil.java b/src/main/java/com/cm/systemcity/utils/RichTextUtil.java new file mode 100644 index 0000000..b036078 --- /dev/null +++ b/src/main/java/com/cm/systemcity/utils/RichTextUtil.java @@ -0,0 +1,28 @@ +package com.cm.systemcity.utils; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +public class RichTextUtil { + + public static String fillImgSrc(String baseUrl, String content) { + // 使用Jsoup解析HTML内容 + Document doc = Jsoup.parse(content); + // 查找所有图片标签 + Elements imgElements = doc.select("img"); + // 循环处理每个图片标签 + for (Element imgElement : imgElements) { + String src = imgElement.attr("src"); + // 检查是否为相对路径 + if (src != null && !src.startsWith("http") && !src.startsWith("data:")) { + // 补齐相对路径 + imgElement.attr("src", baseUrl + "/" + src); + } + } + // 获取更新后的富文本内容 + return doc.toString(); + } + +} diff --git a/src/main/resources/application-btgxq.yml b/src/main/resources/application-btgxq.yml index bbcae1c..01e44be 100644 --- a/src/main/resources/application-btgxq.yml +++ b/src/main/resources/application-btgxq.yml @@ -1,6 +1,6 @@ server: port: 7022 - url: http://127.0.0.1:7022/servicecity + url: http://192.168.0.15:7022/servicecity title: 生态环保网格化监督平台 servlet: context-path: /servicecity diff --git a/src/main/resources/mybatis/mapper/news/news-mapper.xml b/src/main/resources/mybatis/mapper/news/news-mapper.xml index 6ca8046..40dbfcc 100755 --- a/src/main/resources/mybatis/mapper/news/news-mapper.xml +++ b/src/main/resources/mybatis/mapper/news/news-mapper.xml @@ -103,7 +103,13 @@ + +
+ +
+
+ +
+
+ + + +
+ +
+ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/news/list_notice.html b/src/main/resources/static/route/news/list_notice.html index 816b587..e862738 100755 --- a/src/main/resources/static/route/news/list_notice.html +++ b/src/main/resources/static/route/news/list_notice.html @@ -135,7 +135,7 @@ return rowData; } }, - {width: 100, align:'center', title:'操作', fixed: 'right', + {width: 105, align:'center', title:'操作', fixed: 'right', templet: function() { var dom = '
'+ ''+ diff --git a/src/main/resources/static/route/news/list_propaganda.html b/src/main/resources/static/route/news/list_propaganda.html index 297dd22..65bfea8 100755 --- a/src/main/resources/static/route/news/list_propaganda.html +++ b/src/main/resources/static/route/news/list_propaganda.html @@ -117,7 +117,7 @@ return rowData; } }, - {width: 100, align:'center', title:'操作', fixed: 'right', + {width: 105, align:'center', title:'操作', fixed: 'right', templet: function() { var dom = '
'+ ''+ diff --git a/src/main/resources/static/route/news/save_daily.html b/src/main/resources/static/route/news/save_daily.html index 1618660..175fdd9 100755 --- a/src/main/resources/static/route/news/save_daily.html +++ b/src/main/resources/static/route/news/save_daily.html @@ -11,12 +11,12 @@ -
+
-
+
@@ -27,7 +27,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -101,7 +101,7 @@ function initContentRichText() { editor = UE.getEditor('newsContent', {autoHeightEnabled: false}); editor.ready(function() { - editor.setHeight($win.height() - 350); + editor.setHeight($win.height() - 370); }); } diff --git a/src/main/resources/static/route/news/save_manual.html b/src/main/resources/static/route/news/save_manual.html new file mode 100644 index 0000000..f1e8071 --- /dev/null +++ b/src/main/resources/static/route/news/save_manual.html @@ -0,0 +1,151 @@ + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+ +
+ + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/news/save_notice.html b/src/main/resources/static/route/news/save_notice.html index 21203b4..6c61dfa 100755 --- a/src/main/resources/static/route/news/save_notice.html +++ b/src/main/resources/static/route/news/save_notice.html @@ -11,12 +11,12 @@ -
+
-
+
@@ -25,7 +25,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -54,7 +54,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -143,7 +143,7 @@ function initContentRichText() { editor = UE.getEditor('newsContent', {autoHeightEnabled: false}); editor.ready(function() { - editor.setHeight($win.height() - 380); + editor.setHeight($win.height() - 420); }); } diff --git a/src/main/resources/static/route/news/save_propaganda.html b/src/main/resources/static/route/news/save_propaganda.html index 8ac0bf7..f1e8071 100755 --- a/src/main/resources/static/route/news/save_propaganda.html +++ b/src/main/resources/static/route/news/save_propaganda.html @@ -11,12 +11,12 @@ -
+
-
+
@@ -27,7 +27,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -101,7 +101,7 @@ function initContentRichText() { editor = UE.getEditor('newsContent', {autoHeightEnabled: false}); editor.ready(function() { - editor.setHeight($win.height() - 350); + editor.setHeight($win.height() - 370); }); } diff --git a/src/main/resources/static/route/news/update_daily.html b/src/main/resources/static/route/news/update_daily.html index 10cfe43..242946f 100755 --- a/src/main/resources/static/route/news/update_daily.html +++ b/src/main/resources/static/route/news/update_daily.html @@ -11,12 +11,12 @@ -
+
-
+
@@ -27,7 +27,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -124,7 +124,7 @@ function initContentRichText(value) { editor = UE.getEditor('newsContent', {autoHeightEnabled: false}); editor.ready(function() { - editor.setHeight($win.height() - 350); + editor.setHeight($win.height() - 380); editor.setContent(value); }); } diff --git a/src/main/resources/static/route/news/update_manual.html b/src/main/resources/static/route/news/update_manual.html new file mode 100644 index 0000000..242946f --- /dev/null +++ b/src/main/resources/static/route/news/update_manual.html @@ -0,0 +1,171 @@ + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+ +
+ + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/news/update_notice.html b/src/main/resources/static/route/news/update_notice.html index 510ec4e..8801ebf 100755 --- a/src/main/resources/static/route/news/update_notice.html +++ b/src/main/resources/static/route/news/update_notice.html @@ -11,12 +11,12 @@ -
+
-
+
@@ -25,7 +25,7 @@
-
+
@@ -35,8 +35,8 @@
-
-
+
+
@@ -45,7 +45,7 @@
-
+
@@ -54,7 +54,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
@@ -168,7 +168,7 @@ function initContentRichText(value) { editor = UE.getEditor('newsContent', {autoHeightEnabled: false}); editor.ready(function() { - editor.setHeight($win.height() - 380); + editor.setHeight($win.height() - 430); editor.setContent(value); }); } diff --git a/src/main/resources/static/route/news/update_propaganda.html b/src/main/resources/static/route/news/update_propaganda.html index 10cfe43..242946f 100755 --- a/src/main/resources/static/route/news/update_propaganda.html +++ b/src/main/resources/static/route/news/update_propaganda.html @@ -11,12 +11,12 @@ -
+
-
+
@@ -27,7 +27,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -124,7 +124,7 @@ function initContentRichText(value) { editor = UE.getEditor('newsContent', {autoHeightEnabled: false}); editor.ready(function() { - editor.setHeight($win.height() - 350); + editor.setHeight($win.height() - 380); editor.setContent(value); }); }