Explorar o código

[Feature] 工单增加 挂起、激活、终止 操作 V1.1

AA hai 7 meses
pai
achega
50cdb5dcc2

+ 87 - 0
src/main/java/com/dragoninfo/dcuc/auth/auth/dto/WorkFlowPageViewDTO.java

@@ -0,0 +1,87 @@
+package com.dragoninfo.dcuc.auth.auth.dto;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 权限申请工单列表DTO
+ * @author mazq
+ * @date 2021/7/14
+ */
+@Data
+public class WorkFlowPageViewDTO {
+
+    /**
+     * 主键id
+     */
+    private String id;
+
+    /**
+     * 审批单标题
+     */
+    private String flowTitle;
+
+    /**
+     * 审批类型
+     */
+    private String applyType;
+
+    /**
+     * 未操作者
+     */
+    private String dealOperator;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 当前节点
+     */
+    private String taskName;
+
+    /**
+     * 流程审批单号
+     */
+    private String applyOrdNo;
+
+    /**
+     * 是否可撤回
+     */
+    private Boolean showRecall;
+
+    /**
+     * 是否可挂起
+     */
+    private Boolean showSuspend;
+
+    /**
+     * 是否可激活
+     */
+    private Boolean showActivate;
+
+    /**
+     * 是否可终止
+     */
+    private Boolean showStop;
+
+    /**
+     * 是否可退回
+     */
+    private Boolean showBack;
+
+    /**
+     * 是否可编辑
+     */
+    private Boolean showEdit;
+
+    /**
+     * 流程状态
+     * todo: 临时用,需修改
+     */
+    private String flowStatus;
+
+
+}

+ 37 - 0
src/main/java/com/dragoninfo/dcuc/auth/auth/facade/IAuthApplyActionFacade.java

@@ -0,0 +1,37 @@
+package com.dragoninfo.dcuc.auth.auth.facade;
+
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 权限申请api
+ *
+ * @author mazq
+ * @date 2021/7/8
+ */
+@FeignClient(name = "dcuc-auth", path = "/dcuc/auth/selfAuthApplyFacade")
+public interface IAuthApplyActionFacade {
+
+    /**
+     * 通用
+     * 工单挂起
+     */
+    @GetMapping("authApplySuspend")
+    ResponseStatus authApplySuspend(@RequestParam("applyOrdNo") String applyOrdNo);
+
+    /**
+     * 通用
+     * 工单激活
+     */
+    @GetMapping("authApplyActivate")
+    ResponseStatus authApplyActivate(@RequestParam("applyOrdNo") String applyOrdNo);
+
+    /**
+     * 通用
+     * 工单终止
+     */
+    @GetMapping("authApplyStop")
+    ResponseStatus authApplyStop(@RequestParam("applyOrdNo") String applyOrdNo);
+}

+ 80 - 23
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/controller/SelfAuthAppLyController.java

@@ -1,12 +1,35 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.controller;
 
 import com.alibaba.fastjson.JSON;
-import com.dragoninfo.dcuc.auth.auth.dto.*;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunApplyUpdateDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResourceDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResultDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.ApprovalSuggestionDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.FlowDefineInfoDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.FunApplyDetailDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessNodeDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessPicDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessStatusDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowDTO;
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowPageViewDTO;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowSourceEnum;
+import com.dragoninfo.dcuc.auth.auth.facade.IAuthApplyActionFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IAuthApplyFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IFunAuthResultFacade;
 import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
