ソースを参照

流程功能测试

wangliang 1 年間 前
コミット
12bec1c142

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/activiti/service/ActivitiService.java

@@ -49,7 +49,7 @@ public interface ActivitiService {
                                            FlowApprovePassEnum approve,
                                            Long taskId,
                                            String formProperties,
-                                           List<Long> approveUserIds,
+                                           List<String> approveUserIds,
                                            String approveRemark,
                                            Map<String, Object> map);
 

+ 5 - 10
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -44,7 +44,6 @@ import org.springframework.util.CollectionUtils;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.*;
-import java.util.stream.Collectors;
 import java.util.zip.ZipInputStream;
 
 /**
@@ -136,16 +135,12 @@ public class ActivitiServiceImpl implements ActivitiService {
                                            FlowApprovePassEnum approve,
                                            Long taskId,
                                            String formProperties,
-                                           List<Long> approveUserIds,
+                                           List<String> approveUserIds,
                                            String approveRemark,
                                            Map<String, Object> map) {
         List<String> approveIdList = new ArrayList<>();
-        if (!CollectionUtils.isEmpty(approveUserIds)) {
-            approveIdList = approveUserIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList());
-        } else {
-            if (approve == FlowApprovePassEnum.START || approve == FlowApprovePassEnum.DRAFT || approve == FlowApprovePassEnum.PASS) {
-                approveIdList.add("123");//否则是当前登录用户
-            }
+        if (CollectionUtils.isEmpty(approveUserIds) && approve == FlowApprovePassEnum.START || approve == FlowApprovePassEnum.DRAFT || approve == FlowApprovePassEnum.PASS) {
+            approveIdList.add("123");//否则是当前登录用户
         }
         String processFlowId = null;
         TFCustomFlowEntity tfCustomFlowEntity = null;
@@ -460,7 +455,7 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Override
     @Transactional
     public void flowEnd(Long flowId) {
-        boolean lock = memoryLock.lock(SystemConstant.LOCK_FLOW_TASK_PREFIX + flowId, flowId, SystemConstant.LOCK_FLOW_TIME_OUT);
+        boolean lock = memoryLock.lock(SystemConstant.LOCK_FLOW_END_PREFIX + flowId, flowId, SystemConstant.LOCK_FLOW_TIME_OUT);
         if (!lock) {
             throw ExceptionResultEnum.ERROR.exception("正在终止中,请稍候再试!");
         }
@@ -499,7 +494,7 @@ public class ActivitiServiceImpl implements ActivitiService {
                 ResultUtil.error(e.getMessage());
             }
         } finally {
-            memoryLock.unlock(SystemConstant.LOCK_FLOW_TASK_PREFIX + flowId);
+            memoryLock.unlock(SystemConstant.LOCK_FLOW_END_PREFIX + flowId);
         }
     }
 

+ 2 - 2
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -126,8 +126,8 @@ public class SystemConstant {
      * 锁
      */
     public static final String LOCK_FLOW_TASK_PREFIX = "lock:flow:task:";//流程节点锁
-    public static final String LOCK_FLOW_END_PREFIX = "lock:flow:end:";//流程节点
-    public static final String LOCK_FLOW_EXCHANGE_PREFIX = "lock:flow:exchange:";//流程节点
+    public static final String LOCK_FLOW_END_PREFIX = "lock:flow:end:";//流程结束
+    public static final String LOCK_FLOW_EXCHANGE_PREFIX = "lock:flow:exchange:";//流程转办
 
     public static final Long LOCK_FLOW_TIME_OUT = 60L * 2 * 1000;
 

+ 13 - 13
sop-server/src/main/java/com/qmth/sop/server/api/ActivitiFromHtmlController.java

