Browse Source

登录修改

rengb 3 years atrás
parent
commit
c94b54582d

+ 1 - 1
security-center/src/main/java/com/lantone/security/vo/LoginVO.java

@@ -1,4 +1,4 @@
-package com.lantone.security.vo;
+package com.lantone.common.vo;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;

+ 1 - 1
security-center/src/main/java/com/lantone/security/vo/UserLoginVO.java

@@ -1,4 +1,4 @@
-package com.lantone.security.vo;
+package com.lantone.common.vo;
 
 import lombok.Getter;
 import lombok.Setter;

+ 1 - 1
gateway-service/src/main/resources/bootstrap.yml

@@ -11,7 +11,7 @@ spring:
     oauth2:
       resourceserver:
         jwt:
-          jwk-set-uri: http://localhost:8869/userauth/rsa/publicKey #配置RSA的公钥访问地址
+          jwk-set-uri: 'http://localhost:8869/user-auth/rsa/publicKey' #配置RSA的公钥访问地址
   cloud:
     gateway:
       discovery:

+ 27 - 26
security-center/src/main/java/com/lantone/security/facade/DataAuthHandleFacade.java

@@ -2,9 +2,6 @@ package com.lantone.security.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.exception.CommonErrorCode;
-import com.diagbot.exception.CommonException;
 import com.lantone.common.dto.DataAuthDTO;
 import com.lantone.common.dto.DataAuthDetailDTO;
 import com.lantone.common.dto.DeptDTO;
@@ -12,6 +9,7 @@ import com.lantone.common.dto.HospitalDTO;
 import com.lantone.common.dto.RoleDTO;
 import com.lantone.common.dto.ServiceRoleDataAuthDetailDTO;
 import com.lantone.common.dto.SysServiceDTO;
+import com.lantone.common.exception.Asserts;
 import com.lantone.common.util.DateUtil;
 import com.lantone.common.util.ListUtil;
 import com.lantone.common.util.StringUtil;
@@ -36,6 +34,7 @@ import com.lantone.security.enums.CRUDEnum;
 import com.lantone.security.enums.DataAuthDataTypeEnum;
 import com.lantone.security.enums.DataAuthDetailTypeEnum;
 import com.lantone.security.enums.HospitalTypeEnum;
+import com.lantone.security.enums.IsDeleteEnum;
 import com.lantone.security.enums.ServiceEnum;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,15 +87,16 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
                 return addDataAuth(serviceDataAuthVO);
             } catch (Exception e) {
                 e.printStackTrace();
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, e.toString());
+                Asserts.fail(e.toString());
             }
         } else if (CRUDEnum.UPDATE.getKey() == serviceDataAuthVO.getType()) {
             return updateDataAuth(serviceDataAuthVO);
         } else if (CRUDEnum.DELETE.getKey() == serviceDataAuthVO.getType()) {
             return deleteDataAuth(serviceDataAuthVO);
         } else {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "操作码错误");
+            Asserts.fail("操作码错误");
         }
