Browse Source

Merge branch 'mazq-roleauth-apply-231123' into 'master'

Mazq roleauth apply 231123

See merge request dcuc-tjdsj/auth-service!252
黄资权 1 year ago
parent
commit
ab1fcecfe7
100 changed files with 1081 additions and 3878 deletions
  1. 57 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/api/IZeroTrustAuthApplyFacade.java
  2. 1 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/api/IZeroTrustAuthFacade.java
  3. 0 62
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IApprovalFacade.java
  4. 0 18
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IRoleInfoFacade.java
  5. 0 9
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IStaffAssignAuthInfoFacade.java
  6. 0 42
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IStaffAssignAuthInfoLogFacade.java
  7. 0 32
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/power/facade/IAppFunEventFacade.java
  8. 0 47
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/power/facade/IFunEventFacade.java
  9. 0 82
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/power/facade/IFuncSyncRuleConfigFacade.java
  10. 44 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/enums/zerotrust/AuthApplyRespEnum.java
  11. 42 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiRoleAuthContentVo.java
  12. 28 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiRoleAuthReqVo.java
  13. 42 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiServiceAuthContentVo.java
  14. 30 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiServiceAuthReqVo.java
  15. 27 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/AuthApplyRespVo.java
  16. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/AppAuthReqVO.java
  17. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/DataAuthReqVO.java
  18. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/DataAuthRespVO.java
  19. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/FunctionAuthReqVO.java
  20. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/ServiceAuthReqVO.java
  21. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/UserOrgAuthReqVO.java
  22. 26 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/role/ApiAppRoleRespVo.java
  23. 23 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/role/ApiRoleRespVo.java
  24. 25 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/role/ApiRolesReqVo.java
  25. 25 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/ApprovalBizContentDto.java
  26. 36 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/ApprovalBizDataDto.java
  27. 33 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/ApprovalBizResourceDto.java
  28. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/FlowApplyReqDto.java
  29. 38 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/authapply/RoleAuthApplyDto.java
  30. 40 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/authapply/ServiceAuthApplyDto.java
  31. 0 8
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/AppFunAuthResult.java
  32. 0 178
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/FunEvent.java
  33. 0 290
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/FuncApproval.java
  34. 0 213
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/FuncSyncRuleConfig.java
  35. 0 106
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/MdAppDataSource.java
  36. 0 364
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/MdDataSource.java
  37. 0 12
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/ServiceAuthResult.java
  38. 0 141
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/StaffAssignAuthLog.java
  39. 1 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/ApprovalResult.java
  40. 2 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/BaseEntity.java
  41. 2 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/BaseUpdateEntity.java
  42. 19 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/RoleAuthApply.java
  43. 82 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/ServiceAuthApply.java
  44. 0 51
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/AuthStatusEnum.java
  45. 5 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/zerotrust/approval/ApprovalApplyTypeEnum.java
  46. 3 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/vo/zerotrust/roleauthapply/ApplyRoleInVo.java
  47. 19 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/vo/zerotrust/roleauthapply/RoleAuthApplySaveVo.java
  48. 10 3
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/token/vo/AppTokenDetailRespVo.java
  49. 1 2
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/LogSendService.java
  50. 0 48
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/ApprovalEventCenterBus.java
  51. 2 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/PermissionUpdateEventBus.java
  52. 2 2
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/PermssionServiceUpdateEventBus.java
  53. 0 48
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/StaffAssignAuthEventCenterBus.java
  54. 0 113
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/subscribe/ApprovalSendMessage.java
  55. 0 150
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/subscribe/StaffAssignAuthSendMessage.java
  56. 0 13
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ApprovalBPO.java
  57. 0 59
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/FunEventBPO.java
  58. 0 45
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/FuncSyncRuleConfigBPO.java
  59. 10 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/RoleInfoBPO.java
  60. 0 31
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ServiceAuthFlowBPO.java
  61. 18 30
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ServiceAuthResultBPO.java
  62. 10 1
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/StaffAssignAuthInfoBPO.java
  63. 0 65
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/StaffAssignAuthLogBPO.java
  64. 1 1
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustAppAuthBusiness.java
  65. 4 4
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustDataAuthBusiness.java
  66. 3 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustFunAuthBusiness.java
  67. 3 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustServiceAuthBusiness.java
  68. 1 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustAppAuthBusiness.java
  69. 2 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustDataAuthBusiness.java
  70. 1 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustFunAuthBusiness.java
  71. 1 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustServiceAuthBusiness.java
  72. 0 30
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/AppFunEventFacade.java
  73. 0 64
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/ApprovalFacade.java
  74. 0 41
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/FunEventFacade.java
  75. 0 57
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/FuncSyncRuleConfigFacade.java
  76. 6 5
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/RoleAuthInfoFacade.java
  77. 0 10
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/RoleInfoFacade.java
  78. 0 5
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/StaffAssignAuthInfoFacade.java
  79. 0 49
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/StaffAssignAuthInfoLogFacade.java
  80. 53 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/api/ZeroTrustAuthApplyFacade.java
  81. 1 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/api/ZeroTrustAuthFacade.java
  82. 6 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/zerotrust/RoleAuthApplyRepository.java
  83. 32 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/zerotrust/ServiceAuthApplyRepository.java
  84. 0 56
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IApprovalService.java
  85. 0 20
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IFunEventService.java
  86. 0 54
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IFuncSyncRuleConfigService.java
  87. 8 12
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IRoleInfoService.java
  88. 12 26
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IServiceAuthResultService.java
  89. 8 21
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IStaffAssignAuthInfoService.java
  90. 0 36
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IStaffAssignAuthLogService.java
  91. 1 20
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AppFunAuthResultServiceImpl.java
  92. 0 257
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ApprovalService.java
  93. 0 77
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/FunEventService.java
  94. 0 351
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/FuncSyncRuleConfigService.java
  95. 12 20
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RoleInfoService.java
  96. 4 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RoleService.java
  97. 97 56
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ServiceAuthResultServiceImpl.java
  98. 102 214
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/StaffAssignAuthInfoService.java
  99. 0 104
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/StaffAssignAuthLogService.java
  100. 13 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/zerotrust/ApprovalResultServiceImpl.java

+ 57 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/api/IZeroTrustAuthApplyFacade.java

@@ -0,0 +1,57 @@
+package com.dragoninfo.dcuc.auth.auth.api;
+
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustDataRespVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustMessageRespVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply.ApiRoleAuthReqVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply.ApiServiceAuthReqVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply.AuthApplyRespVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.role.ApiAppRoleRespVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.role.ApiRolesReqVo;
+import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.approval.ApprovalCallBackReqVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/23
+ */
+@FeignClient(name = "dcuc-auth", path = "/dcuc/auth/zeroTrustAuthApplyFacade")
+public interface IZeroTrustAuthApplyFacade {
+
+    /**
+     * 角色列表查询
+     * @param reqVo
+     * @return
+     */
+    @PostMapping(value = "appRoleInfos")
+    ZeroTrustDataRespVO<List<ApiAppRoleRespVo>> appRoleInfos(@RequestBody ApiRolesReqVo reqVo);
+
+    /**
+     * 角色授权申请
+     *
+     * @param reqVo
+     * @return
+     */
+    @PostMapping(value = "roleAuthApply")
+    ZeroTrustDataRespVO<AuthApplyRespVo> roleAuthApply(@RequestBody ApiRoleAuthReqVo reqVo);
+
+    /**
+     * 服务授权申请
+     *
+     * @param reqVo
+     * @return
+     */
+    @PostMapping("serviceAuthApply")
+    ZeroTrustDataRespVO<AuthApplyRespVo> serviceAuthApply(@RequestBody ApiServiceAuthReqVo reqVo);
+
+    /**
+     * 授权申请审批结果回调
+     * @param callBackReqVO
+     * @return
+     */
+    @PostMapping("callBack")
+    ZeroTrustMessageRespVO callBack(@RequestBody ApprovalCallBackReqVO callBackReqVO);
+}

+ 1 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/api/IZeroTrustAuthFacade.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.api;
 
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.*;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.*;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;

+ 0 - 62
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IApprovalFacade.java

@@ -1,62 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustMessageRespVO;
-import com.dragoninfo.dcuc.auth.auth.dto.ApprovalDto;
-import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
-import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.approval.ApprovalCallBackReqVO;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-/**
- * Created by liws on 2019/3/4.
- */
-@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/approvalFacade")
-public interface IApprovalFacade {
-    /**
-     * 动态授权申请
-     *
-     * @param appCode       应用代码
-     * @param roleCode       角色代码
-     * @param userIdCard     申请人身份证
-     * @param approvalIdCard 审批人身份证
-     * @param reason         申请事由
-     * @return
-     */
-    @RequestMapping(value = "authApply")
-    ResponseDTO authApply(@RequestParam("appCode")String appCode,
-                          @RequestParam("roleCode")String roleCode,
-                          @RequestParam("userIdCard")String userIdCard,
-                          @RequestParam("approvalIdCard")String approvalIdCard,
-                          @RequestParam("reason")String reason);
-
-    @PostMapping(value = "approvalPage")
-    Page<FuncApproval> approvalPage(@RequestBody SearchDTO searchDTO);
-
-    @PostMapping(value = "agree")
-    ResponseStatus agree(@RequestBody ApprovalDto approvalDto);
-
-    @PostMapping(value = "disagree")
-    ResponseStatus disagree(@RequestBody ApprovalDto approvalDto);
-
-    @RequestMapping(value = "detail")
-    FuncApproval detail(@RequestParam("id")String id);
-
-    @PostMapping(value = "applyResult")
-    ResponseDTO applyResult(@RequestBody ApprovalDto approvalDto);
-
-    /**
-     * 审批回调
-     *
-     * @param approvalCallBackReqVO 审批回调请求
-     * @return 状态
-     */
-    @PostMapping("callBack")
-    ZeroTrustMessageRespVO callBack(@RequestBody ApprovalCallBackReqVO approvalCallBackReqVO);
-}

+ 0 - 18
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IRoleInfoFacade.java

@@ -136,15 +136,6 @@ public interface IRoleInfoFacade {
     ResponseDTO roleQuotaUpdate(@RequestParam("roleId") String roleId,
                                 @RequestParam("initNum") Long initNum);
 
-    /**
-     * 根据appIds获取角色列表
-     *
-     * @param appIds
-     * @return
-     */
-    @RequestMapping(value = "getRolesByAppIds")
-    List<RoleInfo> getRolesByAppIds(@RequestParam("appIds") String appIds);
-
     /**
      * 分页查询机构拥有的应用角色配额情况
      *
@@ -182,15 +173,6 @@ public interface IRoleInfoFacade {
     @PostMapping(value = "staffRoleList")
     List<RoleInfoVO> staffRoleList(@RequestBody SearchDTO searchDTO);
 
-    /**
-     * 根据角色代码获取角色信息
-     *
-     * @param roleCode 角色代码
-     * @return 角色信息
-     */
-    @GetMapping("getRoleInfoByCode")
-    RoleInfo getRoleInfoByCode(@RequestParam("roleCode") String roleCode);
-
     /**
      * 角色授权模块
      * 角色视图 角色列表

+ 0 - 9
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IStaffAssignAuthInfoFacade.java

@@ -33,15 +33,6 @@ public interface IStaffAssignAuthInfoFacade {
     @PostMapping(value = "saveStaffRoleAuth")
     ResponseStatus saveStaffRoleAuth(@RequestBody StaffRoleOperateDTO dto);
 
-    /**
-     * 取消用户的所有角色授权
-     *
-     * @param staffId 用户id
-     * @return ResponseStatus
-     */
-    @RequestMapping(value = "deleteAllStaffRole")
-    ResponseStatus deleteAllStaffRole(@RequestParam("staffId") String staffId);
-
     /**
      * 查询列表
      *

+ 0 - 42
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IStaffAssignAuthInfoLogFacade.java

@@ -1,42 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthLog;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by Administrator on 2018/11/13.
- */
-@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/staffAssignAuthInfoLogFacade")
-public interface IStaffAssignAuthInfoLogFacade {
-
-    /**
-     * 获取用户拥有过的权限
-     * @param searchDTO
-     * @return
-     */
-    @PostMapping(value = "roleListByUserIdAndAppId")
-    Page<RoleInfo> roleListByUserIdAndAppId(@RequestBody SearchDTO searchDTO);
-
-    /**
-     * 获取用户的权限变更记录
-     * @param userId
-     * @param roleId
-     * @return
-     */
-    @RequestMapping(value = "staffAssignAuthLogList")
-    List<StaffAssignAuthLog> staffAssignAuthLogList(@RequestParam("userId")String userId,
-                                                    @RequestParam("roleId")String roleId);
-
-    @RequestMapping(value = "operateList")
-    Page<Map<String,String>> operateList(@RequestBody SearchDTO searchDTO);
-}

+ 0 - 32
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/power/facade/IAppFunEventFacade.java

@@ -1,32 +0,0 @@
-package com.dragoninfo.dcuc.auth.power.facade;
-
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-
-/**
- * Created by huanghy on 2018/7/9.
- */
-@Api(description = "菜单事件服务类")
-@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/appFunEventFacade")
-public interface IAppFunEventFacade {
-
-    /**
-     * 根据菜单id获取菜单的功能事件
-     * @param funId 应用菜单id
-     * @return
-     */
-    @ApiOperation(value = "根据菜单id获取菜单的功能事件",httpMethod = "GET",nickname = "/dcuc/auth/events/{funId}"
-            ,response = List.class)
-    @ApiImplicitParams({@ApiImplicitParam(paramType = "path",name = "funId" ,value="菜单ID",required = true
-            ,example = "yhglpt10004")})
-    @RequestMapping(value = "getEventByFunId")
-    List<EventInfoVO> getEventByFunId(@RequestParam("funId") String funId);
-}

+ 0 - 47
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/power/facade/IFunEventFacade.java

@@ -1,47 +0,0 @@
-package com.dragoninfo.dcuc.auth.power.facade;
-
-
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import com.dragoninfo.dcuc.auth.auth.entity.FunEvent;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-
-@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/funEventFacade")
-public interface IFunEventFacade {
-
-    /**
-     * 根据功能菜单id获取菜单的功能事件列表(包括公共的事件)
-     * @param pkMenuId
-     * @param searchDTO
-     * @return
-     */
-    @RequestMapping(value = "getMenuData")
-    List<FunEvent> getMenuData(@RequestParam("pkMenuId")String pkMenuId,
-                               @RequestParam("searchDTO")SearchDTO searchDTO);
-
-    /**
-     * 更新应用菜单的功能事件
-     * @param funEventList
-     * @param id
-     */
-    @RequestMapping(value = "updateFilter")
-    ResponseDTO updateFilter(@RequestParam("funEventList")List<FunEvent> funEventList,
-                             @RequestParam("id")String id);
-
-    /**
-     * 根据菜单id获取菜单的功能事件
-     * @param id
-     * @return
-     */
-    @GetMapping(value = "getEventByTreeId")
-    List<EventInfoVO> getEventByTreeId(@RequestParam("id") String id);
-
-    @RequestMapping(value = "getEventByFunIds")
-    List<EventInfoVO> getEventByFunIds(@RequestParam("funIds") String funIds);
-}

+ 0 - 82
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/power/facade/IFuncSyncRuleConfigFacade.java

@@ -1,82 +0,0 @@
-package com.dragoninfo.dcuc.auth.power.facade;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FuncSyncRuleConfig;
-import com.dragoninfo.dcuc.auth.auth.vo.MenuInfoVO;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-
-/**
- * Created by liws on 2018/6/21.
- */
-@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/funcSyncRuleConfigFacade")
-public interface IFuncSyncRuleConfigFacade {
-    /**
-     * 根据应用id获取应用菜单规则同步配置列表
-     *
-     * @param applicationId
-     * @return
-     */
-    @RequestMapping(value = "getMenuRulesList")
-    Page<FuncSyncRuleConfig> getMenuRulesList(@RequestParam("applicationId")String applicationId,
-                                              @RequestParam("searchDTO")SearchDTO searchDTO);
-
-    /**
-     * 菜单规则信息删除(物理删)
-     *
-     * @param rulesId 菜单规则id
-     */
-    @RequestMapping(value = "del")
-    ResponseStatus del(@RequestParam("rulesId") String rulesId);
-
-    /**
-     * 资源同步
-     *
-     * @param menuSynId 菜单规则id
-     * @param appId     应用id
-     * @return
-     */
-    @RequestMapping(value = "menuSyn")
-    ResponseStatus menuSyn(@RequestParam("menuSynId")String menuSynId,
-                           @RequestParam("appId")String appId);
-
-    @RequestMapping(value = "menuSynHn")
-    ResponseStatus menuSynHn(@RequestParam("menuSynId")String menuSynId,
-                             @RequestParam("appId")String appId);
-
-    /**
-     * 判断同步规则是否存在
-     *
-     * @param name  规则名称
-     * @param appId 应用id
-     * @return
-     */
-    @RequestMapping(value = "isExist")
-    boolean isExist(@RequestParam("name")String name,
-                    @RequestParam("appId")String appId);
-
-    /**
-     * 保存更新菜单同步规则
-     *
-     * @param ruleConfig
-     */
-    @PostMapping(value = "saveOrUpdate")
-    ResponseDTO saveOrUpdate(@RequestParam("ruleConfig") FuncSyncRuleConfig ruleConfig);
-
-    /**
-     * 根据应用id获取菜单同步规则列表
-     *
-     * @param appId
-     * @return
-     */
-    @RequestMapping(value = "getMenuRuleList")
-    List<MenuInfoVO> getMenuRuleList(@RequestParam("appId")String appId);
-
-}

+ 44 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/enums/zerotrust/AuthApplyRespEnum.java

@@ -0,0 +1,44 @@
+package com.dragoninfo.dcuc.auth.api.enums.zerotrust;
+
+import com.dragonsoft.duceap.base.enums.ICodeEnum;
+
+/**
+ * @author mazq
+ * @date 2023/11/23
+ */
+public enum AuthApplyRespEnum implements ICodeEnum {
+
+    SUCCESS("0", "操作成功"),
+    USER_NOT_EXIST("1", "授权申请人员不存在"),
+    APP_NOT_EXIST("2", "授权申请应用资源不存在"),
+    ROLE_NOT_EXIST("3", "授权申请应用角色不存在"),
+    SERVICE_NOT_EXIST("4", "授权申请服务资源不存在"),
+
+    OTHER("99", "其他类型错误");
+
+    private String value;
+    private String label;
+
+    AuthApplyRespEnum(String value, String label) {
+        this.value = value;
+        this.label = label;
+    }
+
+    @Override
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    @Override
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+}

+ 42 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiRoleAuthContentVo.java

@@ -0,0 +1,42 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/22
+ */
+@Data
+@ApiModel(value = "角色授权申请内容Vo")
+public class ApiRoleAuthContentVo {
+
+    @ApiModelProperty(value = "需要申请授权的应用编码")
+    private String appCode;
+
+    @NotNull
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "开始时间")
+    private Date startTime;
+
+    @NotNull
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "结束时间")
+    private Date endTime;
+
+    @NotEmpty
+    @ApiModelProperty(value = "需要授权的角色编码集合")
+    private List<String> roleCodes;
+
+
+}

+ 28 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiRoleAuthReqVo.java

@@ -0,0 +1,28 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author mazq
+ * @date 2023/11/22
+ */
+@Data
+@ApiModel(value = "api-角色授权申请Vo")
+public class ApiRoleAuthReqVo {
+
+    @NotBlank
+    @ApiModelProperty(value = "申请方应用令牌")
+    private String appTokenId;
+
+    @Valid
+    @NotNull
+    @ApiModelProperty(value = "角色授权申请内容")
+    private ApiRoleAuthContentVo contents;
+
+}

+ 42 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiServiceAuthContentVo.java

@@ -0,0 +1,42 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/22
+ */
+@Data
+@ApiModel(value = "服务授权申请内容Vo")
+public class ApiServiceAuthContentVo {
+
+    @ApiModelProperty(value = "需要申请授权的应用资源编码")
+    private String appCode;
+
+    @NotNull
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "开始时间")
+    private Date startTime;
+
+    @NotNull
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "结束时间")
+    private Date endTime;
+
+    @NotEmpty
+    @ApiModelProperty(value = "需要授权的服务资源编码集合")
+    private List<String> serviceCodes;
+
+
+}

+ 30 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/ApiServiceAuthReqVo.java

@@ -0,0 +1,30 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author mazq
+ * @date 2023/11/24
+ */
+@Data
+@ApiModel("服务授权申请Vo")
+public class ApiServiceAuthReqVo {
+
+    @NotBlank
+    @ApiModelProperty(value = "申请方应用令牌")
+    private String appTokenId;
+
+    @Valid
+    @NotNull
+    @ApiModelProperty(value = "授权申请内容")
+    private ApiServiceAuthContentVo contents;
+
+
+}

+ 27 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authapply/AuthApplyRespVo.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/23
+ */
+@Data
+public class AuthApplyRespVo {
+
+    /**
+     * @see com.dragoninfo.dcuc.auth.api.enums.zerotrust.AuthApplyRespEnum
+     */
+    @ApiModelProperty(value = "业务状态码")
+    private String respCode;
+
+    @ApiModelProperty(value = "业务响应内容")
+    private List<String> respContent;
+
+    @ApiModelProperty(value = "业务消息提示")
+    private String respMsg;
+
+}

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/AppAuthReqVO.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/AppAuthReqVO.java

@@ -1,5 +1,5 @@
 
-package com.dragoninfo.dcuc.auth.api.vo.zerotrust;
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/DataAuthReqVO.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/DataAuthReqVO.java

@@ -1,5 +1,5 @@
 
-package com.dragoninfo.dcuc.auth.api.vo.zerotrust;
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/DataAuthRespVO.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/DataAuthRespVO.java

@@ -1,5 +1,5 @@
 
-package com.dragoninfo.dcuc.auth.api.vo.zerotrust;
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate;
 
 import lombok.Data;
 

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/FunctionAuthReqVO.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/FunctionAuthReqVO.java

@@ -1,5 +1,5 @@
 
-package com.dragoninfo.dcuc.auth.api.vo.zerotrust;
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/ServiceAuthReqVO.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/ServiceAuthReqVO.java

@@ -1,5 +1,5 @@
 
-package com.dragoninfo.dcuc.auth.api.vo.zerotrust;
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/UserOrgAuthReqVO.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/authticate/UserOrgAuthReqVO.java

@@ -1,5 +1,5 @@
 
-package com.dragoninfo.dcuc.auth.api.vo.zerotrust;
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate;
 
 import lombok.Data;
 

+ 26 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/role/ApiAppRoleRespVo.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.role;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/22
+ */
+@Data
+@ApiModel(value = "应用角色信息Vo")
+public class ApiAppRoleRespVo {
+
+    @ApiModelProperty(value = "应用编码")
+    private String appCode;
+
+    @ApiModelProperty(value = "应用名称")
+    private String appName;
+
+    @ApiModelProperty(value = "应用下的角色信息")
+    private List<ApiRoleRespVo> roleInfos;
+
+}

+ 23 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/role/ApiRoleRespVo.java

@@ -0,0 +1,23 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.role;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2023/11/22
+ */
+@Data
+@ApiModel(value = "角色信息Vo")
+public class ApiRoleRespVo {
+
+    @ApiModelProperty(value = "角色名称")
+    private String roleName;
+
+
+    @ApiModelProperty(value = "角色编码")
+    private String roleCode;
+
+
+}

+ 25 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/api/vo/zerotrust/role/ApiRolesReqVo.java

@@ -0,0 +1,25 @@
+package com.dragoninfo.dcuc.auth.api.vo.zerotrust.role;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/22
+ */
+@Data
+@ApiModel(value = "应用角色信息请求Vo")
+public class ApiRolesReqVo {
+
+    @NotBlank
+    @ApiModelProperty(value = "应用令牌")
+    private String appTokenId;
+
+    @ApiModelProperty(value = "需要查询的应用编码集合")
+    private List<String> appCodes;
+
+}

+ 25 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/ApprovalBizContentDto.java

@@ -0,0 +1,25 @@
+package com.dragoninfo.dcuc.auth.auth.dto.zerotrust.approval;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2023/11/29
+ */
+@Builder
+@Data
+public class ApprovalBizContentDto {
+
+    /**
+     * 申请类型
+     * @see com.dragoninfo.dcuc.duceap.enums.AuthApplyTypeEnum
+     */
+    private String flowType;
+
+    /**
+     * 访问资源信息
+     */
+    private ApprovalBizResourceDto resourceInfo;
+
+}

+ 36 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/ApprovalBizDataDto.java

@@ -0,0 +1,36 @@
+package com.dragoninfo.dcuc.auth.auth.dto.zerotrust.approval;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 审批流程申请业务内容dto
+ *
+ * @author mazq
+ * @date 2023/11/29
+ */
+@Builder
+@Data
+public class ApprovalBizDataDto {
+
+    /**
+     * 任务开始时间(yyyy-MM-dd HH:mm:ss)
+     */
+    private String bizTermStart;
+
+    /**
+     * 任务结束时间(yyyy-MM-dd HH:mm:ss)
+     */
+    private String bizTermEnd;
+
+    /**
+     * 业务类型
+     */
+    private String bizType;
+
+    /**
+     * 任务开始时间(yyyy-MM-dd HH:mm:ss)
+     */
+    private ApprovalBizContentDto bizContent;
+
+}

