From 1d7e279bf7a351214fde1f05dfb2c8773b25148a Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Tue, 27 Feb 2024 14:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iasf/common/config/WebMvcConfigurer.java | 2 +- .../iasf/controller/SysColumnController.java | 8 +++++++- .../SysColumnLongPageController.java | 5 ++++- .../iasf/controller/SysContentController.java | 19 ++++++++++++++++++- .../iasf/mapper/xml/SysContentMapper.xml | 6 +++--- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/huoran/iasf/common/config/WebMvcConfigurer.java b/src/main/java/com/huoran/iasf/common/config/WebMvcConfigurer.java index 26a5556..2538ed0 100644 --- a/src/main/java/com/huoran/iasf/common/config/WebMvcConfigurer.java +++ b/src/main/java/com/huoran/iasf/common/config/WebMvcConfigurer.java @@ -50,7 +50,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport { // corsConfiguration.addAllowedOrigin("*"); // 允许任何头 corsConfiguration.addAllowedOrigin("https://new.iasf.ac.cn"); //允许信任域名 corsConfiguration.addAllowedOrigin("https://www.iasf.ac.cn"); //允许信任域名 - corsConfiguration.addAllowedOrigin("http://192.168.31.125:8088"); //允许信任域名 + corsConfiguration.addAllowedOrigin("http://192.168.31.125:8095"); //允许信任域名 corsConfiguration.addAllowedOrigin("http://192.168.31.125:8089"); //允许信任域名 corsConfiguration.addAllowedOrigin("http://10.10.11.7"); //允许信任域名 corsConfiguration.addAllowedMethod("*"); // 允许任何方法(post、get等) diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnController.java b/src/main/java/com/huoran/iasf/controller/SysColumnController.java index 7b51fa6..8b18860 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnController.java @@ -192,8 +192,14 @@ public class SysColumnController { @PostMapping("/sameLevelJudgment") + @Decrypt @ApiOperation(value = "同级判重", response = ColumnWeightReqVO.class) - public R sameLevelJudgment(@RequestBody @Valid ColumnWeightReqVO sysColumn) { + public R sameLevelJudgment(@RequestBody @Valid ColumnWeightReqVO sysColumn) throws UnsupportedEncodingException { + if (!StringUtils.isEmpty(sysColumn.getColumnName())) { + //中文转码 + String name = URLDecoder.decode(sysColumn.getColumnName(), StandardCharsets.UTF_8.toString()); + sysColumn.setColumnName(name); + } return service.sameLevelJudgment(sysColumn) ? R.success() : R.fail("同级下已存在重复栏目!"); } diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java b/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java index 74fb592..12e39b2 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java @@ -129,8 +129,11 @@ public class SysColumnLongPageController { @PostMapping("/getRedisCache") + @Decrypt @ApiOperation(value = "获取Redis缓存") - public R getRedisCache(@ApiParam(name = "columnId", value = "栏目id主键", required = true) @RequestParam Integer columnId) { + public R getRedisCache( + @ApiParam(name = "columnId", value = "栏目id主键", required = true) + @RequestBody Integer columnId) { //保存的key名 String key = "saveTheCache:columnId:" + columnId; //查看缓存是否有数据 diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index c4140f9..87a2dad 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.java @@ -189,7 +189,12 @@ public class SysContentController { @PostMapping("/checkIfTheTitleIsRepeat") @Decrypt @ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = ContentHeavyTitleReqVO.class) - public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) { + public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) throws UnsupportedEncodingException { + if (!org.springframework.util.StringUtils.isEmpty(content.getTitle())) { + //中文转码 + String name = URLDecoder.decode(content.getTitle(), StandardCharsets.UTF_8.toString()); + content.setTitle(name); + } return service.checkIfTheTitleIsRepeat(content) ? R.success() : R.fail("该标题已重复!"); } @@ -202,6 +207,18 @@ public class SysContentController { String title = URLDecoder.decode(content.getTitle(), StandardCharsets.UTF_8.toString()); content.setTitle(title); } + if (!StringUtils.isEmpty(content.getPatentQueryKeyWord())) { + String title = URLDecoder.decode(content.getPatentQueryKeyWord(), StandardCharsets.UTF_8.toString()); + content.setPatentQueryKeyWord(title); + } + if (!StringUtils.isEmpty(content.getMonographQueryKeyWord())) { + String title = URLDecoder.decode(content.getMonographQueryKeyWord(), StandardCharsets.UTF_8.toString()); + content.setMonographQueryKeyWord(title); + } + if (!StringUtils.isEmpty(content.getPaperQueryKeyWord())) { + String title = URLDecoder.decode(content.getPaperQueryKeyWord(), StandardCharsets.UTF_8.toString()); + content.setPaperQueryKeyWord(title); + } return service.newlyPublishedArticles(content); } diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml index a7d2030..b565dbd 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml @@ -88,8 +88,8 @@ ( SELECT s.*, - ( SELECT GROUP_CONCAT( label_name ) FROM sys_content_label l WHERE deleted = 1 AND FIND_IN_SET( l.id, s.lable_id - ) ) AS labelName, + ( SELECT GROUP_CONCAT( l.id ) FROM sys_content_label l WHERE deleted = 1 AND FIND_IN_SET( l.id, s.lable_id + ) ) AS labelId, ( SELECT c.classification_name FROM sys_content_classification c WHERE deleted = 1 AND s.classification_id = c.id ) AS classificationName , (SELECT c.column_name from sys_column c WHERE c.id = s.column_id) as columnName @@ -107,7 +107,7 @@ and - t.labelName LIKE CONCAT('%',#{item},'%') + FIND_IN_SET( #{item}, t.labelId)