From 7ffa1b4e1f15b00ae14ef2942d81c823c3eaf4f8 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Wed, 20 Mar 2024 15:50:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/iasf/common/config/WebMvcConfigurer.java | 2 +- .../huoran/iasf/controller/SysContentController.java | 12 ++++++------ .../com/huoran/iasf/controller/UserController.java | 11 ++++++++++- src/main/resources/application-dev.yml | 12 ++++++------ 4 files changed, 23 insertions(+), 14 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 9d6ee9a..dc42596 100644 --- a/src/main/java/com/huoran/iasf/common/config/WebMvcConfigurer.java +++ b/src/main/java/com/huoran/iasf/common/config/WebMvcConfigurer.java @@ -51,7 +51,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport { corsConfiguration.addAllowedOrigin("https://new.iasf.ac.cn"); //允许信任域名 corsConfiguration.addAllowedOrigin("https://www.iasf.ac.cn"); //允许信任域名 // corsConfiguration.addAllowedOrigin("http://192.168.31.125:8095"); //允许信任域名 -// corsConfiguration.addAllowedOrigin("http://192.168.31.125:8088"); //允许信任域名 + corsConfiguration.addAllowedOrigin("http://192.168.31.125:8088"); //允许信任域名 corsConfiguration.addAllowedOrigin("http://10.10.11.7"); //允许信任域名 corsConfiguration.addAllowedMethod("*"); // 允许任何方法(post、get等) return corsConfiguration; diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index 87a2dad..d714441 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.java @@ -187,14 +187,14 @@ public class SysContentController { } @PostMapping("/checkIfTheTitleIsRepeat") - @Decrypt +// @Decrypt @ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = ContentHeavyTitleReqVO.class) 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); - } +// 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("该标题已重复!"); } diff --git a/src/main/java/com/huoran/iasf/controller/UserController.java b/src/main/java/com/huoran/iasf/controller/UserController.java index e729516..a83616f 100644 --- a/src/main/java/com/huoran/iasf/controller/UserController.java +++ b/src/main/java/com/huoran/iasf/controller/UserController.java @@ -135,7 +135,16 @@ public class UserController { @RequiresPermissions("sys:user:add") @Decrypt @LogAnnotation(title = "用户管理", action = "新增用户") - public R addUser(@RequestBody @Valid SysUser vo) { + public R addUser(@RequestBody @Valid SysUser vo) throws UnsupportedEncodingException { + //中文转码 + if (!StringUtils.isEmpty(vo.getRealName())) { + String realName = URLDecoder.decode(vo.getRealName(), StandardCharsets.UTF_8.toString()); + vo.setRealName(realName); + } + if (!StringUtils.isEmpty(vo.getUsername())) { + String realName = URLDecoder.decode(vo.getUsername(), StandardCharsets.UTF_8.toString()); + vo.setUsername(realName); + } userService.addUser(vo); return R.success(); } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 5d259ad..7c07c49 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -6,12 +6,12 @@ spring: datasource: master: username: root - password: 123456 -# password: iasf#2022 +# password: 123456 + password: iasf#2022 # password: HuoRan@2021 driver-class-name: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://127.0.0.1:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 - url: jdbc:mysql://192.168.31.136:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 + url: jdbc:mysql://127.0.0.1:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 +# url: jdbc:mysql://192.168.31.136:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8 # url: jdbc:mysql://139.9.47.170:3306/iasf?serverTimezone=GMT%2B8 cache: type: redis @@ -39,8 +39,8 @@ file: url: /iasf/sysFiles/preview/ # ip: http://10.10.11.7 ip: https://new.iasf.ac.cn -#knife4j: -# production: true #生成环境禁用查看文档 +knife4j: + production: true #生成环境禁用查看文档 #本地开启 # url: :10000/iasf/sysFiles/preview/ \ No newline at end of file