Browse Source

feature(应用功能权限自助申请): 应用功能权限自助申请

应用功能权限自助申请
mazq 4 years ago
parent
commit
198edd8e1f
41 changed files with 1514 additions and 203 deletions
  1. 1 1
      dcuc-auth-api/pom.xml
  2. 26 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IFunAuthResultFacade.java
  3. 26 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/ISelfAuthApplyFacade.java
  4. 1 1
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IServiceAuthResultFacade.java
  5. 1 1
      dcuc-auth-model/pom.xml
  6. 24 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/AppFunAuthApplyDTO.java
  7. 37 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/AppFunAuthResourceDTO.java
  8. 48 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/AppFunAuthResultDTO.java
  9. 101 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ApprovalWorkFlowDTO.java
  10. 2 2
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ResourceInfoDTO.java
  11. 52 52
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ServiceAuthFlowDTO.java
  12. 62 77
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/WorkFlowDTO.java
  13. 54 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/AppFunApply.java
  14. 95 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/AppFunAuthResult.java
  15. 161 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/WorkFlow.java
  16. 2 2
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/AuthStatusEnum.java
  17. 2 2
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WorkFlowPermissionTypeEnum.java
  18. 53 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WorkFlowSourceEnum.java
  19. 13 1
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WorkFlowTypeEnum.java
  20. 1 1
      dcuc-auth-service/pom.xml
  21. 18 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/IAuthAprResultBusiness.java
  22. 18 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/ISelfAuthApplyBusiness.java
  23. 77 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/AuthAprResultBusiness.java
  24. 52 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/SelfAuthApplyBusiness.java
  25. 17 17
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/ServiceAuthBusinessImpl.java
  26. 26 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/SelfAuthApplyFacade.java
  27. 18 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/AppFunApplyRepository.java
  28. 13 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/AppFunAuthResultRepository.java
  29. 13 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/WorkFlowRepository.java
  30. 29 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IAppFunAuthApplyService.java
  31. 36 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IAppFunAuthResultService.java
  32. 1 8
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IServiceAuthResultService.java
  33. 41 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IWorkFlowService.java
  34. 78 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AppFunAuthApplyServiceImpl.java
  35. 137 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AppFunAuthResultServiceImpl.java
  36. 0 16
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AuthDataSyncDetailService.java
  37. 7 17
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ServiceAuthResultServiceImpl.java
  38. 156 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/WorkFlowServiceImpl.java
  39. 1 1
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/config/DcucAuthApprovalConfig.java
  40. 13 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/msg/WorkFlowResultListener.java
  41. 1 1
      pom.xml

+ 1 - 1
dcuc-auth-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>dcuc-auth</artifactId>
         <groupId>com.dragoninfo</groupId>