+ 33 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/ApprovalBizResourceDto.java

@@ -0,0 +1,33 @@
+package com.dragoninfo.dcuc.auth.auth.dto.zerotrust.approval;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2023/11/29
+ */
+@Builder
+@Data
+public class ApprovalBizResourceDto {
+
+    /**
+     * 申请方编码
+     */
+    private String visitorCode;
+
+    /**
+     * 申请方名称
+     */
+    private String visitorName;
+
+    /**
+     * 访问资源编码,多个使用','分隔
+     */
+    private String visitResourceCode;
+
+    /**
+     * 访问资源名称,多个使用','分隔
+     */
+    private String visitResourceName;
+}

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/approval/FlowApplyReqDto.java

@@ -72,7 +72,7 @@ public class FlowApplyReqDto {
      * 业务数据
      * 扩展字段
      */
-    private Map<String, String> bizData;
+    private Map<String, Object> bizData;
 
     /**
      * 电子签名

+ 38 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/authapply/RoleAuthApplyDto.java

@@ -0,0 +1,38 @@
+package com.dragoninfo.dcuc.auth.auth.dto.zerotrust.authapply;
+
+import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.roleauthapply.ApplyRoleInVo;
+import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 角色授权申请推送审批Dto
+ * @author mazq
+ * @date 2023/11/23
+ */
+@Data
+public class RoleAuthApplyDto {
+
+    /**
+     * 被授权人信息
+     */
+    private AuthUserVo userInfo;
+
+    /**
+     * 授权申请内容
+     */
+    private List<ApplyRoleInVo> applyRoleIns;
+
+    /**
+     * 权限开始时间
+     */
+    private Date startTime;
+
+    /**
+     * 权限结束时间
+     */
+    private Date endTime;
+
+}

+ 40 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/zerotrust/authapply/ServiceAuthApplyDto.java

@@ -0,0 +1,40 @@
+package com.dragoninfo.dcuc.auth.auth.dto.zerotrust.authapply;
+
+import com.dragoninfo.dcuc.auth.sub.vo.ApplyInfoVo;
+import com.dragoninfo.dcuc.auth.sub.vo.ServiceResourceVo;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 服务授权申请推送审批Dto
+ * @author mazq
+ * @date 2023/11/23
+ */
+@Data
+public class ServiceAuthApplyDto {
+
+    /**
+     * 应用信息
+     */
+    private ApplyInfoVo applyInfoVo;
+
+    /**
+     * 服务信息
+     */
+    private List<ServiceResourceVo> serviceVos;
+
+
+    /**
+     * 权限开始时间
+     */
+    private Date startTime;
+
+    /**
+     * 权限结束时间
+     */
+    private Date endTime;
+
+
+}

+ 0 - 8
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/AppFunAuthResult.java

@@ -56,18 +56,10 @@ public class AppFunAuthResult implements LogicDeleteable, IdEntity<String> {
     @Column(name = "FUN_CODE")
     private String funCode;
 
-    /** 权限开始时间 */
-    @Column(name = "START_TIME")
-    private Date startTime;
-
     /** 权限结束时间 */
     @Column(name = "END_TIME")
     private Date endTime;
 
-    /** 权限起停用状态 */
-    @Column(name = "AUTH_STATUS")
-    private String authStatus;
-
     /** 权限结果来源 */
     @Column(name = "AUTH_SOURCE")
     private String authSource;

+ 0 - 178
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/FunEvent.java

@@ -1,178 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.entity;
-
-import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-
-//功能事件资源表:菜单对应的按钮信息
-@Entity
-@Table(name = "T_FUN_EVENT")
-public class FunEvent implements IdEntity<String> {
-
-	@Id
-	@GeneratedValue(generator="idGenerator")
-	@GenericGenerator(name="idGenerator", strategy="uuid")
-	//编号
-	@Column(name = "ID")
-	private String id;
-
-	//事件名称
-	@Column(name = "NAME")
-	private String name;
-
-	//事件代码
-	@Column(name = "CODE")
-	private String code;
-
-	//功能ID
-	@Column(name = "FUN_ID")
-	private String funId;
-
-	//事件类型(1:公共 2:自定义)
-	@Column(name = "EVENT_TYPE")
-	private String eventType;
-
-	//是否显示(1:在菜单中显示 2:不在菜单中显示)
-	@Column(name = "SHOW_MODE")
-	private String showMode;
-
-	//排序
-	@Column(name = "SEQ")
-	private Integer seq;
-
-	//有效标志(0:无效 1:有效)
-	@Column(name = "IS_ACTIVE")
-	private String isActive = "1";
-
-	//创建时间
-	@Column(name = "CREATE_TIME")
-	private java.util.Date createTime;
-
-	//创建人
-	@Column(name = "CREATOR")
-	private String creator;
-
-	//修改时间
-	@Column(name = "MODIFIED_TIME")
-	private java.util.Date modifiedTime;
-
-	//修改人
-	@Column(name = "MODIFIER")
-	private String modifier;
-
-	//备注
-	@Column(name = "REMARK")
-	private String remark;
-
-	//columns END
-
-		
-	public void setId(String value) {
-		this.id = value;
-	}
-	
-	public String getId() {
-		return this.id;
-	}
-		
-	public void setName(String value) {
-		this.name = value;
-	}
-	
-	public String getName() {
-		return this.name;
-	}
-		
-	public void setCode(String value) {
-		this.code = value;
-	}
-	
-	public String getCode() {
-		return this.code;
-	}
-		
-	public void setFunId(String value) {
-		this.funId = value;
-	}
-	
-	public String getFunId() {
-		return this.funId;
-	}
-		
-	public void setEventType(String value) {
-		this.eventType = value;
-	}
-	
-	public String getEventType() {
-		return this.eventType;
-	}
-		
-	public void setShowMode(String value) {
-		this.showMode = value;
-	}
-	
-	public String getShowMode() {
-		return this.showMode;
-	}
-		
-	public void setSeq(Integer value) {
-		this.seq = value;
-	}
-	
-	public Integer getSeq() {
-		return this.seq;
-	}
-		
-	public void setIsActive(String value) {
-		this.isActive = value;
-	}
-	
-	public String getIsActive() {
-		return this.isActive;
-	}
-		
-	public void setCreateTime(java.util.Date value) {
-		this.createTime = value;
-	}
-	
-	public java.util.Date getCreateTime() {
-		return this.createTime;
-	}
-		
-	public void setCreator(String value) {
-		this.creator = value;
-	}
-	
-	public String getCreator() {
-		return this.creator;
-	}
-		
-	public void setModifiedTime(java.util.Date value) {
-		this.modifiedTime = value;
-	}
-	
-	public java.util.Date getModifiedTime() {
-		return this.modifiedTime;
-	}
-		
-	public void setModifier(String value) {
-		this.modifier = value;
-	}
-	
-	public String getModifier() {
-		return this.modifier;
-	}
-		
-	public void setRemark(String value) {
-		this.remark = value;
-	}
-	
-	public String getRemark() {
-		return this.remark;
-	}
-
-
-}
-

+ 0 - 290
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/FuncApproval.java

@@ -1,290 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.entity;
-
-import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.hibernate.annotations.GenericGenerator;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import javax.persistence.*;
-import java.util.Date;
-
-//动态审批表
-@Entity
-@Table(name = "T_FUNC_APPROVAL")
-public class FuncApproval implements IdEntity<String> {
-
-	@Id
-	@GeneratedValue(generator="idGenerator")
-	@GenericGenerator(name="idGenerator", strategy="uuid")
-	//编号
-	@Column(name = "ID")
-	private String id;
-
-	//应用ID
-	@Column(name = "APP_ID")
-	private String appId;
-
-	//应用名称
-	@Column(name = "APP_NAME")
-	private String appName;
-
-	//功能id
-	@Column(name = "FUNC_ID")
-	private String funcId;
-
-	//功能名称
-	@Column(name = "FUNC_NAME")
-	private String funcName;
-
-	//角色id
-	@Column(name = "ROLE_ID")
-	private String roleId;
-
-	//申请单位
-	@Column(name = "PROPOSER_ORG")
-	private String proposerOrg;
-
-	//申请人
-	@Column(name = "PROPOSER_Id")
-	private String proposerId;
-
-	//申请人身份证
-	@Column(name = "PROPOSER_IDCARD")
-	private String proposerIdcard;
-
-	//申请时间
-	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-	@Column(name = "PROPOSER_TIME")
-	private Date proposerTime;
-
-	//申请事由
-	@Column(name = "PROPOSER_REASON")
-	private String proposerReason;
-
-	//审核状态:-1:审批中 0:未通过 1:通过
-	@Column(name = "APPROVAL_STATUS")
-	private String approvalStatus;
-
-	//审批意见
-	@Column(name = "APPROVAL_OPINION")
-	private String approvalOpinion;
-
-	//审批时间
-	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-	@Column(name = "APPROVAL_TIME")
-	private Date approvalTime;
-
-	//审批人
-	@Column(name = "APPROVAL_ID")
-	private String approvalId;
-
-	//权限有效期限
-	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-	@Column(name = "VALID_TIME")
-	private Date validTime;
-
-	//有效标志(0:无效 1:有效)
-	@Column(name = "IS_ACTIVE")
-	private String isActive;
-
-	//角色名称
-	@Column(name = "ROLE_NAME")
-	private String roleName;
-
-	//申请人名称
-	@Column(name = "PEOPOSER_NAME")
-	private String proposerName;
-
-	//调用次数
-	@Column(name = "CALL_TIME")
-	private int callTime;
-
-	//申请人机构名称
-	@Transient
-	private String orgName;
-
-	//审批人名称
-	@Transient
-	private String approvalName;
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public String getAppId() {
-		return appId;
-	}
-
-	public void setAppId(String appId) {
-		this.appId = appId;
-	}
-
-	public String getAppName() {
-		return appName;
-	}
-
-	public void setAppName(String appName) {
-		this.appName = appName;
-	}
-
-	public String getFuncId() {
-		return funcId;
-	}
-
-	public void setFuncId(String funcId) {
-		this.funcId = funcId;
-	}
-
-	public String getFuncName() {
-		return funcName;
-	}
-
-	public void setFuncName(String funcName) {
-		this.funcName = funcName;
-	}
-
-	public String getRoleId() {
-		return roleId;
-	}
-
-	public void setRoleId(String roleId) {
-		this.roleId = roleId;
-	}
-
-	public String getProposerOrg() {
-		return proposerOrg;
-	}
-
-	public void setProposerOrg(String proposerOrg) {
-		this.proposerOrg = proposerOrg;
-	}
-
-	public String getProposerId() {
-		return proposerId;
-	}
-
-	public void setProposerId(String proposerId) {
-		this.proposerId = proposerId;
-	}
-
-	public String getProposerIdcard() {
-		return proposerIdcard;
-	}
-
-	public void setProposerIdcard(String proposerIdcard) {
-		this.proposerIdcard = proposerIdcard;
-	}
-
-	public Date getProposerTime() {
-		return proposerTime;
-	}
-
-	public void setProposerTime(Date proposerTime) {
-		this.proposerTime = proposerTime;
-	}
-
-	public String getProposerReason() {
-		return proposerReason;
-	}
-
-	public void setProposerReason(String proposerReason) {
-		this.proposerReason = proposerReason;
-	}
-
-	public String getApprovalStatus() {
-		return approvalStatus;
-	}
-
-	public void setApprovalStatus(String approvalStatus) {
-		this.approvalStatus = approvalStatus;
-	}
-
-	public String getApprovalOpinion() {
-		return approvalOpinion;
-	}
-
-	public void setApprovalOpinion(String approvalOpinion) {
-		this.approvalOpinion = approvalOpinion;
-	}
-
-	public Date getApprovalTime() {
-		return approvalTime;
-	}
-
-	public void setApprovalTime(Date approvalTime) {
-		this.approvalTime = approvalTime;
-	}
-
-	public String getApprovalId() {
-		return approvalId;
-	}
-
-	public void setApprovalId(String approvalId) {
-		this.approvalId = approvalId;
-	}
-
-	public Date getValidTime() {
-		return validTime;
-	}
-
-	public void setValidTime(Date validTime) {
-		this.validTime = validTime;
-	}
-
-	public String getIsActive() {
-		return isActive;
-	}
-
-	public void setIsActive(String isActive) {
-		this.isActive = isActive;
-	}
-
-	public String getRoleName() {
-		return roleName;
-	}
-
-	public void setRoleName(String roleName) {
-		this.roleName = roleName;
-	}
-
-	public String getOrgName() {
-		return orgName;
-	}
-
-	public void setOrgName(String orgName) {
-		this.orgName = orgName;
-	}
-
-	public String getProposerName() {
-		return proposerName;
-	}
-
-	public void setProposerName(String proposerName) {
-		this.proposerName = proposerName;
-	}
-
-	public String getApprovalName() {
-		return approvalName;
-	}
-
-	public void setApprovalName(String approvalName) {
-		this.approvalName = approvalName;
-	}
-
-	public int getCallTime() {
-		return callTime;
-	}
-
-	public void setCallTime(int callTime) {
-		this.callTime = callTime;
-	}
-}
-

+ 0 - 213
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/FuncSyncRuleConfig.java

@@ -1,213 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.entity;
-
-import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
-import org.hibernate.annotations.GenericGenerator;
-import org.springframework.util.StringUtils;
-
-import javax.persistence.*;
-
-//功能数据源同步配置表
-@Entity
-@Table(name = "T_FUNC_SYNC_RULE_CONFIG")
-public class FuncSyncRuleConfig implements IdEntity<String> {
-
-	@Id
-	@GeneratedValue(generator="idGenerator")
-	@GenericGenerator(name="idGenerator", strategy="uuid")
-	//编号
-	@Column(name = "ID")
-	private String id;
-
-	//名称
-	@Column(name = "NAME")
-	private String name;
-
-	//应用ID
-	@Column(name = "APP_ID")
-	private String appId;
-
-	//数据源
-	@Column(name = "DS")
-	private String ds;
-
-	//表用户
-	@Column(name = "OWNER")
-	private String owner;
-
-	//表名或视图名
-	@Column(name = "TABLE_NAME")
-	private String tableName;
-
-	//功能代码字段
-	@Column(name = "FUN_CODE")
-	private String funCode;
-
-	//功能名称字段
-	@Column(name = "FUN_NAME")
-	private String funName;
-
-	//url
-	@Column(name = "URL")
-	private String url;
-
-	//父功能ID
-	@Column(name = "PARENT_MENU_ID")
-	private String parentMenuId;
-
-	//字段显示方式
-	@Column(name = "SHOW_MODE")
-	private Boolean showMode;
-
-	//排序字段
-	@Column(name = "SEQ")
-	private String seq;
-
-	//查询条件
-	@Column(name = "CONDITIONS")
-	private String conditions;
-
-	//同步时间
-	@Column(name = "SYNC_TIME")
-	private java.util.Date syncTime;
-
-	@Transient
-	private String datasourceName;
-
-	//columns END
-
-	public void setId(String value) {
-		this.id = value;
-	}
-	
-	public String getId() {
-		return this.id;
-	}
-		
-	public void setName(String value) {
-		this.name = value;
-	}
-	
-	public String getName() {
-		return this.name;
-	}
-		
-	public void setAppId(String value) {
-		this.appId = value;
-	}
-	
-	public String getAppId() {
-		return this.appId;
-	}
-		
-	public void setDs(String value) {
-		this.ds = value;
-	}
-	
-	public String getDs() {
-		return this.ds;
-	}
-		
-	public void setOwner(String value) {
-		this.owner = value;
-	}
-	
-	public String getOwner() {
-		return this.owner;
-	}
-		
-	public void setTableName(String value) {
-		this.tableName = value;
-	}
-	
-	public String getTableName() {
-		return this.tableName;
-	}
-		
-	public void setFunCode(String value) {
-		this.funCode = value;
-	}
-	
-	public String getFunCode() {
-		return this.funCode;
-	}
-		
-	public void setFunName(String value) {
-		this.funName = value;
-	}
-	
-	public String getFunName() {
-		return this.funName;
-	}
-		
-	public void setUrl(String value) {
-		this.url = value;
-	}
-	
-	public String getUrl() {
-		return this.url;
-	}
-		
-	public void setParentMenuId(String value) {
-		this.parentMenuId = value;
-	}
-	
-	public String getParentMenuId() {
-		return this.parentMenuId;
-	}
-		
-	public void setShowMode(Boolean value) {
-		this.showMode = value;
-	}
-	
-	public Boolean getShowMode() {
-		return this.showMode;
-	}
-		
-	public void setSeq(String value) {
-		this.seq = value;
-	}
-	
-	public String getSeq() {
-		return this.seq;
-	}
-
-	public String getConditions() {
-		return translation(conditions);
-	}
-
-	public void setConditions(String conditions) {
-		this.conditions = conditions;
-	}
-
-	public void setSyncTime(java.util.Date value) {
-		this.syncTime = value;
-	}
-	
-	public java.util.Date getSyncTime() {
-		return this.syncTime;
-	}
-
-	public String getDatasourceName() {
-		return datasourceName;
-	}
-
-	public void setDatasourceName(String datasourceName) {
-		this.datasourceName = datasourceName;
-	}
-	/**
-	 * 转译
-	 * @param value 需要转译的值
-	 * @return 转译后的值
-	 */
-	private String translation(String value) {
-		if (StringUtils.isEmpty(value))return value;
-			//You'll need to remove the spaces from the html entities below
-		value = value.replaceAll("&lt;","<" ).replaceAll("&gt;",">");
-		value = value.replaceAll("&#40;","\\(").replaceAll("&#41;","\\)");
-		value = value.replaceAll("&#39;","'");
-
-		return value;
-	}
-}
-

+ 0 - 106
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/MdAppDataSource.java

@@ -1,106 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.entity;
-
-import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-import java.util.Date;
-
-@Entity
-@Table(name = "T_MD_APP_DATASOURCE")
-public class MdAppDataSource implements IdEntity<String> {
-
-    //    数据源编号
-    @Id
-    @GeneratedValue(generator = "idGenerator")
-    @GenericGenerator(name = "idGenerator", strategy = "uuid")
-    @Column(name = "ID")
-    private String id;
-
-    //应用编号
-    @Column(name = "APPLY_ID")
-    private String applyId;
-
-    //
-    @Column(name = "APPLY_NAME")
-    private String applyName;
-
-    @Column(name = "DATASOURCE_ID")
-    private String datasourceId;
-
-    @Column(name = "CREATE_USER")
-    private String createUser;
-
-    @Column(name = "CREATE_TIME")
-    private Date createTime;
-
-    @Column(name = "UPDATE_USER")
-    private String updateUser;
-
-    @Column(name = "UPDATE_TIME")
-    private Date updateTime;
-
-    public String getApplyId() {
-        return applyId;
-    }
-
-    public void setApplyId(String applyId) {
-        this.applyId = applyId;
-    }
-
-    public String getApplyName() {
-        return applyName;
-    }
-
-    public void setApplyName(String applyName) {
-        this.applyName = applyName;
-    }
-
-    public String getCreateUser() {
-        return createUser;
-    }
-
-    public void setCreateUser(String createUser) {
-        this.createUser = createUser;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public String getUpdateUser() {
-        return updateUser;
-    }
-
-    public void setUpdateUser(String updateUser) {
-        this.updateUser = updateUser;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getDatasourceId() {
-        return datasourceId;
-    }
-
-    public void setDatasourceId(String datasourceId) {
-        this.datasourceId = datasourceId;
-    }
-}

+ 0 - 364
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/MdDataSource.java

@@ -1,364 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.entity;
-
-import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-import java.util.Date;
-
-/**
- * Created by huanghy on 2018/10/17.
- */
-@Entity
-@Table(name = "T_MD_DATASOURCE")
-public class MdDataSource implements IdEntity<String> {
-
-    @Id
-    @GeneratedValue(generator="idGenerator")
-    @GenericGenerator(name="idGenerator", strategy="uuid")
-
-    //数据源编号
-    @Column(name = "DATASOURCE_ID")
-    private String datasourceId;
-
-    //数据库中文名
-    @Column(name = "NAME")
-    private String name;
-
-    //数据库类型
-    @Column(name = "DB_TYPE")
-    private String dbType;
-
-    //JNDI名称
-    @Column(name = "JNDI_NAME")
-    private String jndiName;
-
-    //用户名
-    @Column(name = "USERNAME")
-    private String username;
-
-    //密码
-    @Column(name = "PASSWORD")
-    private String password;
-
-    //连接串
-    @Column(name = "DB_URL")
-    private String dbUrl;
-
-    //字符集(0:中文;1:英文)
-    @Column(name = "CHARSET")
-    private String charset;
-
-    //主机IP地址
-    @Column(name = "IP_ADDRESS")
-    private String ipAddress;
-
-    //服务器端口
-    @Column(name = "SERVER_PORT")
-    private String serverPort;
-
-    //最大连接数
-    @Column(name = "MAX_CONN_COUNT")
-    private int maxConnCount;
-
-    //最小连接数
-    @Column(name = "MIN_CONN_COUNT")
-    private int minConnCount;
-
-    //数据库名
-    @Column(name = "DBNAME")
-    private String dbname;
-
-    //数据库别名
-    @Column(name = "DATASOURCE_ALIAS")
-    private String datasourceAlias;
-
-    //是否启用数据源(1启用,0不启用)
-    @Column(name = "IS_ENABLED")
-    private String isEnabled;
-
-    //内置数据源标识符(1内置,0用户定义)
-    @Column(name = "IS_SYSTEM")
-    private String isSystem;
-
-    //是否延迟加载成连接池 1-是 0-否
-    @Column(name = "IS_LAZYDATAOURCE")
-    private String isLazydataource;
-
-    //创建用户ID
-    @Column(name = "CREATE_USER")
-    private String createUser;
-
-    //创建时间
-    @Column(name = "CREATE_TIME")
-    private Date createTime;
-
-    //创建单位编码
-    @Column(name = "CREATE_DEPT")
-    private String createDept;
-
-    //更新用户ID
-    @Column(name = "UPDATE_USER")
-    private String updateUser;
-
-    //更新时间
-    @Column(name = "UPDATE_TIME")
-    private Date updateTime;
-
-    //更新单位编码
-    @Column(name = "UPDATE_DEPT")
-    private String updateDept;
-
-    //删除标识; 1-删除;0-使用中
-    @Column(name = "IS_DELETED")
-    private String isDeleted;
-
-    //删除时间
-    @Column(name = "DELETE_TIME")
-    private Date deleteTime;
-
-    //删除用户
-    @Column(name = "DELETE_USER")
-    private String deleteUser;
-
-    //删除部门
-    @Column(name = "DELETE_DEPT")
-    private String deleteDept;
-
-    //提供与spring的连接数据源映射,避免连接池重复创建,浪费
-    @Column(name = "validationquery")
-    private String validationquery;
-
-
-    public String getId() {
-        return datasourceId;
-    }
-
-    public void setId(String s) {
-        this.datasourceId = s;
-    }
-
-    public String getDatasourceId() {
-        return datasourceId;
-    }
-
-    public void setDatasourceId(String datasourceId) {
-        this.datasourceId = datasourceId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDbType() {
-        return dbType;
-    }
-
-    public void setDbType(String dbType) {
-        this.dbType = dbType;
-    }
-
-    public String getJndiName() {
-        return jndiName;
-    }
-
-    public void setJndiName(String jndiName) {
-        this.jndiName = jndiName;
-    }
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    public String getDbUrl() {
-        return dbUrl;
-    }
-
-    public void setDbUrl(String dbUrl) {
-        this.dbUrl = dbUrl;
-    }
-
-    public String getCharset() {
-        return charset;
-    }
-
-    public void setCharset(String charset) {
-        this.charset = charset;
-    }
-
-    public String getIpAddress() {
-        return ipAddress;
-    }
-
-    public void setIpAddress(String ipAddress) {
-        this.ipAddress = ipAddress;
-    }
-
-    public String getServerPort() {
-        return serverPort;
-    }
-
-    public void setServerPort(String serverPort) {
-        this.serverPort = serverPort;
-    }
-
-    public int getMaxConnCount() {
-        return maxConnCount;
-    }
-
-    public void setMaxConnCount(int maxConnCount) {
-        this.maxConnCount = maxConnCount;
-    }
-
-    public int getMinConnCount() {
-        return minConnCount;
-    }
-
-    public void setMinConnCount(int minConnCount) {
-        this.minConnCount = minConnCount;
-    }
-
-    public String getDbname() {
-        return dbname;
-    }
-
-    public void setDbname(String dbname) {
-        this.dbname = dbname;
-    }
-
-    public String getDatasourceAlias() {
-        return datasourceAlias;
-    }
-
-    public void setDatasourceAlias(String datasourceAlias) {
-        this.datasourceAlias = datasourceAlias;
-    }
-
-    public String getIsEnabled() {
-        return isEnabled;
-    }
-
-    public void setIsEnabled(String isEnabled) {
-        this.isEnabled = isEnabled;
-    }
-
-    public String getIsSystem() {
-        return isSystem;
-    }
-
-    public void setIsSystem(String isSystem) {
-        this.isSystem = isSystem;
-    }
-
-    public String getIsLazydataource() {
-        return isLazydataource;
-    }
-
-    public void setIsLazydataource(String isLazydataource) {
-        this.isLazydataource = isLazydataource;
-    }
-
-    public String getCreateUser() {
-        return createUser;
-    }
-
-    public void setCreateUser(String createUser) {
-        this.createUser = createUser;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public String getCreateDept() {
-        return createDept;
-    }
-
-    public void setCreateDept(String createDept) {
-        this.createDept = createDept;
-    }
-
-    public String getUpdateUser() {
-        return updateUser;
-    }
-
-    public void setUpdateUser(String updateUser) {
-        this.updateUser = updateUser;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public String getUpdateDept() {
-        return updateDept;
-    }
-
-    public void setUpdateDept(String updateDept) {
-        this.updateDept = updateDept;
-    }
-
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-
-    public Date getDeleteTime() {
-        return deleteTime;
-    }
-
-    public void setDeleteTime(Date deleteTime) {
-        this.deleteTime = deleteTime;
-    }
-
-    public String getDeleteUser() {
-        return deleteUser;
-    }
-
-    public void setDeleteUser(String deleteUser) {
-        this.deleteUser = deleteUser;
-    }
-
-    public String getDeleteDept() {
-        return deleteDept;
-    }
-
-    public void setDeleteDept(String deleteDept) {
-        this.deleteDept = deleteDept;
-    }
-
-    public String getValidationquery() {
-        return validationquery;
-    }
-
-    public void setValidationquery(String validationquery) {
-        this.validationquery = validationquery;
-    }
-}

+ 0 - 12
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/ServiceAuthResult.java

@@ -71,24 +71,12 @@ public class ServiceAuthResult implements IdEntity<String> {
     @Column(name = "UPDATE_TIME")
     private Date updateTime;
 
-    /**
-     * 授权有效期起始时间
-     */
-    @Column(name = "START_TIME")
-    private Date startTime;
-
     /**
      * 授权有效期结束时间
      */
     @Column(name = "END_TIME")
     private Date endTime;
 
-    /**
-     * 授权结果状态 0:未到启用时间,1.正常 2.回收
-     */
-    @Column(name = "AUTH_STATUS")
-    private String authStatus;
-
     /**
      * 是否删除
      */

+ 0 - 141
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/StaffAssignAuthLog.java

@@ -1,141 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.entity;
-
-import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-import java.util.Date;
-
-
-@Entity
-@Table(name = "T_STAFF_ASSIGN_AUTH_LOG")
-public class StaffAssignAuthLog implements IdEntity<String> {
-
-	@Id
-	@GeneratedValue(generator="idGenerator")
-	@GenericGenerator(name="idGenerator", strategy="uuid")
-	//ID
-	@Column(name = "ID")
-	private String id;
-
-	//管理员ID
-	@Column(name = "MANAGER_ID")
-	private String managerId;
-
-	//应用所属机构ID
-	@Column(name = "APP_ORG_ID")
-	private String appOrgId;
-
-	//应用ID
-	@Column(name = "APP_ID")
-	private String appId;
-
-	//角色ID
-	@Column(name = "ROLE_ID")
-	private String roleId;
-
-	//人员所属机构ID
-	@Column(name = "STAFF_ORG_ID")
-	private String staffOrgId;
-
-	//人员ID
-	@Column(name = "STAFF_ID")
-	private String staffId;
-
-	//状态 10:新建 90:取消
-	@Column(name = "STATUS")
-	private String status;
-
-	//创建时间
-	@Column(name = "CREATE_TIME")
-	private java.util.Date createTime = new Date();
-
-	//创建时间
-	@Column(name = "CHANGE_CONTENT")
-	private String changeContent;
-
-	//columns END
-
-		
-	public void setId(String value) {
-		this.id = value;
-	}
-	
-	public String getId() {
-		return this.id;
-	}
-		
-	public void setManagerId(String value) {
-		this.managerId = value;
-	}
-	
-	public String getManagerId() {
-		return this.managerId;
-	}
-		
-	public void setAppOrgId(String value) {
-		this.appOrgId = value;
-	}
-	
-	public String getAppOrgId() {
-		return this.appOrgId;
-	}
-		
-	public void setAppId(String value) {
-		this.appId = value;
-	}
-	
-	public String getAppId() {
-		return this.appId;
-	}
-		
-	public void setRoleId(String value) {
-		this.roleId = value;
-	}
-	
-	public String getRoleId() {
-		return this.roleId;
-	}
-		
-	public void setStaffOrgId(String value) {
-		this.staffOrgId = value;
-	}
-	
-	public String getStaffOrgId() {
-		return this.staffOrgId;
-	}
-		
-	public void setStaffId(String value) {
-		this.staffId = value;
-	}
-	
-	public String getStaffId() {
-		return this.staffId;
-	}
-		
-	public void setStatus(String value) {
-		this.status = value;
-	}
-	
-	public String getStatus() {
-		return this.status;
-	}
-		
-	public void setCreateTime(java.util.Date value) {
-		this.createTime = value;
-	}
-	
-	public java.util.Date getCreateTime() {
-		return this.createTime;
-	}
-
-    public String getChangeContent() {
-        return changeContent;
-    }
-
-    public void setChangeContent(String changeContent) {
-        this.changeContent = changeContent;
-    }
-}
-

+ 1 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/ApprovalResult.java

@@ -54,7 +54,7 @@ public class ApprovalResult extends BaseUpdateEntity implements IdEntity<String>
     private String businessKey;
 
     /** 申请类型
-     *  @see ApprovalApplyTypeEnum
+     *  @see com.dragoninfo.dcuc.auth.auth.enumresources.zerotrust.approval.ApprovalApplyTypeEnum
      */
     private String applyType;
 

+ 2 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/BaseEntity.java

@@ -7,6 +7,7 @@ import org.springframework.data.annotation.CreatedBy;
 import org.springframework.data.annotation.CreatedDate;
 
 import javax.persistence.Column;
+import javax.persistence.MappedSuperclass;
 import java.util.Date;
 
 /**
@@ -16,6 +17,7 @@ import java.util.Date;
  * @date 2023/3/13
  */
 @Data
+@MappedSuperclass
 public class BaseEntity {
 
     /** 创建人 */

+ 2 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/BaseUpdateEntity.java

@@ -6,6 +6,7 @@ import org.springframework.data.annotation.LastModifiedBy;
 import org.springframework.data.annotation.LastModifiedDate;
 
 import javax.persistence.Column;
+import javax.persistence.MappedSuperclass;
 import java.util.Date;
 
 /**
@@ -16,6 +17,7 @@ import java.util.Date;
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
+@MappedSuperclass
 public class BaseUpdateEntity extends BaseEntity {
 
     /** 更新人 */

+ 19 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/RoleAuthApply.java

@@ -8,6 +8,7 @@ import org.hibernate.annotations.GenericGenerator;
 import org.hibernate.annotations.Where;
 
 import javax.persistence.*;
+import java.util.Date;
 
 /**
  * 角色授权申请操作内容
@@ -49,6 +50,24 @@ public class RoleAuthApply extends BaseUpdateEntity implements IdEntity<String>
     @Column(name = "ROLE_CODE")
     private String roleCode;
 
+    /**
+     * 权限开始时间
+     */
+    @Column(name = "START_TIME")
+    private Date startTime;
+
+    /**
+     * 权限结束时间
+     */
+    @Column(name = "END_TIME")
+    private Date endTime;
+
+    /**
+     * 是否待授权 01是 审批通过后开始时间未到
+     */
+    @Column(name = "TO_BE_AUTHED")
+    private String toBeAuthed;
+
     /**
      * 流程实例id
      */

+ 82 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/zerotrust/ServiceAuthApply.java

@@ -0,0 +1,82 @@
+package com.dragoninfo.dcuc.auth.auth.entity.zerotrust;
+
+import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * 角色授权申请操作内容
+ *
+ * @author mazq
+ * @date 2023/4/21
+ */
+@EqualsAndHashCode(callSuper = true)
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_AUTH_SERVICE_AUTH_APPLY")
+@Where(clause = "deleted = '0'")
+public class ServiceAuthApply extends BaseEntity implements IdEntity<String> {
+
+    /**
+     * 主键id
+     */
+    @Id
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    private String id;
+
+    /**
+     * 应用id
+     */
+    @Column(name = "APP_ID")
+    private String appId;
+
+    /**
+     * 服务资源id
+     */
+    @Column(name = "SERVICE_ID")
+    private String serviceId;
+    
+    /**
+     * 权限开始时间
+     */
+    @Column(name = "START_TIME")
+    private Date startTime;
+
+    /**
+     * 权限结束时间
+     */
+    @Column(name = "END_TIME")
+    private Date endTime;
+
+    /**
+     * 是否待授权 01是 审批通过后开始时间未到
+     */
+    @Column(name = "TO_BE_AUTHED")
+    private String toBeAuthed;
+
+    /**
+     * 流程实例id
+     */
+    @Column(name = "PROCESS_INST_ID")
+    private String processInstId;
+
+    /**
+     * 任务节点实例id
+     */
+    @Column(name = "TASK_INST_ID")
+    private String taskInstId;
+
+    /**
+     * 审批结果
+     */
+    @Column(name = "APPROVAL_RESULT")
+    private String approvalResult;
+}

+ 0 - 51
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/AuthStatusEnum.java

@@ -1,51 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.enumresources;
-
-/**
- * 服务授权结果状态枚举类
- * @author mazq
- * @date 2021/5/12
- */
-public enum AuthStatusEnum {
-
-    /**
-     * 服务授权申请审批通过后权限有效期时间未到启用时间
-     */
-    NOT_START("未到启动时间","0"),
-    /**
-     * 正常启用状态
-     */
-    START("正常","1"),
-    /**
-     * 授权被回收
-     */
-    CANCEL("回收","2"),
-    /**
-     * 权限超过有效期
-     */
-    OVER_DUE("过期","3");
-
-    private String label;
-
-    private String value;
-
-    AuthStatusEnum(String label, String value) {
-        this.label = label;
-        this.value = value;
-    }
-
-    public String getLable() {
-        return label;
-    }
-
-    public void setLable(String lable) {
-        this.label = lable;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-}

+ 5 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/zerotrust/approval/ApprovalApplyTypeEnum.java

@@ -8,6 +8,11 @@ public enum ApprovalApplyTypeEnum implements ICodeEnum {
      */
     ROLE_AUTH_APPLY("功能级权限申请", "ROLE_AUTH_APPLY"),
 
+    /**
+     * 服务级权限申请
+     */
+    SERVICE_AUTH_APPLY("服务级权限申请", "SERVICE_AUTH_APPLY"),
+
     /**
      * 数据级权限申请
      */

+ 3 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/vo/zerotrust/roleauthapply/ApplyRoleInVo.java

@@ -15,6 +15,9 @@ public class ApplyRoleInVo {
     @ApiModelProperty(value = "应用id")
     private String appId;
 
+    @ApiModelProperty(value = "应用code")
+    private String appCode;
+
     @ApiModelProperty(value = "应用名称")
     private String appName;
 

+ 19 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/vo/zerotrust/roleauthapply/RoleAuthApplySaveVo.java

@@ -1,9 +1,14 @@
 package com.dragoninfo.dcuc.auth.auth.vo.zerotrust.roleauthapply;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -15,10 +20,24 @@ import java.util.List;
 @ApiModel(value = "角色授权申请保存Vo")
 public class RoleAuthApplySaveVo {
 
+    @NotBlank
     @ApiModelProperty(value = "申请人人员id")
     private String userId;
 
+    @NotNull
     @ApiModelProperty(value = "申请角色内容")
     private List<ApplyRoleInVo> applyRoleInVos;
 
+    @NotNull
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "权限申请开始时间 yyyy-MM-dd HH:mm:ss")
+    private Date startTime;
+
+    @NotNull
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "权限申请结束时间 yyyy-MM-dd HH:mm:ss")
+    private Date endTime;
+
 }

+ 10 - 3
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/token/vo/TokenDetailRespVo.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/token/vo/AppTokenDetailRespVo.java

@@ -7,6 +7,8 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.util.Objects;
+
 /**
  * 令牌详情响应结果
  *
@@ -17,7 +19,7 @@ import lombok.NoArgsConstructor;
 @NoArgsConstructor
 @AllArgsConstructor
 @Data
-public class TokenDetailRespVo {
+public class AppTokenDetailRespVo {
 
     /**
      * 根据令牌标识查询的用户信息
@@ -39,7 +41,12 @@ public class TokenDetailRespVo {
      */
     private UserTokenInfoRespVO userToken;
 
-    public static TokenDetailRespVo empty() {
-        return new TokenDetailRespVo();
+    public static AppTokenDetailRespVo empty() {
+        return new AppTokenDetailRespVo();
+    }
+
+    public boolean isEmpty() {
+        return Objects.isNull(this.appToken) || Objects.isNull(this.userToken);
     }
+
 }

+ 1 - 2
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/LogSendService.java

@@ -6,7 +6,6 @@ import com.dragoninfo.dcuc.auth.audit.dto.AuthenticationLogDto;
 import com.dragoninfo.dcuc.auth.audit.dto.AuthorizeLogDto;
 import com.dragoninfo.dcuc.auth.config.DcucAuthKafkaConfig;
 import com.dragoninfo.duceap.commons.util.kafka.KafkaServer;
-import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.date.DateConst;
@@ -43,7 +42,7 @@ public class LogSendService {
     public void sendAuthorizeLog(AuthorizeLogDto log) {
         String title = "推送授权日志";
         String content = "推送授权日志";
-        SecurityUser securityUser = (SecurityUser) UserContextUtils.getCurrentUser();
+        SecurityUser securityUser = UserContextUtils.getCurrentUser();
         MessageInfoVo messages = getMessageVo(securityUser, title, content, auditConfig.getAuthorizeTopic());
         messages.setContent(JSON.toJSONString(log));
         List<MessageInfoVo> msg = new ArrayList<>();

+ 0 - 48
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/ApprovalEventCenterBus.java

@@ -1,48 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.async;
-
-import com.dragoninfo.dcuc.auth.auth.async.subscribe.ApprovalSendMessage;
-import com.google.common.eventbus.AsyncEventBus;
-import com.google.common.eventbus.EventBus;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.Executors;
-
-/**
- * 异步处理注册类,在要异步处理的地方,引入此类,调用post方法
- */
-@Component
-public class ApprovalEventCenterBus implements InitializingBean {
-
-    private EventBus eventBus = null;
-
-    @Autowired
-    private ApprovalSendMessage approvalSendMessage;
-
-    /**
-     * 添加异步处理参数
-     * @param object
-     */
-    public void post(Object object){
-        eventBus.post(object);
-    }
-
-    /**
-     * 注册异步处理类
-     * @param object
-     */
-    public void register(Object object){
-        eventBus.register(object);
-    }
-
-    /**
-     * 初始化异步处理参数(单线程、处理类:RecodeLoginLog,可修改)
-     * @throws Exception
-     */
-    @Override
-    public void afterPropertiesSet() throws Exception {
-        eventBus = new AsyncEventBus(EvenBusThreadPoolHolder.executor);
-        eventBus.register(approvalSendMessage);
-    }
-}

+ 2 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/PermissionUpdateEventBus.java

@@ -4,14 +4,13 @@ package com.dragoninfo.dcuc.auth.auth.async;
 import com.dragoninfo.dcuc.auth.auth.async.subscribe.PermissionUpdateMessage;
 
 import com.dragoninfo.dcuc.auth.auth.vo.PermissionParameter;
+import com.dragoninfo.dcuc.auth.util.ThreadPoolHolder;
 import com.google.common.eventbus.AsyncEventBus;
 import com.google.common.eventbus.EventBus;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.concurrent.Executors;
-
 /**
  * @author huangzqa
  * @date 2020/7/10
@@ -34,7 +33,7 @@ public class PermissionUpdateEventBus implements InitializingBean {
 
     @Override
     public void afterPropertiesSet() {
-        eventBus = new AsyncEventBus(EvenBusThreadPoolHolder.executor);
+        eventBus = new AsyncEventBus(ThreadPoolHolder.executor);
         eventBus.register(permissionUpdateMessage);
     }
 }

+ 2 - 2
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/PermssionServiceUpdateEventBus.java

@@ -2,6 +2,7 @@ package com.dragoninfo.dcuc.auth.auth.async;
 
 import com.dragoninfo.dcuc.auth.auth.async.subscribe.PermissionServiceUpdateMessage;
 import com.dragoninfo.dcuc.auth.auth.dto.AppServiceCodeDto;
+import com.dragoninfo.dcuc.auth.util.ThreadPoolHolder;
 import com.google.common.eventbus.AsyncEventBus;
 import com.google.common.eventbus.EventBus;
 import org.slf4j.Logger;
@@ -11,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
-import java.util.concurrent.*;
 
 /**
  * @Author yica
@@ -38,7 +38,7 @@ public class PermssionServiceUpdateEventBus implements InitializingBean {
 
     @Override
     public void afterPropertiesSet()  {
-            eventBus = new AsyncEventBus(EvenBusThreadPoolHolder.executor);
+            eventBus = new AsyncEventBus(ThreadPoolHolder.executor);
             eventBus.register(permissionServiceUpdateMessage);
     }
 }

+ 0 - 48
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/StaffAssignAuthEventCenterBus.java

@@ -1,48 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.async;
-
-import com.dragoninfo.dcuc.auth.auth.async.subscribe.StaffAssignAuthSendMessage;
-import com.google.common.eventbus.AsyncEventBus;
-import com.google.common.eventbus.EventBus;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.Executors;
-
-/**
- * 异步处理注册类,在要异步处理的地方,引入此类,调用post方法
- */
-@Component
-public class StaffAssignAuthEventCenterBus implements InitializingBean {
-
-    private EventBus eventBus = null;
-
-    @Autowired
-    private StaffAssignAuthSendMessage staffAssignAuthSendMessage;
-
-    /**
-     * 添加异步处理参数
-     * @param object
-     */
-    public void post(Object object){
-        eventBus.post(object);
-    }
-
-    /**
-     * 注册异步处理类
-     * @param object
-     */
-    public void register(Object object){
-        eventBus.register(object);
-    }
-
-    /**
-     * 初始化异步处理参数(单线程、处理类:RecodeLoginLog,可修改)
-     * @throws Exception
-     */
-    @Override
-    public void afterPropertiesSet() {
-        eventBus = new AsyncEventBus(EvenBusThreadPoolHolder.executor);
-        eventBus.register(staffAssignAuthSendMessage);
-    }
-}

+ 0 - 113
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/subscribe/ApprovalSendMessage.java

@@ -1,113 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.async.subscribe;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
-import com.dragoninfo.dcuc.auth.auth.enumresources.MessageTypeEnum;
-import com.dragoninfo.dcuc.auth.config.DcucAuthKafkaConfig;
-import com.dragoninfo.duceap.commons.util.kafka.KafkaServer;
-import com.dragonsoft.duceap.base.entity.security.SecurityUser;
-import com.dragonsoft.duceap.commons.util.date.DateConst;
-import com.dragonsoft.duceap.commons.util.date.DateUtils;
-import com.dragonsoft.duceap.commons.util.enums.EnumUtils;
-import com.dragonsoft.duceap.core.entity.response.ResponseResult;
-import com.dragonsoft.mq.client.model.vo.MessageInfoReqVo;
-import com.dragonsoft.mq.client.model.vo.MessageInfoVo;
-import com.google.common.eventbus.Subscribe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 异步消息处理
- */
-@Component
-public class ApprovalSendMessage {
-
-    private Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    @Autowired
-    private KafkaServer kafkaServer;
-    @Autowired
-    private DcucAuthKafkaConfig dcucAuthKafkaConfig;
-
-    @Subscribe
-    public void handle(Map<String, Object> paramsMap) {
-        try {
-            FuncApproval approval = (FuncApproval) paramsMap.get("approval");
-            String messageType = (String) paramsMap.get("messageType");
-            SecurityUser securityUser = (SecurityUser) paramsMap.get("securityUser");
-            String topic = dcucAuthKafkaConfig.getMessageTopic();
-            MessageTypeEnum messageTypeEnum = EnumUtils.enumOf(MessageTypeEnum.class, messageType);
-            //消息自定义内容key-value
-            List<Map<String, String>> infoSetList = infoSetVal(approval);
-            //构造消息
-            MessageInfoVo messages = getMessageVo(securityUser, "动态授权审批结果", messageTypeEnum.getLabel(), topic);
-
-            messages.setInfoSet(infoSetList);
-            List<MessageInfoVo> msg = new ArrayList<>();
-            msg.add(messages);
-            //构造发送请求参数体
-            MessageInfoReqVo requestVo = new MessageInfoReqVo();
-            requestVo.setTopic(topic);
-            requestVo.setAppKey(dcucAuthKafkaConfig.getAppkey());
-            requestVo.setAppSecret(dcucAuthKafkaConfig.getAppSecret());
-            requestVo.setMessages(msg);
-            //
-            ResponseResult result = kafkaServer.send(requestVo, dcucAuthKafkaConfig.getKafkaServers());
-        } catch (
-                Exception e) {
-            logger.error("发送消息失败", e);
-        }
-
-    }
-
-    private MessageInfoVo getMessageVo(SecurityUser securityUser, String title, String content, String topic) {
-        MessageInfoVo messageInfoVo = new MessageInfoVo();
-        if (securityUser == null) {
-            messageInfoVo.setUserCode("dcuc");
-            messageInfoVo.setUserName("用户中心");
-            } else {
-                //账号名称
-            messageInfoVo.setUserCode(securityUser.getUserName());
-                //用户名
-            messageInfoVo.setUserName(securityUser.getName());
-            messageInfoVo.setUserPoliceNo(securityUser.getPoliceNo());
-            messageInfoVo.setUserDeptId(securityUser.getDeptId());
-            }
-        messageInfoVo.setUserSystemCode("dcuc");
-        messageInfoVo.setUserSystem("usercenter");
-            //消息类型,与消息主题一致
-        messageInfoVo.setInfoType(topic);
-        messageInfoVo.setTitle(title);
-        messageInfoVo.setContent(content);
-        messageInfoVo.setCreateTime(DateUtils.getCurrTime(DateConst.DB_STORE_TIME));
-        return messageInfoVo;
-    }
-
-    private List<Map<String, String>> infoSetVal(FuncApproval approval) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-        List<Map<String, String>> mapList = new ArrayList<>();
-        Map<String, String> map = new HashMap<>();
-        map.put("ID", approval.getId());//编号
-        map.put("APP_ID", approval.getAppId());//应用Id
-        map.put("ROLE_ID", approval.getRoleId());//角色Id
-        map.put("PROPOSER_ORG", approval.getProposerOrg());//申请机构Id
-        map.put("PROPOSER_Id", approval.getProposerId());//申请人userId
-        map.put("PROPOSER_IDCARD", approval.getProposerIdcard());//申请人身份证号
-        map.put("PROPOSER_TIME", approval.getProposerTime() == null ? null : sdf.format(approval.getProposerTime()));//申请时间
-        map.put("PROPOSER_REASON", approval.getProposerReason());//申请事由
-        map.put("APPROVAL_STATUS", approval.getApprovalStatus());//审核状态:-1:审批中 0:未通过 1:通过
-        map.put("APPROVAL_TIME", approval.getApprovalTime() == null ? null : sdf.format(approval.getApprovalTime()));//审批时间
-        map.put("APPROVAL_ID", approval.getApprovalId());//审批人userId
-        map.put("VALID_TIME", approval.getValidTime() == null ? null : sdf.format(approval.getValidTime()));//有效期限
-        map.put("APPROVAL_OPINION", approval.getApprovalOpinion());//审批意见
-        mapList.add(map);
-        return mapList;
-    }
-}

+ 0 - 150
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/async/subscribe/StaffAssignAuthSendMessage.java

@@ -1,150 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.async.subscribe;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.bpo.RoleInfoBPO;
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.enumresources.MessageTypeEnum;
-import com.dragoninfo.dcuc.auth.auth.service.impl.StaffAssignAuthInfoService;
-import com.dragoninfo.dcuc.auth.config.DcucAuthKafkaConfig;
-import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
-import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-import com.dragoninfo.duceap.commons.util.kafka.KafkaServer;
-import com.dragonsoft.duceap.base.entity.security.SecurityUser;
-import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
-import com.dragonsoft.duceap.commons.util.date.DateConst;
-import com.dragonsoft.duceap.commons.util.date.DateUtils;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.core.entity.response.ResponseResult;
-import com.dragonsoft.mq.client.model.vo.MessageInfoReqVo;
-import com.dragonsoft.mq.client.model.vo.MessageInfoVo;
-import com.google.common.eventbus.Subscribe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 异步消息处理
- */
-@Component
-public class StaffAssignAuthSendMessage {
-
-    private Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    @Autowired
-    private RoleInfoBPO roleInfoBPO;
-    @Autowired
-    private KafkaServer kafkaServer;
-    @Autowired
-    private StaffAssignAuthInfoService staffAssignAuthInfoService;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-    @Autowired
-    private IAuthUserInfoService authUserInfoService;
-    @Autowired
-    private DcucAuthKafkaConfig dcucAuthKafkaConfig;
-
-
-    @Subscribe
-    public void handle(Map<String, Object> paramsMap) {
-        try {
-            JSONArray staffObjList = (JSONArray) paramsMap.get("staffObjList");
-            String appId = (String) paramsMap.get("appId");
-            SecurityUser securityUser = (SecurityUser) paramsMap.get("securityUser");
-            String topic = dcucAuthKafkaConfig.getMessageJssqTopic();
-            //消息自定义内容key-value
-            List<Map<String, String>> infoSetList = infoSetVal(staffObjList, appId);
-            //构造消息
-            MessageInfoVo messages = getMessageVo(securityUser, "角色授权变更", MessageTypeEnum.JSSQBG.getLabel(), topic);
-            messages.setInfoSet(infoSetList);
-            List<MessageInfoVo> msg = new ArrayList<>();
-            msg.add(messages);
-            //构造发送请求参数体
-            MessageInfoReqVo requestVo = new MessageInfoReqVo();
-            requestVo.setTopic(topic);
-            requestVo.setAppKey(dcucAuthKafkaConfig.getAppkey());
-            requestVo.setAppSecret(dcucAuthKafkaConfig.getAppSecret());
-            requestVo.setMessages(msg);
-            //
-            ResponseResult result = kafkaServer.send(requestVo, dcucAuthKafkaConfig.getKafkaServers());
-        } catch (
-                Exception e) {
-            logger.error("发送消息失败", e);
-        }
-
-    }
-
-    private List<Map<String, String>> infoSetVal(JSONArray staffObjList, String appId) {
-        String appCode = "";
-        List<Map<String, String>> infoSetList = new ArrayList<>();
-        if (CollectionUtils.isEmpty(staffObjList)) {
-            return infoSetList;
-        }
-        for (Object o : staffObjList) {
-            JSONObject jsonObject = (JSONObject) o;
-            String userId = (String) jsonObject.get("id");
-            logger.info("消息发送参数[userId:{},appId:{}]", userId, appId);
-            //获取变更用户的身份证号
-            AuthUserInfo userInfo = authUserInfoService.findById(userId);
-            //获取变更的应用code
-            if (StringUtils.isNotEmpty(appId) && StringUtils.isEmpty(appCode)) {
-                ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
-                appCode = applyInfo.getApplyCode();
-            }
-            //变更后现有对应应用的角色代码
-            StringBuilder roleCodes = new StringBuilder();
-            if (StringUtils.isNotEmpty(appId)) {
-                List<String> roleIds = staffAssignAuthInfoService.getRoleIds(userId, appId);
-                for (String roleId : roleIds) {
-                    RoleInfo roleInfo = roleInfoBPO.get(roleId);
-                    roleCodes.append(roleInfo.getCode()).append(",");
-                }
-                if (StringUtils.isNotEmpty(roleCodes.toString())) {
-                    roleCodes = new StringBuilder(roleCodes.substring(0, roleCodes.length() - 1));
-                }
-            }
-            Map<String, String> map = new HashMap<>();
-            map.put("OPERATE_TYPE", MessageTypeEnum.JSSQBG.getValue());
-            map.put("IDCARD", userInfo.getIdcard());
-            map.put("APP_CODE", appCode);
-            map.put("ROLE_CODES", roleCodes.toString());
-            infoSetList.add(map);
-        }
-        return infoSetList;
-    }
-
-    private MessageInfoVo getMessageVo(SecurityUser securityUser, String title, String content, String topic) {
-        MessageInfoVo messageInfoVo = new MessageInfoVo();
-        if (securityUser == null) {
-            messageInfoVo.setUserCode("dcuc");
-            messageInfoVo.setUserName("用户中心");
-        } else {
-            //账号名称
-            messageInfoVo.setUserCode(securityUser.getUserName());
-            //用户名
-            messageInfoVo.setUserName(securityUser.getName());
-            messageInfoVo.setUserPoliceNo(securityUser.getPoliceNo());
-            messageInfoVo.setUserDeptId(securityUser.getDeptId());
-        }
-        messageInfoVo.setUserSystemCode("dcuc");
-        messageInfoVo.setUserSystem("usercenter");
-        //消息类型,与消息主题一致
-        messageInfoVo.setInfoType(topic);
-        messageInfoVo.setTitle(title);
-        messageInfoVo.setContent(content);
-        messageInfoVo.setCreateTime(DateUtils.getCurrTime(DateConst.DB_STORE_TIME));
-        return messageInfoVo;
-    }
-
-
-
-}

+ 0 - 13
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ApprovalBPO.java

@@ -1,13 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.bpo;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
-import com.dragoninfo.duceap.core.persistent.BaseBPO;
-import org.springframework.stereotype.Repository;
-
-/**
- * Created by liws on 2019/3/4.
- */
-@Repository
-public class ApprovalBPO extends BaseBPO<FuncApproval, String> {
-
-}

+ 0 - 59
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/FunEventBPO.java

@@ -1,59 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.bpo;
-
-
-import com.dragoninfo.dcuc.auth.auth.entity.FunEvent;
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import com.dragoninfo.duceap.core.persistent.BaseBPO;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public class FunEventBPO extends BaseBPO<FunEvent, String> {
-
-    public List<FunEvent> getMenuData(String pkMenuId, Searchable searchable) {
-        pkMenuId = (pkMenuId == null) ? "" :pkMenuId;
-        String hql = "from FunEvent t where (t.funId is null or t.funId = '') and t.eventType = '1' or  t.funId = '" + pkMenuId + "'";
-        return getBaseDAOHibernate().find(hql);
-    }
-
-    public void deleteFunEvent(List<String> idList, String idPlace) {
-        StringBuffer stringBuffer1 = new StringBuffer();
-        StringBuffer stringBuffer2 = new StringBuffer();
-
-        stringBuffer1.append("delete from FunEvent a where a.funId = ? ");
-        stringBuffer2.append("delete from RoleFunRsRl r where r.funId = ?");
-
-        if (!StringUtils.isEmpty(idPlace)) {
-            stringBuffer1.append("and a.id not in (" + idPlace + ")");
-            stringBuffer2.append("and r.eventId not in (" + idPlace + ")");
-            PersistentFactory.getHibernateDao().bulkUpdate(stringBuffer1.toString(), idList.toArray());
-            PersistentFactory.getHibernateDao().bulkUpdate(stringBuffer2.toString(), idList.toArray());
-        }else{
-            PersistentFactory.getHibernateDao().bulkUpdate(stringBuffer1.toString(), idList.toArray());
-            PersistentFactory.getHibernateDao().bulkUpdate(stringBuffer2.toString(), idList.toArray());
-        }
-    }
-
-
-    public List<EventInfoVO> getEventByTreeId(String treeId) {
-        String hql = "select new com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO(t.id,t.code,t.name,t.eventType,t.showMode) from FunEvent t where (t.funId is null or t.funId = '') and t.eventType = '1' or t.funId = ?";
-        return PersistentFactory.getHibernateDao().find(hql, treeId);
-    }
-
-    public List<EventInfoVO> getEventByFunIds(String funIds){
-        String hql = "select new com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO(t.id,t.code,t.name,t.eventType," +
-                "t.showMode,t.funId) from FunEvent t where t.funId in (?)";
-        return PersistentFactory.getHibernateDao().find(hql,funIds);
-    }
-
-    public List<EventInfoVO> getEventNoFunId(){
-        String hql = "select new com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO(t.id,t.code,t.name,t.eventType," +
-                "t.showMode,t.funId) from FunEvent t where (t.funId is null or t.funId = '') and t.eventType = '1'";
-        return PersistentFactory.getHibernateDao().find(hql);
-    }
-}

+ 0 - 45
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/FuncSyncRuleConfigBPO.java

@@ -1,45 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.bpo;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FuncSyncRuleConfig;
-import com.dragoninfo.dcuc.auth.auth.vo.MenuInfoVO;
-import com.dragoninfo.duceap.core.persistent.BaseBPO;
-import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public class FuncSyncRuleConfigBPO extends BaseBPO<FuncSyncRuleConfig, String> {
-    /**
-     * 菜单规则信息删除
-     */
-    public void del(String rulesId) {
-        PersistentFactory.getHibernateDao().delete(FuncSyncRuleConfig.class, rulesId);
-    }
-
-    public Page<FuncSyncRuleConfig> getMenuRulesList(String applicationId, Searchable searchable) {
-        String sql = "select * from T_FUNC_SYNC_RULE_CONFIG a where a.app_id= ?";
-        Page<FuncSyncRuleConfig> page = PersistentFactory.getJdbcDao().paging(sql, searchable, FuncSyncRuleConfig.class, applicationId);
-        return page;
-    }
-
-    public List<FuncSyncRuleConfig> menuSyn(String menuSyn) {
-        String hql = "from FuncSyncRuleConfig t where t.id = '" + menuSyn + "'";
-        return PersistentFactory.getHibernateDao().find(hql);
-    }
-
-    public int isExist(String name, String appId) {
-        String hql = "from FuncSyncRuleConfig where name in (select name from FuncSyncRuleConfig where name = ? ) and appId = ?";
-        List<FuncSyncRuleConfig> funcSyncRuleConfigs = PersistentFactory.getHibernateDao().find(hql, new Object[]{name, appId});
-        return (funcSyncRuleConfigs != null && funcSyncRuleConfigs.size() > 0) ? funcSyncRuleConfigs.size() : 0;
-    }
-
-    public List<MenuInfoVO> getMenuRuleList(String appId) {
-        String hql = "select new com.dragoninfo.dcuc.auth.auth.vo.MenuInfoVO(t.id,t.name,t.url) from FuncSyncRuleConfig t where t.appId = ?";
-        List<MenuInfoVO> menuInfoVOs = PersistentFactory.getHibernateDao().find(hql, appId);
-        return menuInfoVOs;
-    }
-}

+ 10 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/RoleInfoBPO.java

@@ -238,9 +238,10 @@ public class RoleInfoBPO extends BaseBPO<RoleInfo, String> {
         return PersistentFactory.getJdbcDao().paging(sqlBuffer.toString(), searchable, RoleInfoVO.class, orgId, orgId, orgId, applicationId);
     }
 
-    public List<RoleInfo> getRolesByAppIds(String appIds) {
-        String hql = "from RoleInfo t where t.isActive = '1' and ? like concat('%',concat(t.appId,'%'))";
-        return PersistentFactory.getHibernateDao().find(hql, new Object[]{appIds});
+    public List<RoleInfo> getRolesByAppIds(Collection<String> appIds) {
+        String collect = appIds.stream().collect(Collectors.joining("','"));
+        String hql = "from RoleInfo t where t.isActive = '1' and t.appId in ('" + collect + "')";
+        return PersistentFactory.getHibernateDao().find(hql);
     }
 
     public List<RoleInfo> roleListByRoleIds(Collection<String> roleIds) {
@@ -311,4 +312,10 @@ public class RoleInfoBPO extends BaseBPO<RoleInfo, String> {
             return roleInfos.get(0);
         }
     }
+
+    public List<RoleInfo> getByCodes(List<String> roleCodes) {
+        String collect = roleCodes.stream().collect(Collectors.joining("','"));
+        String sql = "SELECT * FROM T_ROLE_INFO WHERE CODE IN ('" + collect + "') AND IS_ACTIVE = '1'";
+        return PersistentFactory.getJdbcDao().queryForList(sql, RoleInfo.class);
+    }
 }

+ 0 - 31
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ServiceAuthFlowBPO.java

@@ -1,31 +0,0 @@
-//package com.dragoninfo.dcuc.auth.auth.bpo;
-//
-//
-//import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthFlow;
-//import com.dragoninfo.duceap.core.persistent.BaseBPO;
-//import com.dragonsoft.duceap.base.enums.BooleanEnum;
-//import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
-//import org.springframework.stereotype.Repository;
-//
-///**
-// * @author Administrator
-// * @Description
-// * @create 2020-11-25 14:31
-// */
-//@Repository
-//public class ServiceAuthFlowBPO extends BaseBPO<ServiceAuthFlow,String> {
-//
-//    /**
-//     * 校验申请单id
-//     * @param applicantId
-//     * @return
-//     */
-//    public boolean checkApplicantId(String applicantId){
-//        String sql="select  count(*) from  t_service_auth_flow where applicant_id = ? and deleted= ?";
-//        int i = PersistentFactory.getJdbcDao().queryForInt(sql, new Object[]{applicantId, BooleanEnum.FALSE.value});
-//        if (i==0){
-//            return false;
-//        }
-//        return true;
-//    }
-//}

+ 18 - 30
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/ServiceAuthResultBPO.java

@@ -4,13 +4,17 @@ package com.dragoninfo.dcuc.auth.auth.bpo;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
 import com.dragoninfo.dcuc.auth.auth.po.ServiceAuthResultPO;
 import com.dragoninfo.duceap.core.persistent.BaseBPO;
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
 import com.dragonsoft.duceap.core.search.Searchable;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Repository;
 
+import java.util.Collections;
+import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author mazq
@@ -50,7 +54,7 @@ public class ServiceAuthResultBPO extends BaseBPO<ServiceAuthResult, String> {
     public List<ServiceAuthResult> serviceAuthResultList(String appCode) {
         String sql = " SELECT t.* FROM T_SERVICE_AUTH_RESULT t, T_SERVICE_RESOURCE r \n" +
                 " where t.service_id=r.id and t.deleted='0' and r.deleted='0'\n" +
-                " and r.service_status='1' and t.auth_status ='1' and t.service_resource_id = 'tj_service' and t.app_code=? \n";
+                " and r.service_status='1' and t.service_resource_id = 'tj_service' and t.app_code=? \n";
         return PersistentFactory.getJdbcDao().queryForList(sql, ServiceAuthResult.class, appCode);
     }
 
@@ -62,7 +66,7 @@ public class ServiceAuthResultBPO extends BaseBPO<ServiceAuthResult, String> {
 
     public Page<ServiceAuthResultPO> serviceResultPageJoinFlow(Searchable searchable) {
         String sql = "SELECT \n" +
-                "t.app_code, t.service_code, t.auth_status, t.create_time as auth_time, t.service_resource_id,t.deleted as deleted, " +
+                "t.app_code, t.service_code, t.create_time as auth_time, t.service_resource_id,t.deleted as deleted, " +
                 "a.apply_name as app_name, a.apply_status as app_status, a.org_name as app_org_name, a.manager_org_name as app_manager_org_name, " +
                 "f.applicant_name as applicant_name, f.applicant_org_code as applicant_org_code, f.create_time as apply_time," +
                 "f.applicant_org_name as applicant_org_name, f.applicant_idcard as applicant_idcard, f.applicant_phone_no as applicant_phone_no, " +
@@ -84,34 +88,18 @@ public class ServiceAuthResultBPO extends BaseBPO<ServiceAuthResult, String> {
         return PersistentFactory.getJdbcDao().paging(sql, searchable, ServiceAuthResultPO.class);
     }
 
+    public List<ServiceAuthResult> getExpiredAuth() {
+        String sql = " SELECT * FROM T_SERVICE_AUTH_RESULT " +
+                " where deleted='0' and end_time < ?";
+        return PersistentFactory.getJdbcDao().queryForList(sql, ServiceAuthResult.class, new Date());
+    }
 
-//    public Page<ServiceAuthResultPO> serviceResultPageJoinFlow(Searchable searchable) {
-//        String sql = "SELECT " +
-//                "t.app_code, t.service_code, t.auth_status, t.create_time as auth_time, t.service_resource_id,t.deleted as deleted, " +
-//                "a.apply_name as app_name, a.apply_status as app_status, a.org_name as app_org_name, a.manager_org_name as app_manager_org_name, " +
-//                "f.applicant_name, f.applicant_org_code, f.create_time as apply_time, f.applicant_org_name, f.applicant_idcard, f.applicant_phone_no, " +
-//                "f.app_org_code as app_org_code, f.app_manager_org_code as app_manager_org_code, f.service_shared_way, " +
-//                "s.service_name, s.service_status, s.build_unit as service_org_name, s.manager_unit as service_manager_org_name, " +
-//                "s.manager_unit_code as service_manager_org_code, s.build_unit_code as service_org_code, s.service_type, " +
-//                "t.app_code as appCode, t.service_code as serviceCode, t.service_resource_id as serviceResourceId, " +
-//                "a.org_name as appOrgName, a.apply_status as appStatus, a.manager_org_name as appManagerOrgName, a.apply_name as appName, a.deleted as app_deleted, " +
-//                "f.app_org_code as appOrgCode, f.applicant_name as applicantName, " +
-//                "s.service_status as serviceStatus, s.service_name as serviceName, s.manager_unit as serviceManagerOrgName, s.manager_unit_code as serviceManagerOrgCode, s.deleted as service_deleted " +
-//                "FROM T_SERVICE_AUTH_RESULT t " +
-//                "INNER JOIN T_SERVICE_RESOURCE s ON t.service_id = s.id " +
-//                "INNER JOIN T_APPLY_INFO a ON t.app_id = a.id " +
-//                "LEFT JOIN T_SERVICE_AUTH_FLOW f ON f.message_id = t.message_id";
-//        return PersistentFactory.getJdbcDao().paging(sql, searchable, ServiceAuthResultPO.class);
-//    }
-
-    /**
-     * 删除结果 根据条件
-     *
-     * @param appCode     应用code
-     * @param serviceCode 服务code
-     */
-    public void delByAppCodeAndServiceId(String appCode, String serviceCode) {
-        String sql = "update t_service_auth_result set deleted='1' where service_code= ? and app_code= ?";
-        PersistentFactory.getJdbcDao().update(sql, new Object[]{serviceCode, appCode});
+    public List<ServiceAuthResult> getByAppIds(List<String> appIds) {
+        if (CollectionUtils.isEmpty(appIds)) {
+            return Collections.emptyList();
+        }
+        String join = String.join("','", appIds);
+        String sql = " SELECT * FROM T_SERVICE_AUTH_RESULT  where deleted='0' and APP_ID IN ('" + join + "')";
+        return PersistentFactory.getJdbcDao().queryForList(sql, ServiceAuthResult.class);
     }
 }

+ 10 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/StaffAssignAuthInfoBPO.java

@@ -17,6 +17,7 @@ import com.dragonsoft.duceap.core.search.filter.Condition;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Repository;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -231,7 +232,7 @@ public class StaffAssignAuthInfoBPO extends BaseBPO<StaffAssignAuthInfo, String>
         return PersistentFactory.getJdbcDao().queryForList(sql, StaffRoleAuthApiPO.class);
     }
 
-    private String getSearchIn(List<String> value) {
+    private String getSearchIn(Collection<String> value) {
         return "('" + String.join("','", value) + "')";
     }
 
@@ -242,4 +243,12 @@ public class StaffAssignAuthInfoBPO extends BaseBPO<StaffAssignAuthInfo, String>
         String sql = "SELECT * FROM T_STAFF_ASSIGN_AUTH_INFO WHERE ID IN " + getSearchIn(authIds);
         return PersistentFactory.getJdbcDao().queryForList(sql, StaffAssignAuthInfo.class);
     }
+
+    public List<StaffAssignAuthInfo> getByStaffIds(Collection<String> staffIds) {
+        if (CollectionUtils.isEmpty(staffIds)) {
+            return Collections.emptyList();
+        }
+        String sql = "SELECT * FROM T_STAFF_ASSIGN_AUTH_INFO WHERE STAFF_ID IN " + getSearchIn(staffIds);
+        return PersistentFactory.getJdbcDao().queryForList(sql, StaffAssignAuthInfo.class);
+    }
 }

+ 0 - 65
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/bpo/StaffAssignAuthLogBPO.java

@@ -1,65 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.bpo;
-
-import com.dragoninfo.dcuc.common.SystemConstant;
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthLog;
-import com.dragoninfo.duceap.core.persistent.BaseBPO;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.core.persistent.dialect.DatabaseType;
-import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Repository;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-@Repository
-public class StaffAssignAuthLogBPO extends BaseBPO<StaffAssignAuthLog, String> {
-
-    public Page<RoleInfo> roleListByUserIdAndAppId(String userId, String appId, Searchable searchable) {
-        String append="";
-        //当应用appid等于空的时候
-        if (StringUtils.isNotEmpty(appId)){
-             append="and t.app_id = '"+appId+"' ";
-        }
-        String sql = "select * from t_role_info where id in (select distinct role_id from t_Staff_Assign_Auth_Log t " +
-                "where t.staff_id=? "+append+")";
-        return PersistentFactory.getJdbcDao().paging(sql, searchable, RoleInfo.class,  userId);
-    }
-
-    public Page<Map<String, String>> operateList(Searchable searchable, String createUser) {
-        List<String> params = new ArrayList<String>();
-        StringBuilder sql = new StringBuilder("select t.id,t.app_id as appId,t.role_id as roleId," +
-                "t.staff_id as userId,t.status,t.change_content as content, t.create_time as createTime " +
-                "from t_staff_assign_auth_log t where t.manager_id = ?");
-        params.add(createUser);
-
-        DatabaseType defaultDatabaseType = SystemConstant.getDefaultDatabaseType();
-        StringBuilder conditionSql = new StringBuilder();
-        if (searchable.getSearchFilterByKey("operateTimeKS_eq") != null) {
-            String timeStart = searchable.getSearchFilterByKey("operateTimeKS_eq").getValue().toString() + "000000";
-            searchable.removeSearchFilter("operateTimeKS_eq");
-            if (DatabaseType.ORACLE.equals(defaultDatabaseType)) {
-                conditionSql.append(" and CREATE_TIME >= to_date(?,'yyyy/mm/dd hh24:mi:ss') ");
-            } else if (DatabaseType.MYSQL.equals(defaultDatabaseType)) {
-                conditionSql.append(" and CREATE_TIME >= str_to_date(?,'%Y%m%d%H%i%s') ");
-            }
-            params.add(timeStart);
-        }
-        if (searchable.getSearchFilterByKey("operateTimeJS_eq") != null) {
-            String timeEnd = searchable.getSearchFilterByKey("operateTimeJS_eq").getValue().toString() + "235959";
-            searchable.removeSearchFilter("operateTimeJS_eq");
-            if (DatabaseType.ORACLE.equals(defaultDatabaseType)) {
-                conditionSql.append(" and CREATE_TIME <= to_date(?,'yyyy/mm/dd hh24:mi:ss') ");
-            } else if (DatabaseType.MYSQL.equals(defaultDatabaseType)) {
-                conditionSql.append(" and CREATE_TIME <= str_to_date(?,'%Y%m%d%H%i%s') ");
-            }
-            params.add(timeEnd);
-        }
-        sql.append(conditionSql).append(" order by t.create_time desc");
-        return PersistentFactory.getJdbcDao().paging(sql.toString(), searchable, params.toArray());
-    }
-}

+ 1 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustAppAuthBusiness.java

@@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.dragoninfo.dcuc.auth.api.enums.securitypolicy.AuthTypeEnum;
 import com.dragoninfo.dcuc.auth.api.enums.zerotrust.ZeroTrustBusinessRespEnum;
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.AppAuthReqVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.AppAuthReqVO;
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustDataRespVO;
 import com.dragoninfo.dcuc.auth.async.BusiEventPublisher;
 import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;

+ 4 - 4
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustDataAuthBusiness.java

@@ -2,8 +2,8 @@ package com.dragoninfo.dcuc.auth.auth.business.impl.zerotrust;
 
 import cn.hutool.core.util.StrUtil;
 import com.dragoninfo.dcuc.auth.api.enums.zerotrust.ZeroTrustBusinessRespEnum;
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.DataAuthReqVO;
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.DataAuthRespVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.DataAuthReqVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.DataAuthRespVO;
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustDataRespVO;
 import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
 import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
@@ -16,7 +16,7 @@ import com.dragoninfo.dcuc.auth.business.zerotrust.IApiCommonBusiness;
 import com.dragoninfo.dcuc.auth.business.zerotrust.IAuthTokenBusiness;
 import com.dragoninfo.dcuc.auth.sub.vo.ApplyInfoVo;
 import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
-import com.dragoninfo.dcuc.auth.token.vo.TokenDetailRespVo;
+import com.dragoninfo.dcuc.auth.token.vo.AppTokenDetailRespVo;
 import com.dragoninfo.dcuc.common.utils.ResponseUtil;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
@@ -71,7 +71,7 @@ public class ZeroTrustDataAuthBusiness implements IZeroTrustDataAuthBusiness {
     @Override
     public ZeroTrustDataRespVO<DataAuthRespVO> dataAuth(DataAuthReqVO dataAuthReqVO) {
         String appTokenId = dataAuthReqVO.getAppTokenId();
-        TokenDetailRespVo tokenInfo = authTokenBusiness.getByAppTokenId(appTokenId, true, true);
+        AppTokenDetailRespVo tokenInfo = authTokenBusiness.getByAppTokenId(appTokenId, true, true);
         if (null == tokenInfo) {
             log.error("查询不到应用令牌信息:{}", appTokenId);
             return ZeroTrustDataRespVO.resultEnumMessage(ZeroTrustBusinessRespEnum.TOKEN_FAIL);

+ 3 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustFunAuthBusiness.java

@@ -2,7 +2,7 @@ package com.dragoninfo.dcuc.auth.auth.business.impl.zerotrust;
 
 import cn.hutool.core.util.StrUtil;
 import com.dragoninfo.dcuc.auth.api.enums.zerotrust.ZeroTrustBusinessRespEnum;
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.FunctionAuthReqVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.FunctionAuthReqVO;
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustDataRespVO;
 import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
 import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
@@ -14,7 +14,7 @@ import com.dragoninfo.dcuc.auth.business.zerotrust.IApiCommonBusiness;
 import com.dragoninfo.dcuc.auth.business.zerotrust.IAuthTokenBusiness;
 import com.dragoninfo.dcuc.auth.sub.vo.ApplyInfoVo;
 import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
-import com.dragoninfo.dcuc.auth.token.vo.TokenDetailRespVo;
+import com.dragoninfo.dcuc.auth.token.vo.AppTokenDetailRespVo;
 import com.dragoninfo.dcuc.common.utils.ResponseUtil;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
@@ -69,7 +69,7 @@ public class ZeroTrustFunAuthBusiness implements IZeroTrustFunAuthBusiness {
     @Override
     public ZeroTrustDataRespVO<String> functionAuth(FunctionAuthReqVO functionAuthReqVO) {
         String appTokenId = functionAuthReqVO.getAppTokenId();
-        TokenDetailRespVo tokenInfo = authTokenBusiness.getByAppTokenId(appTokenId, true, true);
+        AppTokenDetailRespVo tokenInfo = authTokenBusiness.getByAppTokenId(appTokenId, true, true);
         if (null == tokenInfo) {
             log.error("查询不到应用令牌信息:{}", appTokenId);
             return ZeroTrustDataRespVO.resultEnumMessage(ZeroTrustBusinessRespEnum.TOKEN_FAIL);

+ 3 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/zerotrust/ZeroTrustServiceAuthBusiness.java

@@ -2,7 +2,7 @@ package com.dragoninfo.dcuc.auth.auth.business.impl.zerotrust;
 
 import cn.hutool.core.util.StrUtil;
 import com.dragoninfo.dcuc.auth.api.enums.zerotrust.ZeroTrustBusinessRespEnum;
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ServiceAuthReqVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.ServiceAuthReqVO;
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustDataRespVO;
 import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
 import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
@@ -13,7 +13,7 @@ import com.dragoninfo.dcuc.auth.business.zerotrust.IApiCommonBusiness;
 import com.dragoninfo.dcuc.auth.business.zerotrust.IAuthTokenBusiness;
 import com.dragoninfo.dcuc.auth.sub.vo.ApplyInfoVo;
 import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
-import com.dragoninfo.dcuc.auth.token.vo.TokenDetailRespVo;
+import com.dragoninfo.dcuc.auth.token.vo.AppTokenDetailRespVo;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
 import com.dragonsoft.duceap.commons.util.ObjectUtils;
 import com.dragonsoft.duceap.commons.util.ip.IpUtils;
@@ -66,7 +66,7 @@ public class ZeroTrustServiceAuthBusiness implements IZeroTrustServiceAuthBusine
     @Override
     public ZeroTrustDataRespVO<String> serviceAuth(ServiceAuthReqVO serviceAuthReqVO) {
         String appTokenId = serviceAuthReqVO.getAppTokenId();
-        TokenDetailRespVo tokenInfo = authTokenBusiness.getByAppTokenId(appTokenId, true, true);
+        AppTokenDetailRespVo tokenInfo = authTokenBusiness.getByAppTokenId(appTokenId, true, true);
         if (null == tokenInfo) {
             log.error("查询不到应用令牌信息:{}", appTokenId);
             return ZeroTrustDataRespVO.resultEnumMessage(ZeroTrustBusinessRespEnum.TOKEN_FAIL);

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustAppAuthBusiness.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.business.zerotrust;
 
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.*;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.AppAuthReqVO;
 
 /**
  * @author mazq

+ 2 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustDataAuthBusiness.java

@@ -1,6 +1,8 @@
 package com.dragoninfo.dcuc.auth.auth.business.zerotrust;
 
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.*;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.DataAuthReqVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.DataAuthRespVO;
 
 /**
  * @author mazq

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustFunAuthBusiness.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.business.zerotrust;
 
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.*;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.FunctionAuthReqVO;
 
 /**
  * @author mazq

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/zerotrust/IZeroTrustServiceAuthBusiness.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.business.zerotrust;
 
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.*;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.ServiceAuthReqVO;
 
 /**
  * @author mazq

+ 0 - 30
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/AppFunEventFacade.java

@@ -1,30 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import com.dragoninfo.dcuc.auth.power.facade.IAppFunEventFacade;
-import com.dragoninfo.dcuc.auth.power.facade.IFunEventFacade;
-import com.dragoninfo.dcuc.auth.util.DcucConstantsUtil;
-import com.dragonsoft.duceap.base.exception.ApplicationException;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.*;
-
-/**·
- * Created by huanghy on 2018/7/9.
- */
-@RestController
-@RequestMapping(value = "/dcuc/auth/appFunEventFacade")
-public class AppFunEventFacade implements IAppFunEventFacade {
-
-    @Autowired
-    private IFunEventFacade funEventFacade;
-
-    public List<EventInfoVO> getEventByFunId(String funId) {
-        if (StringUtils.isEmpty(funId))
-            throw new ApplicationException(DcucConstantsUtil.loadRequired(DcucConstantsUtil.FUN_ID));
-        return funEventFacade.getEventByTreeId(funId);
-    }
-}

+ 0 - 64
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/ApprovalFacade.java

@@ -1,64 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustMessageRespVO;
-import com.dragoninfo.dcuc.auth.auth.dto.ApprovalDto;
-import com.dragoninfo.dcuc.auth.auth.service.IApprovalService;
-import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
-import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.approval.ApprovalCallBackReqVO;
-import com.dragoninfo.dcuc.auth.business.zerotrust.IApprovalBusiness;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Created by liws on 2019/3/4.
- */
-@RestController
-@RequestMapping(value = "/dcuc/auth/approvalFacade")
-public class ApprovalFacade implements IApprovalFacade {
-
-    @Autowired
-    private IApprovalService iApprovalService;
-
-    @Autowired
-    private IApprovalBusiness iApprovalBusiness;
-
-    @Override
-    public ResponseDTO authApply(String appCode, String roleCode, String userIdCard, String approvalIdCard, String reason) {
-        return iApprovalService.authApply(appCode, roleCode, userIdCard, approvalIdCard, reason);
-    }
-
-    @Override
-    public Page<FuncApproval> approvalPage(SearchDTO searchDTO) {
-        return iApprovalService.approvalPage(searchDTO);
-    }
-
-    @Override
-    public ResponseStatus agree(ApprovalDto approvalDto) {
-        return iApprovalService.agree( approvalDto);
-    }
-
-    @Override
-    public ResponseStatus disagree(ApprovalDto approvalDto) {
-        return iApprovalService.disagree( approvalDto);
-    }
-
-    @Override
-    public FuncApproval detail(String id) {
-        return iApprovalService.detail(id);
-    }
-
-    @Override
-    public ResponseDTO applyResult(ApprovalDto approvalDto) {
-        return iApprovalService.applyResult(approvalDto);
-    }
-
-    @Override
-    public ZeroTrustMessageRespVO callBack(ApprovalCallBackReqVO approvalCallBackReqVO) {
-      return  iApprovalBusiness.approvalCallBack(approvalCallBackReqVO);
-    }
-}

+ 0 - 41
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/FunEventFacade.java

@@ -1,41 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import com.dragoninfo.dcuc.auth.power.facade.IFunEventFacade;
-import com.dragoninfo.dcuc.auth.auth.entity.FunEvent;
-import com.dragoninfo.dcuc.auth.auth.service.IFunEventService;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * Created by liws on 2018/6/20.
- */
-@RestController
-@RequestMapping(value = "/dcuc/auth/funEventFacade")
-public class FunEventFacade implements IFunEventFacade {
-    @Autowired
-    private IFunEventService iFunEventService;
-
-    public List<FunEvent> getMenuData(String pkMenuId, SearchDTO searchDTO) {
-        return iFunEventService.getMenuData(pkMenuId, Searchable.toSearchable(searchDTO));
-    }
-
-    public ResponseDTO updateFilter(List<FunEvent> funEventList, String id) {
-        return iFunEventService.updateFilter(funEventList, id);
-    }
-
-    public List<EventInfoVO> getEventByTreeId(String id) {
-        return iFunEventService.getEventByTreeId(id);
-    }
-
-    public List<EventInfoVO> getEventByFunIds(String funIds){
-        return iFunEventService.getEventByFunIds(funIds);
-    }
-}

+ 0 - 57
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/FuncSyncRuleConfigFacade.java

@@ -1,57 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FuncSyncRuleConfig;
-import com.dragoninfo.dcuc.auth.auth.vo.MenuInfoVO;
-import com.dragoninfo.dcuc.auth.power.facade.IFuncSyncRuleConfigFacade;
-import com.dragoninfo.dcuc.auth.auth.service.IFuncSyncRuleConfigService;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * Created by liws on 2018/6/21.
- */
-@RestController
-@RequestMapping(value = "/dcuc/auth/funcSyncRuleConfigFacade")
-public class FuncSyncRuleConfigFacade implements IFuncSyncRuleConfigFacade {
-
-    @Autowired
-    private IFuncSyncRuleConfigService iFuncSyncRuleConfigService;
-
-    public Page<FuncSyncRuleConfig> getMenuRulesList(String applicationId, SearchDTO searchDTO) {
-        return iFuncSyncRuleConfigService.getMenuRulesList(applicationId, Searchable.toSearchable(searchDTO));
-    }
-
-    public ResponseStatus del(String rulesId) {
-        return iFuncSyncRuleConfigService.del(rulesId);
-    }
-
-    public ResponseStatus menuSyn(String menuSynId, String appId) {
-        return iFuncSyncRuleConfigService.menuSyn(menuSynId, appId);
-    }
-
-    public ResponseStatus menuSynHn(String menuSynId,String appId) {
-        return iFuncSyncRuleConfigService.menuSynHn(menuSynId,appId);
-    }
-
-    public boolean isExist(String name, String appId) {
-        return iFuncSyncRuleConfigService.isExist(name, appId);
-    }
-
-    public ResponseDTO saveOrUpdate(FuncSyncRuleConfig ruleConfig) {
-        iFuncSyncRuleConfigService.saveOrUpdate(ruleConfig);
-        return ResponseDTO.success("保存成功", ruleConfig);
-    }
-
-    public List<MenuInfoVO> getMenuRuleList(String appId) {
-        return iFuncSyncRuleConfigService.getMenuRuleList(appId);
-    }
-
-}

+ 6 - 5
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/RoleAuthInfoFacade.java

@@ -128,12 +128,13 @@ public class RoleAuthInfoFacade implements IRoleAuthInfoFacade {
                 .collect(Collectors.toList());
 
         List<ApplyInfo> applyInfos = applyInfoFacade.getAppById(appIds);
-        Map<String, String> appInfoMap = applyInfos.stream()
-                .collect(Collectors.toMap(ApplyInfo::getId, ApplyInfo::getApplyName));
-        applyRoles.forEach(e-> {
+        Map<String, ApplyInfo> appInfoMap = applyInfos.stream()
+                .collect(Collectors.toMap(ApplyInfo::getId, e -> e));
+        applyRoles.forEach(e -> {
             String appId = e.getAppId();
-            String appName = appInfoMap.get(appId);
-            e.setAppName(appName);
+            ApplyInfo applyInfo = appInfoMap.get(appId);
+            e.setAppName(applyInfo.getApplyName());
+            e.setAppCode(applyInfo.getApplyCode());
         });
 
         return applyRoles;

+ 0 - 10
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/RoleInfoFacade.java

@@ -130,11 +130,6 @@ public class RoleInfoFacade implements IRoleInfoFacade {
         return iRoleInfoService.roleQuotaSave(roleQuotaList);
     }
 
-    @Override
-    public List<RoleInfo> getRolesByAppIds(String appIds) {
-        return iRoleInfoService.getRolesByAppIds(appIds);
-    }
-
     @Override
     public Page<RoleInfoVO> getOrgRoleQuota(RoleAuthParamVo vo) {
 
@@ -173,11 +168,6 @@ public class RoleInfoFacade implements IRoleInfoFacade {
         return iRoleInfoService.staffRoleList(userId, appName, orgId,searchable.toSearchDTO());
     }
 
-    @Override
-    public RoleInfo getRoleInfoByCode(String roleCode) {
-        return iRoleInfoService.getRoleInfoByCode(roleCode);
-    }
-
     @Override
     public Page<RoleInfoVO> roleAuthRoleViewPage(SearchDTO searchDTO) {
         return iRoleInfoService.roleAuthRoleViewPage(searchDTO);

+ 0 - 5
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/StaffAssignAuthInfoFacade.java

@@ -35,11 +35,6 @@ public class StaffAssignAuthInfoFacade implements IStaffAssignAuthInfoFacade {
         return staffAssignAuthInfoService.saveStaffRoleAuth(dto);
     }
 
-    @Override
-    public ResponseStatus deleteAllStaffRole(String staffId) {
-        return staffAssignAuthInfoService.deleteAllStaffRole(staffId);
-    }
-
     @Override
     public Page<StaffAssignAuthInfo> findForPage(SearchDTO searchDTO) {
         return staffAssignAuthInfoService.findForPage(searchDTO);

+ 0 - 49
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/StaffAssignAuthInfoLogFacade.java

@@ -1,49 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.facade;
-
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthLog;
-import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthLogService;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-import com.dragonsoft.duceap.core.search.filter.Condition;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by Administrator on 2018/11/13.
- */
-@RestController
-@RequestMapping(value = "/dcuc/auth/staffAssignAuthInfoLogFacade")
-public class StaffAssignAuthInfoLogFacade implements IStaffAssignAuthInfoLogFacade {
-
-    @Autowired
-    private IStaffAssignAuthLogService staffAssignAuthLogService;
-
-    @Override
-    public Page<RoleInfo> roleListByUserIdAndAppId(SearchDTO searchDTO) {
-        Searchable searchable = Searchable.toSearchable(searchDTO);
-        String userId = searchable.getSearchFilterByKey("userId_eq").getValue().toString();
-        Condition appId_eq = searchable.getSearchFilterByKey("appId_eq");
-        String appId = appId_eq == null?null:appId_eq.getValue().toString();
-        return staffAssignAuthLogService.roleListByUserIdAndAppId(userId, appId, searchable);
-    }
-
-    @Override
-    public List<StaffAssignAuthLog> staffAssignAuthLogList(String userId, String roleId) {
-        return staffAssignAuthLogService.staffAssignAuthLogList(userId, roleId);
-    }
-
-    @Override
-    public Page<Map<String, String>> operateList(SearchDTO searchDTO) {
-        Searchable searchable = Searchable.toSearchable(searchDTO);
-        String createUser = searchable.getSearchFilterByKey("createUser_eq").getValue().toString();
-        searchable.removeSearchFilter("createUser_eq");
-        return staffAssignAuthLogService.operateList(searchDTO,createUser);
-    }
-
-}

+ 53 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/api/ZeroTrustAuthApplyFacade.java

@@ -0,0 +1,53 @@
+package com.dragoninfo.dcuc.auth.auth.facade.api;
+
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustDataRespVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustMessageRespVO;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply.ApiRoleAuthReqVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply.ApiServiceAuthReqVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authapply.AuthApplyRespVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.role.ApiAppRoleRespVo;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.role.ApiRolesReqVo;
+import com.dragoninfo.dcuc.auth.auth.api.IZeroTrustAuthApplyFacade;
+import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.approval.ApprovalCallBackReqVO;
+import com.dragoninfo.dcuc.auth.business.zerotrust.IZeroTrustApprovalBusiness;
+import com.dragoninfo.dcuc.auth.business.zerotrust.IZeroTrustAuthApplyBusiness;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/11/23
+ */
+@RestController
+@RequestMapping("/dcuc/auth/zeroTrustAuthApplyFacade")
+public class ZeroTrustAuthApplyFacade implements IZeroTrustAuthApplyFacade {
+
+    @Autowired
+    private IZeroTrustAuthApplyBusiness zeroTrustAuthApplyBusiness;
+
+    @Autowired
+    private IZeroTrustApprovalBusiness zeroTrustApprovalBusiness;
+
+    @Override
+    public ZeroTrustDataRespVO<List<ApiAppRoleRespVo>> appRoleInfos(ApiRolesReqVo reqVo) {
+        return zeroTrustAuthApplyBusiness.appRoleInfos(reqVo);
+    }
+
+    @Override
+    public ZeroTrustDataRespVO<AuthApplyRespVo> roleAuthApply(ApiRoleAuthReqVo reqVo) {
+        return zeroTrustAuthApplyBusiness.roleAuthApply(reqVo);
+    }
+
+    @Override
+    public ZeroTrustDataRespVO<AuthApplyRespVo> serviceAuthApply(ApiServiceAuthReqVo reqVo) {
+        return zeroTrustAuthApplyBusiness.serviceAuthApply(reqVo);
+    }
+
+    @Override
+    public ZeroTrustMessageRespVO callBack(ApprovalCallBackReqVO approvalCallBackReqVO) {
+        return zeroTrustApprovalBusiness.approvalCallBack(approvalCallBackReqVO);
+    }
+}

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/api/ZeroTrustAuthFacade.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.auth.auth.facade.api;
 
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.*;
+import com.dragoninfo.dcuc.auth.api.vo.zerotrust.authticate.*;
 import com.dragoninfo.dcuc.auth.auth.api.IZeroTrustAuthFacade;
 import com.dragoninfo.dcuc.auth.auth.business.zerotrust.IZeroTrustAppAuthBusiness;
 import com.dragoninfo.dcuc.auth.auth.business.zerotrust.IZeroTrustDataAuthBusiness;

+ 6 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/zerotrust/RoleAuthApplyRepository.java

@@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * @author mazq
  * @date 2023/7/13
@@ -22,4 +24,8 @@ public interface RoleAuthApplyRepository extends BaseRepository<RoleAuthApply, S
     @Modifying
     @Query(value = "UPDATE T_AUTH_ROLE_AUTH_APPLY SET APPROVAL_RESULT = :approvalResult WHERE PROCESS_INST_ID = :processInstId AND DELETED = '0'", nativeQuery = true)
     void updateApprovalResult(@Param("processInstId") String processInstId, @Param("approvalResult") String approvalResult);
+
+    @Modifying
+    @Query(value = "UPDATE T_AUTH_ROLE_AUTH_APPLY SET TO_BE_AUTHED = :value WHERE ID IN :ids AND DELETED = '0'", nativeQuery = true)
+    void setToBeAuthed(@Param("ids") List<String> ids, @Param("value") String value);
 }

+ 32 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/zerotrust/ServiceAuthApplyRepository.java

@@ -0,0 +1,32 @@
+package com.dragoninfo.dcuc.auth.auth.repo.zerotrust;
+
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.ServiceAuthApply;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/7/13
+ */
+@Repository
+public interface ServiceAuthApplyRepository extends BaseRepository<ServiceAuthApply, String> {
+
+    /**
+     * 更新审批结果
+     * @param processInstId
+     * @param approvalResult
+     */
+    @Modifying
+    @Query(value = "UPDATE T_AUTH_SERVICE_AUTH_APPLY SET APPROVAL_RESULT = :approvalResult WHERE PROCESS_INST_ID = :processInstId AND DELETED = '0'", nativeQuery = true)
+    void updateApprovalResult(@Param("processInstId") String processInstId, @Param("approvalResult") String approvalResult);
+
+    @Modifying
+    @Query(value = "UPDATE T_AUTH_SERVICE_AUTH_APPLY SET TO_BE_AUTHED = :value WHERE ID IN :ids AND DELETED = '0'", nativeQuery = true)
+    void setToBeAuthed(@Param("ids") List<String> ids, @Param("value") String value);
+}

+ 0 - 56
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IApprovalService.java

@@ -1,56 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.service;
-
-import com.dragoninfo.dcuc.auth.auth.dto.ApprovalDto;
-import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
-
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import org.springframework.data.domain.Page;
-
-/**
- * Created by liws on 2019/3/4.
- */
-public interface IApprovalService {
-    /**
-     * 新建申请
-     * @param roleCode
-     * @param userIdCard
-     * @param approvalIdCard
-     * @param reason
-     * @return
-     */
-    ResponseDTO authApply( String appCode,  String roleCode,
-                          String userIdCard,
-                          String approvalIdCard,  String reason);
-
-    /**
-     * 申请列表
-     * @param searchDTO
-     * @return
-     */
-    Page<FuncApproval> approvalPage(SearchDTO searchDTO);
-
-    /**
-     * 同意申请
-     * @param approvalDto
-     * @return
-     */
-    ResponseStatus agree(ApprovalDto approvalDto);
-
-    /**
-     * 申请不通过
-     * @param approvalDto
-     * @return
-     */
-    ResponseStatus disagree(ApprovalDto approvalDto);
-
-    /**
-     * 申请详情
-     * @param id
-     * @return
-     */
-    FuncApproval detail(String id);
-
-    ResponseDTO applyResult(ApprovalDto approvalDto);
-}

+ 0 - 20
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IFunEventService.java

@@ -1,20 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.service;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FunEvent;
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import com.dragoninfo.duceap.core.service.IOldBaseService;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-
-import java.util.List;
-
-public interface IFunEventService extends IOldBaseService<FunEvent, String> {
-
-    List<FunEvent> getMenuData( String pkMenuId, Searchable searchable);
-
-    ResponseDTO updateFilter(List<FunEvent> funEventList, String id);
-
-    List<EventInfoVO> getEventByTreeId(String treeId);
-
-    List<EventInfoVO> getEventByFunIds(String funIds);
-}

+ 0 - 54
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IFuncSyncRuleConfigService.java

@@ -1,54 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.service;
-
-import com.dragoninfo.dcuc.auth.auth.entity.FuncSyncRuleConfig;
-import com.dragoninfo.dcuc.auth.auth.vo.MenuInfoVO;
-import com.dragoninfo.duceap.core.service.IOldBaseService;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.data.domain.Page;
-
-import java.util.List;
-
-public interface IFuncSyncRuleConfigService extends IOldBaseService<FuncSyncRuleConfig, String> {
-
-    /**
-     * 根据应用id获取应用菜单规则同步配置列表
-     *
-     * @param applicationId
-     * @return
-     */
-    Page<FuncSyncRuleConfig> getMenuRulesList( String applicationId, Searchable searchable);
-
-    /**
-     * 菜单规则信息删除
-     *
-     * @param rulesId
-     */
-    ResponseStatus del( String rulesId);
-
-    /**
-     * 资源同步功能
-     *
-     * @param menuSynId
-     */
-    ResponseStatus menuSyn( String menuSynId,  String appId);
-
-    ResponseStatus menuSynHn(String menuSynId, String appId);
-
-    /**
-     * 判断同步规则名称是否存在
-     *
-     * @param name
-     */
-    boolean isExist( String name,  String appId);
-
-    /**
-     * 根据应用id获取菜单同步规则列表
-     *
-     * @param appId
-     * @return
-     */
-    
-    List<MenuInfoVO> getMenuRuleList(String appId);
-}

+ 8 - 12
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IRoleInfoService.java

@@ -43,17 +43,6 @@ public interface IRoleInfoService {
      */
     ResponseDTO roleQuotaSave(String roleQuotaList) throws Exception;
 
-    /**
-     * 获取机构角色配额授权情况列表
-     *
-     * @param applicationId:应用id
-     * @param orgId:机构id         注:后续直接从缓存取??????
-     * @param searchable
-     * @return
-     */
-    Page<RoleInfoVO> getOrgRoleQuotaList(String applicationId,
-                                         String orgId, Searchable searchable);
-
 
     ResponseDTO roleQuotaUpdate(String roleId, Long initNum);
 
@@ -63,7 +52,7 @@ public interface IRoleInfoService {
      * @param appIds
      * @return
      */
-    List<RoleInfo> getRolesByAppIds(String appIds);
+    List<RoleInfo> getRolesByAppIds(Collection<String> appIds);
 
     /**
      * 根据角色ids获取角色列表
@@ -203,4 +192,11 @@ public interface IRoleInfoService {
      * @return
      */
     List<RoleInfo> getRolesByAppId(String appId);
+
+    /**
+     * 根据code获取角色信息
+     * @param roleCodes
+     * @return
+     */
+    List<RoleInfo> getByCodes(List<String> roleCodes);
 }

+ 12 - 26
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IServiceAuthResultService.java

@@ -5,6 +5,7 @@ import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
 import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.ServiceAuthApply;
 import com.dragoninfo.dcuc.auth.auth.vo.ServiceAuthenticationResVO;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.core.search.Searchable;
@@ -28,15 +29,6 @@ public interface IServiceAuthResultService {
      */
     ServiceAuthResult saveAuthResult(ServiceAuthResult serviceAuthResult);
 
-    /**
-     * 根据appCode和serviceCode查询授权结果
-     *
-     * @param appCode     应用编码
-     * @param serviceCode 服务编码
-     * @return
-     */
-    ServiceAuthResult getByAppServiceCode(String appCode, String serviceCode);
-
     /**
      * 根据appCode查询授权结果
      *
@@ -50,15 +42,6 @@ public interface IServiceAuthResultService {
      */
     List<ServiceAuthResult> find(Searchable searchable);
 
-
-//    /**
-//     * 服务授权工作单审批结果处理
-//     *
-//     * @param
-//     * @param
-//     */
-//    void dealAuthFlowResult(ServiceAuthFlow flow);
-
     /**
      * 服务授权工作单审批结果处理
      * @param
@@ -107,14 +90,6 @@ public interface IServiceAuthResultService {
 
     ServiceAuthResultDTO getDetail(String id);
 
-    /**
-     * 根据appCode查询 服务结果和服务表关联表
-     *
-     * @param appCode
-     * @return
-     */
-    List<ServiceAuthResult> serviceAuthResultList(String appCode);
-
     /**
      * 发送服务的消息
      *
@@ -148,4 +123,15 @@ public interface IServiceAuthResultService {
      * @return
      */
     List<ServiceAuthResult> findAll();
+
+    /**
+     * 删除过期的权限
+     */
+    void deleteExpireAuth();
+
+    /**
+     * 审批通过后开始服务授权
+     * @param authApplies
+     */
+    void startServiceAuthApply(List<ServiceAuthApply> authApplies);
 }

+ 8 - 21
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IStaffAssignAuthInfoService.java

@@ -5,13 +5,13 @@ import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.StaffAssignDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.StaffRoleOperateDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.RoleAuthApply;
 import com.dragoninfo.dcuc.auth.auth.vo.ApiAppAuthVo;
 import com.dragoninfo.dcuc.auth.auth.vo.StaffRoleAuthApiVo;
 import com.dragoninfo.dcuc.auth.auth.vo.StaffRoleAuthApiV2Vo;
 import com.dragoninfo.dcuc.auth.auth.vo.StaffRoleAuthReqVo;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import org.springframework.data.domain.Page;
 
 import java.util.List;
@@ -25,11 +25,7 @@ public interface IStaffAssignAuthInfoService  {
 
     ResponseStatus saveStaffRoleAuth(StaffRoleOperateDTO dto);
 
-    ResponseStatus deleteAllStaffRole(String staffId);
-
-    void authMonitor(SecurityUser user);
-
-    ResponseStatus changeStaffOrg(String oldOrgId, String newOrgId);
+    void deleteExpireAuth();
 
     /**
      * 查询列表
@@ -50,21 +46,6 @@ public interface IStaffAssignAuthInfoService  {
     ResponseStatus saveStaff(StaffAssignDTO dto);
 
 
-    /**
-     * 保存
-     *
-     * @param roleId     角色id
-     * @param orgId      被操作人机构id
-     * @param appId      应用id
-     * @param userId     审批人用户id
-     * @param userOrg    审批人机构
-     * @param activeTime 赋予被操作人时间
-     * @param staffId    被操作人id
-     */
-    void saveStaffAssign(String roleId, String orgId, String appId,
-                         String userId, String userOrg, String activeTime, String staffId);
-
-
     /**
      * 根据人员ID获取授权信息
      *
@@ -170,4 +151,10 @@ public interface IStaffAssignAuthInfoService  {
      * @return
      */
     ResponseStatus apiStaffRoleAuth(StaffRoleAuthReqVo reqVo);
+
+    /**
+     * 审批通过后开始角色授权
+     * @param authApplies
+     */
+    void startRoleAuthApply(List<RoleAuthApply> authApplies);
 }

+ 0 - 36
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IStaffAssignAuthLogService.java

@@ -1,36 +0,0 @@
-
-package com.dragoninfo.dcuc.auth.auth.service;
-
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthLog;
-import com.dragoninfo.duceap.core.service.IOldBaseService;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.data.domain.Page;
-
-import java.util.List;
-import java.util.Map;
-
-public interface IStaffAssignAuthLogService extends IOldBaseService<StaffAssignAuthLog,String> {
-
-    /**
-     * 获取用户曾经和现在拥有的权限
-     * @param userId
-     * @param appId
-     * @param searchable
-     * @return
-     */
-    Page<RoleInfo> roleListByUserIdAndAppId(String userId, String appId,
-                                            Searchable searchable);
-
-    /**
-     * 获取用户的权限变更日志
-     * @param userId
-     * @param roleId
-     * @return
-     */
-    List<StaffAssignAuthLog> staffAssignAuthLogList( String userId,
-                                                     String roleId);
-
-    Page<Map<String,String>> operateList(SearchDTO searchDTO, String createUser);
-}

+ 1 - 20
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AppFunAuthResultServiceImpl.java

@@ -3,8 +3,6 @@ package com.dragoninfo.dcuc.auth.auth.service.impl;
 import com.dragoninfo.dcuc.auth.auth.entity.AppFunApplyContent;
 import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
 import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
-import com.dragoninfo.dcuc.auth.auth.enumresources.AuthStatusEnum;
-import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
 import com.dragoninfo.dcuc.auth.auth.repo.AppFunAuthResultRepository;
 import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthResultService;
@@ -81,22 +79,7 @@ public class AppFunAuthResultServiceImpl implements IAppFunAuthResultService {
             }
             String userId = applyInfo.getUserId();
             String appId = applyInfo.getAppId();
-            Date startTime = null;
-            Date endTime = null;
-            Date date = new Date();
-            String authStatus = AuthStatusEnum.START.getValue();
-            String permissionValidType = flow.getPermissionValidType();
-            if (StringUtils.isNotBlank(permissionValidType)
-                    && WorkFlowPermissionTypeEnum.TEMP.getValue().equals(permissionValidType)) {
-                startTime = flow.getStartTime();
-                endTime = flow.getEndTime();
-                if (date.before(startTime)) {
-                    authStatus = AuthStatusEnum.NOT_START.getValue();
-                }
-                if (date.after(endTime)) {
-                    authStatus = AuthStatusEnum.OVER_DUE.getValue();
-                }
-            }
+            Date endTime = flow.getEndTime();
             String funId = applyInfo.getFunId();
             String funCode = applyInfo.getFunCode();
             AppFunAuthResult authResult = new AppFunAuthResult();
@@ -107,8 +90,6 @@ public class AppFunAuthResultServiceImpl implements IAppFunAuthResultService {
             authResult.setUserId(userId);
             authResult.setFunId(funId);
             authResult.setFunCode(funCode);
-            authResult.setAuthStatus(authStatus);
-            authResult.setStartTime(startTime);
             authResult.setEndTime(endTime);
             authResult.setDeleted(BooleanEnum.FALSE.value);
             addResult.add(authResult);

+ 0 - 257
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ApprovalService.java

@@ -1,257 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.service.impl;
-
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.async.ApprovalEventCenterBus;
-import com.dragoninfo.dcuc.auth.auth.bpo.AppFunInfoBPO;
-import com.dragoninfo.dcuc.auth.auth.bpo.ApprovalBPO;
-import com.dragoninfo.dcuc.auth.auth.bpo.RoleInfoBPO;
-import com.dragoninfo.dcuc.auth.auth.dto.ApprovalDto;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.FuncApproval;
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.enumresources.ApprovalStatusEnum;
-import com.dragoninfo.dcuc.auth.auth.enumresources.MessageTypeEnum;
-import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
-import com.dragoninfo.dcuc.auth.auth.service.IApprovalService;
-import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthInfoService;
-import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
-import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-import com.dragoninfo.duceap.core.service.impl.BaseService;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.base.entity.security.SecurityUser;
-import com.dragonsoft.duceap.base.utils.UserContextUtils;
-import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.core.context.ContextUtils;
-import com.dragonsoft.duceap.core.search.Searchable;
-import com.dragonsoft.duceap.core.search.enums.SearchOperator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Sort;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * Created by liws on 2019/3/4.
- */
-@Service
-@Transactional
-public class ApprovalService extends BaseService<FuncApproval, String> implements IApprovalService {
-    @Autowired
-    private ApprovalBPO approvalBPO;
-    @Autowired
-    private RoleInfoBPO roleBPO;
-    @Autowired
-    private AppFunInfoBPO appFunInfoBPO;
-    @Autowired
-    private ApprovalEventCenterBus approvalEventCenterBus;
-    @Autowired
-    private IStaffAssignAuthInfoService iStaffAssignAuthInfoService;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @Autowired
-    private IAuthUserInfoService authUserInfoService;
-
-    @Override
-    public ResponseDTO authApply(String appCode, String roleCode, String userIdCard, String approvalIdCard, String reason) {
-
-        ApplyInfo applyInfo = applyInfoFacade.getAppByCode(appCode);
-        if (applyInfo == null) {
-            return ResponseDTO.fail("应用代码不存在,请先创建应用及角色!", (Object) null);
-        }
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("code", roleCode);
-        params.put("appId", applyInfo.getId());
-        List<RoleInfo> roleInfos = roleBPO.andsearch(RoleInfo.class, params);
-        if (CollectionUtils.isEmpty(roleInfos)) {
-            return ResponseDTO.fail("角色代码不存在,请先创建角色!", (Object) null);
-        }
-        RoleInfo roleInfo = roleInfos.get(0);
-
-        AuthUserInfo userInfo = authUserInfoService.findByIdcard(userIdCard);
-        if (userInfo == null) {
-            return ResponseDTO.fail("申请人不存在,核对后重新申请!", (Object) null);
-        }
-        AuthUserInfo approvalUser = authUserInfoService.findByIdcard(approvalIdCard);
-
-        if (approvalUser == null) {
-            return ResponseDTO.fail("审批人不存在,核对后重新申请!", (Object) null);
-        }
-        Searchable searchable = Searchable.newSearchable();
-        searchable.addSearchFilter("appId", SearchOperator.eq, applyInfo.getId());
-        searchable.addSearchFilter("roleId", SearchOperator.eq, roleInfo.getId());
-        searchable.addSearchFilter("proposerIdcard", SearchOperator.eq, userIdCard);
-        searchable.addSearchFilter("isActive", SearchOperator.eq, YesNotEnum.YES.getValue());
-        searchable.addSearchFilter("approvalStatus", SearchOperator.ne, ApprovalStatusEnum.NOTPASS.getValue());
-        List<FuncApproval> list = approvalBPO.find(FuncApproval.class, searchable);
-        if (CollectionUtils.isNotEmpty(list)) {
-            FuncApproval approval = list.get(0);
-            if (ApprovalStatusEnum.DOING.getValue().equals(approval.getApprovalStatus())) {
-                return ResponseDTO.fail("申请正在审批中,请勿重复申请!", (Object) null);
-            } else {
-                if (approval.getValidTime() == null || approval.getValidTime().getTime() > System.currentTimeMillis()) {
-                    return ResponseDTO.fail("您已经拥有该权限,无须重新申请!", (Object) null);
-                }
-            }
-        }
-        //把历史申请置为无效
-        searchable.removeSearchFilter("approvalStatus");
-        list = approvalBPO.find(FuncApproval.class, searchable);
-        if (CollectionUtils.isNotEmpty(list)) {
-            for (FuncApproval funcApproval : list) {
-                funcApproval.setIsActive(YesNotEnum.NO.getValue());
-                approvalBPO.update(funcApproval);
-            }
-        }
-        FuncApproval approval = saveFuncApproval(reason, applyInfo, roleInfo, userInfo, approvalUser);
-        return ResponseDTO.success("申请成功,等待审批人审批!", approval);
-    }
-
-    private FuncApproval saveFuncApproval(String reason, ApplyInfo applyInfo, RoleInfo roleInfo, AuthUserInfo userInfo, AuthUserInfo approvalUser) {
-        FuncApproval approval = new FuncApproval();
-        approval.setAppId(roleInfo.getAppId());
-        approval.setAppName(applyInfo.getApplyName());
-        approval.setRoleId(roleInfo.getId());
-        approval.setRoleName(roleInfo.getName());
-        approval.setProposerOrg(userInfo.getOrgId());
-        approval.setProposerId(userInfo.getId());
-        approval.setProposerName(userInfo.getName());
-        approval.setProposerIdcard(userInfo.getIdcard());
-        approval.setProposerTime(new Date());
-        approval.setProposerReason(reason);
-        approval.setApprovalStatus(ApprovalStatusEnum.DOING.getValue());
-        approval.setApprovalId(approvalUser.getId());
-        approval.setIsActive(YesNotEnum.YES.getValue());
-        approval.setCallTime(0);
-        approvalBPO.save(approval);
-        return approval;
-    }
-
-    @Override
-    public Page<FuncApproval> approvalPage(SearchDTO searchDTO) {
-        SecurityUser securityUser = (SecurityUser) ContextUtils.getUserInfo();
-        Searchable searchable = Searchable.toSearchable(searchDTO);
-        searchable.addSearchFilter("isActive", SearchOperator.eq, YesNotEnum.YES.getValue());
-        searchable.addSearchFilter("approvalId", SearchOperator.eq, securityUser.getId());
-        searchable.addSort(Sort.Direction.ASC, "approvalStatus");
-        return approvalBPO.paging(searchable);
-    }
-
-    @Override
-    public ResponseStatus agree(ApprovalDto approvalDto) {
-        FuncApproval approval = approvalBPO.get(approvalDto.getId());
-        approval.setApprovalStatus(ApprovalStatusEnum.PASS.getValue());
-        approval.setApprovalTime(new Date());
-        if (YesNotEnum.YES.getValue().equals(approvalDto.getHasTime())) {
-            DateFormat format1 = new SimpleDateFormat("yyyyMMddHHmmss");
-            Date date = null;
-            try {
-                date = format1.parse(approvalDto.getValidTime());
-            } catch (ParseException e) {
-                return ResponseStatus.fail("保存失败!");
-            }
-            approval.setValidTime(date);
-        }
-        approvalBPO.update(approval);
-        //发送消息到消息中心
-        String activeTime = "长期";
-        if (StringUtils.isNotEmpty(approvalDto.getValidTime())) {
-            activeTime = approvalDto.getValidTime().substring(0, 4) + "-" + approvalDto.getValidTime().substring(4, 6) + "-" + approvalDto.getValidTime().substring(6, 8);
-        }
-        SecurityUser userInfo = UserContextUtils.getCurrentUser();
-        iStaffAssignAuthInfoService.saveStaffAssign(approval.getRoleId(), approval.getProposerOrg(), approval.getAppId(),
-                userInfo.getId(), userInfo.getDeptId(), activeTime, approval.getProposerId());
-        return ResponseStatus.success("保存成功!");
-    }
-
-    @Override
-    public ResponseStatus disagree(ApprovalDto approvalDto) {
-        FuncApproval approval = approvalBPO.get(approvalDto.getId());
-        approval.setApprovalStatus(ApprovalStatusEnum.NOTPASS.getValue());
-        approval.setApprovalOpinion(approvalDto.getApprovalOpinion());
-        approval.setApprovalTime(new Date());
-        approvalBPO.update(approval);
-        //发送消息到消息中心
-        Map<String, Object> map = new HashMap<>();
-        map.put("approval", approval);
-        map.put("securityUser", ContextUtils.getUserInfo());
-        map.put("messageType", MessageTypeEnum.NOTPASS.getValue());
-        approvalEventCenterBus.post(map);
-        return ResponseStatus.success("保存成功!");
-    }
-
-    @Override
-    public FuncApproval detail(String id) {
-        return approvalBPO.get(id);
-    }
-
-    @Override
-    public ResponseDTO applyResult(ApprovalDto approvalDto) {
-        String appCode = approvalDto.getAppCode();
-        ApplyInfo applyInfo = applyInfoFacade.getAppByCode(appCode);
-        if (applyInfo == null) {
-            return ResponseDTO.fail("应用代码不存在!", (Object) null);
-        }
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("code", approvalDto.getRoleCode());
-        params.put("appId", applyInfo.getId());
-        List<RoleInfo> roleInfos = roleBPO.andsearch(RoleInfo.class, params);
-        if (CollectionUtils.isEmpty(roleInfos)) {
-            return ResponseDTO.fail("角色代码不存在!", (Object) null);
-        }
-        RoleInfo roleInfo = roleInfos.get(0);
-        Searchable searchable = Searchable.newSearchable();
-        searchable.addSearchFilter("appId", SearchOperator.eq, applyInfo.getId());
-        searchable.addSearchFilter("roleId", SearchOperator.eq, roleInfo.getId());
-        searchable.addSearchFilter("proposerIdcard", SearchOperator.eq, approvalDto.getUserIdCard());
-        searchable.addSearchFilter("isActive", SearchOperator.eq, YesNotEnum.YES.getValue());
-        List<FuncApproval> list = approvalBPO.find(FuncApproval.class, searchable);
-        if (CollectionUtils.isEmpty(list)) {
-            return ResponseDTO.fail("没有您的申请记录!", (Object) null);
-        }
-        FuncApproval approval = list.get(0);
-        if (approval.getApprovalStatus().equals(ApprovalStatusEnum.DOING.getValue())) {
-            return ResponseDTO.success("您的申请还未审批,请耐心等待!", null);
-        } else if (approval.getApprovalStatus().equals(ApprovalStatusEnum.NOTPASS.getValue())) {
-            return ResponseDTO.success("对不起, 您的申请没有通过!", null);
-        }
-        if (approval.getValidTime() == null || approval.getValidTime().getTime() > System.currentTimeMillis()) {
-            //在有效期内
-            List<AppFunInfo> funList = appFunInfoBPO.getByRoleId(roleInfo.getId());
-            List<Map<String, String>> result = new ArrayList<Map<String, String>>();
-            for (AppFunInfo funInfo : funList) {
-                Map<String, String> map = getStringStringMap(funInfo);
-                result.add(map);
-            }
-            approval.setCallTime(approval.getCallTime() + 1);
-            approvalBPO.update(approval);
-            return ResponseDTO.success("审批已通过!", result);
-        } else {
-            return ResponseDTO.success("对不起,该申请已超出有效期!", new ArrayList<Map<String, String>>());
-        }
-    }
-
-    private Map<String, String> getStringStringMap(AppFunInfo funInfo) {
-        Map<String, String> map = new HashMap<String, String>();
-        map.put("id", funInfo.getId());
-        map.put("name", funInfo.getName());
-        map.put("code", funInfo.getCode());
-        map.put("appId", funInfo.getAppId());
-        map.put("parentCode", funInfo.getParentId());
-        map.put("url", funInfo.getUrl());
-        map.put("paramName", funInfo.getParamName());
-        map.put("paramValue", funInfo.getParamValue());
-        map.put("isActive", funInfo.getIsActive());
-        return map;
-    }
-}

+ 0 - 77
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/FunEventService.java

@@ -1,77 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.service.impl;
-
-
-import com.dragoninfo.dcuc.auth.auth.bpo.FunEventBPO;
-import com.dragoninfo.dcuc.auth.auth.entity.FunEvent;
-import com.dragoninfo.dcuc.auth.auth.service.IFunEventService;
-import com.dragoninfo.dcuc.auth.auth.vo.EventInfoVO;
-import com.dragoninfo.duceap.core.service.impl.BaseService;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@Service
-@Transactional
-public class FunEventService extends BaseService<FunEvent, String> implements IFunEventService {
-
-    @Autowired
-    private FunEventBPO funEventBPO;
-
-    public List<FunEvent> getMenuData(String pkMenuId, Searchable searchable) {
-        return funEventBPO.getMenuData(pkMenuId, searchable);
-    }
-
-    public ResponseDTO updateFilter(List<FunEvent> funEventList, String pkMenuId) {
-//		funEventBPO.deleteAndUpdate(pkMenuId);
-        List<String> idList = new ArrayList<String>();
-        String idPlace = "";
-        idList.add(pkMenuId);
-        for (FunEvent funEvent : funEventList) {
-            if (funEvent.getCode().contains("DELETE") || funEvent.getCode().equals("ADD")
-                    || funEvent.getCode().equals("EDIT") || funEvent.getCode().equals("QUERY")) {
-                continue;
-            } else if (funEvent.getId() != null) {
-                this.update(funEvent);
-            } else {
-                funEvent.setFunId(pkMenuId);
-                this.save(funEvent);
-            }
-            idList.add(funEvent.getId());
-            idPlace += ",?";
-        }
-        if (!StringUtils.isEmpty(idPlace))
-            idPlace = idPlace.substring(1);
-        funEventBPO.deleteFunEvent(idList, idPlace);
-        return ResponseDTO.success("保存成功", funEventList);
-    }
-
-
-    public List<EventInfoVO> getEventByTreeId(String treeId) {
-        return funEventBPO.getEventByTreeId(treeId);
-    }
-
-    public List<EventInfoVO> getEventByFunIds(String funIds) {
-        List<EventInfoVO> eventInfoVOList = new ArrayList<EventInfoVO>();
-        String[] funIdsArray = funIds.split(",");
-        StringBuffer ids = new StringBuffer();
-        int count = 1;
-        for (String funId : funIdsArray) {
-            ids.append("'").append(funId).append("',");
-            if (count % 100 == 0) {                                                                                        //一次查询100条记录
-                eventInfoVOList.addAll(funEventBPO.getEventByFunIds(ids.substring(0, ids.length() - 1)));
-                ids = new StringBuffer();
-            }
-            count++;
-        }
-        if (ids.length() > 0)
-            eventInfoVOList.addAll(funEventBPO.getEventByFunIds(ids.substring(0, ids.length() - 1)));                    //查询剩余funId的记录
-        eventInfoVOList.addAll(funEventBPO.getEventNoFunId());                                                        //查询没有funId的记录,将所有查询的记录整合为一条list
-        return eventInfoVOList;
-    }
-}

+ 0 - 351
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/FuncSyncRuleConfigService.java

@@ -1,351 +0,0 @@
-
-
-package com.dragoninfo.dcuc.auth.auth.service.impl;
-
-
-import com.dragoninfo.dcuc.auth.auth.bpo.AppFunInfoBPO;
-import com.dragoninfo.dcuc.auth.auth.bpo.FuncSyncRuleConfigBPO;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.FuncSyncRuleConfig;
-import com.dragoninfo.dcuc.auth.auth.service.IFuncSyncRuleConfigService;
-import com.dragoninfo.dcuc.auth.auth.vo.MenuInfoVO;
-import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
-import com.dragoninfo.duceap.core.service.impl.BaseService;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
-import com.dragonsoft.duceap.commons.util.UUIDUtils;
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-//import com.dragonsoft.duceap.resource.facade.IDataSourceService;
-//import com.dragonsoft.duceap.resource.facade.ITableResourceService;
-
-@Service
-@Transactional
-public class FuncSyncRuleConfigService extends BaseService<FuncSyncRuleConfig, String> implements IFuncSyncRuleConfigService {
-
-    @Autowired
-    private FuncSyncRuleConfigBPO funcSyncRuleConfigBPO;
-    //    @Autowired
-//    private ITableResourceService tableResourceService;
-//    @Autowired
-//    private IDataSourceService dataSourceService;
-    @Autowired
-    private DcucAuthConfig dcucAuthConfig;
-    @Autowired
-    private AppFunInfoBPO appFunInfoBPO;
-
-    /**
-     * 根据应用id获取应用菜单规则同步配置列表
-     *
-     * @param applicationId
-     * @return
-     */
-    @Override
-    public Page<FuncSyncRuleConfig> getMenuRulesList(String applicationId, Searchable searchable) {
-        Page<FuncSyncRuleConfig> page = funcSyncRuleConfigBPO.getMenuRulesList(applicationId, searchable);
-        List<Map<String, Object>> list = new ArrayList<>();
-//        List<Map<String, Object>> list = dataSourceService.getDataSources();
-        Map<String, String> dataMap = new HashMap<String, String>();
-        for (Map<String, Object> map : list) {
-            dataMap.put(map.get("code").toString(), map.get("value").toString());
-        }
-        for (FuncSyncRuleConfig fun : page.getContent()) {
-            fun.setDatasourceName(dataMap.get(fun.getDs()));
-        }
-        return page;
-    }
-
-    /**
-     * 应用信息删除
-     */
-    @Override
-    public ResponseStatus del(String rulesId) {
-        funcSyncRuleConfigBPO.del(rulesId);
-        return ResponseStatus.success("删除成功");
-    }
-
-    /**
-     * 资源同步功能
-     *
-     * @param
-     */
-    @Override
-    public ResponseStatus menuSyn(String menuSynId, String appId) {
-        //新数据
-        List<Object[]> appFunInfoList = new ArrayList<Object[]>();
-        //获取旧数据
-        HashMap<String, AppFunInfo> existFunList = getOldAppFunInfos(appId);
-        //更新数据
-        List<AppFunInfo> updateAppFunInfoList = new ArrayList<AppFunInfo>();
-        List<Object[]> delAppFunInfoList = new ArrayList<Object[]>();
-        //新增数据
-        List<Object[]> addAppFunInfoList = new ArrayList<Object[]>();
-        //获取规则表数据
-        addFunInfoList(menuSynId, appId, appFunInfoList);
-
-        if (dcucAuthConfig.getMenuNoclear()) {
-            //不删除旧数据,判断新加入的数据是否在旧数据中存在,存在不重复添加,不存在则加进来
-            calcResult(appId, existFunList, appFunInfoList, updateAppFunInfoList, delAppFunInfoList, addAppFunInfoList);
-            //插入T_APP_FUN_INFO表
-            appFunInfoBPO.batchInsetBaseObject(addAppFunInfoList);
-            appFunInfoBPO.updateOrSave(updateAppFunInfoList);
-            appFunInfoBPO.batchDeleteById(delAppFunInfoList);
-        } else {
-            //删除原来已同步的数据
-            appFunInfoBPO.delByAppId(appId);
-
-            //插入T_APP_FUN_INFO表
-            appFunInfoBPO.batchInsetBaseObject(appFunInfoList);
-        }
-
-
-//        //更新parentId code替换成id
-//        String updateSql = "";
-//        if (DcucConstantsUtil.DATABASE_MYSQL.equals(DcucConstantsUtil.DATABASE_TYPE)) {
-//            updateSql = "update  T_APP_FUN_INFO  t set t.parent_id=(ifnull((select t1.id from (select * from T_APP_FUN_INFO) t1 where  t.parent_id = t1.code and t1.app_id = ? ),t.parent_id)) ";
-//        } else if (DcucConstantsUtil.DATABASE_ORACLE.equals(DcucConstantsUtil.DATABASE_TYPE)) {
-//            updateSql = "update  T_APP_FUN_INFO  t set t.parent_id=(nvl((select t1.id from  T_APP_FUN_INFO t1 where  t.parent_id = t1.code and t1.app_id = ? ),t.parent_id)) ";
-//        }
-//        PersistentFactory.getJdbcDao().update(updateSql,new Object[]{appId});
-        return ResponseDTO.success("同步成功");
-    }
-
-    /**
-     * 组装需要新增,修改,删除的数据
-     *
-     * @param appId                应用Id
-     * @param existFunList         旧数据
-     * @param newFunInfoList       新数据
-     * @param updateAppFunInfoList 更新的数据
-     * @param delAppFunInfoList    删除的数据
-     * @param addAppFunInfoList    新增的数据
-     */
-    private void calcResult(String appId,
-                            HashMap<String, AppFunInfo> existFunList,
-                            List<Object[]> newFunInfoList,
-                            List<AppFunInfo> updateAppFunInfoList,
-                            List<Object[]> delAppFunInfoList,
-                            List<Object[]> addAppFunInfoList) {
-        //循环新数据  objects[0]新增主键 ,objects[1]:name,objects[2]:code
-        for (Object[] objects : newFunInfoList) {
-
-            //对比获取更新数据
-            AppFunInfo appFunInfo = existFunList.get(objects[2]);
-            if (appFunInfo != null && appFunInfo.getCode().equals(objects[2])) {//已存在菜单更新
-                appFunInfo.setName((String) objects[1]);
-                appFunInfo.setUrl((String) objects[4]);
-                appFunInfo.setParentId((String) objects[5]);
-                updateAppFunInfoList.add(appFunInfo);
-                existFunList.remove(objects[2]);
-                continue;
-            }
-            //新增,
-            if (appFunInfo == null) {
-                addAppFunInfoList.add(objects);
-                existFunList.remove(objects[2]);
-            }
-
-        }
-
-        //删除
-        for (String code : existFunList.keySet()) {
-            delAppFunInfoList.add(new Object[]{code});
-        }
-
-         /*  Iterator<Object[]> iterator = appFunInfoList.iterator();
-        while (iterator.hasNext()) {
-            Object[] object = iterator.next();
-            for (AppFunInfo appFunInfo : existFunList) {
-                if (appFunInfo.getCode().equals(object[2])) {
-                    if (!appFunInfo.getName().equals(object[3])){//ID相同Name不同,需要修改名称
-                        //放入需要修改的数据
-                        Object[] updateObjects = new Object[]{
-                                object[1]  ,object[2] ,appId
-                        };
-                        updateAppFunInfoList.add(updateObjects);
-                    }
-                    //appFunInfoList移除需要修改的(appFunInfoList后续作为新增数据)
-                    iterator.remove();
-                }
-            }
-        }*/
-    }
-
-
-    /**
-     * 组装需要新增,修改,删除的数据
-     *
-     * @param appId                应用Id
-     * @param existFunList         旧数据
-     * @param newFunInfoList       新数据
-     * @param updateAppFunInfoList 更新的数据
-     * @param delAppFunInfoList    删除的数据
-     * @param addAppFunInfoList    新增的数据
-     */
-    private void calcResultHn(String appId,
-                              HashMap<String, AppFunInfo> existFunList,
-                              List<Object[]> newFunInfoList,
-                              List<AppFunInfo> updateAppFunInfoList,
-                              List<Object[]> delRoleFunRsRlList,
-                              List<Object[]> delAppFunInfoList,
-                              List<Object[]> addAppFunInfoList) {
-        //循环新数据  objects[0]新增主键 ,objects[1]:name,objects[2]:code
-        for (Object[] objects : newFunInfoList) {
-
-            //对比获取更新数据
-            AppFunInfo appFunInfo = existFunList.get(objects[2]);
-            if (appFunInfo != null && appFunInfo.getCode().equals(objects[2])) {//已存在菜单更新
-                appFunInfo.setName((String) objects[1]);
-                appFunInfo.setUrl((String) objects[4]);
-                appFunInfo.setParentId((String) objects[5]);
-                updateAppFunInfoList.add(appFunInfo);
-                existFunList.remove(objects[2]);
-                continue;
-            }
-            //新增,
-            if (appFunInfo == null) {
-                addAppFunInfoList.add(objects);
-                existFunList.remove(objects[2]);
-            }
-
-        }
-
-        //删除
-        for (String code : existFunList.keySet()) {
-            delAppFunInfoList.add(new Object[]{code, appId});
-            delRoleFunRsRlList.add(new Object[]{appId, code, appId});
-        }
-
-    }
-
-    /**
-     * 资源同步功能
-     *
-     * @param
-     */
-    @Override
-    public ResponseStatus menuSynHn(String menuSynId, String appId) {
-        //新数据
-        List<Object[]> appFunInfoList = new ArrayList<Object[]>();
-        HashMap<String, AppFunInfo> existFunList = getOldAppFunInfos(appId);                         //获取旧数据
-        List<AppFunInfo> updateAppFunInfoList = new ArrayList<AppFunInfo>();                        //更新数据
-        List<Object[]> delRoleFunRsRlList = new ArrayList<Object[]>();                               //同步后需要删除的角色功能关系记录
-        List<Object[]> delAppFunInfoList = new ArrayList<Object[]>();                               //同步后需要删除的功能
-        List<Object[]> addAppFunInfoList = new ArrayList<Object[]>();                               //新增功能数据
-        addFunInfoList(menuSynId, appId, appFunInfoList);                                           //获取规则表数据
-        //不删除旧数据,判断新加入的数据是否在旧数据中存在,存在不重复添加,不存在则加进来
-        calcResultHn(appId, existFunList, appFunInfoList, updateAppFunInfoList, delRoleFunRsRlList, delAppFunInfoList, addAppFunInfoList);
-        appFunInfoBPO.batchInsetBaseObject(addAppFunInfoList);
-        appFunInfoBPO.updateOrSave(updateAppFunInfoList);
-        String delSql = "delete from t_role_fun_rs_rl t where role_id in(select id from t_role_info " +                 //删除同步后不存在的菜单
-                "where app_id = ?) and fun_id = (select id from T_APP_FUN_INFO where code=? and app_id=?)";
-        PersistentFactory.getJdbcDao().batchUpdate(delSql, delRoleFunRsRlList);
-        for (Object[] objects : delAppFunInfoList) {
-            String code = (String) objects[0];
-            String deleteAppId = (String) objects[1];
-            appFunInfoBPO.delByAppIdAndFunCode(deleteAppId, code);
-        }
-        return ResponseDTO.success("同步成功");
-    }
-
-    /**
-     * 获取AppFunInfo旧数据
-     *
-     * @param appId 应用ID
-     * @return
-     */
-    public HashMap<String, AppFunInfo> getOldAppFunInfos(String appId) {
-        Map<String, Object> params = new HashMap<String, Object>();
-        HashMap<String, AppFunInfo> oldAppFun = new HashMap<String, AppFunInfo>();
-        params.put("appId", appId);
-        List<AppFunInfo> list = PersistentFactory.getHibernateDao().andsearch(AppFunInfo.class, params);
-        for (AppFunInfo appFunInfo : list) {
-            oldAppFun.put(appFunInfo.getCode(), appFunInfo);
-        }
-        return oldAppFun;
-    }
-
-    /**
-     * 获取规则表数据
-     *
-     * @param menuSynId
-     * @param appId          应用系统ID
-     * @param appFunInfoList 组装列集合
-     */
-    public void addFunInfoList(String menuSynId, String appId, List<Object[]> appFunInfoList) {
-        FuncSyncRuleConfig funcSyncRuleConfig = funcSyncRuleConfigBPO.menuSyn(menuSynId).get(0);
-        StringBuilder stringBuffer = new StringBuilder();
-        //查询列
-        String tableName = funcSyncRuleConfig.getTableName();
-        String code = funcSyncRuleConfig.getFunCode();
-        String name = funcSyncRuleConfig.getFunName();
-        String url = funcSyncRuleConfig.getUrl();
-        String parentId = funcSyncRuleConfig.getParentMenuId();
-        String columnName = code + "," + name;
-        if (StringUtils.isNotBlank(url)) {
-            columnName += "," + url;
-        }
-        if (StringUtils.isNotBlank(parentId)) {
-            columnName += "," + parentId;
-        }
-        //拼接sql语句
-        stringBuffer.append("select ").append(columnName).append(" from ").append(tableName).append(" ");
-        if (StringUtils.isNotEmpty(funcSyncRuleConfig.getConditions())) {
-            String translation = translation(funcSyncRuleConfig.getConditions());
-            stringBuffer.append("where ").append(translation);
-        }
-        //查出的结果
-        List<Map<String, Object>> checkResultList = new ArrayList<>();
-//        List<Map<String, Object>> checkResultList = tableResourceService.getSourcesData(funcSyncRuleConfig.getDs(), stringBuffer.toString());/**/
-        //查出的结果进行数据处理装在List里
-        for (Map<String, Object> checkResult : checkResultList) {
-            Object[] objects = new Object[]{
-                    UUIDUtils.getUUID(),
-                    checkResult.get(name) == null ? "" : checkResult.get(name).toString(),
-                    checkResult.get(code) == null ? "" : checkResult.get(code).toString(),
-                    appId,
-                    checkResult.get(url) == null ? "" : checkResult.get(url).toString(),
-                    checkResult.get(parentId) == null ? "" : checkResult.get(parentId).toString(),
-                    "1"};
-            appFunInfoList.add(objects);
-        }
-    }
-
-    /**
-     * 转译
-     *
-     * @param value 需要转译的值
-     * @return 转译后的值
-     */
-    private String translation(String value) {
-        if (StringUtils.isNotEmpty(value)) {
-            //You'll need to remove the spaces from the html entities below
-            value = value.replaceAll("&lt;", "<").replaceAll("&gt;", ">");
-            value = value.replaceAll("&#40;", "\\(").replaceAll("&#41;", "\\)");
-            value = value.replaceAll("&#39;", "'");
-        }
-        return value;
-    }
-
-    @Override
-    public boolean isExist(String name, String appId) {
-        return funcSyncRuleConfigBPO.isExist(name, appId) > 0;
-    }
-
-    @Override
-    public List<MenuInfoVO> getMenuRuleList(String appId) {
-        return funcSyncRuleConfigBPO.getMenuRuleList(appId);
-    }
-
-}

+ 12 - 20
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RoleInfoService.java

@@ -256,21 +256,6 @@ public class RoleInfoService implements IRoleInfoService {
         return ResponseDTO.success("保存成功", null);
     }
 
-    /**
-     * 获取机构角色配额授权情况列表
-     *
-     * @param applicationId:应用id
-     * @param orgId:机构id         注:后续直接从缓存取??????
-     * @param searchable
-     * @return
-     */
-    @Override
-    public Page<RoleInfoVO> getOrgRoleQuotaList(String applicationId,
-                                                String orgId, Searchable searchable) {
-        Page<RoleInfoVO> page = roleInfoBPO.getOrgRoleQuotaList(applicationId, orgId, searchable);
-        return page;
-    }
-
     /**
      * 根据角色id修改角色的初始配额
      *
@@ -290,7 +275,10 @@ public class RoleInfoService implements IRoleInfoService {
      * @return
      */
     @Override
-    public List<RoleInfo> getRolesByAppIds(String appIds) {
+    public List<RoleInfo> getRolesByAppIds(Collection<String> appIds) {
+        if (CollectionUtils.isEmpty(appIds)) {
+            return Collections.emptyList();
+        }
         return roleInfoBPO.getRolesByAppIds(appIds);
     }
 
@@ -299,10 +287,6 @@ public class RoleInfoService implements IRoleInfoService {
         return roleInfoBPO.roleListByRoleIds(roleIds);
     }
 
-    public List<CountVO> getQuotoCountByAppId(String appId) {
-        return orgQuotaBPO.getQuotoCountByAppId(appId);
-    }
-
     @Override
     public Page<RoleInfoVO> getOrgRoleQuota(String applicationId, String orgId, SearchDTO searchDTO) {
         Searchable searchable = Searchable.toSearchable(searchDTO);
@@ -609,4 +593,12 @@ public class RoleInfoService implements IRoleInfoService {
     public List<RoleInfo> getRolesByAppId(String appId) {
         return roleInfoBPO.getRolesByAppId(appId);
     }
+
+    @Override
+    public List<RoleInfo> getByCodes(List<String> roleCodes) {
+        if (CollectionUtils.isEmpty(roleCodes)) {
+            return Collections.emptyList();
+        }
+        return roleInfoBPO.getByCodes(roleCodes);
+    }
 }

+ 4 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/RoleService.java

@@ -7,9 +7,11 @@ import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
 import com.dragoninfo.dcuc.auth.auth.bpo.RoleInfoBPO;
 import com.dragoninfo.dcuc.auth.auth.dto.AppFunInfoDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.RoleApiDto;
-import com.dragoninfo.dcuc.auth.auth.entity.*;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
+import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
+import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
 import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.AuthRoleOrgRel;
-import com.dragoninfo.dcuc.auth.auth.enumresources.AuthStatusEnum;
 import com.dragoninfo.dcuc.auth.auth.service.*;
 import com.dragoninfo.dcuc.auth.auth.service.zerotrust.IAuthRoleOrgRelService;
 import com.dragoninfo.dcuc.auth.auth.vo.RoleAppFunVO;
@@ -139,7 +141,6 @@ public class RoleService implements IRoleService {
         searchable.addSearchFilter("appCode", SearchOperator.eq, appCode);
         searchable.addSearchFilter("userId", SearchOperator.eq, userId);
         searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.value);
-        searchable.addSearchFilter("authStatus", SearchOperator.eq, AuthStatusEnum.START.getValue());
         return appFunAuthResultService.getResultList(searchable);
     }
 

+ 97 - 56
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ServiceAuthResultServiceImpl.java

@@ -7,6 +7,7 @@ import com.dragoninfo.dcuc.app.entity.ServiceResource;
 import com.dragoninfo.dcuc.app.enumresources.ResourceTypeEnum;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.app.facade.IServiceResourceFacade;
+import com.dragoninfo.dcuc.app.vo.ServiceResourceVo;
 import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
 import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
 import com.dragoninfo.dcuc.auth.auth.async.PermssionServiceUpdateEventBus;
@@ -14,8 +15,7 @@ import com.dragoninfo.dcuc.auth.auth.bpo.ServiceAuthResultBPO;
 import com.dragoninfo.dcuc.auth.auth.dto.*;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
 import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
-import com.dragoninfo.dcuc.auth.auth.enumresources.AuthStatusEnum;
-import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.ServiceAuthApply;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
 import com.dragoninfo.dcuc.auth.auth.po.ServiceAuthResultPO;
 import com.dragoninfo.dcuc.auth.auth.service.IServiceApplyContentService;
@@ -24,7 +24,9 @@ import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
 import com.dragoninfo.dcuc.auth.auth.vo.ServiceAuthenticationResVO;
 import com.dragoninfo.dcuc.duceap.enums.AuthApplyTypeEnum;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
 import com.dragonsoft.duceap.commons.util.ip.IpUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
@@ -38,11 +40,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.Pageable;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -56,9 +56,6 @@ import java.util.stream.Collectors;
 @Service
 public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
 
-    @Resource(name = "redisTemplate")
-    private RedisTemplate<String, String> redisTemplate;
-
     @Autowired
     private IApplyInfoFacade applyInfoFacade;
 
@@ -91,20 +88,6 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
         return serviceAuthResult;
     }
 
-    @Override
-    public ServiceAuthResult getByAppServiceCode(String appCode, String serviceCode) {
-        Searchable searchable = Searchable.newSearchable();
-        searchable.addSearchFilter("service_code", SearchOperator.eq, serviceCode);
-        searchable.addSearchFilter("app_code", SearchOperator.eq, appCode);
-        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.getValue());
-        List<ServiceAuthResult> authResults = serviceAuthResultBPO.find(ServiceAuthResult.class, searchable);
-        if (CollectionUtils.isEmpty(authResults)) {
-            return null;
-        }
-        return authResults.get(0);
-    }
-
-
     @Override
     public void dealAuthFlowResult(WorkFlow workFlow, WorkFlowResutlAcceptDTO flowResutlAcceptDTO) {
         if (WorkFlowStatusEnum.SUCCESS.getValue().equals(workFlow.getFlowStatus())) {
@@ -124,12 +107,12 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
             dto.setPermissionValidType(flowResutlAcceptDTO.getPermissionValidType());
             String startTime = flowResutlAcceptDTO.getStartTime();
             Date start = parseTime(startTime);
-            if (start != null){
+            if (start != null) {
                 dto.setStartTime(start);
             }
             String endTime = flowResutlAcceptDTO.getEndTime();
             Date end = parseTime(endTime);
-            if (end != null){
+            if (end != null) {
                 dto.setEndTime(end);
             }
 
@@ -142,7 +125,7 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
             SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             try {
                 return dateFormat.parse(startTime);
-            }catch (Exception e) {
+            } catch (Exception e) {
                 return null;
             }
         }
@@ -241,21 +224,7 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
         Date date = new Date();
         String appCode = serviceAuthFlow.getAppCode();
         //判断工作单是长期还是自定义
-        Date startTime = null;
-        Date endTime = null;
-        String authStatus = AuthStatusEnum.START.getValue();
-        String permissionValidType = serviceAuthFlow.getPermissionValidType();
-        if (StringUtils.isNotBlank(permissionValidType)
-                && WorkFlowPermissionTypeEnum.TEMP.getValue().equals(permissionValidType)) {
-            startTime = serviceAuthFlow.getStartTime();
-            endTime = serviceAuthFlow.getEndTime();
-            if (date.before(startTime)) {
-                authStatus = AuthStatusEnum.NOT_START.getValue();
-            }
-            if (date.after(endTime)) {
-                authStatus = AuthStatusEnum.OVER_DUE.getValue();
-            }
-        }
+        Date endTime = serviceAuthFlow.getEndTime();
         //授权工作单
         //新增授权
         List<String> serviceCodes = serviceResourceMap.keySet().stream().filter(e -> !allAuthResultMap.containsKey(e)).collect(Collectors.toList());
@@ -264,9 +233,7 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
                 //已经存在的更新
                 if (allAuthResultMap.containsKey(serviceCode)) {
                     ServiceAuthResult serviceAuthResult = allAuthResultMap.get(serviceCode);
-                    serviceAuthResult.setStartTime(startTime);
                     serviceAuthResult.setEndTime(endTime);
-                    serviceAuthResult.setAuthStatus(authStatus);
                     serviceAuthResult.setUpdateTime(date);
                     serviceAuthResult.setFlowId(serviceAuthFlow.getFlowId());
                     serviceAuthResult.setMessageId(serviceAuthFlow.getMessageId());
@@ -277,9 +244,7 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
                     serviceAuthResult.setAppCode(appCode);
                     serviceAuthResult.setServiceCode(serviceCode);
                     ServiceResourceDTO serviceResource = serviceResourceMap.get(serviceCode);
-                    serviceAuthResult.setStartTime(startTime);
                     serviceAuthResult.setEndTime(endTime);
-                    serviceAuthResult.setAuthStatus(authStatus);
                     serviceAuthResult.setServiceId(serviceResource.getId());
                     serviceAuthResult.setAppId(appId);
                     serviceAuthResult.setFlowId(serviceAuthFlow.getFlowId());
@@ -377,7 +342,6 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
             result.setDeleted(BooleanEnum.FALSE.value);
             ServiceResource serviceResource = serviceResourceFacade.detailByCode(dto.getServiceCode());
             result.setServiceId(serviceResource.getId());
-            result.setAuthStatus(AuthStatusEnum.START.getValue());
             result.setServiceResourceId(ResourceTypeEnum.TJ_SERVICE.getResourceId());
             this.saveAuthResult(result);
             List<String> addServiceCodes = new ArrayList<>();
@@ -533,17 +497,6 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
 
     }
 
-    /**
-     * 查询结果
-     *
-     * @param appCode
-     * @return
-     */
-    @Override
-    public List<ServiceAuthResult> serviceAuthResultList(String appCode) {
-        return this.serviceAuthResultBPO.serviceAuthResultList(appCode);
-    }
-
     /**
      * 发送删除服务的消息
      *
@@ -614,7 +567,6 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
         Searchable searchable = Searchable.newSearchable();
         searchable.addSearchFilter("app_code", SearchOperator.eq, appCode);
         searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.getValue());
-        searchable.addSearchFilter("auth_status", SearchOperator.eq, AuthStatusEnum.START.getValue());
         List<ServiceAuthResult> authResults = serviceAuthResultBPO.find(ServiceAuthResult.class, searchable);
         List<String> exist = authResults.stream()
                 .map(item -> item.getServiceCode())
@@ -629,4 +581,93 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
         return serviceAuthResultBPO.findAll();
     }
 
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void deleteExpireAuth() {
+        log.info("取消过期的服务授权开始");
+        setAuthSysSecurityUser();
+        List<ServiceAuthResult> expires = serviceAuthResultBPO.getExpiredAuth();
+        if (CollectionUtils.isNotEmpty(expires)) {
+            expires.forEach(e -> {
+                ServiceAuthResultDTO dto = new ServiceAuthResultDTO();
+                dto.setId(e.getId());
+                delServiceAuthResult(dto);
+            });
+        }
+        log.info("取消过期的服务授权结束");
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void startServiceAuthApply(List<ServiceAuthApply> authApplies) {
+        if (CollectionUtils.isEmpty(authApplies)) {
+            return;
+        }
+
+        setAuthSysSecurityUser();
+
+        List<ServiceAuthResult> serviceAuthResult = transToServiceAuthResult(authApplies);
+        serviceAuthResult.forEach(e -> {
+            serviceAuthResultBPO.save(e);
+            logInfoFillService.sendServiceAuthLog(AuthResultEnum.SUC, e.getAppId(), e.getServiceCode(), "");
+        });
+        Map<String, List<String>> map = serviceAuthResult.stream()
+                .collect(Collectors.groupingBy(ServiceAuthResult::getAppCode,
+                        Collectors.mapping(ServiceAuthResult::getServiceCode, Collectors.toList())));
+        // 发送服务权限变更通知
+        map.forEach((key, list) -> {
+            this.sendPermssionService(key, list, Collections.emptyList());
+        });
+    }
+
+    private void setAuthSysSecurityUser() {
+        // 设置当前登录人为系统自动
+        SecurityUser securityUser = new SecurityUser();
+        securityUser.setName("权限服务审批回调处理");
+        UserContextUtils.setCurrentUser(securityUser);
+    }
+
+    private List<ServiceAuthResult> transToServiceAuthResult(List<ServiceAuthApply> authApplies) {
+        List<String> appIds = authApplies.stream().map(ServiceAuthApply::getAppId).distinct().collect(Collectors.toList());
+        List<String> serviceIds = authApplies.stream().map(ServiceAuthApply::getServiceId).distinct().collect(Collectors.toList());
+        List<ApplyInfo> appInfos = applyInfoFacade.getAppById(appIds);
+        List<ServiceResourceVo> serviceResourceVos = serviceResourceFacade.getServiceByIds(serviceIds);
+        Map<String, ApplyInfo> appMap = appInfos.stream().collect(Collectors.toMap(ApplyInfo::getId, e -> e));
+        Map<String, ServiceResourceVo> serviceMap = serviceResourceVos.stream().collect(Collectors.toMap(ServiceResourceVo::getId, e -> e));
+        Date createTime = new Date();
+
+        // 查询已存在的权限
+        List<ServiceAuthResult> exists = getByAppIds(appIds);
+        Map<String, Set<String>> existMap = exists.stream().collect(Collectors.groupingBy(ServiceAuthResult::getAppId,
+                Collectors.mapping(ServiceAuthResult::getServiceId, Collectors.toSet())));
+
+
+        return authApplies.stream().map(e -> {
+            String appId = e.getAppId();
+            String serviceId = e.getServiceId();
+            // 过滤存在的权限
+            Set<String> exist = existMap.get(appId);
+            if (CollectionUtils.isNotEmpty(exist) && exist.contains(serviceId)) {
+                return null;
+            }
+            Date endTime = e.getEndTime();
+            ServiceAuthResult authResult = new ServiceAuthResult();
+            ServiceResourceVo serviceResourceVo = serviceMap.get(serviceId);
+            authResult.setServiceId(serviceId);
+            authResult.setServiceCode(serviceResourceVo.getServiceCode());
+            authResult.setAppId(appId);
+            authResult.setAppCode(appMap.get(appId).getApplyCode());
+            authResult.setEndTime(endTime);
+            authResult.setCreateTime(createTime);
+            authResult.setServiceResourceId(serviceResourceVo.getResourceId());
+            authResult.setDeleted(BooleanEnum.FALSE.value);
+            return authResult;
+        }).filter(Objects::nonNull).collect(Collectors.toList());
+    }
+
+    private List<ServiceAuthResult> getByAppIds(List<String> appIds) {
+        return serviceAuthResultBPO.getByAppIds(appIds);
+    }
+
 }

+ 102 - 214
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/StaffAssignAuthInfoService.java

@@ -8,7 +8,6 @@ import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
 import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
-import com.dragoninfo.dcuc.auth.auth.async.StaffAssignAuthEventCenterBus;
 import com.dragoninfo.dcuc.auth.auth.bpo.StaffAssignAuthInfoBPO;
 import com.dragoninfo.dcuc.auth.auth.bpo.po.StaffRoleAuthApiPO;
 import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
@@ -17,6 +16,7 @@ import com.dragoninfo.dcuc.auth.auth.dto.StaffRoleOperateDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.UserRoleAuthInfoDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.*;
 import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.AuthRoleOrgRel;
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.RoleAuthApply;
 import com.dragoninfo.dcuc.auth.auth.service.*;
 import com.dragoninfo.dcuc.auth.auth.service.zerotrust.IAuthRoleOrgRelService;
 import com.dragoninfo.dcuc.auth.auth.vo.*;
@@ -39,6 +39,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
 import com.dragonsoft.duceap.core.search.filter.Condition;
 import com.dragonsoft.duceap.web.utils.RequestUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.hibernate.criterion.DetachedCriteria;
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
@@ -56,6 +57,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
+@Slf4j
 @Service
 @Transactional
 public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
@@ -69,10 +71,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
     @Autowired
     private IRoleInfoService roleInfoService;
     @Autowired
-    private IStaffAssignAuthLogService staffAssignAuthLogService;
-    @Autowired
-    private StaffAssignAuthEventCenterBus staffAssignAuthEventCenterBus;
-    @Autowired
     private IApplyInfoFacade applyInfoFacade;
     @Autowired
     private IAuthUserInfoService authUserInfoService;
@@ -207,31 +205,12 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
             updateNum = dfpNum - needNum;
             bjNum = quotoInfo.getBjNum() + needNum;
         }
-        SecurityUser securityUser = UserContextUtils.getCurrentUser();
         //保存授权、日志
-        addList.forEach(e -> {
-            staffAssignAuthInfoBPO.save(e);
-            String activeTime = e.getActiveTime();
-            String prefix = "有效期至:";
-            if ("长期".equals(activeTime)) {
-                prefix = "有效期为:";
-            }
-            saveLog(e, applyInfo.getOrgCode(), "10", securityUser, prefix + activeTime);
-        });
-        Map<String, StaffAssignAuthInfo> finalExistMap1 = existMap;
+        addList.forEach(e -> staffAssignAuthInfoBPO.save(e));
         //更新有效期、保存日志
-        updateList.forEach(e -> {
-            staffAssignAuthInfoBPO.update(e);
-            String staffId = e.getStaffId();
-            String oldActiveTime = finalExistMap1.get(staffId).getActiveTime();
-            String content = "有效期时间由" + oldActiveTime + "变更为" + e.getActiveTime();
-            saveLog(e, applyInfo.getOrgCode(), "20", securityUser, content);
-        });
+        updateList.forEach(e -> staffAssignAuthInfoBPO.update(e));
         //删除权限、保存日志
-        delList.forEach(e -> {
-            staffAssignAuthInfoBPO.delete(e.getId());
-            saveLog(e, applyInfo.getOrgCode(), "30", securityUser, "");
-        });
+        delList.forEach(e -> staffAssignAuthInfoBPO.delete(e.getId()));
         //更新配额
         if (updateNum != null) {
             quotoInfo.setDfpNum(updateNum);
@@ -243,20 +222,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
         return ResponseStatus.success("保存成功!");
     }
 
-    private void saveLog(StaffAssignAuthInfo assignAuthInfo, String appOrgCode, String status, SecurityUser securityUser, String content) {
-        StaffAssignAuthLog staffAssignAuthLog = new StaffAssignAuthLog();
-        staffAssignAuthLog.setAppId(assignAuthInfo.getAppId());
-        staffAssignAuthLog.setRoleId(assignAuthInfo.getRoleId());
-        staffAssignAuthLog.setStaffId(assignAuthInfo.getStaffId());
-        staffAssignAuthLog.setCreateTime(new Date());
-        staffAssignAuthLog.setStaffOrgId(assignAuthInfo.getStaffOrgId());
-        staffAssignAuthLog.setManagerId(securityUser.getId());
-        staffAssignAuthLog.setStatus(status);
-        staffAssignAuthLog.setAppOrgId(appOrgCode); // 之后取appOrgId
-        staffAssignAuthLog.setChangeContent(content);
-        staffAssignAuthLogService.save(staffAssignAuthLog);
-    }
-
     private List<StaffAssignAuthInfo> getRoleAuthByOrgId(String orgId, String roleId) {
         Searchable searchable = Searchable.newSearchable();
         searchable.addSearchFilter("role_id", SearchOperator.eq, roleId);
@@ -278,20 +243,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
         return authInfo;
     }
 
-    /**
-     * 人员角色变更消息发送
-     *
-     * @param staffObjList
-     * @param appId
-     */
-    private void sendMessage(JSONArray staffObjList, String appId) {
-        Map<String, Object> paramsObject = new HashMap<String, Object>();
-        paramsObject.put("staffObjList", staffObjList);
-        paramsObject.put("appId", appId);
-        paramsObject.put("securityUser", ContextUtils.getUserInfo());
-        staffAssignAuthEventCenterBus.post(paramsObject);
-    }
-
     private boolean isEnoughQuota(String appId, String roleId, String orgId, int needNum, boolean isAdd) {
         RoleInfo roleInfo = roleInfoService.get(roleId);
         if (BooleanEnum.FALSE.getValue().equals(roleInfo.getIsNotLimitCount())) {
@@ -321,10 +272,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
                 }
                 staffAssignAuthInfo.setActiveTime(activeTime);
                 this.update(staffAssignAuthInfo);
-                //记录修改日志
-
-                //保存T_STAFF_ASSIGN_AUTH_INFO表
-                saveLog(roleId, orgId, appId, user, staffId, "20", "有效时间由" + oldActiveTime + "变更为" + activeTime);
             }
             return "update";
         } else {
@@ -340,127 +287,30 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
             }
             staffAssignAuthInfo.setActiveTime(activeTime);
             this.save(staffAssignAuthInfo);
-            //记录授权日志
-
-            //保存T_STAFF_ASSIGN_AUTH_INFO表
-            String prefix = "有效期至:";
-            if ("长期".equals(activeTime)) {
-                prefix = "有效期为:";
-            }
-            saveLog(roleId, orgId, appId, user, staffId, "10", prefix + activeTime);
             return "save";
         }
     }
 
-    private void saveLog(String roleId, String orgId, String appId, SecurityUser user, String staffId, String status, String changeContent) {
-        ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
-        StaffAssignAuthLog staffAssignAuthLog = new StaffAssignAuthLog();
-        staffAssignAuthLog.setAppId(appId);
-        staffAssignAuthLog.setRoleId(roleId);
-        staffAssignAuthLog.setStaffId(staffId);
-        staffAssignAuthLog.setCreateTime(new Date());
-        staffAssignAuthLog.setStaffOrgId(orgId);
-        if (null != user) {
-            staffAssignAuthLog.setManagerId(user.getId());
-        }
-        staffAssignAuthLog.setStatus(status);
-        staffAssignAuthLog.setAppOrgId(applyInfo.getOrgCode()); // 之后取appOrgId
-        staffAssignAuthLog.setChangeContent(changeContent);
-        staffAssignAuthLogService.save(staffAssignAuthLog);
-    }
-
     public void deletedAuth(List<StaffAssignAuthInfo> staffAssignAuthInfos) {
         if (staffAssignAuthInfos == null) {
             return;
         }
         for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
             this.delete(staffAssignAuthInfo.getId());
-            //记录取消授权日志
-            saveLog(staffAssignAuthInfo.getRoleId(), staffAssignAuthInfo.getStaffOrgId(), staffAssignAuthInfo.getAppId(), (SecurityUser) ContextUtils.getUserInfo(), staffAssignAuthInfo.getStaffId(), "30", "");
         }
     }
 
-    public void deletedAuthAndUpdateQuota(StaffAssignAuthInfo staffAssignAuthInfo, String appOrgId) {
-        SecurityUser user = UserContextUtils.getCurrentUser();
-        if (staffAssignAuthInfo == null) {
-            return;
-        }
-        this.delete(staffAssignAuthInfo.getId());
-        //记录取消授权日志
-
-        //修改配额
-        String appId = staffAssignAuthInfo.getAppId();
-        String roleId = staffAssignAuthInfo.getRoleId();
-        String orgId = staffAssignAuthInfo.getStaffOrgId();
-        OrgQuotaAuthInfo orgQuotaAuthInfo = orgQuotaAuthService.getOrgQuotaAuthInfo(appId, roleId, orgId);
-        int bjNum = 0;
-        int dfpNum = 0;
-        if (orgQuotaAuthInfo != null) {
-            bjNum = orgQuotaAuthInfo.getBjNum() - 1;
-            dfpNum = orgQuotaAuthInfo.getDfpNum() + 1;
-        }
-        orgQuotaAuthService.updateQuotaWhileAuth(appId, orgId, roleId, appOrgId, user, bjNum, dfpNum, orgQuotaAuthInfo);
-    }
-
-    @Override
-    public ResponseStatus deleteAllStaffRole(String staffId) {
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("staffId", staffId);
-        List<StaffAssignAuthInfo> staffAssignAuthInfos = this.findByPropertyValue("staffId", staffId);
-        if (staffAssignAuthInfos == null) {
-            return ResponseStatus.success("删除角色授权成功!");
-        }
-        for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
-            String appId = staffAssignAuthInfo.getAppId();
-
-            ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
-            if (applyInfo == null) {
-                continue;
-            }
-            String orgCode = applyInfo.getOrgCode();
-            AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(orgCode);
-            deletedAuthAndUpdateQuota(staffAssignAuthInfo, appOrgInfo.getId());
-        }
-
-        //删除用户时取消用户的所有角色授权,发送消息
-        JSONArray staffList = new JSONArray();
-        JSONObject staffObject = new JSONObject();
-        staffObject.put("id", staffId);
-        staffList.add(staffObject);
-        sendMessage(staffList, null);
-        return ResponseStatus.success("删除角色授权成功!");
-    }
-
     @Override
-    public void authMonitor(SecurityUser user) {
-        List<StaffAssignAuthInfo> staffAssignAuthInfos = staffAssignAuthInfoBPO.findAuthExpired();
-        for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
-            String appId = staffAssignAuthInfo.getAppId();
-            ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
-            if (applyInfo == null) {
-                continue;
-            }
-            String orgCode = applyInfo.getOrgCode();
-            AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(orgCode);
-            deletedAuthAndUpdateQuota(staffAssignAuthInfo, appOrgInfo.getId());
-
-            //发送消息
-            JSONArray staffList = new JSONArray();
-            JSONObject staffObject = new JSONObject();
-            staffObject.put("id", staffAssignAuthInfo.getStaffId());
-            staffList.add(staffObject);
-            sendMessage(staffList, staffAssignAuthInfo.getAppId());
+    public void deleteExpireAuth() {
+        log.info("取消过期的服务授权开始");
+        setAuthSysSecurityUser();
+        List<StaffAssignAuthInfo> authExpired = staffAssignAuthInfoBPO.findAuthExpired();
+        if (CollectionUtils.isNotEmpty(authExpired)) {
+            authExpired.forEach(e-> staffAssignAuthInfoBPO.delete(e));
+            Map<String, List<StaffAssignAuthInfo>> collect = authExpired.stream().collect(Collectors.groupingBy(StaffAssignAuthInfo::getRoleId));
+            collect.forEach((roleId, list)-> logInfoFillService.sendRoleViewAuthLog(AuthResultEnum.SUC, null, list, ""));
         }
-    }
-
-    @Override
-    public ResponseStatus changeStaffOrg(String oldOrgId, String newOrgId) {
-        List<StaffAssignAuthInfo> staffAssignAuthInfos = this.findByPropertyValue("staffOrgId", oldOrgId);
-        for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
-            staffAssignAuthInfo.setStaffOrgId(newOrgId);
-        }
-        PersistentFactory.getHibernateDao().saveOrUpdateAll(staffAssignAuthInfos);
-        return ResponseStatus.success();
+        log.info("取消过期的服务授权开始");
     }
 
     @Override
@@ -584,14 +434,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
             //5、删除原勾选-->未勾选的角色授权
             deletedAuth(deleteUserRoles);
             //6、发送授权变更消息
-            JSONArray staffList = new JSONArray();
-            JSONObject staffObject = new JSONObject();
-            staffObject.put("id", dto.getUserId());
-            staffList.add(staffObject);
-            for (String appId : appIds) {
-                sendMessage(staffList, appId);
-            }
-
             logInfoFillService.sendUserViewAuthLog(AuthResultEnum.SUC, dto, logUserRoles, IpUtils.getRealIpAdrress(RequestUtils.getRequest()));
 
         } catch (Exception e) {
@@ -602,53 +444,12 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
         return ResponseStatus.success("保存成功!");
     }
 
-    /**
-     * 保存
-     *
-     * @param roleId     角色id
-     * @param orgId      被操作人机构id
-     * @param appId      应用id
-     * @param userId     审批人用户id
-     * @param userOrg    审批人机构
-     * @param activeTime 赋予被操作人时间
-     * @param staffId    被操作人id
-     */
-    @Override
-    public void saveStaffAssign(String roleId, String orgId, String appId,
-                                String userId, String userOrg, String activeTime, String staffId) {
-        StaffAssignAuthInfo staffAssignAuthInfo;
-        staffAssignAuthInfo = new StaffAssignAuthInfo();
-        staffAssignAuthInfo.setAppId(appId);
-        staffAssignAuthInfo.setRoleId(roleId);
-        staffAssignAuthInfo.setStaffOrgId(orgId);
-        staffAssignAuthInfo.setStaffId(staffId);
-        staffAssignAuthInfo.setCreateTime(new Date());
-        staffAssignAuthInfo.setManagerId(userId);
-        staffAssignAuthInfo.setMgeOrgId(userOrg);
-        staffAssignAuthInfo.setActiveTime(activeTime);
-        this.save(staffAssignAuthInfo);
-    }
 
     @Override
     public List<StaffAssignAuthInfo> getByStaffId(String staffId) {
         return staffAssignAuthInfoBPO.findByPropertyValue("staffId", staffId);
     }
 
-//    @Override
-//    public Integer getAppIdeNumber(String appId) {
-//        return staffAssignAuthInfoBPO.getAppIdNumber(appId);
-//    }
-//
-//    @Override
-//    public Integer getOrgIdRoleIdNumber(String orgId, String roleId) {
-//        return staffAssignAuthInfoBPO.getOrgIdRoleIdNumber(orgId, roleId);
-//    }
-//
-//    @Override
-//    public Integer getFuncNumber(String appId, String funcId) {
-//        return staffAssignAuthInfoBPO.getFuncNumber(appId, funcId);
-//    }
-
     @Override
     public List<String> getPermissionUpdateUserByAppId(String appId) {
         return staffAssignAuthInfoBPO.getStaffIdsByAppId(appId);
@@ -1092,6 +893,93 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
         return saveStaff(dto);
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void startRoleAuthApply(List<RoleAuthApply> authApplies) {
+        if (CollectionUtils.isEmpty(authApplies)) {
+            return;
+        }
+
+        setAuthSysSecurityUser();
+
+        // 查询申请人员
+        List<String> userIds = authApplies.stream().map(RoleAuthApply::getUserId).distinct().collect(Collectors.toList());
+        List<AuthUserInfo> userInfos = authUserInfoService.findByIds(userIds);
+        Map<String, AuthUserInfo> userMap = userInfos.stream().collect(Collectors.toMap(AuthUserInfo::getId, e -> e));
+
+        // 查询应用中的角色
+        List<String> appIds = authApplies.stream().map(RoleAuthApply::getAppId).distinct().collect(Collectors.toList());
+        List<RoleInfo> roles = roleInfoService.getRolesByAppIds(appIds);
+        Map<String, Map<String, String>> appRoleMap = roles.stream().collect(Collectors.groupingBy(RoleInfo::getAppId,
+                Collectors.collectingAndThen(Collectors.toList(),
+                        e -> e.stream().collect(Collectors.toMap(RoleInfo::getCode, RoleInfo::getId)))));
+
+        List<StaffAssignAuthInfo> roleAuths = getStaffAssignAuthInfos(authApplies, appRoleMap, userMap);
+
+        if (CollectionUtils.isNotEmpty(roleAuths)) {
+            roleAuths.forEach(e-> staffAssignAuthInfoBPO.save(e));
+            Map<String, List<StaffAssignAuthInfo>> collect = roleAuths.stream().collect(Collectors.groupingBy(StaffAssignAuthInfo::getRoleId));
+            collect.forEach((roleId, list)-> logInfoFillService.sendRoleViewAuthLog(AuthResultEnum.SUC, list, null, ""));
+        }
+    }
+
+
+    private void setAuthSysSecurityUser() {
+        // 设置当前登录人为系统自动
+        SecurityUser securityUser = new SecurityUser();
+        securityUser.setName("权限服务审批回调处理");
+        UserContextUtils.setCurrentUser(securityUser);
+    }
+
+
+    private List<StaffAssignAuthInfo> getStaffAssignAuthInfos(List<RoleAuthApply> authApplies, Map<String, Map<String, String>> appRoleMap,
+                                                              Map<String, AuthUserInfo> userMap) {
+        Date createTime = new Date();
+        String activeTime = getActiveTime(authApplies);
+
+        // 过滤重复的角色授权
+        List<StaffAssignAuthInfo> existAuths = getByStaffIds(userMap.keySet());
+        Map<String, Set<String>> existMap = existAuths.stream().collect(Collectors.groupingBy(StaffAssignAuthInfo::getStaffId,
+                Collectors.mapping(StaffAssignAuthInfo::getRoleId, Collectors.toSet())));
+
+
+        return authApplies.stream().map(e -> {
+            String roleId = appRoleMap.get(e.getAppId()).get(e.getRoleCode());
+            // 判断是否存在
+            Set<String> existRoles = existMap.get(e.getUserId());
+            if (CollectionUtils.isNotEmpty(existAuths) && existRoles.contains(roleId)) {
+                return null;
+            }
+
+            StaffAssignAuthInfo authInfo = new StaffAssignAuthInfo();
+            authInfo.setRoleId(roleId);
+            authInfo.setAppId(e.getAppId());
+
+            AuthUserInfo authUserInfo = userMap.get(e.getUserId());
+            authInfo.setStaffId(e.getUserId());
+            authInfo.setStaffOrgId(authUserInfo.getOrgId());
+
+            authInfo.setCreateTime(createTime);
+            authInfo.setActiveTime(activeTime);
+            return authInfo;
+        }).filter(Objects::nonNull).collect(Collectors.toList());
+    }
+
+    private List<StaffAssignAuthInfo> getByStaffIds(Collection<String> staffIds) {
+        return staffAssignAuthInfoBPO.getByStaffIds(staffIds);
+    }
+
+    private String getActiveTime(List<RoleAuthApply> authApplies) {
+        RoleAuthApply roleAuthApply = authApplies.get(0);
+        Date endTime = roleAuthApply.getEndTime();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        if (Objects.isNull(endTime)) {
+            return "长期";
+        } else {
+            return format.format(endTime);
+        }
+    }
+
     private void setUserContext(AuthUserInfo manageUser) {
         SecurityUser securityUser = new SecurityUser();
         securityUser.setId(manageUser.getId());

+ 0 - 104
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/StaffAssignAuthLogService.java

@@ -1,104 +0,0 @@
-
-
-package com.dragoninfo.dcuc.auth.auth.service.impl;
-
-
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.bpo.RoleInfoBPO;
-import com.dragoninfo.dcuc.auth.auth.bpo.StaffAssignAuthLogBPO;
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthLog;
-import com.dragoninfo.dcuc.auth.auth.enumresources.LogTypeEnum;
-import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthLogService;
-import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
-import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
-import com.dragoninfo.duceap.core.service.impl.BaseService;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.hibernate.criterion.Order;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-@Transactional
-public class StaffAssignAuthLogService extends BaseService<StaffAssignAuthLog, String> implements IStaffAssignAuthLogService {
-
-    @Autowired
-    private StaffAssignAuthLogBPO staffAssignAuthLogBPO;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @Autowired
-    private IAuthUserInfoService authUserInfoService;
-
-    @Autowired
-    private RoleInfoBPO roleInfoBPO;
-
-    @Override
-    public Page<RoleInfo> roleListByUserIdAndAppId(String userId, String appId, Searchable searchable) {
-        searchable.removeSearchFilter("userId_eq");
-        searchable.removeSearchFilter("appId_eq");
-        Page<RoleInfo> roleInfos = staffAssignAuthLogBPO.roleListByUserIdAndAppId(userId, appId, searchable);
-        for (RoleInfo roleInfo : roleInfos) {
-            String roleAppId = roleInfo.getAppId();
-            ApplyInfo applyInfo = applyInfoFacade.applyDetail(roleAppId);
-            roleInfo.setAppId(applyInfo == null ? "" : applyInfo.getApplyName());
-        }
-        return roleInfos;
-    }
-
-    @Override
-    public List<StaffAssignAuthLog> staffAssignAuthLogList(String userId, String roleId) {
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("staffId", userId);
-        params.put("roleId", roleId);
-        return this.andsearch(StaffAssignAuthLog.class, params, Order.desc("createTime"));
-    }
-
-    @Override
-    public Page<Map<String, String>> operateList(SearchDTO searchDTO, String createUser) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        Searchable searchable = Searchable.toSearchable(searchDTO);
-        searchable.removeSearchFilter("createUser_eq");
-        searchable.removeSearchFilter("logType_eq");
-        Page<Map<String, String>> page = staffAssignAuthLogBPO.operateList(searchable, createUser);
-        Map<String, RoleInfo> roleMap = new HashMap<String, RoleInfo>();
-        Map<String, ApplyInfo> appMap = new HashMap<>();
-        Map<String, AuthUserInfo> userMap = new HashMap<>();
-        for (Map<String, String> logMap : page.getContent()) {
-            String roleId = logMap.get("roleId");
-            String appId = logMap.get("appId");
-            String userId = logMap.get("userId");
-            RoleInfo roleInfo = roleMap.containsKey(roleId) ? roleMap.get(roleId) : roleInfoBPO.get(roleId);
-            ApplyInfo applyInfo = null;
-            AuthUserInfo userInfo = null;
-            if (appMap.containsKey(appId)) {
-                applyInfo = appMap.get(appId);
-            } else {
-
-                applyInfo = applyInfoFacade.applyDetail(appId);
-            }
-            if (userMap.containsKey(userId)) {
-                userInfo = userMap.get(userId);
-            } else {
-
-                userInfo = authUserInfoService.findById(userId);
-            }
-            logMap.put("createTime", format.format(logMap.get("createTime")));
-            logMap.put("type", LogTypeEnum.RYSQ.getValue());
-            logMap.put("roleName", roleInfo != null ? roleInfo.getName() : "");
-            logMap.put("objectName", userInfo != null ? userInfo.getName() + "(" + userInfo.getOrgName() + ")" : "");
-            logMap.put("appName", applyInfo != null ? applyInfo.getApplyName() : "");
-        }
-        return page;
-    }
-}

+ 13 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/zerotrust/ApprovalResultServiceImpl.java

@@ -3,6 +3,8 @@ package com.dragoninfo.dcuc.auth.auth.service.impl.zerotrust;
 import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.ApprovalResult;
 import com.dragoninfo.dcuc.auth.auth.repo.zerotrust.ApprovalResultRepository;
 import com.dragoninfo.dcuc.auth.auth.service.zerotrust.IApprovalResultService;
+import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -10,7 +12,9 @@ import org.springframework.data.domain.Example;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -27,14 +31,23 @@ public class ApprovalResultServiceImpl implements IApprovalResultService {
         this.repository = repository;
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @Override
     public void save(ApprovalResult approvalResult) {
+        approvalResult.setCreateTime(new Date());
+        String userId = Optional.ofNullable(UserContextUtils.getCurrentUser())
+                .map(e -> ((BaseSecurityUser) e).getId()).orElse("");
+        approvalResult.setCreateUser(userId);
         repository.save(approvalResult);
     }
 
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void update(ApprovalResult approvalResult) {
+        approvalResult.setUpdateTime(new Date());
+        String updateUserId = Optional.ofNullable(UserContextUtils.getCurrentUser())
+                .map(e -> ((BaseSecurityUser) e).getId()).orElse("");
+        approvalResult.setUpdateUser(updateUserId);
         repository.update(approvalResult);
     }
 

Some files were not shown because too many files changed in this diff