Browse Source

删除巡检计划

wangbo 4 years ago
parent
commit
85063ffeb1

+ 26 - 3
operation_manager/src/main/java/com/huaxu/task/controller/PlanManageController.java

@@ -6,8 +6,10 @@ import com.huaxu.model.AjaxMessage;
 import com.huaxu.model.LoginUser;
 import com.huaxu.model.Pagination;
 import com.huaxu.model.ResultStatus;
+import com.huaxu.process.dto.TaskPorcessResult;
 import com.huaxu.process.entity.ProcessDefinition;
 import com.huaxu.process.service.WorkFlowService;
+import com.huaxu.process.utils.Action;
 import com.huaxu.task.dto.PlanManageDto;
 import com.huaxu.task.entity.PlanManage;
 import com.huaxu.task.service.PlanManageService;
@@ -130,11 +132,10 @@ public class PlanManageController {
             @ApiParam(value = "任务id", required = true) @RequestParam Integer flowId) {
         return new AjaxMessage<>(ResultStatus.OK,  planManageService.selectPlanDetail(flowId));
     }
-
     @GetMapping("/plan/submit")
     @ApiOperation(value = "提交巡检计划")
     public AjaxMessage submitPlan(
-            @ApiParam(value = "计划单号", required = true) @RequestParam(required = false) Integer id){
+            @ApiParam(value = "计划ID", required = true) @RequestParam(required = false) Integer id){
         LoginUser loginUser = UserUtil.getCurrentUser();
         PlanManage planManage = planManageService.selectByPrimaryKey(id);
         //测试数据 test1 1 1
@@ -146,8 +147,11 @@ public class PlanManageController {
                 "test1",
                 1,
                 1);
+        if(processDefinition == null){
+            new AjaxMessage(ResultStatus.ERROR,"没有创建流程,不能提交!");
+        }
         Map<String,Object> vars = new HashMap<>();
-        vars.put("assineeFormUserId",planManage.getUserId());
+        vars.put("assineeFormUserId",loginUser.getId());
         //巡检发送系统消息所需参数
         vars.put("任务类型",planManage.getTaskType());
         vars.put("任务编号",planManage.getPlanId());
@@ -214,4 +218,23 @@ public class PlanManageController {
     public AjaxMessage<Integer> batchDelete( @ApiParam(value = "巡检计划ids") @RequestParam List<Integer> ids){
         return new AjaxMessage<>(ResultStatus.OK, planManageService.batchDelete(ids));
     }
+
+    @GetMapping("/task/handle")
+    @ApiOperation(value = "流程处理")
+    public AjaxMessage approvePlan(@ApiParam(value = "任务ID", required = true) @RequestParam(required = true) String taskId,
+                                   @ApiParam(value = "流程状态(审批:1,接单:2,拒单:3)", required = true) @RequestParam(required = true) Integer actionId,
+                                   @ApiParam(value = "流程备注", required = false) @RequestParam(required = false) String comment){
+        Action action = null;
+        if(actionId==1){
+            action=Action.ACTION_AUDIT;
+        }else if(actionId==2){
+            action=Action.ACTION_RECEIVE;
+        }
+        else if(actionId==3){
+            action=Action.ACTION_REJECT;
+        }
+        Map<String,Object>args=new HashMap<>();
+        List<TaskPorcessResult> results = workFlowService.handleTask(Action.ACTION_AUDIT, taskId, args, comment);
+        return new AjaxMessage(ResultStatus.OK,results);
+    }
 }