From 9e387dc447396e6ce91c8f9c36405819ae1e4c15 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 11 Dec 2020 13:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=94=A8=E6=88=B7=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E9=82=AE=E7=AE=B1=E9=83=A8=E9=97=A8=E5=BF=85=E5=A1=AB?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/SysUserController.java | 12 ++++++++---- .../java/com/ruoyi/common/utils/poi/ExcelUtil.java | 2 +- .../java/com/ruoyi/framework/aspectj/LogAspect.java | 3 ++- ruoyi-ui/src/views/system/user/index.vue | 5 ----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 37d6a4dde..03461ca95 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -127,11 +127,13 @@ public class SysUserController extends BaseController { return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); } - else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + else if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); } - else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } @@ -149,11 +151,13 @@ public class SysUserController extends BaseController public AjaxResult edit(@Validated @RequestBody SysUser user) { userService.checkUserAllowed(user); - if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } - else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index bf77d93aa..62c0439ae 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -877,7 +877,7 @@ public class ExcelUtil */ private Object getValue(Object o, String name) throws Exception { - if (StringUtils.isNotEmpty(name)) + if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) { Class clazz = o.getClass(); Field field = clazz.getDeclaredField(name); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index c11a4776f..4f3de4a04 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -212,6 +212,7 @@ public class LogAspect * @param o 对象信息。 * @return 如果是需要过滤的对象,则返回true;否则返回false。 */ + @SuppressWarnings("rawtypes") public boolean isFilterObject(final Object o) { Class clazz = o.getClass(); @@ -230,7 +231,7 @@ public class LogAspect else if (Map.class.isAssignableFrom(clazz)) { Map map = (Map) o; - for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) + for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); return entry.getValue() instanceof MultipartFile; diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 78bef4b3d..d126f59e4 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -421,14 +421,10 @@ export default { nickName: [ { required: true, message: "用户昵称不能为空", trigger: "blur" } ], - deptId: [ - { required: true, message: "归属部门不能为空", trigger: "change" } - ], password: [ { required: true, message: "用户密码不能为空", trigger: "blur" } ], email: [ - { required: true, message: "邮箱地址不能为空", trigger: "blur" }, { type: "email", message: "'请输入正确的邮箱地址", @@ -436,7 +432,6 @@ export default { } ], phonenumber: [ - { required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码",