From 6ae7f020d21ff0dd1b44184bf7545e14829db5a4 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 7 Mar 2023 15:53:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/common/config/WebSecurityConfig.java | 1 + .../com/xkrs/straw/controller/NoticeController.java | 12 ++++++++++-- .../java/com/xkrs/straw/service/NoticeService.java | 5 +++++ .../xkrs/straw/service/impl/NoticeServiceImpl.java | 12 ++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 8385289..9f7894e 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -41,6 +41,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.POST, "/insertFirePointChannelPrecise").permitAll() .antMatchers(HttpMethod.GET, "/queryFirePointBroadcast").permitAll() .antMatchers(HttpMethod.POST, "/api/user/updateSysUser").permitAll() + .antMatchers(HttpMethod.GET, "/queryNotice").permitAll()//查询通知 .antMatchers(HttpMethod.GET, "/selectGlobalConfigDict").permitAll() .antMatchers(HttpMethod.GET, "/selectGlobalConfigValue").permitAll() .antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll() diff --git a/src/main/java/com/xkrs/straw/controller/NoticeController.java b/src/main/java/com/xkrs/straw/controller/NoticeController.java index 733618e..8d11d81 100644 --- a/src/main/java/com/xkrs/straw/controller/NoticeController.java +++ b/src/main/java/com/xkrs/straw/controller/NoticeController.java @@ -36,12 +36,20 @@ public class NoticeController { return noticeService.updateNotice(token, updateQo); } +// /** +// * 查询通知 +// */ +// @GetMapping("/queryNotice") +// public String queryNotice(@RequestHeader(value = "Authorization") String token) { +// return noticeService.queryNotice(token); +// } + /** * 查询通知 */ @GetMapping("/queryNotice") - public String queryNotice(@RequestHeader(value = "Authorization") String token) { - return noticeService.queryNotice(token); + public String queryNotice() { + return noticeService.queryNotice(); } /** diff --git a/src/main/java/com/xkrs/straw/service/NoticeService.java b/src/main/java/com/xkrs/straw/service/NoticeService.java index 762a34e..bb94667 100644 --- a/src/main/java/com/xkrs/straw/service/NoticeService.java +++ b/src/main/java/com/xkrs/straw/service/NoticeService.java @@ -27,6 +27,11 @@ public interface NoticeService { */ String queryNotice(String token); + /** + * 查询通知 + */ + String queryNotice(); + /** * 已读通知 */ diff --git a/src/main/java/com/xkrs/straw/service/impl/NoticeServiceImpl.java b/src/main/java/com/xkrs/straw/service/impl/NoticeServiceImpl.java index fa5b690..fa0cfd7 100644 --- a/src/main/java/com/xkrs/straw/service/impl/NoticeServiceImpl.java +++ b/src/main/java/com/xkrs/straw/service/impl/NoticeServiceImpl.java @@ -169,6 +169,18 @@ public class NoticeServiceImpl implements NoticeService { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale); } + /** + * 查询通知 + */ + @Override + public String queryNotice() { + List noticeList = noticeDao.findAll(Sort.by(Sort.Direction.DESC, "id")); + if (noticeList.size() > 0) { + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, noticeList.get(0), locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, null, locale); + } + /** * 已读通知 */