wangliang 1 рік тому
батько
коміт
d54b21c966

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

@@ -99,7 +99,8 @@ public interface ActivitiService {
      * 获取流程详细信息接口
      *
      * @param flowId
+     * @param code
      * @return
      */
-    public FlowViewResult flowView(Long flowId);
+    public FlowViewResult flowView(Long flowId, String code);
 }

+ 9 - 2
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -610,12 +610,19 @@ public class ActivitiServiceImpl implements ActivitiService {
      * 获取流程详细信息接口
      *
      * @param flowId
+     * @param code
      * @return
      */
     @Override
-    public FlowViewResult flowView(Long flowId) {
-        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
+    public FlowViewResult flowView(Long flowId, String code) {
+        TFCustomFlowEntity tfCustomFlowEntity = null;
+        if (Objects.nonNull(flowId)) {
+            tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, flowId));
+        } else {
+            tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, code));
+        }
         Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+        flowId = Objects.isNull(flowId) ? tfCustomFlowEntity.getFlowId() : flowId;
 
         //获取当前流程节点
         TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, flowId));

+ 9 - 3
sop-server/src/main/java/com/qmth/sop/server/api/TFCustomFlowController.java

@@ -10,6 +10,7 @@ import com.qmth.sop.business.bean.result.WorkTaskResult;
 import com.qmth.sop.business.entity.TFCustomFlow;
 import com.qmth.sop.business.service.TFCustomFlowService;
 import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
 import com.qmth.sop.common.enums.FlowTaskTypeEnum;
 import com.qmth.sop.common.enums.TFCustomTypeEnum;
 import com.qmth.sop.common.util.Result;
@@ -27,6 +28,7 @@ import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Objects;
 
 /**
  * <p>
@@ -114,14 +116,18 @@ public class TFCustomFlowController {
     @RequestMapping(value = "/task/approver/exchange", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
     public Result taskApproverExchange(@ApiParam(value = "用户id", required = true) @RequestParam Long userId,
-                                       @ApiParam(value = "用户id", required = true) @RequestParam Long taskId) {
+                                       @ApiParam(value = "流程任务id", required = true) @RequestParam Long taskId) {
         return ResultUtil.ok(activitiService.taskApproverExchange(userId, taskId));
     }
 
     @ApiOperation(value = "获取流程详细信息接口")
     @RequestMapping(value = "/view", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = FlowViewResult.class)})
-    public Result flowView(@ApiParam(value = "用户id", required = true) @RequestParam Long flowId) {
-        return ResultUtil.ok(activitiService.flowView(flowId));
+    public Result flowView(@ApiParam(value = "流程id") @RequestParam(required = false) Long flowId,
+                           @ApiParam(value = "流程编号") @RequestParam(required = false) String code) {
+        if (Objects.isNull(flowId) || Objects.isNull(code)) {
+            throw ExceptionResultEnum.PARAMS_ERROR.exception();
+        }
+        return ResultUtil.ok(activitiService.flowView(flowId, code));
     }
 }