|
@@ -1,18 +1,19 @@
|
|
|
package com.ruoyi.project.training.spec.controller;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.ruoyi.project.approve.damain.DevTask;
|
|
|
import com.ruoyi.project.listener.monthSemsApprove.*;
|
|
|
-import org.activiti.engine.HistoryService;
|
|
|
-import org.activiti.engine.RuntimeService;
|
|
|
-import org.activiti.engine.TaskService;
|
|
|
+import com.ruoyi.project.sems.domain.*;
|
|
|
+import com.ruoyi.project.sems.his.domain.*;
|
|
|
+import com.ruoyi.project.training.spec.domain.TStPlan;
|
|
|
+import com.ruoyi.project.training.spec.service.ITStPlanService;
|
|
|
+import org.activiti.engine.*;
|
|
|
import org.activiti.engine.impl.identity.Authentication;
|
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
|
+import org.activiti.engine.task.Task;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -50,7 +51,8 @@ public class TStApproveController extends BaseController
|
|
|
private HistoryService historyService;
|
|
|
@Autowired
|
|
|
private TaskService taskService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ITStPlanService tStPlanService;
|
|
|
/**
|
|
|
* 查询专项培训计划申请列表
|
|
|
*/
|
|
@@ -62,6 +64,21 @@ public class TStApproveController extends BaseController
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "info/{id}")
|
|
|
+ public AjaxResult info(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ TStApprove tStApprove = tStApproveService.selectTStApproveById(id);
|
|
|
+ String[] ids = tStApprove.getPlanId().split(",");
|
|
|
+ List<TStPlan> planList = new ArrayList<TStPlan>();
|
|
|
+ for (String i : ids
|
|
|
+ ) {
|
|
|
+ TStPlan tStPlan = tStPlanService.selectTStPlanById(Long.parseLong(i));
|
|
|
+ planList.add(tStPlan);
|
|
|
+ }
|
|
|
+ tStApprove.setPlanList(planList);
|
|
|
+ return AjaxResult.success(tStApprove);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 新增专项培训计划申请
|
|
@@ -105,6 +122,62 @@ public class TStApproveController extends BaseController
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 审核处理
|
|
|
+ */
|
|
|
+ @Log(title = "专项培训计划申请审核处理", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/handle")
|
|
|
+ public AjaxResult handle(@RequestBody DevTask devTask) {
|
|
|
+ //流程审批意见
|
|
|
+ String symbol= "";
|
|
|
+ if (devTask.getComment() != "") {
|
|
|
+ symbol = ",";
|
|
|
+ }
|
|
|
+ //使用任务服务完成任务(提交任务)
|
|
|
+ String taskId = devTask.getTaskId();
|
|
|
+ // 使用任务id,获取任务对象,获取流程实例id
|
|
|
+ Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
|
|
+ //利用任务对象,获取流程实例id
|
|
|
+ String processInstancesId = task.getProcessInstanceId();
|
|
|
+ TStApprove tStApprove = tStApproveService.selectTStApproveById(Long.parseLong(devTask.getBusinessKey()));
|
|
|
+ if (devTask.getCondition().equals("1")) {
|
|
|
+ devTask.setComment("通过" + symbol + devTask.getComment());
|
|
|
+ String[] ids;
|
|
|
+ ids = tStApprove.getPlanId().split(",");
|
|
|
+ for (String i : ids
|
|
|
+ ) {
|
|
|
+ TStPlan t = tStPlanService.selectTStPlanById(Long.parseLong(i));
|
|
|
+ t.setApproveStatus(1l);
|
|
|
+ tStPlanService.updateTStPlan(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (devTask.getCondition().equals("0")) {
|
|
|
+ devTask.setComment("未通过" + symbol + devTask.getComment());
|
|
|
+ String[] ids;
|
|
|
+ ids = tStApprove.getPlanId().split(",");
|
|
|
+ for (String i : ids
|
|
|
+ ) {
|
|
|
+ TStPlan t = tStPlanService.selectTStPlanById(Long.parseLong(i));
|
|
|
+ t.setApproveStatus(2l);
|
|
|
+ tStPlanService.updateTStPlan(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(processInstancesId);
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("condition", devTask.getCondition());
|
|
|
+ ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
+ TaskService taskService = processEngine.getTaskService();
|
|
|
+ //认领任务
|
|
|
+ processEngine.getTaskService()//
|
|
|
+ .claim(taskId, getUserId().toString());
|
|
|
+// Authentication.setAuthenticatedUserId("cmc"); // 添加批注时候的审核人
|
|
|
+ taskService.addComment(taskId, processInstancesId, devTask.getComment());
|
|
|
+ //业务监听处理
|
|
|
+// tApproveService.handleApprove(task ,devTask);
|
|
|
+ taskService.complete(taskId, param);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改专项培训计划申请
|
|
|
*/
|