Jelajahi Sumber

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

应用功能权限自助申请
mazq 4 tahun lalu
induk
melakukan
338f62e6c0

+ 2 - 2
pom.xml

@@ -5,7 +5,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.dragoninfo</groupId>
     <artifactId>dcuc-auth-back</artifactId>
-    <version>2.3.1-tjdsj-SNAPSHOT</version>
+    <version>2.3.2-tjdsj-SNAPSHOT</version>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -113,7 +113,7 @@
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-auth-api</artifactId>
-            <version>2.3.1-tjdsj-SNAPSHOT</version>
+            <version>2.3.2-tjdsj-SNAPSHOT</version>
         </dependency>
         <!--redis缓存-->
         <dependency>

+ 2 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/WorkFlowApiController.java

@@ -5,7 +5,7 @@ import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
 import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.AuthFlowRepeatCheckVo;
-import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceAuthInfoVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthFlowAcceptVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.WorkFlowResutlAcceptVo;
 import com.dragoninfo.dcuc.common.Constants;
@@ -138,7 +138,7 @@ public class WorkFlowApiController {
      * 设置申请单appCode和serviceCode信息
      */
     private void setAppServiceInfo(ServiceAuthFlowDTO dto, ServiceAuthFlowAcceptVo serviceAuthFlowVo) {
-        ResourceAuthInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
+        ResourceInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
         dto.setAppName(resourceInfo.getVisitorName());
         dto.setAppCode(resourceInfo.getVisitorCode());
         dto.setServiceCodes(resourceInfo.getVisitResourceCode());

+ 1 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ResourceAuthInfoVo.java → src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ResourceInfoVo.java

@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank;
  */
 @ApiModel(value = "资源信息")
 @Data
-public class ResourceAuthInfoVo {
+public class ResourceInfoVo {
 
     /**
      * 应用编码

+ 1 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ServiceAuthFlowAcceptVo.java

@@ -106,7 +106,7 @@ public class ServiceAuthFlowAcceptVo {
     @ApiModelProperty(value = "访问资源信息实体类")
     @Valid
     @NotNull
-    private ResourceAuthInfoVo resourceInfo;
+    private ResourceInfoVo resourceInfo;
 
     /**
      * 工作单类型

+ 2 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/controller/WorkFlowApiV2Controller.java

@@ -4,7 +4,7 @@ import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.app.facade.IServiceResourceFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
 import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
-import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceAuthInfoVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthFlowAcceptVo;
 import com.dragoninfo.dcuc.common.Constants;
 import com.dragoninfo.dcuc.common.entity.ApiResult;
@@ -87,7 +87,7 @@ public class WorkFlowApiV2Controller {
      * 设置申请单appCode和serviceCode信息
      */
     private void setAppServiceInfo(ServiceAuthFlowDTO dto, ServiceAuthFlowAcceptVo serviceAuthFlowVo) {
-        ResourceAuthInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
+        ResourceInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
         dto.setAppName(resourceInfo.getVisitorName());
         dto.setAppCode(resourceInfo.getVisitorCode());
         dto.setServiceCodes(resourceInfo.getVisitResourceCode());

+ 2 - 4
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v3/controller/WorkFlowApiV3Controller.java

@@ -4,11 +4,9 @@ import com.auth0.jwt.JWT;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.dragoninfo.dcuc.auth.auth.dto.ActivitiHolderDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
-import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowApplyTypeEnum;
-import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ActivitiHolderVo;
-import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceAuthInfoVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthFlowAcceptVo;
 import com.dragoninfo.dcuc.common.Constants;
 import com.dragoninfo.dcuc.common.entity.ApiResult;
@@ -114,7 +112,7 @@ public class WorkFlowApiV3Controller {
      * 设置申请单appCode和serviceCode信息
      */
     private void setAppServiceInfo(ServiceAuthFlowDTO dto, ServiceAuthFlowAcceptVo serviceAuthFlowVo) {
-        ResourceAuthInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
+        ResourceInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
         dto.setAppName(resourceInfo.getVisitorName());
         dto.setAppCode(resourceInfo.getVisitorCode());
         dto.setServiceCodes(resourceInfo.getVisitResourceCode());

+ 75 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/controller/SelfAuthAppLyController.java

@@ -0,0 +1,75 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResultDTO;
+import com.dragoninfo.dcuc.auth.auth.facade.IFunAuthResultFacade;
+import com.dragoninfo.dcuc.auth.auth.facade.ISelfAuthApplyFacade;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthApplyVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthResultVo;
+import com.dragoninfo.duceap.core.response.Result;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.core.search.Searchable;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RestController;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+/**
+ * @author mazq
+ * @date 2021/7/7
+ */
+@Api(tags = "权限自助申请接口")
+@RestController
+@RequestMapping(value = "/authsvr/v2/selfauth")
+public class SelfAuthAppLyController {
+
+    @Autowired
+    ISelfAuthApplyFacade selfAuthApplyFacade;
+
+    @Autowired
+    IFunAuthResultFacade appFunResultFacade;
+
+
+    @ApiOperation(value = "应用功能授权申请保存")
+    @PostMapping(value = "funApplySave")
+    public Result funApplySave(@RequestBody AppFunAuthApplyVo vo) {
+        AppFunAuthApplyDTO authApplyDTO = convertToAuthApplyDTO(vo);
+        ResponseStatus status = selfAuthApplyFacade.funApplySave(authApplyDTO);
+        if(status.getStatusCode().equals(ResponseStatus.SUCCESS_CODE)) {
+            return Result.success();
+        } else {
+            return Result.fail(status.getMessage());
+        }
+    }
+
+    private AppFunAuthApplyDTO convertToAuthApplyDTO(AppFunAuthApplyVo vo) {
+        String jsonString = JSON.toJSONString(vo);
+        return JSON.parseObject(jsonString, AppFunAuthApplyDTO.class);
+    }
+
+
+    @ApiOperation(value = "应用功能权限结果列表")
+    @ApiImplicitParam(name = "searchable", value = "searchable 查询条件")
+    @PostMapping(value = "funAuthList")
+    public Result<List<AppFunAuthResultVo>> funAuthList(Searchable searchable){
+       List<AppFunAuthResultDTO> authResultList = appFunResultFacade.findList(searchable.toSearchDTO());
+       List<AppFunAuthResultVo> resultVos = authResultList.stream().map(item -> {
+            AppFunAuthResultVo resultVo = new AppFunAuthResultVo();
+            BeanUtils.copyProperties(item, resultVo);
+            return resultVo;
+       }).collect(Collectors.toList());
+       return Result.success(resultVos);
+    }
+
+
+}

+ 24 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/vo/AppFunAuthApplyVo.java

@@ -0,0 +1,24 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@ApiModel(value = "应用功能权限自助申请Vo")
+@Data
+public class AppFunAuthApplyVo {
+
+    @ApiModelProperty(value = "工作流申请vo")
+    private WorkFlowVo workFlow;
+
+
+    @ApiModelProperty(value = "需要申请权限的应用菜单和功能集合")
+    private List<AppFunAuthResourceVo> resourceInfos;
+
+}

+ 27 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/vo/AppFunAuthResourceVo.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@ApiModel(value = "应用功能申请资源Vo")
+@Data
+public class AppFunAuthResourceVo {
+
+    @ApiModelProperty(value = "应用id")
+    private String appId;
+
+    @ApiModelProperty(value = "应用名称")
+    private String appName;
+
+    @ApiModelProperty(value = "功能code,多个使用','隔开")
+    private String funCodes;
+
+    @ApiModelProperty(value = "功能名称,多个使用','隔开")
+    private String funNames;
+
+}

+ 56 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/vo/AppFunAuthResultVo.java

@@ -0,0 +1,56 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo;
+
+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 java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2021/7/9
+ */
+@ApiModel(value = "应用功能授权结果Vo")
+@Data
+public class AppFunAuthResultVo {
+
+    @ApiModelProperty(value = "主键")
+    private String id;
+
+    @ApiModelProperty(value = "人员id")
+    private String userId ;
+
+    @ApiModelProperty(value = "应用id")
+    private String appId ;
+
+    @ApiModelProperty(value = "应用code")
+    private String appCode ;
+
+    @ApiModelProperty(value = "功能id")
+    private String funId ;
+
+    @ApiModelProperty(value = "功能code")
+    private String funCode ;
+
+    @ApiModelProperty(value = "权限开始时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date startTime ;
+
+    @ApiModelProperty(value = "权限结束时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date endTime ;
+
+    @ApiModelProperty(value = "权限起停用状态")
+    private String authStatus ;
+
+    @ApiModelProperty(value = "权限结果来源")
+    private String authSource ;
+
+    @ApiModelProperty(value = "来源对象标识")
+    private String sourceId ;
+
+}

+ 76 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/vo/WorkFlowVo.java

@@ -0,0 +1,76 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo;
+
+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 java.util.Date;
+
+/**
+ * @author mazq
+ * @date 2021/7/8
+ */
+@ApiModel(value = "权限申请工作流Vo")
+@Data
+public class WorkFlowVo {
+
+    @ApiModelProperty(value = "流程审批号(申请单号)")
+    private String applicantId;
+
+    @ApiModelProperty(value = "申请人身份证号")
+    private String applicantIdcard;
+
+    @ApiModelProperty(value = "申请人姓名")
+    private String applicantName;
+
+    @ApiModelProperty(value = "申请人联系方式")
+    private String applicantPhoneNo;
+
+    @ApiModelProperty(value = "申请人单位编码")
+    private String applicantOrgCode;
+
+    @ApiModelProperty(value = "申请人单位名称")
+    private String applicantOrgName;
+
+    @ApiModelProperty(value = "申请内容")
+    private String applyContent;
+
+    @ApiModelProperty(value = "申请理由")
+    private String applyReason;
+
+    @ApiModelProperty(value = "申请单来源平台")
+    private String applySource;
+
+    @ApiModelProperty(value = "权限申请单类型")
+    private String flowType;
+
+    @ApiModelProperty(value = "流程标识码")
+    private String businessCode;
+
+    @ApiModelProperty(value = "流程类型")
+    private String processType;
+
+    @ApiModelProperty(value = "流程名称")
+    private String processName;
+
+    @ApiModelProperty(value = "权限有效起始时间(2020-01-01 00:00:00)")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date startTime;
+
+    @ApiModelProperty(value = "权限有效终止时间(2020-01-01 00:00:00)")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date endTime;
+
+    @ApiModelProperty(value = "权限有效类型 01:自定义 | 02:长期")
+    private String permissionValidType;
+
+    @ApiModelProperty(value = "操作类型 1:保存  2:提交")
+    private String operateType;
+
+
+
+}