package com.bzgwl.mybatis_plus.web.controller;
import com.bzgwl.mybatis_plus.sys.entity.User;
import com.bzgwl.mybatis_plus.utils.JsonResponse;
import com.bzgwl.mybatis_plus.utils.StringUtil;
import com.bzgwl.mybatis_plus.web.activitiListeners.MyExecutionListener;
import com.bzgwl.mybatis_plus.web.entity.QingjForm;
import org.activiti.bpmn.model.*;
import org.activiti.bpmn.model.Process;
import org.activiti.engine.*;
import org.activiti.engine.history.*;
import org.activiti.engine.impl.identity.Authentication;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author Professor_Kong
* @Description
* @Date 2019/11/20
*/
@Controller
@RequestMapping("web/act")
@SuppressWarnings("all")
public class ActivityController {
@Autowired
private RepositoryService repositoryService;
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
private HistoryService historyService;
@Autowired
private MyExecutionListener myExecutionListener;
/**
* 新建工作 -页面跳转
* @return
*/
@RequestMapping("/index")
public String index(){
return "act/act";
}
@RequestMapping("/myApply")
public String myApply(){
return "act/act-my-apply";
}
@RequestMapping("/waiting")
public String waiting(){
return "act/act-my-waiting";
}
/**
* 工作流 流程图 查看
* @return
*/
@RequestMapping("/view")
public String view(){
return "act/act-view";
}
/**
* 工作流 流程图 个人流程查看
* @return
*/
@RequestMapping("/apply-my-view")
public ModelAndView applyMyView(ModelAndView modelAndView,String instanceId){
modelAndView.setViewName("act/act-my-view");
modelAndView.addObject("instanceId",instanceId);
return modelAndView;
}
/**
* @param resp
* @return
*/
@RequestMapping("/addIndex")
public String addIndex(HttpServletResponse resp){
return "act/act-add";
}
/**
* 流程模板列表
* @param page
* @param limit
* @return
*/
@RequestMapping("/proDefList")
@ResponseBody
public JsonResponse modelList(Integer page , Integer limit){
JsonResponse jsonResponse = new JsonResponse();
long count = repositoryService.createProcessDefinitionQuery().count();
List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
.latestVersion()
.listPage(page-1,limit);
List<Map<String,String>> list =processDefinitionList.stream().map( (s)-> {
Map<String,String> map = new HashMap();
map.put("name", s.getName());
map.put("des", s.getDescription());
map.put("version", String.valueOf(s.getVersion()));
map.put("key",s.getKey());
map.put("id",s.getId());
return map;
}).collect(Collectors.toList());
jsonResponse.setCount(count);
jsonResponse.setData(list);
return jsonResponse;
}
/**
* 我的待办
* @return
*/
@RequestMapping("/myWaitingToDo")
@ResponseBody
public JsonResponse getActList(Integer page , Integer limit){
JsonResponse jsonResponse = new JsonResponse();
User user = (User)SecurityUtils.getSubject().getPrincipal();
List<Task> taskList = taskService.createTaskQuery()
.taskAssignee(user.getUsername())
.listPage(page-1,limit);
long count = taskService.createTaskQuery()
.taskAssignee(user.getUsername()).count();
List<Map<String,String>> list = new ArrayList<>();
String username ="";
if(taskList!=null && taskList.size()!=0){
HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery()
.variableName("username").taskId(taskList.get(0).getId()).singleResult();
username = (String)historicVariableInstance.getValue();
}
for(Task t : taskList){
Map map2 = new HashMap();
t.setDescription(username+"-请假申请单-"+t.getCreateTime());
map2.put("description",username+"-请假申请单-"+t.getCreateTime());
map2.put("name",t.getName());
map2.put("executionId",t.getExecutionId());
map2.put("status",t.getDelegationState());
map2.put("id",t.getId());
list.add(map2);
}
jsonResponse.setData(list);
jsonResponse.setCount(count);
return jsonResponse;
}
/**
* 流程部署-- 导入方式
* @param file
* @return
* @throws Exception
*/
@RequestMapping("/importProcess")
@ResponseBody
public JsonResponse importProcess(@RequestParam("file") MultipartFile file) throws Exception{
JsonResponse jsonResponse = new JsonResponse();
Resource resource = file.getResource();
InputStream inputStream = resource.getInputStream();
try {
Deployment deployment = repositoryService//获取流程定义和部署对象相关的Service
.createDeployment()//创建部署对象
.name("请假流程-EL")
.addInputStream("请假复杂流程-EL.bpmn", file.getInputStream())
.deploy();//完成部署
System.out.println("部署ID:" + deployment.getId());//1
System.out.println("部署Name:" + deployment.getName());
System.out.println("部署时间:" + deployment.getDeploymentTime());
}catch (Exception e){
e.printStackTrace();
}
return jsonResponse;
}
/**
* 一键删除
* @return
*/
@RequestMapping("/oneDel")
@ResponseBody
public JsonResponse oneDel(){
JsonResponse jsonResponse = new JsonResponse();
List<Deployment> list = repositoryService.createDeploymentQuery().list();
list.forEach(e ->{
repositoryService.deleteDeployment(e.getId(),true);
});
return jsonResponse;
}
/**
* 一键删除
* @return
*/
@RequestMapping("/batchDel")
@ResponseBody
public JsonResponse batchDel( @RequestParam(value = "ids[]")String[] ids){
JsonResponse jsonResponse = new JsonResponse();
jsonResponse.setMsg("未选择有效数据!");
if(ids == null){
return jsonResponse;
}
List<String> list = Arrays.asList(ids);
list.forEach(e ->{
repositoryService.deleteDeployment(e,true);
});
return jsonResponse;
}
@RequestMapping("/newProBefore")
public String newProBefore(){
return "act/act-add-form";
}
@RequestMapping("/addNewApply")
@ResponseBody
public JsonResponse addNewApply(QingjForm qingjForm){
没有合适的资源?快使用搜索试试~ 我知道了~
activiti7前端设计器bpmn-js整合shiro,mybatis-plus,使用maven构建的springboot项目
共434个文件
js:83个
gif:79个
html:62个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 69 浏览量
2023-11-29
11:27:01
上传
评论
收藏 8.38MB ZIP 举报
温馨提示
activiti7前端设计器bpmn-js整合shiro,mybatis-plus,使用maven构建的springboot项目
资源推荐
资源详情
资源评论
收起资源包目录
activiti7前端设计器bpmn-js整合shiro,mybatis-plus,使用maven构建的springboot项目 (434个子文件)
supp.bpmn 17KB
layui.css 68KB
layer.css 14KB
okadmin-v2.css 13KB
diagram-js.css 11KB
layui.mobile.css 10KB
bpmn.css 9KB
okfont.css 9KB
laydate.css 7KB
metroStyle.css 6KB
zTreeStyle.css 6KB
login.css 2KB
sub-page.css 2KB
demo.css 2KB
common.css 2KB
okfdemo.css 2KB
home.css 2KB
nprogress.css 1KB
scroll-bar.css 1KB
user.css 1KB
code.css 1KB
myfont.css 725B
treetable.css 294B
okicomoon.eot 60KB
iconfont.eot 40KB
iconfont.eot 2KB
list.html.ftl 12KB
user_list.html.ftl 11KB
user_addOrUpdate.html.ftl 5KB
controller.java.ftl 4KB
entity.java.ftl 4KB
serviceImpl.java.ftl 3KB
mapper.xml.ftl 1KB
service.java.ftl 632B
mapper.java.ftl 433B
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
zTreeStandard.gif 5KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
metro.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
19.gif 3KB
66.gif 3KB
18.gif 3KB
46.gif 3KB
10.gif 3KB
28.gif 3KB
51.gif 3KB
57.gif 3KB
67.gif 3KB
0.gif 3KB
48.gif 3KB
43.gif 3KB
30.gif 2KB
61.gif 2KB
33.gif 2KB
69.gif 2KB
14.gif 2KB
47.gif 2KB
36.gif 2KB
49.gif 2KB
58.gif 2KB
6.gif 2KB
54.gif 2KB
共 434 条
- 1
- 2
- 3
- 4
- 5
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6815
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功