-import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.*;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunApplyUpdateVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthApplyVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthResourceVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthResultVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.ApprovalSuggestionVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.FlowDefineInfoVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.FunApplyDetailVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.ProcessNodeVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.ProcessPicVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.ProcessStatusVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.WorkFlowPageViewVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.WorkFlowVo;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
@@ -21,12 +44,21 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+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 org.springframework.web.bind.annotation.RestController;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
-
 /**
  * @author mazq
  * @date 2021/7/7
@@ -39,6 +71,9 @@ public class SelfAuthAppLyController {
     @Autowired
     IAuthApplyFacade selfAuthApplyFacade;
 
+    @Autowired
+    IAuthApplyActionFacade selfAuthApplyActionFacade;
+
     @Autowired
     IFunAuthResultFacade appFunResultFacade;
 
@@ -47,7 +82,7 @@ public class SelfAuthAppLyController {
             "createTime ge (大于等于); createTime le (小于等于)时间格式:yyyy-MM-dd HH:mm:ss")
     @PostMapping(value = "authApplySearch")
     public Result<List<WorkFlowPageViewVo>> authApplySearch(Searchable searchable) {
-        if(null == searchable) {
+        if (null == searchable) {
             searchable = Searchable.newSearchable();
         }
         searchable.addSearchFilter("applySource", SearchOperator.eq, WorkFlowSourceEnum.SELF_AUTH_APPLY.getValue());
@@ -68,6 +103,30 @@ public class SelfAuthAppLyController {
         return dealResult(status);
     }
 
+    @ApiOperation(value = "权限申请单挂起")
+    @ApiImplicitParam(name = "id", value = "工作流审批单号")
+    @GetMapping(value = "authApplySuspend")
+    public Result authApplySuspend(@RequestParam("applyOrdNo") String applyOrdNo) {
+        ResponseStatus status = selfAuthApplyActionFacade.authApplySuspend(applyOrdNo);
+        return dealResult(status);
+    }
+
+    @ApiOperation(value = "权限申请单激活")
+    @ApiImplicitParam(name = "id", value = "工作流审批单号")
+    @GetMapping(value = "authApplyActivate")
+    public Result authApplyActivate(@RequestParam("applyOrdNo") String applyOrdNo) {
+        ResponseStatus status = selfAuthApplyActionFacade.authApplyActivate(applyOrdNo);
+        return dealResult(status);
+    }
+
+    @ApiOperation(value = "权限申请单终止")
+    @ApiImplicitParam(name = "id", value = "工作流审批单号")
+    @GetMapping(value = "authApplyStop")
+    public Result authApplyStop(@RequestParam("applyOrdNo") String applyOrdNo) {
+        ResponseStatus status = selfAuthApplyActionFacade.authApplyStop(applyOrdNo);
+        return dealResult(status);
+    }
+
     @ApiOperation(value = "权限申请单删除")
     @ApiImplicitParam(name = "applyOrdNo", value = "工作流审批单号")
     @DeleteMapping(value = "authApplyDelete")
@@ -76,7 +135,6 @@ public class SelfAuthAppLyController {
         return dealResult(status);
     }
 
-
     @ApiOperation(value = "应用功能授权申请保存")
     @PostMapping(value = "funApplySave")
     public Result funApplySave(@RequestBody AppFunAuthApplyVo vo) {
@@ -98,7 +156,7 @@ public class SelfAuthAppLyController {
         }
     }
 
-    private Date getEndTime(Date endTime) {
+    private static Date getEndTime(Date endTime) {
         if (null != endTime) {
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(endTime);
@@ -118,7 +176,7 @@ public class SelfAuthAppLyController {
     @GetMapping(value = "funApplyDetail")
     public Result<FunApplyDetailVo> funApplyDetail(@RequestParam("applyOrdNo") String applyOrdNo,
                                                    @RequestParam(value = "needFlowInfo", required = false) Boolean needFlowInfo) {
-        if(null == needFlowInfo) {
+        if (null == needFlowInfo) {
             needFlowInfo = false;
         }
         FunApplyDetailDTO detailDTO = selfAuthApplyFacade.funApplyDetail(applyOrdNo, needFlowInfo);
@@ -143,13 +201,12 @@ public class SelfAuthAppLyController {
         List<AppFunAuthResourceDTO> delResourceInfos = detailDTO.getDelResourceInfos();
         List<AppFunAuthResourceVo> delVoList = Optional.ofNullable(delResourceInfos).orElse(new ArrayList<>())
                 .stream().map(item -> {
-            AppFunAuthResourceVo resourceVo = new AppFunAuthResourceVo();
-            BeanUtils.copyProperties(item, resourceVo);
-            return resourceVo;
-        }).collect(Collectors.toList());
+                    AppFunAuthResourceVo resourceVo = new AppFunAuthResourceVo();
+                    BeanUtils.copyProperties(item, resourceVo);
+                    return resourceVo;
+                }).collect(Collectors.toList());
         detailVo.setDelResourceInfos(delVoList);
 
-
         List<AppFunAuthResourceDTO> existResourceInfos = detailDTO.getExistResourceInfos();
         List<AppFunAuthResourceVo> existVoList = Optional.ofNullable(existResourceInfos).orElse(new ArrayList<>())
                 .stream().map(item -> {
@@ -164,7 +221,7 @@ public class SelfAuthAppLyController {
 
     @ApiOperation(value = "应用功能权限申请修改")
     @PostMapping(value = "funApplyUpdate")
-    public Result funApplyUpdate(@RequestBody AppFunApplyUpdateVo vo){
+    public Result funApplyUpdate(@RequestBody AppFunApplyUpdateVo vo) {
         String jsonString = JSON.toJSONString(vo);
         AppFunApplyUpdateDTO updateDTO = JSON.parseObject(jsonString, AppFunApplyUpdateDTO.class);
         Date endTime = getEndTime(updateDTO.getEndTime());
@@ -176,14 +233,14 @@ public class SelfAuthAppLyController {
     @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 -> {
+    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);
+        }).collect(Collectors.toList());
+        return Result.success(resultVos);
     }
 
     @ApiOperation(value = "获取申请人已被授权的功能id")
@@ -193,7 +250,7 @@ public class SelfAuthAppLyController {
     })
     @GetMapping(value = "userHasAuthFunIds")
     public Result<List<String>> userHasAuthFunIds(@RequestParam("userId") String userId,
-                                                  @RequestParam(value = "appId" ,required = false) String appId) {
+                                                  @RequestParam(value = "appId", required = false) String appId) {
         List<String> funIds = appFunResultFacade.userHasAuthFunIds(userId, appId);
         return Result.success(funIds);
     }
@@ -201,7 +258,7 @@ public class SelfAuthAppLyController {
     @ApiOperation(value = "查询审批流程意见")
     @ApiImplicitParam(name = "applyOrdNo", value = "工作流审批单号")
     @GetMapping(value = "approvalSuggestion")
-    public Result<List<ApprovalSuggestionVo>> approvalSuggestion(@RequestParam(value = "applyOrdNo") String applyOrdNo){
+    public Result<List<ApprovalSuggestionVo>> approvalSuggestion(@RequestParam(value = "applyOrdNo") String applyOrdNo) {
         List<ApprovalSuggestionDTO> dtoList = selfAuthApplyFacade.approvalSuggestion(applyOrdNo);
         List<ApprovalSuggestionVo> collect = dtoList.stream().map(item -> {
             ApprovalSuggestionVo suggestionVo = new ApprovalSuggestionVo();
@@ -255,7 +312,7 @@ public class SelfAuthAppLyController {
     @GetMapping("flowDefineInfo")
     public Result<FlowDefineInfoVo> getFlowDefineInfo(@RequestParam(value = "applyType") String applyType) {
         ResponseDTO<FlowDefineInfoDTO> status = selfAuthApplyFacade.getFlowDefineInfo(applyType);
-        if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
+        if (!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
             return Result.fail(status.getStatusCode(), status.getMessage());
         } else {
             FlowDefineInfoDTO dto = (FlowDefineInfoDTO) status.getResult();

+ 15 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/selfauth/vo/WorkFlowPageViewVo.java

@@ -16,7 +16,6 @@ import java.util.Date;
 @Data
 public class WorkFlowPageViewVo {
 
-
     @ApiModelProperty(value = "主键id")
     private String id;
 
@@ -49,5 +48,20 @@ public class WorkFlowPageViewVo {
     @ApiModelProperty(value = "是否可编辑")
     private Boolean showEdit;
 
+    @ApiModelProperty(value = "是否可挂起")
+    private Boolean showSuspend;
+
+    @ApiModelProperty(value = "是否可激活")
+    private Boolean showActivate;
+
+    @ApiModelProperty(value = "是否可终止")
+    private Boolean showStop;
+
+    /**
+     * 流程状态
+     * todo: 临时用,需修改
+     */
+    @ApiModelProperty(value = "流程状态")
+    private String flowStatus;
 
 }