Przeglądaj źródła

更新错误提示

wuweihao 5 lat temu
rodzic
commit
fd0ecdf265

+ 2 - 0
gis_application/src/main/resources/application-sit.properties

@@ -59,3 +59,5 @@ output.file.path=/root/user/cms_celebrity_data/
 oss.file.path=sc_celebrity/
 oss.domain=http://ossxiaoan.4dage.com/
 
+
+

+ 2 - 0
gis_common/src/main/java/com/gis/common/config/Swagger2.java

@@ -1,5 +1,6 @@
 package com.gis.common.config;
 
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
 import com.google.common.collect.Lists;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ import java.util.List;
  */
 @Configuration
 @EnableSwagger2
+@EnableKnife4j
 public class Swagger2 {
     @Bean
     public Docket createRestApi() {

+ 2 - 2
gis_domain/src/main/java/com/gis/domain/vo/UserVo.java

@@ -47,8 +47,8 @@ public class UserVo extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "头像url")
     private String icon;
 
-//    @ApiModelProperty(value = "超级管理员,1:是, 0:否")
-//    private Integer sysManager;
+    @ApiModelProperty(value = "超级管理员,1:是, 0:否")
+    private Integer sysManager;
 
 
 

+ 1 - 1
gis_mapper/src/main/java/com/gis/mapper/SysUserMapper.java

@@ -25,7 +25,7 @@ public interface SysUserMapper extends IBaseMapper<SysUserEntity, Long> {
     @SelectProvider(type = UserProvider.class, method = "findBySearchKey")
     List<UserVo> findBySearchKey(UserPageRequest param);
 
-    @Select("SELECT a.id, a.user_name, a.real_name, a.phone, a.status, a.icon, a.role_id , b.role_name as role_name " +
+    @Select("SELECT a.id, a.user_name, a.real_name, a.phone, a.status, a.icon, a.role_id , a.sys_manager, b.role_name as role_name " +
             "FROM sys_user a left join sys_role b on b.id = a.role_id where a.rec_status = 'A' ORDER BY a.create_time DESC ")
     List<UserVo> findByRoleId(Long roleId);
 }

+ 2 - 2
gis_mapper/src/main/java/com/gis/mapper/provider/UserProvider.java

@@ -13,8 +13,8 @@ public class UserProvider {
 
     public String findBySearchKey(UserPageRequest param){
         StringBuffer sql = new StringBuffer(
-                "SELECT a.id, a.user_name, a.real_name, a.phone, a.status, a.icon, a.role_id , b.role_name as role_name " +
-                        "FROM sys_user a left join sys_role b on b.id = a.role_id where a.rec_status = 'A' ");
+                "SELECT a.id, a.user_name, a.real_name, a.phone, a.status, a.icon, a.role_id , b.role_name as role_name, " +
+                        "a.sys_manager FROM sys_user a left join sys_role b on b.id = a.role_id where a.rec_status = 'A' ");
         String searchKey = param.getSearchKey();
         if(StrUtil.isNotBlank(searchKey)){
             sql.append(" and (");

+ 13 - 6
gis_web/src/main/java/com/gis/web/controller/IndexController.java

@@ -61,21 +61,28 @@ public class IndexController extends BaseController {
         SysUserEntity userEntity = userService.findByUserName(param.getUserName());
         if (userEntity == null){
             log.error("用户不存在");
-            return Result.failure("用户不存在");
+            return Result.failure(5100,"用户不存在或密码错误");
         }
         // 验证密码,解密出来是明文密码,在跟输入密码比较
         boolean decryptName = PasswordUtils.decrypt(userEntity.getPassword(), param.getPassword(), PasswordUtils.getStaticSalt());
         if (!decryptName) {
             log.error("密码错误");
-            return Result.failure("密码错误");
+            return Result.failure(5100,"用户不存在或密码错误");
         }
 
-        // 检查账号是否启用
-        if (userEntity.getStatus() != 0) {
-            log.error("账号已停用或注销: {}", userEntity.getUserName());
-            return Result.failure("账号已停用或注销");
+        // 检查账号是否启用, 状态 0:启用  1:停用 2:注销
+        if (userEntity.getStatus() == 1) {
+            log.error("账号已停用: {}", userEntity.getUserName());
+            return Result.failure(5101, "账号已停用");
         }
 
+        if (userEntity.getStatus() == 2) {
+            log.error("账号已注销: {}", userEntity.getUserName());
+            return Result.failure(5102, "账号已注销");
+        }
+
+
+
 
         // 获取用户角色, 目前的设计是一个用户只有一个角色
 //        SysRoleEntity roleEntity = sysRoleService.findUserRoleByUserId(userEntity.getId());