@@ -52,9 +52,9 @@ public class ActivitiFromHtmlController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
     public Result formPropertiesGet(@ApiParam(value = "流程部署id") @RequestParam(required = false) String flowDeploymentId,
-                                    @ApiParam(value = "流程id") @RequestParam(required = false) Long flowId,
-                                    @ApiParam(value = "流程任务id") @RequestParam(required = false) Long taskId) {
-        return ResultUtil.ok(activitiService.formPropertiesGet(flowDeploymentId, flowId, taskId));
+                                    @ApiParam(value = "流程id") @RequestParam(required = false) String flowId,
+                                    @ApiParam(value = "流程任务id") @RequestParam(required = false) String taskId) {
+        return ResultUtil.ok(activitiService.formPropertiesGet(flowDeploymentId, Objects.nonNull(flowId) ? Long.parseLong(flowId) : null, Objects.nonNull(taskId) ? Long.parseLong(taskId) : null));
     }
 
     @ApiOperation(value = "流程审批接口")
@@ -63,9 +63,9 @@ public class ActivitiFromHtmlController {
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
     public Result approve(@ApiParam(value = "流程部署id") @RequestParam(required = false) String flowDeploymentId,
                           @ApiParam(value = "流程操作", required = true) @RequestParam FlowApprovePassEnum approve,
-                          @ApiParam(value = "流程任务id") @RequestParam(required = false) Long taskId,
+                          @ApiParam(value = "流程任务id") @RequestParam(required = false) String taskId,
                           @ApiParam(value = "流程表单数据") @RequestParam(required = false) String formProperties,
-                          @ApiParam(value = "流程审批人") @RequestParam(required = false) List<Long> approveUserIds,
+                          @ApiParam(value = "流程审批人") @RequestParam(required = false) List<String> approveUserIds,
                           @ApiParam(value = "流程审批意见") @RequestParam(required = false) String approveRemark,
 //                                         @ApiParam(value = "上传文件") @RequestParam(required = false) MultipartFile file,
                           HttpServletRequest request) {
@@ -79,31 +79,31 @@ public class ActivitiFromHtmlController {
             formDataMap.put(key, value[0]);
         }
         map.putAll(formDataMap);
-        map = activitiService.taskApprove(flowDeploymentId, approve, taskId, formProperties, approveUserIds, approveRemark, map);
+        map = activitiService.taskApprove(flowDeploymentId, approve, Objects.nonNull(taskId) ? Long.parseLong(taskId) : null, formProperties, approveUserIds, approveRemark, map);
         return ResultUtil.ok(true);
     }
 
     @ApiOperation(value = "获取待办接口")
     @RequestMapping(value = "/getTaskList", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result getTaskList(@ApiParam(value = "用户id", required = true) @RequestParam Long userId) {
-        return ResultUtil.ok(activitiService.getTaskList(userId));
+    public Result getTaskList(@ApiParam(value = "用户id", required = true) @RequestParam String userId) {
+        return ResultUtil.ok(activitiService.getTaskList(Objects.nonNull(userId) ? Long.parseLong(userId) : null));
     }
 
     @ApiOperation(value = "结束流程接口")
     @RequestMapping(value = "/delete", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result delete(@ApiParam(value = "流程id", required = true) Long flowId) {
-        activitiService.flowEnd(flowId);
+    public Result delete(@ApiParam(value = "流程id", required = true) String flowId) {
+        activitiService.flowEnd(Objects.nonNull(flowId) ? Long.parseLong(flowId) : null);
         return ResultUtil.ok(true);
     }
 
     @ApiOperation(value = "流程转办接口")
     @RequestMapping(value = "/task/approver/exchange", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result taskApproverExchange(@ApiParam(value = "用户id", required = true) Long userId,
-                                       @ApiParam(value = "用户id", required = true) Long taskId) {
-        activitiService.taskApproverExchange(userId, taskId);
+    public Result taskApproverExchange(@ApiParam(value = "用户id", required = true) String userId,
+                                       @ApiParam(value = "用户id", required = true) String taskId) {
+        activitiService.taskApproverExchange(Objects.nonNull(userId) ? Long.parseLong(userId) : null, Objects.nonNull(taskId) ? Long.parseLong(taskId) : null);
         return ResultUtil.ok(true);
     }
 }