-        <version>2.3.1-tjdsj-SNAPSHOT</version>
+        <version>2.3.2-tjdsj-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 26 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IFunAuthResultFacade.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.auth.auth.facade;
+
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResultDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * 应用功能授权结果api
+ * @author mazq
+ * @date 2021/7/9
+ */
+@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/funAuthResultFacade")
+public interface IFunAuthResultFacade {
+
+    /**
+     * 查询列表
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping(value = "findList")
+    List<AppFunAuthResultDTO> findList(@RequestBody SearchDTO searchDTO);
+}

+ 26 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/ISelfAuthApplyFacade.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.auth.auth.facade;
+
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * 权限自助申请api
+ * @author mazq
+ * @date 2021/7/8
+ */
+@FeignClient(name = "dcuc-auth",path = "/dcuc/auth/selfAuthApplyFacade")
+public interface ISelfAuthApplyFacade {
+
+    /**
+     * 应用功能权限申请
+     * @param authApplyDTO
+     * @return
+     */
+    @PostMapping("funApplySave")
+    ResponseStatus funApplySave(@RequestBody AppFunAuthApplyDTO authApplyDTO);
+
+
+}

+ 1 - 1
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IServiceAuthResultFacade.java

@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 /**
- * 服务授权结果Facade
+ * 服务授权结果Api
  * @Author yica
  * @Date 2021/3/9 10:01
  **/

+ 1 - 1
dcuc-auth-model/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>dcuc-auth</artifactId>
         <groupId>com.dragoninfo</groupId>
-        <version>2.3.1-tjdsj-SNAPSHOT</version>
+        <version>2.3.2-tjdsj-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 24 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/AppFunAuthApplyDTO.java

@@ -0,0 +1,24 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Data
+public class AppFunAuthApplyDTO {
+
+    /**
+     * 工单dto
+     */
+    private WorkFlowDTO workFlow;
+
+    /**
+     * 应用功能权限申请资源集合
+     */
+    private List<AppFunAuthResourceDTO> resourceInfos;
+
+}

+ 37 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/AppFunAuthResourceDTO.java

@@ -0,0 +1,37 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Data
+public class AppFunAuthResourceDTO {
+
+    /**
+     * 应用id
+     */
+    private String appId;
+
+    /**
+     * 应用名称
+     */
+    private String appName;
+
+    /**
+     * 功能id,多个使用','隔开
+     */
+    private String funIds;
+
+    /**
+     * 功能code,多个使用','隔开
+     */
+    private String funCodes;
+
+    /**
+     * 功能名称,多个使用','隔开
+     */
+    private String funNames;
+
+}

+ 48 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/AppFunAuthResultDTO.java

@@ -0,0 +1,48 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2021/7/9
+ */
+@Data
+public class AppFunAuthResultDTO {
+
+    /** 主键 */
+    private String id;
+
+    /** 人员id */
+    private String userId ;
+
+    /** 应用id */
+    private String appId ;
+
+    /** 应用code */
+    private String appCode ;
+
+    /** 功能id */
+    private String funId ;
+
+    /** 功能code */
+    private String funCode ;
+
+    /** 权限开始时间 */
+    private Date startTime ;
+
+    /** 权限结束时间 */
+    private Date endTime ;
+
+    /** 权限起停用状态 */
+    private String authStatus ;
+
+    /** 权限结果来源 */
+    private String authSource ;
+
+    /** 来源对象标识 */
+    private String sourceId ;
+
+
+}

+ 101 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ApprovalWorkFlowDTO.java

@@ -0,0 +1,101 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 审批服务-提交工作流服务入参DTO
+ * @author mazq
+ * @date 2021/2/23
+ */
+@Data
+public class ApprovalWorkFlowDTO {
+
+    /**
+     * 申请人身份证号
+     */
+    private String applicantIdcard;
+    /**
+     * 申请人姓名
+     */
+    private String applicantName;
+
+    /**
+     * 申请人联系方式
+     */
+    private String applicantPhoneNo;
+
+    /**
+     * 申请人单位编码
+     */
+    private String applicantOrgCode;
+    /**
+     * 申请人单位名称
+     */
+    private String applicantOrgName;
+
+    /**
+     * 申请内容
+     */
+    private String applyContent;
+    /**
+     * 申请理由
+     */
+    private String applyReason;
+    /**
+     * 流程标识码
+     */
+    private String businessCode;
+    /**
+     * 操作类型(1-保存|2-保存并提交)
+     */
+    private String operateType;
+
+    /**
+     * 流程类型名称
+     */
+    private String processTypeName;
+    /**
+     * 流程类型
+     */
+    private String processType;
+    /**
+     * 流程名称
+     */
+    private String processName;
+
+    /**
+     * 权限有效起始时间(2020-01-01 00:00:00)
+     */
+    private String startTime;
+    /**
+     * 权限有效终止时间(2020-01-01 00:00:00)
+     */
+    private String endTime;
+
+    /**
+     * 授权资源对象
+     */
+    private ResourceInfoDTO resourceInfoDTO;
+
+    /**
+     * 权限有效类型(01:自定义 | 02:长期)
+     */
+    private String permissionValidType;
+
+    /**
+     * 消息id
+     */
+    private String messageId;
+    /**
+     * 工作单类型
+     * SERVICE_AUTH-服务授权工作单 SERVICE_AUTH_CANCEL-服务权限撤销工作单
+     */
+    private String flowType;
+
+    /**
+     * 下一任务对象信息
+     */
+    private List<ActivitiHolderDTO> activitiHolderList;
+}

+ 2 - 2
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ResourceInfoDTO.java

@@ -20,12 +20,12 @@ public class ResourceInfoDTO {
     private String visitorName;
 
     /**
-     * 访问资源编码
+     * 访问资源编码,多个使用','分隔
      */
     private String visitResourceCode;
 
     /**
-     * 访问资源名称
+     * 访问资源名称,多个使用','分隔
      */
     private String visitResourceName;
 

+ 52 - 52
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ServiceAuthFlowDTO.java

@@ -46,38 +46,6 @@ public class ServiceAuthFlowDTO implements Serializable {
      */
     private String applicantOrgName;
 
-    /**
-     * 应用代码
-     */
-    private String appCode;
-
-    /**
-     * 应用名称
-     */
-    private String appName;
-
-    /**
-     * 应用管理单位名称
-     */
-    private String appManagerOrgName;
-
-
-    /**
-     * 应用管理单位code
-     */
-    private String appManagerOrgCode;
-
-    /**
-     * 应用事权单位名称
-     */
-    private String appOrgName;
-
-    /**
-     * 应用事权单位code
-     */
-    private String appOrgCode;
-
-
     /**
      * 工作单类型
      * SERVICE_AUTH-服务授权工作单 SERVICE_CANCEL-服务权限撤销工作单
@@ -105,26 +73,6 @@ public class ServiceAuthFlowDTO implements Serializable {
      */
     private Date applyTime;
 
-    /**
-     * 服务资源codes (多个服务使用',' 隔开)
-     */
-    private String serviceCodes;
-
-    /**
-     * 服务资源名称 (多个服务使用',' 隔开)
-     */
-    private String serviceNames;
-
-    /**
-     * 是否删除
-     */
-    private String deleted;
-
-    /**
-     * 工作单结果说明
-     */
-    private String desc;
-
     /**
      * 申请原因
      */
@@ -168,6 +116,58 @@ public class ServiceAuthFlowDTO implements Serializable {
      */
     private Date endTime;
 
+    /**
+     * 应用代码
+     */
+    private String appCode;
+
+    /**
+     * 应用名称
+     */
+    private String appName;
+
+    /**
+     * 应用管理单位名称
+     */
+    private String appManagerOrgName;
+
+
+    /**
+     * 应用管理单位code
+     */
+    private String appManagerOrgCode;
+
+    /**
+     * 应用事权单位名称
+     */
+    private String appOrgName;
+
+    /**
+     * 应用事权单位code
+     */
+    private String appOrgCode;
+
+
+    /**
+     * 服务资源codes (多个服务使用',' 隔开)
+     */
+    private String serviceCodes;
+
+    /**
+     * 服务资源名称 (多个服务使用',' 隔开)
+     */
+    private String serviceNames;
+
+    /**
+     * 是否删除
+     */
+    private String deleted;
+
+    /**
+     * 工作单结果说明
+     */
+    private String desc;
+
     /**
      * 服务共享方式
      */

+ 62 - 77
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/WorkFlowDTO.java

@@ -2,100 +2,85 @@ package com.dragoninfo.dcuc.auth.auth.dto;
 
 import lombok.Data;
 
-import java.util.List;
+import java.util.Date;
 
 /**
- * 审批服务-提交工作流服务入参DTO
+ * 权限申请工作流DTO
  * @author mazq
- * @date 2021/2/23
+ * @date 2021/7/8
  */
 @Data
 public class WorkFlowDTO {
 
-    /**
-     * 申请人身份证号
-     */
-    private String applicantIdcard;
-    /**
-     * 申请人姓名
-     */
+    /** 主键 */
+    private String id;
+
+    /** 申请人*/
     private String applicantName;
 
-    /**
-     * 申请人联系方式
-     */
-    private String applicantPhoneNo;
+    /** 申请人身份证号 */
+
+    private String applicantIdcard;
 
-    /**
-     * 申请人单位编码
-     */
+    /** 申请人机构编号*/
     private String applicantOrgCode;
-    /**
-     * 申请人单位名称
-     */
+
+    /** 申请人机构名称 */
     private String applicantOrgName;
 
-    /**
-     * 申请内容
-     */
-    private String applyContent;
-    /**
-     * 申请理由
-     */
+    /** 申请人电话号码 */
+    private String applicantPhoneNo;
+
+    /** 申请理由 */
     private String applyReason;
-    /**
-     * 流程标识码
-     */
-    private String businessCode;
-    /**
-     * 操作类型(1-保存|2-保存并提交)
-     */
-    private String operateType;
 
-    /**
-     * 流程类型名称
-     */
-    private String processTypeName;
-    /**
-     * 流程类型
-     */
-    private String processType;
-    /**
-     * 流程名称
-     */
-    private String processName;
-
-    /**
-     * 权限有效起始时间(2020-01-01 00:00:00)
-     */
-    private String startTime;
-    /**
-     * 权限有效终止时间(2020-01-01 00:00:00)
-     */
-    private String endTime;
-
-    /**
-     * 授权资源对象
-     */
-    private ResourceInfoDTO resourceInfoDTO;
-
-    /**
-     * 权限有效类型(01:自定义 | 02:长期)
-     */
+    /** 申请单号 */
+    private String applicantId;
+
+    /** 申请单来源平台 */
+    private String applySource;
+
+    /** 权限有效期类型 */
     private String permissionValidType;
 
-    /**
-     * 消息id
-     */
-    private String messageId;
-    /**
-     * 工作单类型
-     * SERVICE_AUTH-服务授权工作单 SERVICE_AUTH_CANCEL-服务权限撤销工作单
-     */
+    /** 权限申请单类型 */
     private String flowType;
 
-    /**
-     * 下一任务对象信息
-     */
-    private List<ActivitiHolderDTO> activitiHolderList;
+    /** 消息id(内部审批流程消息使用通知用)*/
+    private String messageId;
+
+    /** 工作流实例id */
+        private String flowId;
+
+    /** 工作流流程编号 */
+    private String flowCode;
+
+    /** 工作流流程标识码 */
+    private String businessCode;
+
+    /** 工作流状态 */
+    private String flowStatus;
+
+    /** 工作流名称 */
+    private String flowName;
+
+    /** 工作流标题 */
+    private String flowTitle;
+
+    /** 工作流审批内容 */
+    private String flowContent;
+
+    /**操作类型1:保存 2:提交 */
+    private String operateType;
+
+    /** 权限开始时间 */
+    private Date startTime;
+
+    /** 权限结束时间 */
+    private Date endTime;
+
+    /** 附件id */
+    private String fileId;
+
+
 }

+ 54 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/AppFunApply.java

@@ -0,0 +1,54 @@
+package com.dragoninfo.dcuc.auth.auth.entity;
+
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+/**
+ * 功能授权详细信息实体类
+ * @author mazq
+ * @date 2021/7/8
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_AUTH_APP_FUN_APPLY")
+public class AppFunApply {
+
+    /** 主键 */
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /** 权限申请表记录id */
+    @Column(name = "AUTH_APPLY_ID")
+    private String authApplyId ;
+
+    /** 应用id */
+    @Column(name = "APP_ID")
+    private String appId ;
+
+    /** 应用code标识 */
+    @Column(name = "APP_CODE")
+    private String appCode ;
+
+    /** 应用名称 */
+    @Column(name = "APP_NAME")
+    private String appName ;
+
+    /** 功能标识,多个用','号隔开 */
+    @Column(name = "FUN_CODES")
+    private String funCodes ;
+
+    /** 功能名称,多个用','号隔开 */
+    @Column(name = "FUN_NAMES")
+    private String funNames ;
+
+    /** 权限赋予人id */
+    @Column(name = "USER_ID")
+    private String userId ;
+
+}

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

@@ -0,0 +1,95 @@
+package com.dragoninfo.dcuc.auth.auth.entity;
+
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * 功能授权结果实体类
+ * @author mazq
+ * @date 2021/7/8
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_AUTH_APP_FUN_AUTH_RESULT")
+public class AppFunAuthResult {
+
+    /** 主键 */
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /** 人员id */
+    @Column(name = "USER_ID")
+    private String userId ;
+
+    /** 应用id */
+    @Column(name = "APP_ID")
+    private String appId ;
+
+    /** 应用code */
+    @Column(name = "APP_CODE")
+    private String appCode ;
+
+    /** 功能id */
+    @Column(name = "FUN_ID")
+    private String funId ;
+
+    /** 功能code */
+    @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 ;
+
+    /** 来源对象标识 */
+    @Column(name = "SOURCE_ID")
+    private String sourceId ;
+
+    /** 是否删除 */
+    @Column(name = "DELETED")
+    private String deleted ;
+
+    /** 创建时间 */
+    @Column(name = "CREATE_TIME")
+    private String createTime ;
+
+    /** 更新时间 */
+    @Column(name = "UPDATE_TIME")
+    private Date updateTime ;
+
+    /** 删除时间 */
+    @Column(name = "DELETE_TIME")
+    private Date deleteTime ;
+
+    /** 创建人 */
+    @Column(name = "CREATE_USER")
+    private String createUser ;
+
+    /** 更新人 */
+    @Column(name = "UPDATE_USER")
+    private String updateUser ;
+
+    /** 删除人 */
+    @Column(name = "DELETE_USER")
+    private String deleteUser ;
+
+}

+ 161 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/entity/WorkFlow.java

@@ -0,0 +1,161 @@
+package com.dragoninfo.dcuc.auth.auth.entity;
+
+import com.dragonsoft.duceap.base.annotations.audit.DeletedBy;
+import com.dragonsoft.duceap.base.annotations.audit.DeletedDate;
+import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedBy;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_AUTH_APPLY_FLOW")
+public class WorkFlow implements IdEntity<String> {
+
+    /** 主键 */
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /** 申请人*/
+    @Column(name = "APPLICANT_NAME")
+    private String applicantName;
+
+    /** 申请人身份证号 */
+
+    @Column(name = "APPLICANT_IDCARD")
+    private String applicantIdcard;
+
+    /** 申请人机构编号*/
+    @Column(name = "APPLICANT_ORG_CODE")
+    private String applicantOrgCode;
+
+    /** 申请人机构名称 */
+    @Column(name = "APPLICANT_ORG_NAME")
+    private String applicantOrgName;
+
+    /** 申请人电话号码 */
+    @Column(name = "APPLICANT_PHONE_NO")
+    private String applicantPhoneNo;
+
+    /** 申请理由 */
+    @Column(name = "APPLY_REASON")
+    private String applyReason;
+
+    /** 申请单号 */
+    @Column(name = "APPLICANT_ID")
+    private String applicantId;
+
+    /** 申请单来源平台 */
+    @Column(name = "APPLY_SOURCE")
+    private String applySource;
+
+    /** 权限有效期类型 01:自定义 02:长期*/
+    @Column(name = "PERMISSION_VALID_TYPE")
+    private String permissionValidType;
+
+    /** 权限申请单类型 */
+    @Column(name = "FLOW_TYPE")
+    private String flowType;
+
+    /** 消息id(内部审批流程消息使用通知用)*/
+    @Column(name = "MESSAGE_ID")
+    private String messageId;
+
+    /** 工作流实例id */
+    @Column(name = "FLOW_ID")
+    private String flowId;
+
+    /** 工作流流程编号 */
+    @Column(name = "FLOW_CODE")
+    private String flowCode;
+
+    /** 工作流流程标识码 */
+    @Column(name = "BUSINESS_CODE")
+    private String businessCode;
+
+    /** 工作流状态 */
+    @Column(name = "FLOW_STATUS")
+    private String flowStatus;
+
+    /** 工作流名称 */
+    @Column(name = "FLOW_NAME")
+    private String flowName;
+
+    /** 工作流标题 */
+    @Column(name = "FLOW_TITLE")
+    private String flowTitle;
+
+    /** 工作流审批内容 */
+    @Column(name = "FLOW_CONTENT")
+    private String flowContent;
+
+    /**操作类型1:保存 2:提交 */
+    @Column(name = "OPERATE_TYPE")
+    private String operateType;
+
+    /** 审批结果说明 */
+    @Column(name = "REMARK")
+    private String remark ;
+
+    /** 权限开始时间 */
+    @Column(name = "START_TIME")
+    private Date startTime;
+
+    /** 权限结束时间 */
+    @Column(name = "END_TIME")
+    private Date endTime;
+
+    /** 附件id */
+    @Column(name = "FILE_ID")
+    private String fileId;
+
+    /** 是否删除 */
+    @Column(name = "DELETED")
+    private String deleted;
+
+    /** 创建时间 */
+    @CreatedDate
+    @Column(name = "CREATE_TIME")
+    private Date createTime;
+
+    /** 更新时间 */
+    @LastModifiedDate
+    @Column(name = "UPDATE_TIME")
+    private Date updateTime;
+
+    /** 删除时间 */
+    @DeletedDate
+    @Column(name = "DELETE_TIME")
+    private Date deleteTime;
+
+    /** 创建人 */
+    @CreatedBy
+    @Column(name = "CREATE_USER")
+    private String createUser;
+
+    /** 更新人 */
+    @LastModifiedBy
+    @Column(name = "UPDATE_USER")
+    private String updateUser;
+
+    /** 删除人 */
+    @DeletedBy
+    @Column(name = "DELETE_USER")
+    private String deleteUser;
+
+
+}

+ 2 - 2
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/ServiceAuthStatusEnum.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/AuthStatusEnum.java

@@ -5,7 +5,7 @@ package com.dragoninfo.dcuc.auth.auth.enumresources;
  * @author mazq
  * @date 2021/5/12
  */
-public enum  ServiceAuthStatusEnum {
+public enum AuthStatusEnum {
 
     /**
      * 服务授权申请审批通过后权限有效期时间未到启用时间
@@ -28,7 +28,7 @@ public enum  ServiceAuthStatusEnum {
 
     private String value;
 
-    ServiceAuthStatusEnum(String label, String value) {
+    AuthStatusEnum(String label, String value) {
         this.label = label;
         this.value = value;
     }

+ 2 - 2
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WokrFlowPermissionTypeEnum.java → dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WorkFlowPermissionTypeEnum.java

@@ -6,7 +6,7 @@ package com.dragoninfo.dcuc.auth.auth.enumresources;
  * @author mazq
  * @date 2021/3/11
  */
-public enum WokrFlowPermissionTypeEnum {
+public enum WorkFlowPermissionTypeEnum {
     /**
      * 自定义时长
      */
@@ -20,7 +20,7 @@ public enum WokrFlowPermissionTypeEnum {
     private String value;
     private String label;
 
-    WokrFlowPermissionTypeEnum(String value, String label) {
+    WorkFlowPermissionTypeEnum(String value, String label) {
         this.value = value;
         this.label = label;
     }

+ 53 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WorkFlowSourceEnum.java

@@ -0,0 +1,53 @@
+package com.dragoninfo.dcuc.auth.auth.enumresources;
+
+/**
+ * 工作单来源枚举类
+ *
+ * @author mazq
+ * @date 2021/2/22
+ */
+public enum WorkFlowSourceEnum {
+
+    /**
+     * 权限中心自助申请
+     */
+    SELF_AUTH_APPLY("SELF_AUTH_APPLY", "权限中心自助申请"),
+
+
+    /**
+     * 权限中心管理员授权
+     */
+    MANAGER_ROLE_AUTH("MANAGER_AUTH","权限中心管理员授权"),
+
+
+    /**
+     * 大数据运营平台申请
+     */
+    YYPT_APPLY("TJDSJ_APPLY","大数据运营平台申请");
+
+
+    private String value;
+
+    private String label;
+
+    WorkFlowSourceEnum(String value, String label) {
+        this.value = value;
+        this.label = label;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+}

+ 13 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/enumresources/WorkFlowTypeEnum.java

@@ -7,14 +7,26 @@ package com.dragoninfo.dcuc.auth.auth.enumresources;
  * @date 2021/2/22
  */
 public enum WorkFlowTypeEnum {
+
     /**
      * 服务授权工作单
      */
     SERVICE_AUTH("SERVICE_AUTH", "服务授权工作单"),
+
     /**
      * 权限撤销工作单
      */
-    SERVICE_AUTH_CANCEL("SERVICE_AUTH_CANCEL", "权限撤销工作单");
+    SERVICE_AUTH_CANCEL("SERVICE_AUTH_CANCEL", "权限撤销工作单"),
+
+    /**
+     * 应用功能授权工作单
+     */
+    APP_FUN_AUTH("APP_FUN_AUTH", "应用功能授权工作单"),
+
+    /**
+     * 数据授权工作单
+     */
+    DATA_AUTH("DATA_AUTH","数据授权工作单");
 
     private String value;
 

+ 1 - 1
dcuc-auth-service/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>dcuc-auth</artifactId>
         <groupId>com.dragoninfo</groupId>
-        <version>2.3.1-tjdsj-SNAPSHOT</version>
+        <version>2.3.2-tjdsj-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>dcuc-auth-service</artifactId>

+ 18 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/IAuthAprResultBusiness.java

@@ -0,0 +1,18 @@
+package com.dragoninfo.dcuc.auth.auth.business;
+
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
+
+/**
+ * 权限申请工作流审批结果统一处理业务组合类
+ * @author mazq
+ * @date 2021/7/8
+ */
+public interface IAuthAprResultBusiness {
+
+     /**
+     * 处理审批结果
+      * @param dto
+      * @return
+      */
+     boolean dealAuthFlowResult(WorkFlowResutlAcceptDTO dto);
+}

+ 18 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/ISelfAuthApplyBusiness.java

@@ -0,0 +1,18 @@
+package com.dragoninfo.dcuc.auth.auth.business;
+
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+public interface ISelfAuthApplyBusiness {
+
+    /**
+     * 应用功能权限申请
+     * @param authApplyDTO
+     * @return
+     */
+    ResponseStatus funApplySave(AppFunAuthApplyDTO authApplyDTO);
+}

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

@@ -0,0 +1,77 @@
+package com.dragoninfo.dcuc.auth.auth.business.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.dragoninfo.dcuc.auth.auth.business.IAuthAprResultBusiness;
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApply;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthApplyService;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthResultService;
+import com.dragoninfo.dcuc.auth.auth.service.IServiceAuthResultService;
+import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Slf4j
+@Component
+public class AuthAprResultBusiness implements IAuthAprResultBusiness {
+
+    @Autowired
+    private IWorkFlowService workFlowService;
+
+    @Autowired
+    private IAppFunAuthApplyService appFunAuthApplyService;
+
+    @Autowired
+    private IAppFunAuthResultService appFunAuthResultService;
+
+    @Autowired
+    private IServiceAuthResultService serviceAuthResultService;
+
+    @Override
+    public boolean dealAuthFlowResult(WorkFlowResutlAcceptDTO dto) {
+        String flowId = dto.getProcessInstanceId();
+        String messageId = dto.getMessageId();
+        log.info("dealAuthFlowResult>>flow Id:{},message Id:{}",flowId,messageId);
+        WorkFlow flow = workFlowService.getByMessageId(messageId);
+
+        if(null == flow){
+            log.info("dealAuthFlowResult>>get work flow null,message id:{}",messageId);
+            return false;
+        }
+
+        //幂等性
+        if (!WorkFlowStatusEnum.APPLYING.getValue().equals(flow.getFlowStatus())) {
+            return true;
+        }
+
+        flow.setRemark(dto.getRemark());
+        flow.setFlowStatus(dto.getApproveResult());
+        flow.setFlowId(flowId);
+
+        String[] arr = messageId.split(StrUtil.COLON);
+        String workFlowType = arr[1];
+        //处理服务授权结果
+        if(WorkFlowTypeEnum.APP_FUN_AUTH.getValue().equals(workFlowType)) {
+            List<AppFunApply> applyInfos = appFunAuthApplyService.getByAuthApplyId(flow.getId());
+            appFunAuthResultService.dealAuthFlowResult(flow, applyInfos);
+        } else if(WorkFlowTypeEnum.SERVICE_AUTH.getValue().equals(workFlowType) ||
+                WorkFlowTypeEnum.SERVICE_AUTH_CANCEL.getValue().equals(workFlowType)) {
+            //serviceAuthResultService.dealAuthFlowResult(flow);
+        } else {
+
+        }
+        //更新工作单状态
+        workFlowService.update(flow);
+        return true;
+    }
+}

+ 52 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/SelfAuthApplyBusiness.java

@@ -0,0 +1,52 @@
+package com.dragoninfo.dcuc.auth.auth.business.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.dragoninfo.dcuc.auth.auth.business.ISelfAuthApplyBusiness;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResourceDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.ResourceInfoDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowSourceEnum;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthApplyService;
+import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.commons.util.UUIDUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 权限自主申请业务组合类
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Component
+public class SelfAuthApplyBusiness implements ISelfAuthApplyBusiness {
+
+    @Autowired
+    IWorkFlowService workFlowService;
+
+    @Autowired
+    IAppFunAuthApplyService funAuthApplyService;
+
+    @Override
+    public ResponseStatus funApplySave(AppFunAuthApplyDTO authApplyDTO) {
+        WorkFlowDTO workFlowDTO = authApplyDTO.getWorkFlow();
+        workFlowDTO.setFlowStatus(WorkFlowStatusEnum.APPLYING.getValue());
+        String flowType = WorkFlowTypeEnum.APP_FUN_AUTH.getValue();
+        workFlowDTO.setFlowType(flowType);
+        workFlowDTO.setApplySource(WorkFlowSourceEnum.SELF_AUTH_APPLY.getValue());
+        workFlowDTO.setMessageId(UUIDUtils.getUUID()+ StrUtil.COLON + flowType);
+        //保存工单
+        WorkFlow workFlow = workFlowService.saveWorkFlow(workFlowDTO);
+        List<AppFunAuthResourceDTO> authResources = authApplyDTO.getResourceInfos();
+        //保存授权相关信息
+        funAuthApplyService.saveAuthApplyDetail(workFlow, authResources);
+        //推送审批服务
+        return workFlowService.pushToApproval(authApplyDTO);
+    }
+}

+ 17 - 17
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/ServiceAuthBusinessImpl.java

@@ -9,16 +9,16 @@ import com.dragoninfo.dcuc.app.facade.IServiceResourceFacade;
 import com.dragoninfo.dcuc.auth.auth.business.IServiceAuthBusiness;
 import com.dragoninfo.dcuc.auth.auth.dto.ResourceInfoDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
-import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.ApprovalWorkFlowDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthFlow;
-import com.dragoninfo.dcuc.auth.auth.enumresources.WokrFlowPermissionTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.service.IAuthFlowService;
 import com.dragoninfo.dcuc.auth.auth.service.IServiceAuthResultService;
 import com.dragoninfo.dcuc.auth.auth.service.impl.AuthFlowServiceImpl;
-import com.dragoninfo.dcuc.auth.config.DcucAuthServiceAuthConfig;
+import com.dragoninfo.dcuc.auth.config.DcucAuthApprovalConfig;
 import com.dragoninfo.dcuc.common.Constants;
 import com.dragoninfo.dcuc.common.http.HttpUtil;
 import com.dragoninfo.dcuc.org.entity.OrgInfo;
@@ -56,7 +56,7 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
     private IServiceAuthResultService authResultService;
 
     @Autowired
-    private DcucAuthServiceAuthConfig serviceAuthConfig;
+    private DcucAuthApprovalConfig serviceAuthConfig;
 
     @Autowired
     private IApplyInfoFacade applyInfoFacade;
@@ -123,7 +123,7 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
         //对撤销权限申请不做校验
         String flowStatus = WorkFlowStatusEnum.APPLYING.getValue();
         //生成消息id
-        dto.setMessageId(UUIDUtils.getUUID());
+        dto.setMessageId(UUIDUtils.getUUID()+ StrUtil.COLON + dto.getFlowType());
         //先保存工作单
         dto.setFlowStatus(flowStatus);
         //设置应用的管理单位和事权单位信息
@@ -154,11 +154,11 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
             if(!ResponseStatus.SUCCESS_CODE.equals(responseDTO.getStatusCode())){
                 //删除工单
                 authFlowService.delById(serviceAuthFlow.getId());
-                return new ResponseDTO(ResponseStatus.FAIL_CODE,"approve service faild :"+responseDTO.getMessage(),null);
+                responseDTO = new ResponseDTO(ResponseStatus.FAIL_CODE,"approve service faild :"+responseDTO.getMessage(),null);
             }
         } catch (Exception e) {
             logger.error("work flow push error.", e);
-            new ResponseDTO(ResponseStatus.FAIL_CODE,"push to work flow error",null);
+            responseDTO = new ResponseDTO(ResponseStatus.FAIL_CODE,"push to work flow error",null);
         }
         return responseDTO;
     }
@@ -206,23 +206,23 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
         resourceInfoDTO.setVisitorName(appName);
         resourceInfoDTO.setVisitResourceCode(serviceCodes);
         resourceInfoDTO.setVisitResourceName(serviceNames);
-        WorkFlowDTO workFlowDTO = new WorkFlowDTO();
-        BeanUtils.copyProperties(dto, workFlowDTO, "startTime", "endTime");
-        workFlowDTO.setFlowType(dto.getFlowType());
-        workFlowDTO.setResourceInfoDTO(resourceInfoDTO);
-        workFlowDTO.setOperateType("2");
-        workFlowDTO.setActivitiHolderList(dto.getActivitiHolderDTOSList());
-        if (WokrFlowPermissionTypeEnum.TEMP.getValue().equals(workFlowDTO.getPermissionValidType())) {
+        ApprovalWorkFlowDTO approvalWorkFlowDTO = new ApprovalWorkFlowDTO();
+        BeanUtils.copyProperties(dto, approvalWorkFlowDTO, "startTime", "endTime");
+        approvalWorkFlowDTO.setFlowType(dto.getFlowType());
+        approvalWorkFlowDTO.setResourceInfoDTO(resourceInfoDTO);
+        approvalWorkFlowDTO.setOperateType("2");
+        approvalWorkFlowDTO.setActivitiHolderList(dto.getActivitiHolderDTOSList());
+        if (WorkFlowPermissionTypeEnum.TEMP.getValue().equals(approvalWorkFlowDTO.getPermissionValidType())) {
             Date startTime = dto.getStartTime();
             Date endTime = dto.getEndTime();
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
             if (null != startTime) {
                 String startTimeStr = format.format(startTime);
-                workFlowDTO.setStartTime(startTimeStr);
+                approvalWorkFlowDTO.setStartTime(startTimeStr);
             }
             if (null != endTime) {
                 String endTimeStr = format.format(endTime);
-                workFlowDTO.setStartTime(endTimeStr);
+                approvalWorkFlowDTO.setStartTime(endTimeStr);
             }
         }
         List<Header> headers = new ArrayList<>();
@@ -247,7 +247,7 @@ public class ServiceAuthBusinessImpl implements IServiceAuthBusiness {
                 dto.getUserToken(),
                 dto.getAppToken(),
                 dto.getFlowType());
-        String postBody = JSON.toJSONString(workFlowDTO);
+        String postBody = JSON.toJSONString(approvalWorkFlowDTO);
         logger.info("work flow request body:{}", postBody);
 
         String response = HttpUtil.postJSON(serviceAuthConfig.getWorkflowUrl(), postBody, headers, null);

+ 26 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/facade/SelfAuthApplyFacade.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.auth.auth.facade;
+
+import com.dragoninfo.dcuc.auth.auth.business.ISelfAuthApplyBusiness;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@RestController
+@RequestMapping(value = "/dcuc/auth/selfAuthApplyFacade")
+public class SelfAuthApplyFacade implements ISelfAuthApplyFacade{
+
+    @Autowired
+    ISelfAuthApplyBusiness authApplyBusiness;
+
+
+    @Override
+    public ResponseStatus funApplySave(AppFunAuthApplyDTO authApplyDTO) {
+       return authApplyBusiness.funApplySave(authApplyDTO);
+    }
+}

+ 18 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/AppFunApplyRepository.java

@@ -0,0 +1,18 @@
+package com.dragoninfo.dcuc.auth.auth.repo;
+
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApply;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Repository
+public interface AppFunApplyRepository extends BaseRepository<AppFunApply,String> {
+
+
+
+
+
+}

+ 13 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/AppFunAuthResultRepository.java

@@ -0,0 +1,13 @@
+package com.dragoninfo.dcuc.auth.auth.repo;
+
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Repository
+public interface AppFunAuthResultRepository extends BaseRepository<AppFunAuthResult,String> {
+}

+ 13 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/repo/WorkFlowRepository.java

@@ -0,0 +1,13 @@
+package com.dragoninfo.dcuc.auth.auth.repo;
+
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Repository
+public interface WorkFlowRepository extends BaseRepository<WorkFlow, String> {
+}

+ 29 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IAppFunAuthApplyService.java

@@ -0,0 +1,29 @@
+package com.dragoninfo.dcuc.auth.auth.service;
+
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResourceDTO;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApply;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+
+import java.util.List;
+
+/**
+ * 应用功能权限申请业务类
+ * @author mazq
+ * @date 2021/7/8
+ */
+public interface IAppFunAuthApplyService {
+
+    /**
+     * 申请内容详细信息保存
+     * @param workFlow
+     * @param authResources
+     */
+    void saveAuthApplyDetail(WorkFlow workFlow, List<AppFunAuthResourceDTO> authResources);
+
+    /**
+     * 根据工单id查询授权内容
+     * @param applyId
+     * @return
+     */
+    List<AppFunApply> getByAuthApplyId(String applyId);
+}

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

@@ -0,0 +1,36 @@
+package com.dragoninfo.dcuc.auth.auth.service;
+
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApply;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragonsoft.duceap.core.search.Searchable;
+
+import java.util.List;
+
+/**
+ * 应用功能授权结果统一处理类
+ * @author mazq
+ * @date 2021/7/8
+ */
+public interface IAppFunAuthResultService {
+
+    /**
+     * 处理审批结果
+     * @param flow
+     * @param applyInfos
+     */
+    void dealAuthFlowResult(WorkFlow flow, List<AppFunApply> applyInfos);
+
+    /**
+     * 保存授权结果
+     * @param authResult
+     */
+    void save(AppFunAuthResult authResult);
+
+    /**
+     * 获取结果列表
+     * @param searchable
+     * @return
+     */
+    List<AppFunAuthResult> getResultList(Searchable searchable);
+}

+ 1 - 8
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IServiceAuthResultService.java

@@ -11,7 +11,7 @@ import org.springframework.data.domain.Page;
 import java.util.List;
 
 /**
- * 服务授权结果service
+ * 服务授权结果统一处理类
  *
  * @author mazq
  * @date 2020/11/26
@@ -26,13 +26,6 @@ public interface IServiceAuthResultService {
      */
     ServiceAuthResult saveAuthResult(ServiceAuthResult serviceAuthResult);
 
-    /**
-     * 查询全部
-     *
-     * @return List<ServiceAuthResult>
-     */
-    List<ServiceAuthResult> findAuthResultAll();
-
     /**
      * 根据appCode和serviceCode查询授权结果
      *

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

@@ -0,0 +1,41 @@
+package com.dragoninfo.dcuc.auth.auth.service;
+
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+
+/**
+ * 权限自主申请工单业务类
+ * @author mazq
+ * @date 2021/7/8
+ */
+public interface IWorkFlowService {
+
+    /**
+     * 保存工单
+     * @param authApplyDTO
+     * @return
+     */
+    WorkFlow saveWorkFlow(WorkFlowDTO authApplyDTO);
+
+    /**
+     * 推送工单到审批服务
+     * @param authApplyDTO
+     * @return
+     */
+    ResponseStatus pushToApproval(AppFunAuthApplyDTO authApplyDTO);
+
+    /**
+     * 根据messageId查询工单
+     * @param messageId
+     * @return
+     */
+    WorkFlow getByMessageId(String messageId);
+
+    /**
+     * 更新工单
+     * @param flow
+     */
+    void update(WorkFlow flow);
+}

+ 78 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AppFunAuthApplyServiceImpl.java

@@ -0,0 +1,78 @@
+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.dto.AppFunAuthResourceDTO;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApply;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragoninfo.dcuc.auth.auth.repo.AppFunApplyRepository;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthApplyService;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Service
+public class AppFunAuthApplyServiceImpl implements IAppFunAuthApplyService {
+
+    @Autowired
+    IApplyInfoFacade applyInfoFacade;
+
+    @Autowired
+    IAuthUserInfoService userInfoService;
+
+    @Autowired
+    AppFunApplyRepository applyRepository;
+
+
+    @Override
+    public void saveAuthApplyDetail(WorkFlow workFlow, List<AppFunAuthResourceDTO> authResources) {
+        if(CollectionUtils.isEmpty(authResources)) {
+            return;
+        }
+        AuthUserInfo userInfo = userInfoService.findByIdcard(workFlow.getApplicantIdcard());
+        List<String> appIds = authResources.stream()
+                .map(AppFunAuthResourceDTO::getAppId)
+                .distinct()
+                .collect(Collectors.toList());
+        List<ApplyInfo> appList = applyInfoFacade.getAppById(appIds);
+        Map<String, ApplyInfo> appIdMap = appList.stream()
+                .collect(Collectors.toMap(ApplyInfo::getApplyCode, item -> item, (old, last) -> last));
+        for (AppFunAuthResourceDTO resourceDTO : authResources) {
+            String appId = resourceDTO.getAppId();
+            ApplyInfo applyInfo = appIdMap.get(appId);
+            if(null == applyInfo) {
+                continue;
+            }
+            AppFunApply appFunApply = new AppFunApply();
+            appFunApply.setAppCode(applyInfo.getApplyCode());
+            appFunApply.setAppId(appId);
+            appFunApply.setAppName(applyInfo.getApplyName());
+            appFunApply.setFunCodes(resourceDTO.getFunCodes());
+            appFunApply.setFunNames(resourceDTO.getFunNames());
+            appFunApply.setAuthApplyId(workFlow.getId());
+            if(null != userInfo) {
+                appFunApply.setUserId(userInfo.getId());
+            }
+            applyRepository.save(appFunApply);
+        }
+    }
+
+    @Override
+    public List<AppFunApply> getByAuthApplyId(String applyId) {
+        AppFunApply query = new AppFunApply();
+        query.setAuthApplyId(applyId);
+        Example<AppFunApply> example = Example.of(query);
+        return applyRepository.findAll(example);
+    }
+}

+ 137 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AppFunAuthResultServiceImpl.java

@@ -0,0 +1,137 @@
+package com.dragoninfo.dcuc.auth.auth.service.impl;
+
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApply;
+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.enumresources.WorkFlowTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.repo.AppFunAuthResultRepository;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthResultService;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
+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.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Service
+public class AppFunAuthResultServiceImpl implements IAppFunAuthResultService {
+
+    @Autowired
+    AppFunAuthResultRepository authResultRepository;
+
+    @Override
+    public void dealAuthFlowResult(WorkFlow flow, List<AppFunApply> applyInfos) {
+        if(WorkFlowStatusEnum.SUCCESS.getValue().equals(flow.getFlowStatus())) {
+            if(WorkFlowTypeEnum.APP_FUN_AUTH.getValue().equals(flow.getFlowType())) {
+                approvalResult(flow, applyInfos);
+            } else {
+                cancelResult(flow, applyInfos);
+            }
+        }
+    }
+
+    private void cancelResult(WorkFlow flow, List<AppFunApply> applyInfos) {
+
+    }
+
+    private void approvalResult(WorkFlow flow, List<AppFunApply> applyInfos) {
+        if(CollectionUtils.isEmpty(applyInfos)) {
+            return;
+        }
+        for (AppFunApply applyInfo : applyInfos) {
+            String userId = applyInfo.getUserId();
+            String appId = applyInfo.getAppId();
+            Searchable searchable = Searchable.newSearchable();
+            searchable.addSearchFilter("user_id", SearchOperator.eq, userId);
+            searchable.addSearchFilter("app_id", SearchOperator.eq, appId);
+            List<AppFunAuthResult> exist =  getResultList(searchable);
+            Map<String, AppFunAuthResult> resultMap = exist.stream()
+                    .collect(Collectors.toMap(AppFunAuthResult::getFunCode, item -> item, (old, last) -> last));
+            addAuthApply(flow, applyInfo, resultMap);
+            delAuthExist(applyInfo,resultMap);
+        }
+
+    }
+
+    private void delAuthExist(AppFunApply applyInfo, Map<String, AppFunAuthResult> resultMap) {
+        String funCodes = applyInfo.getFunCodes();
+        List<String> applyFunCodes = Arrays.asList(funCodes.split(","));
+        Set<String> existFunCodes = resultMap.keySet();
+        for (String existFunCode : existFunCodes) {
+            if(!applyFunCodes.contains(existFunCode)) {
+                AppFunAuthResult authResult = resultMap.get(existFunCode);
+                authResultRepository.delete(authResult);
+            }
+        }
+
+    }
+
+    private void addAuthApply(WorkFlow flow, AppFunApply applyInfo, Map<String, AppFunAuthResult> resultMap) {
+        Set<String> existFunCodes = resultMap.keySet();
+        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();
+            }
+        }
+        String funCodes = applyInfo.getFunCodes();
+        String[] applyFunCodes = funCodes.split(",");
+        for (String funCode : applyFunCodes) {
+            if(!existFunCodes.contains(funCode)) {
+                AppFunAuthResult authResult = new AppFunAuthResult();
+                authResult.setAppId(appId);
+                authResult.setAppCode(applyInfo.getAppCode());
+                authResult.setAuthSource(flow.getApplySource());
+                authResult.setSourceId(flow.getMessageId());
+                authResult.setUserId(userId);
+                authResult.setFunCode(funCode);
+                authResult.setAuthStatus(authStatus);
+                authResult.setStartTime(startTime);
+                authResult.setEndTime(endTime);
+                save(authResult);
+            } else {
+                AppFunAuthResult authResult = resultMap.get(funCode);
+                authResult.setAuthSource(flow.getApplySource());
+                authResult.setSourceId(flow.getMessageId());
+                authResult.setAuthStatus(authStatus);
+                authResult.setStartTime(startTime);
+                authResult.setEndTime(endTime);
+                authResultRepository.update(authResult);
+            }
+        }
+    }
+
+    @Override
+    public void save(AppFunAuthResult authResult) {
+        authResult.setDeleted(BooleanEnum.FALSE.value);
+        authResultRepository.save(authResult);
+    }
+
+    @Override
+    public List<AppFunAuthResult> getResultList(Searchable searchable) {
+       return authResultRepository.findAll(searchable);
+    }
+}

+ 0 - 16
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AuthDataSyncDetailService.java

@@ -1,16 +0,0 @@
-package com.dragoninfo.dcuc.auth.auth.service.impl;
-
-import com.dragoninfo.dcuc.auth.auth.entity.AuthDataSyncDetail;
-import com.dragoninfo.dcuc.auth.auth.service.IAuthDataSyncDetailService;
-import com.dragonsoft.duceap.core.service.BaseService;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author wangrs
- * @date 2021-04-25
- */
-@Service
-@Transactional
-public class AuthDataSyncDetailService extends BaseService<AuthDataSyncDetail,String> implements IAuthDataSyncDetailService {
-}

+ 7 - 17
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ServiceAuthResultServiceImpl.java

@@ -15,8 +15,8 @@ import com.dragoninfo.dcuc.auth.auth.dto.AppServiceCodeDto;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthFlow;
 import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthResult;
-import com.dragoninfo.dcuc.auth.auth.enumresources.ServiceAuthStatusEnum;
-import com.dragoninfo.dcuc.auth.auth.enumresources.WokrFlowPermissionTypeEnum;
+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.enumresources.WorkFlowTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.po.ServiceAuthResultPO;
@@ -105,16 +105,6 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
         }
     }
 
-    /**
-     * 查询全部
-     *
-     * @return List<ServiceAuthResult>
-     */
-    @Override
-    public List<ServiceAuthResult> findAuthResultAll() {
-        return serviceAuthResultBPO.findAll();
-    }
-
     /**
      * 根据工单内容新增或删除服务授权结果
      *
@@ -208,17 +198,17 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
         //判断工作单是长期还是自定义
         Date startTime = null;
         Date endTime = null;
-        String authStatus = ServiceAuthStatusEnum.START.getValue();
+        String authStatus = AuthStatusEnum.START.getValue();
         String permissionValidType = serviceAuthFlow.getPermissionValidType();
         if (StringUtils.isNotBlank(permissionValidType)
-                && WokrFlowPermissionTypeEnum.TEMP.getValue().equals(permissionValidType)) {
+                && WorkFlowPermissionTypeEnum.TEMP.getValue().equals(permissionValidType)) {
             startTime = serviceAuthFlow.getStartTime();
             endTime = serviceAuthFlow.getEndTime();
             if (date.before(startTime)) {
-                authStatus = ServiceAuthStatusEnum.NOT_START.getValue();
+                authStatus = AuthStatusEnum.NOT_START.getValue();
             }
             if (date.after(endTime)) {
-                authStatus = ServiceAuthStatusEnum.OVER_DUE.getValue();
+                authStatus = AuthStatusEnum.OVER_DUE.getValue();
             }
         }
         //授权工作单
@@ -580,7 +570,7 @@ 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, ServiceAuthStatusEnum.START.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())

+ 156 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/WorkFlowServiceImpl.java

@@ -0,0 +1,156 @@
+package com.dragoninfo.dcuc.auth.auth.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.dragoninfo.dcuc.auth.auth.dto.*;
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.repo.WorkFlowRepository;
+import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
+import com.dragoninfo.dcuc.auth.config.DcucAuthApprovalConfig;
+import com.dragoninfo.dcuc.common.Constants;
+import com.dragoninfo.dcuc.common.http.HttpUtil;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.Header;
+import org.apache.http.message.BasicHeader;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Service;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@Slf4j
+@Service
+public class WorkFlowServiceImpl implements IWorkFlowService {
+
+    @Autowired
+    WorkFlowRepository workFlowRepository;
+
+    @Autowired
+    DcucAuthApprovalConfig approvalConfig;
+
+    @Override
+    public WorkFlow saveWorkFlow(WorkFlowDTO dto) {
+        WorkFlow workFlow = new WorkFlow();
+        BeanUtils.copyProperties(dto, workFlow);
+        workFlow.setDeleted(BooleanEnum.FALSE.value);
+        return workFlowRepository.save(workFlow);
+    }
+
+    @Override
+    public ResponseStatus pushToApproval(AppFunAuthApplyDTO authApplyDTO) {
+        WorkFlowDTO workFlowDTO = authApplyDTO.getWorkFlow();
+        ApprovalWorkFlowDTO approvalWorkFlowDTO = new ApprovalWorkFlowDTO();
+        BeanUtils.copyProperties(workFlowDTO, approvalWorkFlowDTO, "resourceInfoDTO", "startTime", "endTime");
+        List<AppFunAuthResourceDTO> authResourceInfos = authApplyDTO.getResourceInfos();
+        String applicantIdcard = authApplyDTO.getWorkFlow().getApplicantIdcard();
+        String applicantName = authApplyDTO.getWorkFlow().getApplicantName();
+        ResourceInfoDTO resourceInfoDTO = new ResourceInfoDTO();
+        resourceInfoDTO.setVisitorName(applicantName);
+        resourceInfoDTO.setVisitorCode(applicantIdcard);
+
+        String funCodes = authResourceInfos.stream()
+                .map(AppFunAuthResourceDTO::getFunCodes)
+                .collect(Collectors.joining(StrUtil.COLON));
+        String funNames = authResourceInfos.stream()
+                .map(AppFunAuthResourceDTO::getFunNames)
+                .collect(Collectors.joining(StrUtil.COLON));
+        funCodes = funCodes.replaceAll(StrUtil.COMMA, StrUtil.SLASH).replaceAll(StrUtil.COLON, StrUtil.COMMA);
+        funNames = funNames.replaceAll(StrUtil.COMMA, StrUtil.SLASH).replaceAll(StrUtil.COLON, StrUtil.COMMA);
+        resourceInfoDTO.setVisitResourceCode(funCodes);
+        resourceInfoDTO.setVisitResourceName(funNames);
+        approvalWorkFlowDTO.setResourceInfoDTO(resourceInfoDTO);
+
+        if (WorkFlowPermissionTypeEnum.TEMP.getValue().equals(approvalWorkFlowDTO.getPermissionValidType())) {
+            Date startTime = workFlowDTO.getStartTime();
+            Date endTime = workFlowDTO.getEndTime();
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+            if (null != startTime) {
+                String startTimeStr = format.format(startTime);
+                approvalWorkFlowDTO.setStartTime(startTimeStr);
+            }
+            if (null != endTime) {
+                String endTimeStr = format.format(endTime);
+                approvalWorkFlowDTO.setStartTime(endTimeStr);
+            }
+        }
+
+        List<Header> headers = new ArrayList<>();
+        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+        String userToken = "";
+        String appToken = "";
+        if (requestAttributes != null) {
+            ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
+            HttpServletRequest request = servletRequestAttributes.getRequest();
+            userToken = request.getHeader(Constants.USER_TOKEN);
+            appToken = request.getHeader(Constants.APP_TOKEN);
+            BasicHeader appTokenHeader = new BasicHeader(Constants.BUS_SRA_TOKEN, appToken);
+            BasicHeader userTokenHeader = new BasicHeader(Constants.BUS_SRE_TOKEN, userToken);
+            headers.add(appTokenHeader);
+            headers.add(userTokenHeader);
+        }
+
+        String idcard = UserContextUtils.getCurrentUser().getIdcard();
+        BasicHeader busSreIdcardHeader = new BasicHeader(Constants.BUS_SRE_IDCARD , idcard);
+        BasicHeader busSraIdHeader = new BasicHeader("bus_sra_id", approvalConfig.getBusSraId());
+        BasicHeader busServiceIdHeader = new BasicHeader("bus_service_id", approvalConfig.getBusServiceId());
+        BasicHeader busServiceFuncHeader = new BasicHeader("bus_service_func", approvalConfig.getBusServiceFunc());
+        headers.add(busSraIdHeader);
+        headers.add(busSreIdcardHeader);
+        headers.add(busServiceIdHeader);
+        headers.add(busServiceFuncHeader);
+        log.info("work flow push url:{}, busSraId:{}, busSreIdcard:{}, busServiceId:{}, busServiceFunc:{},userToken:{},appToken:{},flowType:{}",
+                approvalConfig.getWorkflowUrl(),
+                approvalConfig.getBusSraId(),
+                idcard,
+                approvalConfig.getBusServiceId(),
+                approvalConfig.getBusServiceFunc(),
+                userToken,
+                appToken,
+                workFlowDTO.getFlowType());
+        String postBody = JSON.toJSONString(approvalWorkFlowDTO);
+        log.info("work flow request body:{}", postBody);
+
+        String response = HttpUtil.postJSON(approvalConfig.getWorkflowUrl(), postBody, headers, null);
+        if(StringUtils.isBlank(response)) {
+            return new ResponseStatus(ResponseStatus.FAIL_CODE,"push to approve service failed");
+        }
+
+        log.info("work flow push result:{}", response);
+        return JSON.parseObject(response, ResponseStatus.class);
+    }
+
+    @Override
+    public WorkFlow getByMessageId(String messageId) {
+        if(StringUtils.isBlank(messageId)) {
+            return null;
+        }
+        WorkFlow query = new WorkFlow();
+        query.setMessageId(messageId);
+        Example<WorkFlow> example = Example.of(query);
+        return workFlowRepository.findOne(example).orElse(null);
+    }
+
+    @Override
+    public void update(WorkFlow flow) {
+        workFlowRepository.update(flow);
+    }
+
+}

+ 1 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/config/DcucAuthServiceAuthConfig.java → dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/config/DcucAuthApprovalConfig.java

@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
 @Data
 @Component
 @ConfigurationProperties(prefix = "dcuc.auth.service-auth")
-public class DcucAuthServiceAuthConfig {
+public class DcucAuthApprovalConfig {
     /**
      * 审批服务推送工单url
      */

+ 13 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/msg/WorkFlowResultListener.java

@@ -1,9 +1,10 @@
 package com.dragoninfo.dcuc.auth.msg;
 
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
+import com.dragoninfo.dcuc.auth.auth.business.IAuthAprResultBusiness;
 import com.dragoninfo.dcuc.auth.auth.business.IServiceAuthBusiness;
 import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
-import com.dragoninfo.dcuc.auth.auth.enumresources.ApproveResultEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
 import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
 import com.dragonsoft.mq.client.model.entity.MessageInfoDTO;
@@ -30,6 +31,9 @@ public class WorkFlowResultListener {
     @Autowired
     private IServiceAuthBusiness serviceAuthBusiness;
 
+    @Autowired
+    private IAuthAprResultBusiness aprResultBusiness;
+
     @KafkaListener(topics = "${dcuc.auth.service-auth.topic}",containerFactory = "kafkaListenerContainerFactory")
     public void receiveMessage(ConsumerRecord<String, byte[]> record) {
         try {
@@ -56,12 +60,18 @@ public class WorkFlowResultListener {
                 logger.info("status enum is null");
                 return;
             }
+            String messageId = map.get("messageId");
             WorkFlowResutlAcceptDTO dto = new WorkFlowResutlAcceptDTO();
-            dto.setMessageId(map.get("messageId"));
+            dto.setMessageId(messageId);
             dto.setProcessInstanceId(map.get("processInstanceId"));
             dto.setApproveResult(statusEnum.getValue());
             logger.info("WorkFlowResultListener------ work flow dto:{}", JSON.toJSONString(dto));
-            serviceAuthBusiness.dealAuthFlowResult(dto);
+            //兼容未处理过的messageId
+            if(!messageId.contains(StrUtil.COLON)) {
+                serviceAuthBusiness.dealAuthFlowResult(dto);
+            } else {
+                aprResultBusiness.dealAuthFlowResult(dto);
+            }
         } catch (Exception e) {
             logger.error("receiveMessage error.", e);
         }

+ 1 - 1
pom.xml

@@ -4,7 +4,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.dragoninfo</groupId>
-    <version>2.3.1-tjdsj-SNAPSHOT</version>
+    <version>2.3.2-tjdsj-SNAPSHOT</version>
     <artifactId>dcuc-auth</artifactId>
     <packaging>pom</packaging>
     <modules>