|
@@ -15,12 +15,20 @@ import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionServ
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
import com.jeeplus.modules.test.activiti.entity.OALeave;
|
|
|
import com.jeeplus.modules.test.activiti.service.OALeaveService;
|
|
|
+import org.activiti.engine.ProcessEngine;
|
|
|
+import org.activiti.engine.ProcessEngines;
|
|
|
+import org.activiti.engine.TaskService;
|
|
|
+import org.activiti.engine.impl.RepositoryServiceImpl;
|
|
|
+import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
|
|
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
|
|
import org.activiti.engine.repository.ProcessDefinition;
|
|
|
+import org.activiti.engine.task.Task;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -60,6 +68,29 @@ public class ConstructionController extends BaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "form/{mode}")
|
|
|
public String form(@PathVariable String mode, Construction construction, Model model) {
|
|
|
+/* String proId = construction.getAct().getProcDefId();
|
|
|
+ ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
+ TaskService taskService = processEngine.getTaskService();
|
|
|
+ //根据assignee(代理人)查询任务
|
|
|
+ List<Task> tasks = taskService.createTaskQuery().processDefinitionId(proId).list();*//*taskAssignee(proDefId).list();*//*
|
|
|
+
|
|
|
+ ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl)rs).getDeployedProcessDefinition(construction.getAct().getProcDefId());
|
|
|
+ List<ActivityImpl> activitiList = def.getActivities(); //rs是指RepositoryService的实例
|
|
|
+
|
|
|
+
|
|
|
+ int size = tasks.size();
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
+ Task task = tasks.get(i);
|
|
|
+
|
|
|
+ }
|
|
|
+ //首次运行的时候这个没有输出,因为第一次运行的时候扫描act_ru_task的表里面是空的,但第一次运行完成之后里面会添加一条记录,之后每次运行里面都会添加一条记录
|
|
|
+ for (Task task : tasks) {
|
|
|
+ System.out.println("taskId:" + task.getId() +
|
|
|
+ ",taskName:" + task.getName() +
|
|
|
+ ",assignee:" + task.getAssignee() +
|
|
|
+ ",createTime:" + task.getCreateTime() +
|
|
|
+ ",getTaskLocalVariables:" + task.getTaskLocalVariables());
|
|
|
+ }*/
|
|
|
model.addAttribute("construction", construction);
|
|
|
if("add".equals(mode) || "edit".equals(mode)){
|
|
|
return "modules/sg/managementcenter/activiti/constructionForm";
|
|
@@ -85,13 +116,13 @@ public class ConstructionController extends BaseController {
|
|
|
return j;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 流程审批
|
|
|
*/
|
|
|
if (StringUtils.isBlank(construction.getId())){
|
|
|
//新增或编辑表单保存
|
|
|
constructionService.save(construction);//保存
|
|
|
+ String procDefKey = construction.getAct().getProcDefKey();
|
|
|
// 启动流程
|
|
|
ProcessDefinition p = actProcessService.getProcessDefinition(construction.getAct().getProcDefId());
|
|
|
Map<String, Object> vars = Maps.newHashMap();
|
|
@@ -115,7 +146,7 @@ public class ConstructionController extends BaseController {
|
|
|
|
|
|
return j;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|