package com.jc.bus.workflow.web;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricDetail;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Comment;
import org.activiti.engine.task.Task;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class WorkFlowController {
@Autowired
RuntimeService rs;
@Autowired
TaskService ts;
@Autowired
ProcessEngine pe;
@Autowired
HistoryService hs;
@Autowired
RepositoryService reps;
@RequestMapping (value = {"StartWorkFlow"})
@ResponseBody
public Map<String, Object> SpringActivitiStart (){
Map<String, Object> retval = new HashMap<String, Object>();
Map<String, Object> parm = new HashMap<String, Object>();
parm.put("flag", 1);
ProcessInstance processInstance = rs.startProcessInstanceByKey("process", parm);
System.out.println("id:"+processInstance.getId()+",activitiId:"+processInstance.getActivityId());
return retval;
}
@RequestMapping (value = {"saQuery"})
@ResponseBody
public Map<String, Object> StringActivitiQuery (){
Map<String, Object> retval = new HashMap<String, Object>();
String username = "sunhw";
List<Task> tasks = ts.createTaskQuery().taskAssignee(username).list();
for (Task task : tasks) {
System.out.println("任务ID:" + task.getId());
System.out.println("任务名称:" + task.getName());
System.out.println("任务办理人:" + task.getAssignee());
System.out.println("任务的创建时间:"+task.getCreateTime());
System.out.println("流程定义ID:" + task.getProcessDefinitionId());
System.out.println("_____________流程实例ID:" + task.getProcessInstanceId());
System.out.println("执行对象ID:" + task.getExecutionId());
System.out.println("===========================================");
}
return retval;
}
@RequestMapping (value = {"saComplete"})
@ResponseBody
public Map<String, Object> SpringActivitiComplete (String taskId,String instanceId,Integer flag){
Map<String, Object> retval = new HashMap<String, Object>();
Map<String, Object> parm = new HashMap<String, Object>();
if (flag == null){
parm.put("flag", flag);
}
ts.addComment(taskId, instanceId, "设置审批意见".concat(taskId).concat(instanceId));
ts.complete(taskId, parm);
return retval;
}
/**
*
* @param instanceId
* @return
* @throws IOException
*/
@RequestMapping (value = {"saHistory"})
@ResponseBody
public Map<String, Object> SpringActivitiHistory (String instanceId) throws IOException{
Map<String, Object> retval = new HashMap<String, Object>();
List<HistoricTaskInstance> historiesTs = hs.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list();
for (HistoricTaskInstance hti : historiesTs){
String des = hti.getDescription();
System.out.println(des);
}
List<HistoricDetail> historiesDt = hs.createHistoricDetailQuery().processInstanceId(instanceId).listPage(0, 10);
for (HistoricDetail hd : historiesDt){
System.out.println(hd);
}
List<Comment> comments = ts.getProcessInstanceComments(instanceId);
for (Comment cm : comments){
System.out.println(cm.getFullMessage());
}
return retval;
}
/**
* 启动会签流程
* @return
*/
@RequestMapping (value = {"saStartMI"})
@ResponseBody
public Map<String, Object> SpringMultiInstance (){
Map<String, Object> retval = new HashMap<String, Object>();
Map<String, Object> parm = new HashMap<String, Object>();
List<String> assigneeList=new ArrayList<String>(); //分配任务的人员
assigneeList.add("sunhw");
assigneeList.add("bikean");
assigneeList.add("admin");
parm.put("userList", assigneeList);
ProcessInstance processInstance = rs.startProcessInstanceByKey("w3c", parm);
String pdi = processInstance.getProcessDefinitionId();
System.out.println(pdi);
System.out.println("id:"+processInstance.getId()+",activitiId:"+processInstance.getActivityId());
return retval;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
smActiviti.zip (59个子文件)
smact
.project 2KB
pom.xml 5KB
.tern-project 66B
target
test-classes
m2e-jee
web-resources
META-INF
maven
smact
smact
pom.xml 5KB
pom.properties 208B
MANIFEST.MF 114B
classes
com
jc
spring
main
SpringWebInitializer.class 887B
RootConfig.class 1KB
spring-transaction.xml 6KB
WebConfig.class 5KB
WebInit.class 2KB
extend
JacksonSerializerUtil.class 5KB
HtmlFilter.class 2KB
SpringContextHolder.class 2KB
UserMapper.class 870B
bus
jttsp
dao
SpxtBusMainMapper.class 431B
web
JttspxtController.class 2KB
service
JttspxtService.class 2KB
entity
SpxtBusMain.class 3KB
SpxtBusMainMapper.xml 5KB
busness
example
web
ExampleController.class 2KB
serializer
ExampleSerializer.class 1KB
service
entity
ExampleEntity.class 2KB
workflow
event
TestTaskListeners.class 698B
web
WorkFlowController.class 7KB
jdbc.properties 165B
.settings
org.eclipse.wst.common.project.facet.core.prefs.xml 161B
.jsdtscope 522B
org.eclipse.wst.common.component 647B
org.eclipse.wst.validation.prefs 50B
org.eclipse.jdt.core.prefs 430B
org.eclipse.wst.common.project.facet.core.xml 391B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
WebRoot
WEB-INF
lib
classes
index.jsp 829B
META-INF
MANIFEST.MF 39B
j14001.jsp 2KB
src
com
jc
spring
main
RootConfig.java 1KB
SpringWebInitializer.java 664B
WebConfig.java 4KB
WebInit.java 795B
spring-transaction.xml 6KB
extend
HtmlFilter.java 1KB
JacksonSerializerUtil.java 4KB
SpringContextHolder.java 3KB
UserMapper.java 700B
bus
jttsp
dao
SpxtBusMainMapper.java 407B
web
JttspxtController.java 1KB
service
JttspxtService.java 2KB
entity
SpxtBusMain.java 2KB
SpxtBusMainMapper.xml 5KB
busness
example
web
ExampleController.java 1KB
serializer
ExampleSerializer.java 744B
service
entity
ExampleEntity.java 1KB
workflow
event
TestTaskListeners.java 535B
web
WorkFlowController.java 5KB
jdbc.properties 165B
.classpath 940B
共 59 条
- 1
资源评论
- 南丘xf2019-09-10数据库脚本都不放?远程连不了数据库
aa80303857
- 粉丝: 43
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- ORACLE数据库管理系统体系结构中文WORD版最新版本
- Sybase数据库安装以及新建数据库中文WORD版最新版本
- tomcat6.0配置oracle数据库连接池中文WORD版最新版本
- hibernate连接oracle数据库中文WORD版最新版本
- MyEclipse连接MySQL的方法中文WORD版最新版本
- MyEclipse中配置Hibernate连接Oracle中文WORD版最新版本
- MyEclipseTomcatMySQL的环境搭建中文WORD版3.37MB最新版本
- hggm - 国密算法 SM2 SM3 SM4 SM9 ZUC Python实现完整代码-算法实现资源
- SQLITE操作入门中文WORD版最新版本
- Sqlite操作实例中文WORD版最新版本
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功