+        return false;
     }
 
     /**
@@ -122,16 +122,16 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
 
             if (ListUtil.isNotEmpty(serviceDataAuthIDS)) {
                 //3.获取该权限关联的角色id
-//                List<Long> roleIDS = roleServiceDataAuthFacade.list(new QueryWrapper<RoleServiceDataAuth>()
-//                        .in("service_data_auth_id", serviceDataAuthIDS)
-//                        .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(RoleServiceDataAuth::getRoleId).collect(Collectors.toList());
+                //                List<Long> roleIDS = roleServiceDataAuthFacade.list(new QueryWrapper<RoleServiceDataAuth>()
+                //                        .in("service_data_auth_id", serviceDataAuthIDS)
+                //                        .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(RoleServiceDataAuth::getRoleId).collect(Collectors.toList());
 
                 //4.通过serviceDataAuthIDS 删除sys_role_service_data_auth和sys_service_data_auth和sys_data_auth_detail 对应关系
                 if (deleteServiceDataAuth(serviceDataAuthIDS)) {
                     //5.插入新建数据权限与系统的关系
                     saveServiceDataAuth(serviceDataAuthVO, serviceDataAuthVO.getDataAuthVO().getId());
                 } else {
-                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "数据权限与系统关系删除失败");
+                    Asserts.fail("数据权限与系统关系删除失败");
                 }
 
 
@@ -139,7 +139,7 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
 
 
         } else {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "数据权限修改失败");
+            Asserts.fail("数据权限修改失败");
         }
         return true;
     }
@@ -163,11 +163,12 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
                         .in("id", serviceDataAuthIDS)
                         .eq("is_deleted", IsDeleteEnum.N.getKey()));
             } else {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "数据权限与系统、角色关联关系删除失败");
+                Asserts.fail("数据权限与系统、角色关联关系删除失败");
             }
         } else {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "系统数据权限与数据权限明细关联关系删除失败");
+            Asserts.fail("系统数据权限与数据权限明细关联关系删除失败");
         }
+        return false;
     }
 
     /**
@@ -209,7 +210,7 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
             saveServiceDataAuth(serviceDataAuthVO, dataAuthId);
 
         } else {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "数据权限插入失败");
+            Asserts.fail("数据权限插入失败");
         }
         return true;
 
@@ -248,7 +249,7 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
                     roleServiceDataAuth.setCreator(1l);
                     //                        roleServiceDataAuth.setCreator(Long.parseLong(SysUserUtils.getCurrentPrincipleID()));
                     if (!roleServiceDataAuthFacade.save(roleServiceDataAuth)) {
-                        throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "角色对应服务数据权限关系插入失败");
+                        Asserts.fail("角色对应服务数据权限关系插入失败");
                     }
                 }
 
@@ -261,12 +262,12 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
                     dataAuthDetail.setCreateTime(DateUtil.now());
                     dataAuthDetail.setServiceDataAuthId(serviceDataAuthId);
                     if (!dataAuthDetailFacade.save(dataAuthDetail)) {
-                        throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "数据权限明细插入失败");
+                        Asserts.fail("数据权限明细插入失败");
                     }
                 }
 
             } else {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "服务对应数据权限关系插入失败");
+                Asserts.fail("服务对应数据权限关系插入失败");
             }
         }
     }
@@ -281,35 +282,35 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
      */
     private void inputParamCheck(ServiceDataAuthVO serviceDataAuthVO) {
         if (serviceDataAuthVO == null) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "入参为空");
+            Asserts.fail("入参为空");
         }
         if (serviceDataAuthVO.getType() == 0) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "操作码为空");
+            Asserts.fail("操作码为空");
         }
         switch (serviceDataAuthVO.getType()) {
             case 1:
                 if (StringUtil.isEmpty(serviceDataAuthVO.getDataAuthVO().getAuthName())) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "数据权限名称为空");
+                    Asserts.fail("数据权限名称为空");
                 }
                 if (ListUtil.isEmpty(serviceDataAuthVO.getDataAuthVO().getServiceVOS())) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "数据权限对应系统未选择");
+                    Asserts.fail("数据权限对应系统未选择");
                 }
                 if (ListUtil.isEmpty(serviceDataAuthVO.getDataAuthVO().getServiceVOS().get(0).getDataAuthDetailVOS())) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "系统对应数据权限明细未选择");
+                    Asserts.fail("系统对应数据权限明细未选择");
                 }
                 break;
             case 2:
                 if (serviceDataAuthVO.getDataAuthVO().getId() == null) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "数据权限ID为空");
+                    Asserts.fail("数据权限ID为空");
                 }
                 if (StringUtil.isEmpty(serviceDataAuthVO.getDataAuthVO().getAuthName())) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "数据权限名称为空");
+                    Asserts.fail("数据权限名称为空");
                 }
                 if (ListUtil.isEmpty(serviceDataAuthVO.getDataAuthVO().getServiceVOS())) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "数据权限对应系统未选择");
+                    Asserts.fail("数据权限对应系统未选择");
                 }
                 if (ListUtil.isEmpty(serviceDataAuthVO.getDataAuthVO().getServiceVOS().get(0).getDataAuthDetailVOS())) {
-                    throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "系统对应数据权限明细未选择");
+                    Asserts.fail("系统对应数据权限明细未选择");
                 }
                 break;
             case 3:
@@ -379,7 +380,7 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
             });
             dataAuthDTO.setSysServiceDTOS(sysServiceDTOS);
         } else {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请检查角色id或数据权限id");
+            Asserts.fail("请检查角色id或数据权限id");
         }
 
         return dataAuthDTO;

+ 1 - 1
security-center/src/main/java/com/lantone/security/facade/UserAdminFacade.java

@@ -2,8 +2,8 @@ package com.lantone.security.facade;
 
 import com.lantone.common.api.CommonResult;
 import com.lantone.common.constant.AuthConstant;
+import com.lantone.common.vo.LoginVO;
 import com.lantone.security.service.AuthService;
-import com.lantone.security.vo.LoginVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 

+ 9 - 14
security-center/src/main/java/com/lantone/security/web/DataAuthController.java

@@ -1,7 +1,6 @@
 package com.lantone.security.web;
 
-import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.RespDTO;
+import com.lantone.common.api.CommonResult;
 import com.lantone.common.dto.DataAuthDTO;
 import com.lantone.common.vo.ServiceDataAuthVO;
 import com.lantone.security.facade.DataAuthHandleFacade;
@@ -34,11 +33,10 @@ public class DataAuthController {
                     "roles:角色列表,必填<br>" +
                     "type:操作码 1:新增;2:修改 ;3:删除")
     @PostMapping("/addAuth")
-    @SysLogger("addAuth")
     @ApiIgnore
     @Transactional
-    public RespDTO<Boolean> addAuth(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
-        return RespDTO.onSuc(dataAuthHandleFacade.CRUDOperation(serviceDataAuthVO));
+    public CommonResult<Boolean> addAuth(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
+        return CommonResult.success(dataAuthHandleFacade.CRUDOperation(serviceDataAuthVO));
     }
 
     @ApiOperation(value = "修改数据权限[by:songxl]",
@@ -46,11 +44,10 @@ public class DataAuthController {
                     "roles:角色列表,必填<br>" +
                     "type:操作码 1:新增;2:修改;3:删除")
     @PostMapping("/updateAuth")
-    @SysLogger("updateAuth")
     @ApiIgnore
     @Transactional
-    public RespDTO<Boolean> updateAuth(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
-        return RespDTO.onSuc(dataAuthHandleFacade.CRUDOperation(serviceDataAuthVO));
+    public CommonResult<Boolean> updateAuth(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
+        return CommonResult.success(dataAuthHandleFacade.CRUDOperation(serviceDataAuthVO));
     }
 
     @ApiOperation(value = "删除数据权限[by:songxl]",
@@ -58,11 +55,10 @@ public class DataAuthController {
                     "roles:角色列表,必填<br>" +
                     "type:操作码 1:新增;2:修改;3:删除")
     @PostMapping("/deleteAuth")
-    @SysLogger("deleteAuth")
     @ApiIgnore
     @Transactional
-    public RespDTO<Boolean> deleteAuth(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
-        return RespDTO.onSuc(dataAuthHandleFacade.CRUDOperation(serviceDataAuthVO));
+    public CommonResult<Boolean> deleteAuth(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
+        return CommonResult.success(dataAuthHandleFacade.CRUDOperation(serviceDataAuthVO));
     }
 
     @ApiOperation(value = "通过数据权限id和角色id获取数据权限详情[by:songxl]",
@@ -70,9 +66,8 @@ public class DataAuthController {
                     "roles:角色列表,必填<br>" +
                     "type:操作码 1:新增;2:修改;3:删除")
     @PostMapping("/getDataAuthById")
-    @SysLogger("getDataAuthById")
     @ApiIgnore
-    public RespDTO<DataAuthDTO> getDataAuthById(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
-        return RespDTO.onSuc(dataAuthHandleFacade.getDataAuthById(serviceDataAuthVO));
+    public CommonResult<DataAuthDTO> getDataAuthById(@RequestBody ServiceDataAuthVO serviceDataAuthVO) {
+        return CommonResult.success(dataAuthHandleFacade.getDataAuthById(serviceDataAuthVO));
     }
 }

+ 1 - 1
security-center/src/main/java/com/lantone/security/web/UserAdminController.java

@@ -3,8 +3,8 @@ package com.lantone.security.web;
 import com.google.common.collect.Lists;
 import com.lantone.common.api.CommonResult;
 import com.lantone.common.domain.UserDto;
+import com.lantone.common.vo.LoginVO;
 import com.lantone.security.facade.UserAdminFacade;
-import com.lantone.security.vo.LoginVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 4
structure-center/pom.xml

@@ -18,10 +18,6 @@
             <groupId>com.lantone</groupId>
             <artifactId>common</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-config</artifactId>

+ 0 - 8
user-auth/pom.xml

@@ -24,10 +24,6 @@
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
@@ -52,10 +48,6 @@
             <groupId>io.github.openfeign</groupId>
             <artifactId>feign-okhttp</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-        </dependency>
     </dependencies>
 
     <build>