Commit ce9f81062073a90657531d6f32aff847480ed57e

Authored by youxiw2000
1 parent ca9b738a

step 1 修改用户鉴权 以及部分流程

Showing 41 changed files with 2205 additions and 250 deletions
trash-activiti/src/main/java/com/trash/activiti/controller/TaskController.java
... ... @@ -28,18 +28,20 @@ public class TaskController extends BaseController {
28 28 @Autowired
29 29 private IActTaskService actTaskService;
30 30  
31   -
32   -
33 31 //获取我的代办任务
34 32 @GetMapping(value = "/list")
35 33 public TableDataInfo getTasks() {
36 34 PageDomain pageDomain = TableSupport.buildPageRequest();
37 35 Page<ActTaskDTO> hashMaps = actTaskService.selectProcessDefinitionList(pageDomain);
38 36 return getDataTable(hashMaps);
  37 + }
39 38  
40   -
  39 + @RequestMapping("/taskHistory")
  40 + public String taskHistory() {
  41 + return "taskHistory";
41 42 }
42 43  
  44 +
43 45  
44 46 //渲染表单
45 47 @GetMapping(value = "/formDataShow/{taskID}")
... ...
trash-activiti/src/main/java/com/trash/activiti/controller/TaskHistoryController.java 0 → 100644
  1 +package com.trash.activiti.controller;
  2 +
  3 +
  4 +import com.github.pagehelper.Page;
  5 +import com.trash.common.core.controller.BaseController;
  6 +import com.trash.common.core.domain.AjaxResult;
  7 +import com.trash.common.core.page.PageDomain;
  8 +import com.trash.common.core.page.TableDataInfo;
  9 +import com.trash.common.core.page.TableSupport;
  10 +import com.trash.activiti.domain.dto.ActTaskDTO;
  11 +import com.trash.activiti.domain.dto.ActWorkflowFormDataDTO;
  12 +import com.trash.activiti.service.IActTaskService;
  13 +
  14 +import org.activiti.api.task.runtime.TaskRuntime;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.web.bind.annotation.*;
  17 +
  18 +import java.text.ParseException;
  19 +import java.util.List;
  20 +
  21 +
  22 +@RestController
  23 +@RequestMapping("/taskhistory")
  24 +public class TaskHistoryController extends BaseController {
  25 + @Autowired
  26 + private TaskRuntime taskRuntime;
  27 +
  28 + @Autowired
  29 + private IActTaskService actTaskService;
  30 +
  31 + //获取我的代办任务
  32 + @GetMapping(value = "/list")
  33 + public TableDataInfo getTasks() {
  34 + PageDomain pageDomain = TableSupport.buildPageRequest();
  35 + Page<ActTaskDTO> hashMaps = actTaskService.selectRuntimeTaskHistoryDefinitionList(pageDomain);
  36 + return getDataTable(hashMaps);
  37 + }
  38 +
  39 + @GetMapping(value = "/listend")
  40 + public TableDataInfo getEndTasks() {
  41 + PageDomain pageDomain = TableSupport.buildPageRequest();
  42 + Page<ActTaskDTO> hashMaps = actTaskService.selectTaskEndHistoryDefinitionList(pageDomain);
  43 + return getDataTable(hashMaps);
  44 + }
  45 +
  46 +
  47 + //渲染表单
  48 + @GetMapping(value = "/formDataShow/{taskID}")
  49 + public AjaxResult formDataShow(@PathVariable("taskID") String taskID) {
  50 + return AjaxResult.success(actTaskService.formDataShow(taskID));
  51 + }
  52 +
  53 + //保存表单
  54 + @PostMapping(value = "/formDataSave/{taskID}")
  55 + public AjaxResult formDataSave(@PathVariable("taskID") String taskID,
  56 + @RequestBody List<ActWorkflowFormDataDTO> formData ) throws ParseException {
  57 + return toAjax(actTaskService.formDataSave(taskID, formData));
  58 +
  59 + }
  60 +
  61 +}
... ...
trash-activiti/src/main/java/com/trash/activiti/domain/dto/ActTaskDTO.java
... ... @@ -3,10 +3,13 @@ package com.trash.activiti.domain.dto;
3 3 import com.fasterxml.jackson.annotation.JsonFormat;
4 4 import com.trash.common.core.domain.BaseEntity;
5 5 import org.activiti.api.task.model.Task;
6   -
  6 +import org.activiti.engine.history.HistoricProcessInstance;
  7 +import org.activiti.engine.history.HistoricTaskInstance;
7 8 import org.activiti.engine.runtime.ProcessInstance;
8 9  
  10 +import java.text.SimpleDateFormat;
9 11 import java.util.Date;
  12 +import java.util.Map;
10 13  
11 14 public class ActTaskDTO
12 15 extends BaseEntity {
... ... @@ -19,16 +22,52 @@ public class ActTaskDTO
19 22  
20 23 private String status;
21 24  
  25 + private String startTime;
  26 +
  27 + private String endTime;
  28 +
  29 + private String reason;
  30 +
  31 + private String type;
  32 +
  33 + private String checkStatus;
  34 +
  35 +
22 36 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
23 37 private Date createdDate;
24 38 private String instanceName;
25 39 private String definitionKey;
26 40 private String businessKey;
27 41  
28   - public ActTaskDTO() {
  42 +
  43 +
  44 + public ActTaskDTO(ProcessInstance processInstance, Map<String, String> map) {
  45 + this.id = processInstance.getId();
  46 + this.instanceName = processInstance.getName();
  47 + this.definitionKey= processInstance.getProcessDefinitionKey();
  48 + this.businessKey= processInstance.getBusinessKey();
  49 + this.startTime = sdf.format(map.get("startTime"));
  50 + this.endTime = sdf.format(map.get("endTime"));
  51 + this.reason = map.get("reason");
  52 + this.type = map.get("type");
  53 + }
  54 +
  55 + public ActTaskDTO(HistoricProcessInstance processInstance, Map<String, String> map) {
  56 + this.id = processInstance.getId();
  57 + this.instanceName = processInstance.getName();
  58 + this.definitionKey= processInstance.getProcessDefinitionKey();
  59 + this.businessKey= processInstance.getBusinessKey();
  60 + this.startTime = sdf.format(map.get("startTime"));
  61 + this.endTime = sdf.format(map.get("endTime"));
  62 + this.reason = map.get("reason");
  63 + this.type = map.get("type");
29 64 }
  65 +
  66 +
  67 +
  68 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
30 69  
31   - public ActTaskDTO(Task task, ProcessInstance processInstance) {
  70 + public ActTaskDTO(Task task, ProcessInstance processInstance,Map<String,String> map) {
32 71 this.id = task.getId();
33 72 this.name = task.getName();
34 73 this.status = task.getStatus().toString();
... ... @@ -36,9 +75,14 @@ public class ActTaskDTO
36 75 this.instanceName = processInstance.getName();
37 76 this.definitionKey=processInstance.getProcessDefinitionKey();
38 77 this.businessKey=processInstance.getBusinessKey();
  78 + this.startTime = sdf.format(map.get("startTime"));
  79 + this.endTime = sdf.format(map.get("endTime"));
  80 + this.reason = map.get("reason");
  81 + this.type = map.get("type");
39 82 }
40 83  
41   - public String getId() {
  84 +
  85 + public String getId() {
42 86 return id;
43 87 }
44 88  
... ... @@ -93,4 +137,47 @@ public class ActTaskDTO
93 137 public void setBusinessKey(String businessKey) {
94 138 this.businessKey = businessKey;
95 139 }
  140 +
  141 + public String getStartTime() {
  142 + return startTime;
  143 + }
  144 +
  145 + public void setStartTime(String startTime) {
  146 + this.startTime = startTime;
  147 + }
  148 +
  149 + public String getEndTime() {
  150 + return endTime;
  151 + }
  152 +
  153 + public void setEndTime(String endTime) {
  154 + this.endTime = endTime;
  155 + }
  156 +
  157 + public String getReason() {
  158 + return reason;
  159 + }
  160 +
  161 + public void setReason(String reason) {
  162 + this.reason = reason;
  163 + }
  164 +
  165 + public String getType() {
  166 + return type;
  167 + }
  168 +
  169 + public void setType(String type) {
  170 + this.type = type;
  171 + }
  172 +
  173 + public String getCheckStatus() {
  174 + return checkStatus;
  175 + }
  176 +
  177 + public void setCheckStatus(String checkStatus) {
  178 + this.checkStatus = checkStatus;
  179 + }
  180 +
  181 +
  182 +
96 183 }
... ...
trash-activiti/src/main/java/com/trash/activiti/mapper/ActReDeploymentMapper.java
... ... @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
5 5 import com.trash.activiti.domain.vo.ActReDeploymentVO;
6 6  
7 7 import java.util.List;
  8 +import java.util.Map;
8 9 import java.util.Set;
9 10  
10 11 /**
... ... @@ -17,5 +18,12 @@ public interface ActReDeploymentMapper {
17 18  
18 19  
19 20 public List<ActReDeploymentVO> selectActReDeploymentByIds(@Param("ids") Set<String> ids);
  21 +
  22 +
  23 + public Map<String,String> selectWorkLeaveById(@Param("id") String id);
  24 +
  25 + public Set<String> selectUnCompleteWorkByUsername(@Param("username") String username);
  26 +
  27 + public List<String> selectCompleteWorkByUsername(@Param("username") String username);
20 28  
21 29 }
... ...
trash-activiti/src/main/java/com/trash/activiti/service/IActTaskService.java
... ... @@ -12,4 +12,8 @@ public interface IActTaskService {
12 12 public Page<ActTaskDTO> selectProcessDefinitionList(PageDomain pageDomain);
13 13 public List<String>formDataShow(String taskID);
14 14 public int formDataSave(String taskID, List<ActWorkflowFormDataDTO> awfs) throws ParseException;
  15 +
  16 + Page<ActTaskDTO> selectRuntimeTaskHistoryDefinitionList(PageDomain pageDomain);
  17 +
  18 + Page<ActTaskDTO> selectTaskEndHistoryDefinitionList(PageDomain pageDomain);
15 19 }
... ...
trash-activiti/src/main/java/com/trash/activiti/service/impl/ActTaskServiceImpl.java
1 1  
2   -
3 2 package com.trash.activiti.service.impl;
4 3  
5   -import com.github.pagehelper.Page;
6   -import com.trash.common.core.page.PageDomain;
7   -import com.trash.activiti.domain.ActWorkflowFormData;
8   -import com.trash.activiti.domain.dto.ActTaskDTO;
9   -import com.trash.activiti.domain.dto.ActWorkflowFormDataDTO;
10   -import com.trash.activiti.service.IActTaskService;
11   -import com.trash.activiti.service.IActWorkflowFormDataService;
  4 +import java.text.ParseException;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.ArrayList;
  7 +import java.util.HashMap;
  8 +import java.util.HashSet;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +import java.util.Set;
  12 +import java.util.stream.Collectors;
12 13  
  14 +import org.activiti.api.runtime.shared.identity.UserGroupManager;
13 15 import org.activiti.api.runtime.shared.query.Pageable;
  16 +import org.activiti.api.runtime.shared.security.SecurityManager;
14 17 import org.activiti.api.task.model.Task;
15 18 import org.activiti.api.task.model.builders.TaskPayloadBuilder;
  19 +import org.activiti.api.task.model.payloads.GetTasksPayload;
16 20 import org.activiti.api.task.runtime.TaskRuntime;
17 21 import org.activiti.bpmn.model.FormProperty;
18 22 import org.activiti.bpmn.model.UserTask;
  23 +import org.activiti.engine.HistoryService;
  24 +import org.activiti.engine.ProcessEngine;
  25 +import org.activiti.engine.ProcessEngines;
19 26 import org.activiti.engine.RepositoryService;
20 27 import org.activiti.engine.RuntimeService;
  28 +import org.activiti.engine.TaskService;
  29 +import org.activiti.engine.history.HistoricProcessInstance;
  30 +import org.activiti.engine.history.HistoricProcessInstanceQuery;
  31 +import org.activiti.engine.history.HistoricTaskInstance;
  32 +import org.activiti.engine.impl.HistoricProcessInstanceQueryImpl;
  33 +import org.activiti.engine.impl.ProcessInstanceQueryImpl;
21 34 import org.activiti.engine.runtime.ProcessInstance;
  35 +import org.activiti.engine.runtime.ProcessInstanceQuery;
  36 +import org.activiti.engine.task.TaskQuery;
  37 +import org.activiti.runtime.api.query.impl.PageImpl;
22 38 import org.springframework.beans.factory.annotation.Autowired;
23 39 import org.springframework.stereotype.Service;
24   -import java.text.ParseException;
25   -import java.util.ArrayList;
26   -import java.util.HashMap;
27   -import java.util.List;
28   -import java.util.Set;
29   -import java.util.stream.Collectors;
  40 +
  41 +import com.github.pagehelper.Page;
  42 +import com.trash.activiti.domain.ActWorkflowFormData;
  43 +import com.trash.activiti.domain.dto.ActTaskDTO;
  44 +import com.trash.activiti.domain.dto.ActWorkflowFormDataDTO;
  45 +import com.trash.activiti.mapper.ActReDeploymentMapper;
  46 +import com.trash.activiti.service.IActTaskService;
  47 +import com.trash.activiti.service.IActWorkflowFormDataService;
  48 +import com.trash.common.core.page.PageDomain;
30 49  
31 50 @Service
32 51 public class ActTaskServiceImpl implements IActTaskService {
33 52  
34   - @Autowired
35   - private RepositoryService repositoryService;
36   -
37   - @Autowired
38   - private TaskRuntime taskRuntime;
39   - @Autowired
40   - private RuntimeService runtimeService;
41   - @Autowired
42   - private IActWorkflowFormDataService actWorkflowFormDataService;
43   -
44   -
45   - @Override
46   - public Page<ActTaskDTO> selectProcessDefinitionList(PageDomain pageDomain) {
47   - Page<ActTaskDTO> list = new Page<ActTaskDTO>();
48   - org.activiti.api.runtime.shared.query.Page<Task> pageTasks = taskRuntime.tasks(Pageable.of((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize()));
49   - List<Task> tasks = pageTasks.getContent();
50   - int totalItems = pageTasks.getTotalItems();
51   - list.setTotal(totalItems);
52   - if (totalItems != 0) {
53   - Set<String> processInstanceIdIds = tasks.parallelStream().map(t -> t.getProcessInstanceId()).collect(Collectors.toSet());
54   - List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().processInstanceIds(processInstanceIdIds).list();
55   - List<ActTaskDTO> actTaskDTOS = tasks.stream()
56   - .map(t -> new ActTaskDTO(t, processInstanceList.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get()))
57   - .collect(Collectors.toList());
58   - list.addAll(actTaskDTOS);
59   -
60   - }
61   - return list;
62   - }
63   -
64   - @Override
65   - public List<String> formDataShow(String taskID) {
66   - Task task = taskRuntime.task(taskID);
67   -/* ------------------------------------------------------------------------------
68   - FormProperty_0ueitp2--__!!类型--__!!名称--__!!是否参数--__!!默认值
69   - 例子:
70   - FormProperty_0lovri0--__!!string--__!!姓名--__!!f--__!!同意!!__--驳回
71   - FormProperty_1iu6onu--__!!int--__!!年龄--__!!s
72   -
73   - 默认值:无、字符常量、FormProperty_开头定义过的控件ID
74   - 是否参数:f为不是参数,s是字符,t是时间(不需要int,因为这里int等价于string)
75   - 注:类型是可以获取到的,但是为了统一配置原则,都配置到
76   - */
77   -
78   - //注意!!!!!!!!:表单Key必须要任务编号一模一样,因为参数需要任务key,但是无法获取,只能获取表单key“task.getFormKey()”当做任务key
79   - UserTask userTask = (UserTask) repositoryService.getBpmnModel(task.getProcessDefinitionId())
80   - .getFlowElement(task.getFormKey());
81   -
82   - if (userTask == null) {
83   - return null;
84   - }
85   - List<FormProperty> formProperties = userTask.getFormProperties();
86   - List<String> collect = formProperties.stream().map(fp -> fp.getId()).collect(Collectors.toList());
87   -
88   - return collect;
89   - }
90   -
91   - @Override
92   - public int formDataSave(String taskID, List<ActWorkflowFormDataDTO> awfs) throws ParseException {
93   - Task task = taskRuntime.task(taskID);
94   - ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
95   -
96   - Boolean hasVariables = false;//没有任何参数
97   - HashMap<String, Object> variables = new HashMap<String, Object>();
98   - //前端传来的字符串,拆分成每个控件
99   - List<ActWorkflowFormData> acwfds = new ArrayList<>();
100   - for (ActWorkflowFormDataDTO awf : awfs) {
101   - ActWorkflowFormData actWorkflowFormData = new ActWorkflowFormData(processInstance.getBusinessKey(),awf, task);
102   - acwfds.add(actWorkflowFormData);
103   - //构建参数集合
104   - if(!"f".equals(awf.getControlIsParam())) {
105   - variables.put(awf.getControlId(), awf.getControlValue());
106   - hasVariables = true;
107   - }
108   - }//for结束
109   - if (task.getAssignee() == null) {
110   - taskRuntime.claim(TaskPayloadBuilder.claim().withTaskId(task.getId()).build());
111   - }
112   - if (hasVariables) {
113   - //带参数完成任务
114   - taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID)
115   - .withVariables(variables)
116   - .build());
117   - } else {
118   - taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID)
119   - .build());
120   - }
121   -
122   -
123   - //写入数据库
124   - return actWorkflowFormDataService.insertActWorkflowFormDatas(acwfds);
125   - }
  53 + @Autowired
  54 + private RepositoryService repositoryService;
  55 +
  56 + @Autowired
  57 + private TaskRuntime taskRuntime;
  58 +
  59 + @Autowired
  60 + private TaskService taskService;
  61 +
  62 + @Autowired
  63 + private RuntimeService runtimeService;
  64 + @Autowired
  65 + private IActWorkflowFormDataService actWorkflowFormDataService;
  66 +
  67 + @Autowired
  68 + private ActReDeploymentMapper actMapper;
  69 +
  70 + @Autowired
  71 + SecurityManager securityManager;
  72 +
  73 + @Autowired
  74 + UserGroupManager userGroupManager;
  75 +
  76 + HistoricProcessInstanceQuery processInstanceQuery;
  77 +
  78 + @Override
  79 + public Page<ActTaskDTO> selectProcessDefinitionList(PageDomain pageDomain) {
  80 + Page<ActTaskDTO> list = new Page<ActTaskDTO>();
  81 + org.activiti.api.runtime.shared.query.Page<Task> pageTasks = taskRuntime
  82 + .tasks(Pageable.of((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize()));
  83 + List<Task> tasks = pageTasks.getContent();
  84 + int totalItems = pageTasks.getTotalItems();
  85 + list.setTotal(totalItems);
  86 + if (totalItems != 0) {
  87 + Set<String> processInstanceIdIds = tasks.parallelStream().map(t -> t.getProcessInstanceId())
  88 + .collect(Collectors.toSet());
  89 + List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery()
  90 + .processInstanceIds(processInstanceIdIds).list();
  91 +
  92 + List<ActTaskDTO> actTaskDTOS = tasks.stream()
  93 + .map(t -> new ActTaskDTO(t,
  94 + processInstanceList.parallelStream()
  95 + .filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get(),
  96 + getData(processInstanceList.parallelStream()
  97 + .filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get())))
  98 + .collect(Collectors.toList());
  99 +
  100 + list.addAll(actTaskDTOS);
  101 + }
  102 + return list;
  103 + }
  104 +
  105 + @Override
  106 + public Page<ActTaskDTO> selectTaskEndHistoryDefinitionList(PageDomain pageDomain) {
  107 + Page<ActTaskDTO> list = new Page<ActTaskDTO>();
  108 +
  109 + ProcessEngine pes = ProcessEngines.getDefaultProcessEngine();
  110 + HistoryService historyService = pes.getHistoryService();
  111 +
  112 +
  113 + List<String> collect = actMapper.selectCompleteWorkByUsername(securityManager.getAuthenticatedUserId());
  114 +
  115 + if(collect.size() > 0){
  116 + Set<String> set = new HashSet(collect);
  117 +
  118 + List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceIds(set).list();
  119 +
  120 + list.setTotal(processInstanceList.size());
  121 +
  122 + if(processInstanceList.size() > 0){
  123 + for(HistoricProcessInstance p : processInstanceList){
  124 + ActTaskDTO actTaskDTOS = new ActTaskDTO(p,getData(p));
  125 +
  126 + getCheckData(actTaskDTOS);
  127 +
  128 + list.add(actTaskDTOS);
  129 + }
  130 +
  131 + }
  132 + }
  133 +
  134 + return list;
  135 + }
  136 +
  137 +
  138 +
  139 + @Override
  140 + public Page<ActTaskDTO> selectRuntimeTaskHistoryDefinitionList(PageDomain pageDomain) {
  141 + Page<ActTaskDTO> list = new Page<ActTaskDTO>();
  142 +
  143 + Set<String> collect = actMapper.selectUnCompleteWorkByUsername(securityManager.getAuthenticatedUserId());
  144 +
  145 + if(collect.size() > 0){
  146 +
  147 + List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().processInstanceIds(collect).list();
  148 +
  149 + list.setTotal(processInstanceList.size());
  150 +
  151 + if(processInstanceList.size() > 0){
  152 + for(ProcessInstance p: processInstanceList){
  153 + ActTaskDTO actTaskDTOS = new ActTaskDTO(p,getData(p));
  154 +
  155 + getCheckData(actTaskDTOS);
  156 +
  157 + list.add(actTaskDTOS);
  158 + }
  159 +
  160 + }
  161 + }
  162 + return list;
  163 + }
  164 +
  165 +
  166 + public void getCheckData(ActTaskDTO actTaskDTOS){
  167 + ActWorkflowFormData ActWorkflowFormData = new ActWorkflowFormData();
  168 + ActWorkflowFormData.setBusinessKey(actTaskDTOS.getBusinessKey());
  169 + ActWorkflowFormData.setCreateBy(securityManager.getAuthenticatedUserId());
  170 + ActWorkflowFormData.setControlName("审批");
  171 +
  172 + actTaskDTOS.setCheckStatus(actWorkflowFormDataService.selectActWorkflowFormDataList(ActWorkflowFormData).get(0).getControlValue().equals("通过") ? "0" : "1");
  173 + }
  174 +
  175 + SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS");
  176 +
  177 + public Map<String, String> getData(HistoricProcessInstance processInstance) {
  178 + Map<String, String> map = actMapper.selectWorkLeaveById(processInstance.getBusinessKey());
  179 + return map;
  180 +
  181 + }
  182 +
  183 + public Map<String, String> getData(ProcessInstance processInstance) {
  184 + Map<String, String> map = actMapper.selectWorkLeaveById(processInstance.getBusinessKey());
  185 + return map;
  186 + }
  187 +
  188 + @Override
  189 + public List<String> formDataShow(String taskID) {
  190 + Task task = taskRuntime.task(taskID);
  191 + /*
  192 + * ---------------------------------------------------------------------
  193 + * --------- FormProperty_0ueitp2--__!!类型--__!!名称--__!!是否参数--__!!默认值 例子:
  194 + * FormProperty_0lovri0--__!!string--__!!姓名--__!!f--__!!同意!!__--驳回
  195 + * FormProperty_1iu6onu--__!!int--__!!年龄--__!!s
  196 + *
  197 + * 默认值:无、字符常量、FormProperty_开头定义过的控件ID
  198 + * 是否参数:f为不是参数,s是字符,t是时间(不需要int,因为这里int等价于string)
  199 + * 注:类型是可以获取到的,但是为了统一配置原则,都配置到
  200 + */
  201 +
  202 + // 注意!!!!!!!!:表单Key必须要任务编号一模一样,因为参数需要任务key,但是无法获取,只能获取表单key“task.getFormKey()”当做任务key
  203 + UserTask userTask = (UserTask) repositoryService.getBpmnModel(task.getProcessDefinitionId())
  204 + .getFlowElement(task.getFormKey());
  205 +
  206 + if (userTask == null) {
  207 + return null;
  208 + }
  209 + List<FormProperty> formProperties = userTask.getFormProperties();
  210 + List<String> collect = formProperties.stream().map(fp -> fp.getId()).collect(Collectors.toList());
  211 +
  212 + return collect;
  213 + }
  214 +
  215 + @Override
  216 + public int formDataSave(String taskID, List<ActWorkflowFormDataDTO> awfs) throws ParseException {
  217 + Task task = taskRuntime.task(taskID);
  218 + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
  219 + .processInstanceId(task.getProcessInstanceId()).singleResult();
  220 +
  221 + Boolean hasVariables = false;// 没有任何参数
  222 + HashMap<String, Object> variables = new HashMap<String, Object>();
  223 + // 前端传来的字符串,拆分成每个控件
  224 + List<ActWorkflowFormData> acwfds = new ArrayList<>();
  225 + for (ActWorkflowFormDataDTO awf : awfs) {
  226 + ActWorkflowFormData actWorkflowFormData = new ActWorkflowFormData(processInstance.getBusinessKey(), awf,
  227 + task);
  228 + acwfds.add(actWorkflowFormData);
  229 + // 构建参数集合
  230 + if (!"f".equals(awf.getControlIsParam())) {
  231 + variables.put(awf.getControlId(), awf.getControlValue());
  232 + hasVariables = true;
  233 + }
  234 + } // for结束
  235 + if (task.getAssignee() == null) {
  236 + taskRuntime.claim(TaskPayloadBuilder.claim().withTaskId(task.getId()).build());
  237 + }
  238 + if (hasVariables) {
  239 + // 带参数完成任务
  240 + taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID).withVariables(variables).build());
  241 + } else {
  242 + taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID).build());
  243 + }
  244 +
  245 + // 写入数据库
  246 + return actWorkflowFormDataService.insertActWorkflowFormDatas(acwfds);
  247 + }
126 248 }
... ...
trash-activiti/src/main/resources/mapper/activiti/ActReDeploymentMapper.xml
... ... @@ -23,5 +23,16 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
23 23 </foreach>
24 24 </select>
25 25  
26   -
  26 + <select id="selectWorkLeaveById" parameterType="String" resultType="java.util.Map">
  27 + select start_time as startTime,end_time as endTime, reason,type from workflow where id = #{id}
  28 + </select>
  29 +
  30 + <select id="selectUnCompleteWorkByUsername" parameterType="String" resultType="java.lang.String">
  31 + select instance_id from workflow where id in (select business_key from act_workflow_formdata where create_by = #{username} GROUP BY business_key)
  32 + </select>
  33 +
  34 + <select id="selectCompleteWorkByUsername" parameterType="String" resultType="java.lang.String">
  35 + select ID_ from act_hi_procinst where BUSINESS_KEY_ in (select business_key from act_workflow_formdata where create_by = #{username} GROUP BY business_key) and END_ACT_ID_ is not null
  36 + </select>
  37 +
27 38 </mapper>
28 39 \ No newline at end of file
... ...
trash-activiti/src/main/resources/mapper/activiti/ActWorkflowFormDataMapper.xml
... ... @@ -27,8 +27,11 @@
27 27 <if test="formKey != null and formKey != ''"> and form_key = #{formKey}</if>
28 28 <if test="controlId != null and controlId != ''"> and control_id = #{controlId}</if>
29 29 <if test="controlValue != null and controlValue != ''"> and control_value = #{controlValue}</if>
  30 + <if test="controlName != null and controlName != ''"> and control_name = #{controlName}</if>
30 31 <if test="taskNodeName != null and taskNodeName != ''"> and task_node_name = #{taskNodeName}</if>
  32 + <if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
31 33 </where>
  34 + order by create_time DESC
32 35 </select>
33 36  
34 37 <select id="selectActWorkflowFormDataById" parameterType="Long" resultMap="ActWorkflowFormDataResult">
... ...
trash-admin/src/main/java/com/trash/web/controller/system/SysLoginController.java
... ... @@ -2,6 +2,9 @@ package com.trash.web.controller.system;
2 2  
3 3 import java.util.List;
4 4 import java.util.Set;
  5 +
  6 +import javax.servlet.http.HttpServletRequest;
  7 +
5 8 import org.springframework.beans.factory.annotation.Autowired;
6 9 import org.springframework.web.bind.annotation.GetMapping;
7 10 import org.springframework.web.bind.annotation.PostMapping;
... ... @@ -64,8 +67,11 @@ public class SysLoginController
64 67 */
65 68 @GetMapping("getInfo")
66 69 public AjaxResult getInfo()
67   - {
68   - LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  70 + {
  71 + HttpServletRequest request = ServletUtils.getRequest();
  72 +
  73 + LoginUser loginUser = tokenService.getLoginUser(request);
  74 +
69 75 SysUser user = loginUser.getUser();
70 76 // 角色集合
71 77 Set<String> roles = permissionService.getRolePermission(user);
... ...
trash-framework/src/main/java/com/trash/framework/config/ResourcesConfig.java
... ... @@ -22,6 +22,7 @@ import com.trash.framework.interceptor.RepeatSubmitInterceptor;
22 22 @Configuration
23 23 public class ResourcesConfig implements WebMvcConfigurer
24 24 {
  25 +
25 26 @Autowired
26 27 private RepeatSubmitInterceptor repeatSubmitInterceptor;
27 28  
... ... @@ -41,7 +42,7 @@ public class ResourcesConfig implements WebMvcConfigurer
41 42 */
42 43 @Override
43 44 public void addInterceptors(InterceptorRegistry registry)
44   - {
  45 + {
45 46 registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
46 47 }
47 48  
... ...
trash-framework/src/main/java/com/trash/framework/config/SecurityConfig.java
... ... @@ -118,6 +118,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
118 118 .antMatchers("/druid/**").anonymous()
119 119 .antMatchers("/system/post/all").anonymous()
120 120 .antMatchers("/system/user/all").anonymous()
  121 +// .antMatchers("/workflow/add").anonymous()//测试
  122 +// .antMatchers("/workflow/addtest").anonymous()//测试
121 123 // 除上面外的所有请求全部需要鉴权认证
122 124 .anyRequest().authenticated()
123 125 .and()
... ...
trash-framework/src/main/java/com/trash/framework/security/filter/JwtAuthenticationTokenFilter.java
1 1 package com.trash.framework.security.filter;
2 2  
  3 +import java.awt.datatransfer.FlavorEvent;
3 4 import java.io.IOException;
4 5 import javax.servlet.FilterChain;
5 6 import javax.servlet.ServletException;
  7 +import javax.servlet.http.Cookie;
6 8 import javax.servlet.http.HttpServletRequest;
7 9 import javax.servlet.http.HttpServletResponse;
8 10 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -15,6 +17,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
15 17 import com.trash.common.core.domain.model.LoginUser;
16 18 import com.trash.common.utils.SecurityUtils;
17 19 import com.trash.common.utils.StringUtils;
  20 +import com.trash.framework.web.service.SysLoginService;
18 21 import com.trash.framework.web.service.TokenService;
19 22  
20 23 /**
... ... @@ -28,11 +31,32 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
28 31 @Autowired
29 32 private TokenService tokenService;
30 33  
  34 + @Autowired
  35 + private SysLoginService loginService;
  36 +
31 37 @Override
32 38 protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
33 39 throws ServletException, IOException
34 40 {
35   - LoginUser loginUser = tokenService.getLoginUser(request);
  41 +
  42 + LoginUser loginUser = tokenService.getLoginUser(request);
  43 +
  44 + if(loginUser == null){
  45 + String token = request.getHeader("Authorization");
  46 +
  47 + if(token == null){
  48 + token = getTokenFromCookies(request);
  49 + }
  50 +
  51 + if(token!= null && !token.equals("undefined")){
  52 + loginUser = tokenService.getLoginUserByToken(token);
  53 +
  54 + if(loginUser == null){
  55 + loginUser = requestRemoteUser(token);
  56 + }
  57 + }
  58 + }
  59 +
36 60 if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
37 61 {
38 62 tokenService.verifyToken(loginUser);
... ... @@ -42,4 +66,20 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
42 66 }
43 67 chain.doFilter(request, response);
44 68 }
  69 +
  70 + private String getTokenFromCookies(HttpServletRequest request) {
  71 +
  72 + for(Cookie cookie : request.getCookies()){
  73 +
  74 + if(("token").equals(cookie.getName())){
  75 + return cookie.getValue();
  76 + }
  77 + }
  78 +
  79 + return null;
  80 + }
  81 +
  82 + private LoginUser requestRemoteUser(String token) {
  83 + return loginService.loginByRemote(token);
  84 + }
45 85 }
... ...
trash-framework/src/main/java/com/trash/framework/web/service/SysLoginService.java
1 1 package com.trash.framework.web.service;
2 2  
  3 +import java.util.Date;
  4 +
3 5 import javax.annotation.Resource;
4 6 import org.springframework.beans.factory.annotation.Autowired;
5 7 import org.springframework.security.authentication.AuthenticationManager;
... ... @@ -7,6 +9,7 @@ import org.springframework.security.authentication.BadCredentialsException;
7 9 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
8 10 import org.springframework.security.core.Authentication;
9 11 import org.springframework.stereotype.Component;
  12 +import org.springframework.security.core.userdetails.UserDetailsService;
10 13  
11 14 import com.trash.common.constant.Constants;
12 15 import com.trash.common.core.domain.model.LoginUser;
... ... @@ -16,6 +19,7 @@ import com.trash.common.exception.user.CaptchaException;
16 19 import com.trash.common.exception.user.CaptchaExpireException;
17 20 import com.trash.common.exception.user.UserPasswordNotMatchException;
18 21 import com.trash.common.utils.MessageUtils;
  22 +import com.trash.common.utils.uuid.UUID;
19 23 import com.trash.framework.manager.AsyncManager;
20 24 import com.trash.framework.manager.factory.AsyncFactory;
21 25  
... ... @@ -35,7 +39,9 @@ public class SysLoginService
35 39  
36 40 @Autowired
37 41 private RedisCache redisCache;
38   -
  42 +
  43 + @Autowired
  44 + UserDetailsService UserDetailsService;
39 45 /**
40 46 * 登录验证
41 47 *
... ... @@ -86,4 +92,49 @@ public class SysLoginService
86 92 // 生成token
87 93 return tokenService.createToken(loginUser);
88 94 }
  95 +
  96 + public LoginUser loginByRemote(String token)
  97 + {
  98 +// String verifyKey = Constants.CAPTCHA_CODE_KEY;
  99 +// String captcha = redisCache.getCacheObject(verifyKey);
  100 +// redisCache.deleteObject(verifyKey);
  101 +// if (captcha == null)
  102 +// {
  103 +// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
  104 +// throw new CaptchaExpireException();
  105 +// }
  106 +// if (!code.equalsIgnoreCase(captcha))
  107 +// {
  108 +// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
  109 +// throw new CaptchaException();
  110 +// }
  111 + // 用户验证
  112 + Authentication authentication = null;
  113 + try
  114 + {
  115 +// // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
  116 + authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken("youxiw2000", "123456"));
  117 + }
  118 + catch (Exception e)
  119 + {
  120 + if (e instanceof BadCredentialsException)
  121 + {
  122 + AsyncManager.me().execute(AsyncFactory.recordLogininfor("youxiw2000", Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
  123 + throw new UserPasswordNotMatchException();
  124 + }
  125 + else
  126 + {
  127 + AsyncManager.me().execute(AsyncFactory.recordLogininfor("youxiw2000", Constants.LOGIN_FAIL, e.getMessage()));
  128 + throw new CustomException(e.getMessage());
  129 + }
  130 + }
  131 + AsyncManager.me().execute(AsyncFactory.recordLogininfor("youxiw2000", Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
  132 + LoginUser loginUser = (LoginUser) authentication.getPrincipal();
  133 +
  134 + loginUser.setToken(token);
  135 + tokenService.refreshToken(loginUser);
  136 +
  137 + // 生成token
  138 + return loginUser;
  139 + }
89 140 }
... ...
trash-framework/src/main/java/com/trash/framework/web/service/TokenService.java
... ... @@ -3,6 +3,8 @@ package com.trash.framework.web.service;
3 3 import java.util.HashMap;
4 4 import java.util.Map;
5 5 import java.util.concurrent.TimeUnit;
  6 +
  7 +import javax.servlet.http.Cookie;
6 8 import javax.servlet.http.HttpServletRequest;
7 9 import org.springframework.beans.factory.annotation.Autowired;
8 10 import org.springframework.beans.factory.annotation.Value;
... ... @@ -69,6 +71,36 @@ public class TokenService
69 71 LoginUser user = redisCache.getCacheObject(userKey);
70 72 return user;
71 73 }
  74 +
  75 + token = getTokenFromCookies(request);
  76 + if(StringUtils.isNotEmpty(token)){
  77 + String userKey = getTokenKey(token);
  78 + LoginUser user = redisCache.getCacheObject(userKey);
  79 + return user;
  80 + }
  81 + return null;
  82 + }
  83 +
  84 +
  85 + private String getTokenFromCookies(HttpServletRequest request) {
  86 + for(Cookie cookie : request.getCookies()){
  87 +
  88 + if(("token").equals(cookie.getName())){
  89 + return cookie.getValue();
  90 + }
  91 + }
  92 +
  93 + return null;
  94 + }
  95 +
  96 + public LoginUser getLoginUserByToken(String token)
  97 + {
  98 + // 获取请求携带的令牌
  99 + if (StringUtils.isNotEmpty(token))
  100 + {
  101 + LoginUser user = redisCache.getCacheObject(token);
  102 + return user;
  103 + }
72 104 return null;
73 105 }
74 106  
... ...
trash-ui/public/bpmnjs/index.js
... ... @@ -83459,6 +83459,8 @@ module.exports = function(group, element, bpmnFactory, translate) {
83459 83459 return formHelper.getFormField(element, selected.idx);
83460 83460 }
83461 83461  
  83462 +
  83463 +
83462 83464 // [FormKey] form key text input field
83463 83465 group.entries.push(entryFactory.textField({
83464 83466 id : 'form-key',
... ... @@ -83551,6 +83553,29 @@ module.exports = function(group, element, bpmnFactory, translate) {
83551 83553 }
83552 83554 }));
83553 83555  
  83556 + function updateParamInput(idvalue){
  83557 + var value = $("#activiti-form-field-id").val();
  83558 +
  83559 + value = value.split("--__!!")[0];
  83560 +
  83561 + var label = $("#FormLabel").val() == "" ? "NULL" : $("#FormLabel").val();
  83562 + var labelValue = $("#FormValue").val() == "" ? "NULL" : $("#FormValue").val();
  83563 +
  83564 + var isCheck = "f";
  83565 + if($("#isprime:checked").val()){
  83566 + isCheck = "i";
  83567 + }
  83568 + var label = $("#FormLabel").val() == "" ? "NULL" : $("#FormLabel").val();
  83569 +
  83570 + value += "--__!!" + $("#FormProperty_type").val();
  83571 + value += "--__!!" + label;
  83572 + value += "--__!!" + isCheck;
  83573 + value += "--__!!" + labelValue.replace("--__--");
  83574 +
  83575 + $("#activiti-form-field-id")[0].value = value;
  83576 + }
  83577 +
  83578 +
83554 83579 // [FormData] form field id text input field
83555 83580 group.entries.push(entryFactory.validationAwareTextField({
83556 83581 id: 'form-field-id',
... ... @@ -83570,9 +83595,7 @@ module.exports = function(group, element, bpmnFactory, translate) {
83570 83595 hidden: function(element, node) {
83571 83596 return !getSelectedFormField(element, node);
83572 83597 },
83573   -
83574 83598 validate: function(element, values, node) {
83575   - debugger;
83576 83599  
83577 83600 var formField = getSelectedFormField(element, node);
83578 83601  
... ... @@ -83588,32 +83611,58 @@ module.exports = function(group, element, bpmnFactory, translate) {
83588 83611  
83589 83612 // var combox = entryFactory.comboBox({"selectOptions": [{ name: 'textarea', value: 'textarea' },{ name: 'radio', value: 'radio' }]});
83590 83613  
83591   - if($("#FormProperty_type").length == 0){
83592   - $(".bpp-properties-entry[data-entry='form-field-id']").append("类型<br/><select id=FormProperty_type><option value=radio selected='selected'>radio</option><option value=textarea>textarea</option></select>");
83593   - $(".bpp-properties-entry[data-entry='form-field-id']").append("标签<br/><input id=FormLabel type=input value="+param[2] +">");
83594   - $(".bpp-properties-entry[data-entry='form-field-id']").append("参数<br/><input id=FormValue type=input value="+param[4].replace("--__--",",") +">");
  83614 + $(".bpp-properties-entry[data-entry='form-field-id'] p").remove();
  83615 + $("#FormProperty_type").remove();
  83616 + $("#FormLabel").remove();
  83617 + $("#FormValue").remove();
  83618 + $("#isprime").remove();
83595 83619  
  83620 + var tag = "<p>类型</p><select id=FormProperty_type><option value=radio ";
  83621 + if(param[1] && param[1] == "radio"){
  83622 + tag += "selected='selected'";
  83623 + }
  83624 + tag += ">单选</option><option value=textarea ";
  83625 + if(param[1] && param[1] == "textarea"){
  83626 + tag += "selected='selected'";
  83627 + }
  83628 + tag += ">文本</option><option value=file ";
  83629 + if(param[1] && param[1] == "file"){
  83630 + tag += "selected='selected'";
  83631 + }
  83632 + tag += ">文件</option><option value=image ";
  83633 + if(param[1] && param[1] == "image"){
  83634 + tag += "selected='selected'";
  83635 + }
  83636 + tag += ">图片</option></select>";
  83637 + $(".bpp-properties-entry[data-entry='form-field-id']").append(tag);
83596 83638  
83597   - var test = "";
83598   - var check = 'false';
  83639 + var p = "";
83599 83640  
83600   - if(param[3] != 'f'){
83601   - check = 'true';
  83641 + if(param[2]){
  83642 + p = param[2];
83602 83643 }
  83644 + $(".bpp-properties-entry[data-entry='form-field-id']").append("<p>标签</p><input id=FormLabel type=input value="+p +">");
83603 83645  
83604   - $(".bpp-properties-entry[data-entry='form-field-id']").append("是否<br/><input id=FormValue type=checkbox checked="+ check + ">");
  83646 + p = "";
83605 83647  
  83648 + if(param[4]){
  83649 + p = param[4].replace("--__--",",");
  83650 + }
  83651 + $(".bpp-properties-entry[data-entry='form-field-id']").append("<p>参数</p><input id=FormValue type=input value="+p +">");
83606 83652  
83607   - $("#FormProperty_type").change(function(){
83608   - console.log("change");
83609   - });
83610   - $("#FormLabel").change(function(){
83611   - console.log("change");
83612   - });
83613   - }else{
  83653 + p = '';
  83654 +
  83655 + if(param[3] != 'f'){
  83656 + p = 'checked=checked';
  83657 + }
  83658 +
  83659 + $(".bpp-properties-entry[data-entry='form-field-id']").append("<p>是否关键</p><input id=isprime type=checkbox "+p+">");
83614 83660  
83615   - }
83616 83661  
  83662 + $("#FormProperty_type").change(updateParamInput);
  83663 + $("#FormLabel").change(updateParamInput);
  83664 + $("#FormValue").change(updateParamInput);
  83665 + $("#isprime").change(updateParamInput);
83617 83666  
83618 83667 if (!idValue || idValue.trim() === '') {
83619 83668 return { id: 'Form field id must not be empty' };
... ...
trash-ui/src/api/activiti/taskhistory.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 查询task列表
  4 +export function listTask(query) {
  5 + return request({
  6 + url: '/taskhistory/list',
  7 + method: 'get',
  8 + params: query
  9 + })
  10 +}
  11 +
  12 +// 查询task列表
  13 +export function listEndTask(query) {
  14 + return request({
  15 + url: '/taskhistory/listend',
  16 + method: 'get',
  17 + params: query
  18 + })
  19 +}
  20 +
  21 +// 查询表单
  22 +export function formDataShow(taskID) {
  23 + return request({
  24 + url: '/historyFromData/ByInstanceId/'+taskID,
  25 + method: 'get',
  26 + })
  27 +}
  28 +
  29 +// 查询表单
  30 +export function formDataSave(taskID,data) {
  31 + return request({
  32 + url: '/taskhistory/formDataSave/'+taskID,
  33 + method: 'post',
  34 + data:data
  35 + })
  36 +}
... ...
trash-ui/src/assets/css/font.css 0 → 100644
trash-ui/src/assets/css/task.css 0 → 100644
  1 +.card_status{
  2 + position: relative;
  3 + top:-15px;
  4 + left:-20px;
  5 + height:20px;
  6 + width:60px;
  7 + font-size: 12px;
  8 + text-align: center;
  9 + line-height: 20px;
  10 + border-radius: 5px;
  11 +}
  12 +
  13 +.card_status.notcheck{
  14 + background-color: aqua;
  15 + color:blue;
  16 +}
  17 +
  18 +.card_status.agree{
  19 + background-color: greenyellow;
  20 + color: green;
  21 +}
  22 +.card_status.dismiss{
  23 + background-color: pink;
  24 + color: red;
  25 +}
  26 +
  27 +.card_btn a{
  28 + color:blue;
  29 + margin-right: 10px;
  30 +}
  31 +
  32 +.card_btn a.agree{
  33 + color:green;
  34 +}
  35 +
  36 +.card_btn a.dismiss{
  37 + color:red;
  38 +}
  39 +
  40 +.card_btn{
  41 + float: right;
  42 +}
  43 +
  44 +.box-card{
  45 + margin-bottom: 30px;
  46 +}
  47 +
  48 +.card_title{
  49 + font-size: 18px;
  50 + font-weight: bold;
  51 +}
  52 +
  53 +.card_row{
  54 + margin-top: 20px;
  55 + margin-bottom: 20px;
  56 +}
  57 +
  58 +.card_grid{
  59 + height:20px;
  60 + line-height: 20px;
  61 +}
  62 +
  63 +.card_grid.center{
  64 + text-align: center;
  65 + border-left: 2px solid black;
  66 + border-right: 2px solid black;
  67 +}
  68 +.card_grid.right{
  69 + text-align: right;
  70 +}
... ...
trash-ui/src/layout/components/Navbar.vue
... ... @@ -9,11 +9,11 @@
9 9 <search id="header-search" class="right-menu-item" />
10 10  
11 11 <el-tooltip content="源码地址" effect="dark" placement="bottom">
12   - <ruo-yi-git id="trash-git" class="right-menu-item hover-effect" />
  12 + <trash-git id="trash-git" class="right-menu-item hover-effect" />
13 13 </el-tooltip>
14 14  
15 15 <el-tooltip content="文档地址" effect="dark" placement="bottom">
16   - <ruo-yi-doc id="trash-doc" class="right-menu-item hover-effect" />
  16 + <trash-doc id="trash-doc" class="right-menu-item hover-effect" />
17 17 </el-tooltip>
18 18  
19 19 <screenfull id="screenfull" class="right-menu-item hover-effect" />
... ...
trash-ui/src/layout/index3.vue 0 → 100644
  1 +<template>
  2 + <app-main />
  3 +</template>
  4 +
  5 +<script>
  6 +import RightPanel from '@/components/RightPanel'
  7 +import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
  8 +import ResizeMixin from './mixin/ResizeHandler'
  9 +import { mapState } from 'vuex'
  10 +
  11 +export default {
  12 + name: 'Layout',
  13 + components: {
  14 + AppMain,
  15 + Navbar,
  16 + RightPanel,
  17 + Settings,
  18 + Sidebar,
  19 + TagsView
  20 + },
  21 + mixins: [ResizeMixin],
  22 + computed: {
  23 + ...mapState({
  24 + sidebar: state => state.app.sidebar,
  25 + device: state => state.app.device,
  26 + showSettings: state => state.settings.showSettings,
  27 + needTagsView: state => state.settings.tagsView,
  28 + fixedHeader: state => state.settings.fixedHeader
  29 + }),
  30 + classObj() {
  31 + return {
  32 + hideSidebar: !this.sidebar.opened,
  33 + openSidebar: this.sidebar.opened,
  34 + withoutAnimation: this.sidebar.withoutAnimation,
  35 + mobile: this.device === 'mobile'
  36 + }
  37 + }
  38 + },
  39 + methods: {
  40 + handleClickOutside() {
  41 + this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
  42 + }
  43 + }
  44 +}
  45 +</script>
  46 +
  47 +<style lang="scss" scoped>
  48 + @import "~@/assets/styles/mixin.scss";
  49 + @import "~@/assets/styles/variables.scss";
  50 +
  51 + .app-wrapper {
  52 + @include clearfix;
  53 + position: relative;
  54 + height: 100%;
  55 + width: 100%;
  56 +
  57 + &.mobile.openSidebar {
  58 + position: fixed;
  59 + top: 0;
  60 + }
  61 + }
  62 +
  63 + .drawer-bg {
  64 + background: #000;
  65 + opacity: 0.3;
  66 + width: 100%;
  67 + top: 0;
  68 + height: 100%;
  69 + position: absolute;
  70 + z-index: 999;
  71 + }
  72 +
  73 + .fixed-header {
  74 + position: fixed;
  75 + top: 0;
  76 + right: 0;
  77 + z-index: 9;
  78 + width: calc(100% - #{$sideBarWidth});
  79 + transition: width 0.28s;
  80 + }
  81 +
  82 + .hideSidebar .fixed-header {
  83 + width: calc(100% - 54px)
  84 + }
  85 +
  86 + .mobile .fixed-header {
  87 + width: 100%;
  88 + }
  89 +</style>
... ...
trash-ui/src/permission.js
... ... @@ -4,21 +4,31 @@ import { Message } from &#39;element-ui&#39;
4 4 import NProgress from 'nprogress'
5 5 import 'nprogress/nprogress.css'
6 6 import { getToken } from '@/utils/auth'
  7 +import Cookies from "js-cookie";
7 8  
8 9 NProgress.configure({ showSpinner: false })
9 10  
10 11 const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
11 12  
  13 +// const whiteList = ['/*']
  14 +
12 15 router.beforeEach((to, from, next) => {
13 16 NProgress.start()
14   - if (getToken()) {
  17 + var token = getToken();
  18 + if(!token){
  19 + token = to.query.token;
  20 + if(token){
  21 + Cookies.set("token", token, { expires: 30 });
  22 + }
  23 + }
  24 +
  25 + if (token) {
15 26 /* has token*/
16 27 if (to.path === '/login') {
17 28 next({ path: '/' })
18 29 NProgress.done()
19 30 } else {
20 31 if (store.getters.roles.length === 0) {
21   - // 判断当前用户是否已拉取完user_info信息
22 32 store.dispatch('GetInfo').then(res => {
23 33 // 拉取user_info
24 34 const roles = res.roles
... ...
trash-ui/src/utils/auth.js
... ... @@ -12,4 +12,4 @@ export function setToken(token) {
12 12  
13 13 export function removeToken() {
14 14 return Cookies.remove(TokenKey)
15 15 -}
  16 +}
16 17 \ No newline at end of file
... ...
trash-ui/src/views/activiti/definition/index.vue
... ... @@ -104,6 +104,7 @@
104 104 />
105 105 <!--bpmnjs在线流程设计器-->
106 106 <el-dialog
  107 + :close-on-click-modal="false"
107 108 :visible.sync="modelVisible"
108 109 title="流程图"
109 110 width="1680px"
... ...
trash-ui/src/views/activiti/task/index.vue
1 1 <template>
2 2 <div class="app-container">
3 3  
  4 + <el-card class="box-card" v-for="task in tastList">
  5 + <div class="card_status notcheck">待审批</div>
  6 + <div class="card_btn">
  7 + <a @click="examineAndApprove(task,0)" class="agree">同意</a>
  8 + <a @click="examineAndApprove(task,1)" class="dismiss">拒绝</a>
  9 + <a @click="examineAndApprove(task,-1)" >详情>></a>
  10 + </div>
  11 + <el-row class="card_row">
  12 + <el-col :span="2" class="card_grid"></el-col>
  13 + <div class="card_title">{{task.instanceName}}</div>
  14 + </el-row>
  15 +
  16 + <el-row class="card_row">
  17 + <el-col :span="3" class="card_grid"></el-col>
  18 + <el-col :span="6" class="card_grid">
  19 + <div>开始时间: {{task.startTime}}</div>
  20 + </el-col>
  21 + <el-col :span="6" class="card_grid center">
  22 + <div>结束时间: {{task.endTime}}</div>
  23 + </el-col>
  24 + <el-col :span="6" class="card_grid right">
  25 + <div>申请类型: {{task.type}}</div>
  26 + </el-col>
  27 + <el-col :span="3" class="card_grid"></el-col>
  28 + </el-row>
  29 + <el-row class="card_row">
  30 + <el-col :span="3" class="card_grid">
  31 + <div></div>
  32 + </el-col>
  33 + <el-col :span="18">
  34 + <div>申请理由: {{task.reason}}</div>
  35 + </el-col>
  36 + <el-col :span="3" class="card_grid"></el-col>
  37 + </el-row>
  38 + </el-card>
4 39  
5   - <el-table v-loading="loading" :data="tastList">
6   - <!-- <el-table-column label="流程ID" align="center" prop="id"/>-->
7   - <el-table-column label="流程名称" align="center" prop="instanceName"/>
8   - <el-table-column label="任务节点名称" align="center" prop="name"/>
9   - <el-table-column label="任务状态" align="center" prop="status"/>
10   - <el-table-column label="办理人" align="center" prop="assignee"/>
11   - <el-table-column label="创建时间" align="center" prop="createdDate"/>
  40 +
  41 + <!--<el-table v-loading="loading" :data="tastList">
  42 + <el-table-column label="流程ID" align="center" prop="id"/>
  43 + <el-table-column label="流程名称" align="center" prop="instanceName" />
  44 + <el-table-column label="任务节点名称" align="center" prop="name" />
  45 + <el-table-column label="任务状态" align="center" prop="status" />
  46 + <el-table-column label="办理人" align="center" prop="assignee" />
  47 + <el-table-column label="创建时间" align="center" prop="createdDate" />
12 48  
13 49 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
14 50 <template slot-scope="scope">
15   - <el-button
16   - size="mini"
17   - type="text"
18   - icon="el-icon-edit"
19   - @click="examineAndApprove (scope.row)"
20   - v-hasPermi="['workflow:leave:edit']"
21   - >审批
  51 + <el-button size="mini" type="text" icon="el-icon-edit" @click="examineAndApprove (scope.row)"
  52 + v-hasPermi="['workflow:leave:edit']">审批
22 53 </el-button>
23 54 </template>
24 55 </el-table-column>
25   - </el-table>
  56 + </el-table>-->
26 57  
27   - <pagination
28   - v-show="total>0"
29   - :total="total"
30   - :page.sync="queryParams.pageNum"
31   - :limit.sync="queryParams.pageSize"
32   - @pagination="getList"
33   - />
  58 + <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
34 59  
35 60 <!-- 审批对话框 -->
36 61 <el-dialog :title="title" :visible.sync="open" v-if="open" width="500px" append-to-body>
37   - <leaveHistoryForm :businessKey="businessKey" v-if="'leave'==definitionKey"/>
  62 + <leaveHistoryForm :businessKey="businessKey" v-if="'leave'==definitionKey && needShow" />
38 63  
39 64 <el-form :model="form" ref="form" label-width="100px" class="demo-dynamic">
40   - <el-form-item
41   - v-for="(domain, index) in form.formData"
42   - :label="domain.controlLable"
43   - :key="index"
44   - >
45   - <el-radio-group v-model="domain.controlValue" v-if="'radio'==domain.controlType">
46   - <el-radio v-for="(defaults,indexd) in domain.controlDefault.split('--__--')"
47   - :label=indexd
48   - :key="indexd"
49   - >{{defaults}}
50   -
  65 + <el-form-item v-for="(domain, index) in form.formData" :label="domain.controlLable" :key="index">
  66 + <el-radio-group v-model="domain.controlValue" v-if="'radio'==domain.controlType && needShow">
  67 + <el-radio v-for="(defaults,indexd) in domain.controlDefault.split('--__--')" :label=indexd :key="indexd">
  68 + {{defaults}}
51 69 </el-radio>
52   -
53 70 </el-radio-group>
54   - <el-input type="textarea" v-model="domain.controlValue" v-if="'textarea'==domain.controlType"
55   - ></el-input>
  71 + <el-input type="textarea" v-model="domain.controlValue" v-if="'textarea'==domain.controlType"></el-input>
56 72 </el-form-item>
57 73 </el-form>
58 74  
... ... @@ -64,18 +80,26 @@
64 80 </div>
65 81 </template>
66 82  
67   -<script>
68   -
  83 +<style>
  84 + @import '../../../assets/css/task.css'
  85 +</style>
69 86  
70   - import {listTask, formDataShow, formDataSave} from "@/api/activiti/task";
  87 +<script>
  88 + import {
  89 + listTask,
  90 + formDataShow,
  91 + formDataSave
  92 + } from "@/api/activiti/task";
71 93 import leaveHistoryForm from "@/views/workflow/leave/leaveHistoryForm";
72 94  
73 95 export default {
74   - name: "Leave",
75   - components: {leaveHistoryForm},
  96 + name: "task",
  97 + components: {
  98 + leaveHistoryForm
  99 + },
76 100 data() {
77 101 return {
78   - id:'',
  102 + id: '',
79 103 definitionKey: '',
80 104 businessKey: '',
81 105 // 遮罩层
... ... @@ -103,8 +127,9 @@
103 127 },
104 128 // 表单参数
105 129 form: {
106   - formData:[]
  130 + formData: []
107 131 },
  132 + needShow:false,
108 133 // 表单校验
109 134 rules: {}
110 135 };
... ... @@ -133,20 +158,18 @@
133 158 this.definitionKey = '',
134 159 this.businessKey = '',
135 160 this.form = {
136   - formData:[],
  161 + formData: [],
137 162 };
138 163 this.resetForm("form");
139 164 },
140   -
141 165 /** 审批按钮操作 */
142   - examineAndApprove(row) {
143   - console.log(row)
  166 + examineAndApprove(row,idx) {
  167 + this.needShow = false;
144 168 this.reset();
145 169 this.definitionKey = row.definitionKey;
146   - this.businessKey = row.businessKey;
147   - this.id=row.id;
  170 + this.businessKey = row.businessKey;
  171 + this.id = row.id;
148 172 formDataShow(row.id).then(response => {
149   - debugger;
150 173 // FormProperty_3qipis2--__!!radio--__!!审批意见--__!!i--__!!同意--__--不同意
151 174 // FormProperty_0lffpcm--__!!textarea--__!!批注--__!!f--__!!null
152 175 let datas = response.data;
... ... @@ -157,11 +180,16 @@
157 180 let controlDefault = null
158 181 switch (strings[1]) {
159 182 case 'radio':
160   - controlValue = 0;
  183 + controlValue = idx;
161 184 controlDefault = strings[4]
162 185 break;
163   - // default:
  186 + // default:
164 187 }
  188 +
  189 + if(idx == -1){
  190 + this.needShow = true;
  191 + }
  192 +
165 193 formData.push({
166 194 controlId: strings[0],
167 195 controlType: strings[1],
... ... @@ -178,7 +206,7 @@
178 206 },
179 207 /** 提交按钮 */
180 208 submitForm() {
181   - formDataSave(this.id,this.form.formData).then(response => {
  209 + formDataSave(this.id, this.form.formData).then(response => {
182 210 this.msgSuccess("审批成功");
183 211 this.open = false;
184 212 this.getList();
... ...
trash-ui/src/views/activiti/taskhistory/end.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 +
  4 + <el-card class="box-card" v-for="task in tastList">
  5 + <div :class="{card_status:true,dismiss:task.checkStatus=='1',agree:task.checkStatus=='0'}">{{task.checkStatus=="0"?"已同意":"已拒绝"}}</div>
  6 + <div class="card_btn">
  7 + <a @click="examineAndApprove(task,-1)" >详情>></a>
  8 + </div>
  9 + <el-row class="card_row">
  10 + <el-col :span="2" class="card_grid"></el-col>
  11 + <div class="card_title">{{task.instanceName}}</div>
  12 + </el-row>
  13 +
  14 + <el-row class="card_row">
  15 + <el-col :span="3" class="card_grid"></el-col>
  16 + <el-col :span="6" class="card_grid">
  17 + <div>开始时间: {{task.startTime}}</div>
  18 + </el-col>
  19 + <el-col :span="6" class="card_grid center">
  20 + <div>结束时间: {{task.endTime}}</div>
  21 + </el-col>
  22 + <el-col :span="6" class="card_grid right">
  23 + <div>申请类型: {{task.type}}</div>
  24 + </el-col>
  25 + <el-col :span="3" class="card_grid"></el-col>
  26 + </el-row>
  27 + <el-row class="card_row">
  28 + <el-col :span="3" class="card_grid">
  29 + <div></div>
  30 + </el-col>
  31 + <el-col :span="18">
  32 + <div>申请理由: {{task.reason}}</div>
  33 + </el-col>
  34 + <el-col :span="3" class="card_grid"></el-col>
  35 + </el-row>
  36 + </el-card>
  37 +
  38 +
  39 + <!--<el-table v-loading="loading" :data="tastList">
  40 + <el-table-column label="流程ID" align="center" prop="id"/>
  41 + <el-table-column label="流程名称" align="center" prop="instanceName" />
  42 + <el-table-column label="任务节点名称" align="center" prop="name" />
  43 + <el-table-column label="任务状态" align="center" prop="status" />
  44 + <el-table-column label="办理人" align="center" prop="assignee" />
  45 + <el-table-column label="创建时间" align="center" prop="createdDate" />
  46 +
  47 + <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  48 + <template slot-scope="scope">
  49 + <el-button size="mini" type="text" icon="el-icon-edit" @click="examineAndApprove (scope.row)"
  50 + v-hasPermi="['workflow:leave:edit']">审批
  51 + </el-button>
  52 + </template>
  53 + </el-table-column>
  54 + </el-table>-->
  55 +
  56 + <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  57 +
  58 + <!-- 查看详细信息话框 -->
  59 + <el-dialog :title="title" :visible.sync="open" append-to-body>
  60 + <earthSitesForm :businessKey="businessKey" v-if="open"/>
  61 + <div slot="footer" class="dialog-footer">
  62 + <el-button @click="open=!open">关闭</el-button>
  63 + </div>
  64 + </el-dialog>
  65 +
  66 + </div>
  67 +</template>
  68 +
  69 +<style>
  70 + @import '../../../assets/css/task.css'
  71 +</style>
  72 +
  73 +<script>
  74 + import {
  75 + listEndTask,
  76 + formDataShow
  77 + } from "@/api/activiti/taskhistory";
  78 + import leaveHistoryForm from "@/views/workflow/leave/leaveHistoryForm";
  79 + import earthSitesForm from "@/views/workflow/leave/earthSitesForm";
  80 +
  81 + export default {
  82 + name: "taskHistory",
  83 + components: {
  84 + leaveHistoryForm,
  85 + earthSitesForm
  86 + },
  87 + data() {
  88 + return {
  89 + id: '',
  90 + definitionKey: '',
  91 + businessKey: '',
  92 + // 遮罩层
  93 + loading: true,
  94 + // 选中数组
  95 + ids: [],
  96 + // 非单个禁用
  97 + single: true,
  98 + // 非多个禁用
  99 + multiple: true,
  100 + // 显示搜索条件
  101 + showSearch: true,
  102 + // 总条数
  103 + total: 0,
  104 + // 请假表格数据
  105 + tastList: [],
  106 + // 弹出层标题
  107 + title: "",
  108 + // 是否显示弹出层
  109 + open: false,
  110 + // 查询参数
  111 + queryParams: {
  112 + pageNum: 1,
  113 + pageSize: 10,
  114 + },
  115 + // 表单参数
  116 + form: {
  117 + formData: []
  118 + },
  119 + needShow:false,
  120 + // 表单校验
  121 + rules: {}
  122 + };
  123 + },
  124 + created() {
  125 + this.getList();
  126 + },
  127 + methods: {
  128 + /** 查询请假列表 */
  129 + getList() {
  130 + this.loading = true;
  131 + listEndTask(this.queryParams).then(response => {
  132 + this.tastList = response.rows;
  133 + this.total = response.total;
  134 + this.loading = false;
  135 + });
  136 + },
  137 +
  138 + // 取消按钮
  139 + cancel() {
  140 + this.open = false;
  141 + this.reset();
  142 + },
  143 + // 表单重置
  144 + reset() {
  145 + this.definitionKey = '',
  146 + this.businessKey = '',
  147 + this.form = {
  148 + formData: [],
  149 + };
  150 + this.resetForm("form");
  151 + },
  152 + examineAndApprove(row,idx) {
  153 + this.needShow = false;
  154 + this.reset();
  155 + this.definitionKey = row.definitionKey;
  156 + this.businessKey = row.businessKey;
  157 + this.id = row.id;
  158 + this.open = true;
  159 + this.title = "详情";
  160 + /* formDataShow(this.id).then(response => {
  161 + // FormProperty_3qipis2--__!!radio--__!!审批意见--__!!i--__!!同意--__--不同意
  162 + // FormProperty_0lffpcm--__!!textarea--__!!批注--__!!f--__!!null
  163 + let datas = response.data;
  164 + let formData = []
  165 + for (let i = 0; i < datas.length; i++) {
  166 + let strings = datas[i].split('--__!!')
  167 + let controlValue = null
  168 + let controlDefault = null
  169 + switch (strings[1]) {
  170 + case 'radio':
  171 + controlValue = idx;
  172 + controlDefault = strings[4]
  173 + break;
  174 + // default:
  175 + }
  176 +
  177 + if(idx == -1){
  178 + this.needShow = true;
  179 + }
  180 +
  181 + formData.push({
  182 + controlId: strings[0],
  183 + controlType: strings[1],
  184 + controlLable: strings[2],
  185 + controlIsParam: strings[3],
  186 + controlValue: controlValue,
  187 + controlDefault: controlDefault
  188 + })
  189 + }
  190 + this.form.formData = formData;
  191 + }); */
  192 + },
  193 + }
  194 + };
  195 +</script>
... ...
trash-ui/src/views/activiti/taskhistory/index.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 +
  4 + <el-card class="box-card" v-for="task in tastList">
  5 + <div :class="{card_status:true,dismiss:task.checkStatus=='1',agree:task.checkStatus=='0'}">{{task.checkStatus=="0"?"已同意":"已拒绝"}}</div>
  6 + <div class="card_btn">
  7 + <a @click="examineAndApprove(task,-1)" >详情>></a>
  8 + </div>
  9 + <el-row class="card_row">
  10 + <el-col :span="2" class="card_grid"></el-col>
  11 + <div class="card_title">{{task.instanceName}}</div>
  12 + </el-row>
  13 +
  14 + <el-row class="card_row">
  15 + <el-col :span="3" class="card_grid"></el-col>
  16 + <el-col :span="6" class="card_grid">
  17 + <div>开始时间: {{task.startTime}}</div>
  18 + </el-col>
  19 + <el-col :span="6" class="card_grid center">
  20 + <div>结束时间: {{task.endTime}}</div>
  21 + </el-col>
  22 + <el-col :span="6" class="card_grid right">
  23 + <div>申请类型: {{task.type}}</div>
  24 + </el-col>
  25 + <el-col :span="3" class="card_grid"></el-col>
  26 + </el-row>
  27 + <el-row class="card_row">
  28 + <el-col :span="3" class="card_grid">
  29 + <div></div>
  30 + </el-col>
  31 + <el-col :span="18">
  32 + <div>申请理由: {{task.reason}}</div>
  33 + </el-col>
  34 + <el-col :span="3" class="card_grid"></el-col>
  35 + </el-row>
  36 + </el-card>
  37 +
  38 +
  39 + <!--<el-table v-loading="loading" :data="tastList">
  40 + <el-table-column label="流程ID" align="center" prop="id"/>
  41 + <el-table-column label="流程名称" align="center" prop="instanceName" />
  42 + <el-table-column label="任务节点名称" align="center" prop="name" />
  43 + <el-table-column label="任务状态" align="center" prop="status" />
  44 + <el-table-column label="办理人" align="center" prop="assignee" />
  45 + <el-table-column label="创建时间" align="center" prop="createdDate" />
  46 +
  47 + <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  48 + <template slot-scope="scope">
  49 + <el-button size="mini" type="text" icon="el-icon-edit" @click="examineAndApprove (scope.row)"
  50 + v-hasPermi="['workflow:leave:edit']">审批
  51 + </el-button>
  52 + </template>
  53 + </el-table-column>
  54 + </el-table>-->
  55 +
  56 + <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  57 +
  58 + <!-- 查看详细信息话框 -->
  59 + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  60 + <leaveHistoryForm :businessKey="businessKey" v-if="open"/>
  61 + <div slot="footer" class="dialog-footer">
  62 + <el-button @click="open=!open">关闭</el-button>
  63 + </div>
  64 + </el-dialog>
  65 +
  66 + </div>
  67 +</template>
  68 +
  69 +<style>
  70 + @import '../../../assets/css/task.css'
  71 +</style>
  72 +
  73 +<script>
  74 + import {
  75 + listTask,
  76 + formDataShow
  77 + } from "@/api/activiti/taskhistory";
  78 + import leaveHistoryForm from "@/views/workflow/leave/leaveHistoryForm";
  79 +
  80 + export default {
  81 + name: "taskHistory",
  82 + components: {
  83 + leaveHistoryForm
  84 + },
  85 + data() {
  86 + return {
  87 + id: '',
  88 + definitionKey: '',
  89 + businessKey: '',
  90 + // 遮罩层
  91 + loading: true,
  92 + // 选中数组
  93 + ids: [],
  94 + // 非单个禁用
  95 + single: true,
  96 + // 非多个禁用
  97 + multiple: true,
  98 + // 显示搜索条件
  99 + showSearch: true,
  100 + // 总条数
  101 + total: 0,
  102 + // 请假表格数据
  103 + tastList: [],
  104 + // 弹出层标题
  105 + title: "",
  106 + // 是否显示弹出层
  107 + open: false,
  108 + // 查询参数
  109 + queryParams: {
  110 + pageNum: 1,
  111 + pageSize: 10,
  112 + },
  113 + // 表单参数
  114 + form: {
  115 + formData: []
  116 + },
  117 + needShow:false,
  118 + // 表单校验
  119 + rules: {}
  120 + };
  121 + },
  122 + created() {
  123 + this.getList();
  124 + },
  125 + methods: {
  126 + /** 查询请假列表 */
  127 + getList() {
  128 + this.loading = true;
  129 + listTask(this.queryParams).then(response => {
  130 + this.tastList = response.rows;
  131 + this.total = response.total;
  132 + this.loading = false;
  133 + });
  134 + },
  135 +
  136 + // 取消按钮
  137 + cancel() {
  138 + this.open = false;
  139 + this.reset();
  140 + },
  141 + // 表单重置
  142 + reset() {
  143 + this.definitionKey = '',
  144 + this.businessKey = '',
  145 + this.form = {
  146 + formData: [],
  147 + };
  148 + this.resetForm("form");
  149 + },
  150 + examineAndApprove(row,idx) {
  151 + this.needShow = false;
  152 + this.reset();
  153 + this.definitionKey = row.definitionKey;
  154 + this.businessKey = row.businessKey;
  155 + this.id = row.id;
  156 + formDataShow(row.id).then(response => {
  157 + // FormProperty_3qipis2--__!!radio--__!!审批意见--__!!i--__!!同意--__--不同意
  158 + // FormProperty_0lffpcm--__!!textarea--__!!批注--__!!f--__!!null
  159 + let datas = response.data;
  160 + let formData = []
  161 + for (let i = 0; i < datas.length; i++) {
  162 + let strings = datas[i].split('--__!!')
  163 + let controlValue = null
  164 + let controlDefault = null
  165 + switch (strings[1]) {
  166 + case 'radio':
  167 + controlValue = idx;
  168 + controlDefault = strings[4]
  169 + break;
  170 + // default:
  171 + }
  172 +
  173 + if(idx == -1){
  174 + this.needShow = true;
  175 + }
  176 +
  177 + formData.push({
  178 + controlId: strings[0],
  179 + controlType: strings[1],
  180 + controlLable: strings[2],
  181 + controlIsParam: strings[3],
  182 + controlValue: controlValue,
  183 + controlDefault: controlDefault
  184 + })
  185 + }
  186 + this.form.formData = formData;
  187 + this.open = true;
  188 + this.title = "审批";
  189 + });
  190 + },
  191 + /** 提交按钮 */
  192 + submitForm() {
  193 + formDataSave(this.id, this.form.formData).then(response => {
  194 + this.msgSuccess("审批成功");
  195 + this.open = false;
  196 + this.getList();
  197 + });
  198 + },
  199 + }
  200 + };
  201 +</script>
... ...
trash-ui/src/views/index.vue
1 1 <template>
2 2 <div class="dashboard-editor-container">
3   -
  3 +<!--
4 4 <panel-group @handleSetLineChartData="handleSetLineChartData" />
5 5  
6 6 <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
7 7 <line-chart :chart-data="lineChartData" />
8   - </el-row>
  8 + </el-row> -->
9 9  
10   - <el-row :gutter="32">
  10 + <!-- <el-row :gutter="32">
11 11 <el-col :xs="24" :sm="24" :lg="8">
12 12 <div class="chart-wrapper">
13 13 <raddar-chart />
... ... @@ -23,55 +23,55 @@
23 23 <bar-chart />
24 24 </div>
25 25 </el-col>
26   - </el-row>
  26 + </el-row> -->
  27 +
27 28  
28   -
29 29 </div>
30 30 </template>
31 31  
32 32 <script>
33   -import PanelGroup from './dashboard/PanelGroup'
34   -import LineChart from './dashboard/LineChart'
35   -import RaddarChart from './dashboard/RaddarChart'
36   -import PieChart from './dashboard/PieChart'
37   -import BarChart from './dashboard/BarChart'
  33 +// import PanelGroup from './dashboard/PanelGroup'
  34 +// import LineChart from './dashboard/LineChart'
  35 +// import RaddarChart from './dashboard/RaddarChart'
  36 +// import PieChart from './dashboard/PieChart'
  37 +// import BarChart from './dashboard/BarChart'
38 38  
39   -const lineChartData = {
40   - newVisitis: {
41   - expectedData: [100, 120, 161, 134, 105, 160, 165],
42   - actualData: [120, 82, 91, 154, 162, 140, 145]
43   - },
44   - messages: {
45   - expectedData: [200, 192, 120, 144, 160, 130, 140],
46   - actualData: [180, 160, 151, 106, 145, 150, 130]
47   - },
48   - purchases: {
49   - expectedData: [80, 100, 121, 104, 105, 90, 100],
50   - actualData: [120, 90, 100, 138, 142, 130, 130]
51   - },
52   - shoppings: {
53   - expectedData: [130, 140, 141, 142, 145, 150, 160],
54   - actualData: [120, 82, 91, 154, 162, 140, 130]
55   - }
56   -}
  39 +// const lineChartData = {
  40 +// newVisitis: {
  41 +// expectedData: [100, 120, 161, 134, 105, 160, 165],
  42 +// actualData: [120, 82, 91, 154, 162, 140, 145]
  43 +// },
  44 +// messages: {
  45 +// expectedData: [200, 192, 120, 144, 160, 130, 140],
  46 +// actualData: [180, 160, 151, 106, 145, 150, 130]
  47 +// },
  48 +// purchases: {
  49 +// expectedData: [80, 100, 121, 104, 105, 90, 100],
  50 +// actualData: [120, 90, 100, 138, 142, 130, 130]
  51 +// },
  52 +// shoppings: {
  53 +// expectedData: [130, 140, 141, 142, 145, 150, 160],
  54 +// actualData: [120, 82, 91, 154, 162, 140, 130]
  55 +// }
  56 +// }
57 57  
58 58 export default {
59 59 name: 'Index',
60 60 components: {
61   - PanelGroup,
62   - LineChart,
63   - RaddarChart,
64   - PieChart,
65   - BarChart
  61 + // PanelGroup,
  62 + // LineChart,
  63 + // RaddarChart,
  64 + // PieChart,
  65 + // BarChart
66 66 },
67 67 data() {
68 68 return {
69   - lineChartData: lineChartData.newVisitis
  69 + // lineChartData: lineChartData.newVisitis
70 70 }
71 71 },
72 72 methods: {
73 73 handleSetLineChartData(type) {
74   - this.lineChartData = lineChartData[type]
  74 + // this.lineChartData = lineChartData[type]
75 75 }
76 76 }
77 77 }
... ...
trash-ui/src/views/workflow/leave/earthSitesForm.vue 0 → 100644
  1 +<template>
  2 + <div>
  3 + <div>
  4 + <h2>申请人:{{form.createName}}</h2>
  5 + <el-form label-width="80px">
  6 + <el-form-item label="类型" >
  7 + <el-input v-model="form.type"/>
  8 + </el-form-item>
  9 + <el-form-item label="标题">
  10 + <el-input v-model="form.title"/>
  11 + </el-form-item>
  12 + <el-form-item label="申请理由" >
  13 + <el-input v-model="form.reason" />
  14 + </el-form-item>
  15 + <el-form-item label="开始时间">
  16 + <el-input v-model="form.leaveStartTime"/>
  17 + </el-form-item>
  18 + <el-form-item label="结束时间">
  19 + <el-input v-model="form.leaveEndTime"/>
  20 + </el-form-item>
  21 + </el-form>
  22 + </div>
  23 + <div v-for="(historyData, index) in fromData"
  24 + :key="index" >
  25 + <h2>{{historyData.taskNodeName}}</h2>
  26 + <h3>审批人:{{historyData.createName}}</h3>
  27 + <h3>审批时间:{{historyData.createdDate}}</h3>
  28 + <el-form v-for="(fistoryFormData, indexH) in historyData.formHistoryDataDTO" :key="indexH" label-width="80px">
  29 + <el-form-item :label=fistoryFormData.title >
  30 + <el-input v-model="fistoryFormData.value"/>
  31 + </el-form-item>
  32 + </el-form>
  33 + </div>
  34 + </div>
  35 +</template>
  36 +
  37 +<script>
  38 + import { getLeave } from '@/api/workflow/leave'
  39 + import { historyFromData } from '@/api/activiti/historyFormdata'
  40 + export default {
  41 + name: "earthSitesForm",
  42 + props: {
  43 + businessKey: {
  44 + type: String
  45 + }
  46 + },
  47 + data(){
  48 + return{
  49 + // 表单参数
  50 + form: {},
  51 + fromData:[],
  52 + }
  53 + },
  54 + created() {
  55 + this.getLeave()
  56 + this.historyFromData()
  57 + },
  58 + methods:{
  59 + getLeave() {
  60 + getLeave(this.businessKey).then(response => {
  61 + this.form = response.data
  62 + })
  63 + },
  64 + historyFromData() {
  65 + historyFromData(this.businessKey).then(response => {
  66 + this.fromData = response.data
  67 + })
  68 + },
  69 + }
  70 +
  71 + }
  72 +</script>
  73 +
  74 +<style scoped>
  75 +
  76 +</style>
... ...
trash-ui/src/views/workflow/leave/index.vue
... ... @@ -400,7 +400,6 @@
400 400 this.businessKey = row.id
401 401 this.open2 = true
402 402 this.title = '审批详情'
403   -
404 403 },
405 404 /** 进度查看 */
406 405 checkTheSchedule(row) {
... ...
trash-ui/src/views/workflow/leave/leaveHistoryForm.vue
... ... @@ -9,7 +9,7 @@
9 9 <el-form-item label="标题">
10 10 <el-input v-model="form.title"/>
11 11 </el-form-item>
12   - <el-form-item label="原因" >
  12 + <el-form-item label="申请理由" >
13 13 <el-input v-model="form.reason" />
14 14 </el-form-item>
15 15 <el-form-item label="开始时间">
... ...
trash-workFlow/pom.xml
... ... @@ -16,6 +16,9 @@
16 16 <groupId>com.trash</groupId>
17 17 <artifactId>trash-activiti</artifactId>
18 18 </dependency>
19   -
  19 + <dependency>
  20 + <groupId>com.trash</groupId>
  21 + <artifactId>trash-activiti</artifactId>
  22 + </dependency>
20 23 </dependencies>
21 24 </project>
22 25 \ No newline at end of file
... ...
trash-workFlow/src/main/java/com/trash/leave/controller/WorkflowController.java 0 → 100644
  1 +package com.trash.leave.controller;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.PathVariable;
  7 +import org.springframework.web.bind.annotation.PostMapping;
  8 +import org.springframework.web.bind.annotation.RequestBody;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.trash.common.core.controller.BaseController;
  13 +import com.trash.common.core.domain.AjaxResult;
  14 +import com.trash.common.core.domain.entity.SysUser;
  15 +import com.trash.common.core.domain.model.LoginUser;
  16 +import com.trash.common.utils.SecurityUtils;
  17 +import com.trash.framework.web.service.SysLoginService;
  18 +import com.trash.leave.service.IWorkflowService;
  19 +import com.trash.system.service.ISysUserService;
  20 +
  21 +/**
  22 + * 请假Controller
  23 + *
  24 + * @author danny
  25 + * @date 2020-10-28
  26 + */
  27 +@RestController
  28 +@RequestMapping("/workflow")
  29 +public class WorkflowController extends BaseController {
  30 +
  31 + @Autowired
  32 + IWorkflowService workflowService;
  33 +
  34 +
  35 + @Autowired
  36 + private SysLoginService loginService;
  37 + /**
  38 + * 查询请假列表
  39 + */
  40 + @RequestMapping("/add")
  41 + public AjaxResult add(@RequestBody Map<String,Object> map) {
  42 + String username = null;
  43 + try {
  44 + username = SecurityUtils.getUsername() ;
  45 + } catch (Exception e) {
  46 + // TODO: handle exception
  47 + }
  48 + if(username == null){
  49 + loginService.loginByRemote(map.get("user").toString());
  50 + }
  51 +
  52 + int i = workflowService.createWorkFlow(map);
  53 +
  54 + return AjaxResult.success("create work flow success");
  55 + }
  56 +
  57 + /**
  58 + * 查询请假列表 */
  59 +// @GetMapping("/listAll")
  60 +// public TableDataInfo listAll(WorkflowLeave workflowLeave) {
  61 +// startPage();
  62 +// List<WorkflowLeave> list = workflowLeaveService.selectWorkflowLeaveList(workflowLeave);
  63 +// return getDataTable(list);
  64 +// }
  65 +//
  66 +// /**
  67 +// * 获取请假详细信息
  68 +// */
  69 +// @PreAuthorize("@ss.hasPermi('workflow:leave:query')")
  70 +// @GetMapping(value = "/{id}")
  71 +// public AjaxResult getInfo(@PathVariable("id") String id) {
  72 +// return AjaxResult.success(workflowLeaveService.selectWorkflowLeaveById(id));
  73 +// } /**
  74 +// * 获取请假详细信息
  75 +// */
  76 +// @PreAuthorize("@ss.hasPermi('workflow:leave:query')")
  77 +// @GetMapping(value = "ByInstanceId/{instanceId}")
  78 +// public AjaxResult getInfoByInstanceId(@PathVariable("instanceId") String instanceId) {
  79 +// return AjaxResult.success(workflowLeaveService.selectWorkflowLeaveByInstanceId(instanceId));
  80 +// }
  81 +//
  82 +// /**
  83 +// * 新增请假
  84 +// */
  85 +// @PreAuthorize("@ss.hasPermi('workflow:leave:add')")
  86 +// @Log(title = "请假", businessType = BusinessType.INSERT)
  87 +// @PostMapping
  88 +// public AjaxResult add(@RequestBody WorkflowLeave workflowLeave) {
  89 +// return toAjax(workflowLeaveService.insertWorkflowLeave(workflowLeave));
  90 +// }
  91 +//
  92 +// /**
  93 +// * 修改请假
  94 +// */
  95 +// @PreAuthorize("@ss.hasPermi('workflow:leave:edit')")
  96 +// @Log(title = "请假", businessType = BusinessType.UPDATE)
  97 +// @PutMapping
  98 +// public AjaxResult edit(@RequestBody WorkflowLeave workflowLeave) {
  99 +// return toAjax(workflowLeaveService.insertWorkflowLeave(workflowLeave));
  100 +// }
  101 +//
  102 +// /**
  103 +// * 删除请假
  104 +// */
  105 +// @PreAuthorize("@ss.hasPermi('workflow:leave:remove')")
  106 +// @Log(title = "请假", businessType = BusinessType.DELETE)
  107 +// @DeleteMapping("/{ids}")
  108 +// public AjaxResult remove(@PathVariable String[] ids) {
  109 +// return toAjax(workflowLeaveService.deleteWorkflowLeaveByIds(ids));
  110 +// }
  111 +}
... ...
trash-workFlow/src/main/java/com/trash/leave/domain/Workflow.java 0 → 100644
  1 +package com.trash.leave.domain;
  2 +
  3 +import java.util.Date;
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import org.apache.commons.lang3.builder.ToStringBuilder;
  6 +import org.apache.commons.lang3.builder.ToStringStyle;
  7 +import com.trash.common.annotation.Excel;
  8 +import com.trash.common.core.domain.BaseEntity;
  9 +
  10 +/**
  11 + * 请假对象 workflow_leave
  12 + *
  13 + * @author danny
  14 + * @date 2020-10-28
  15 + */
  16 +public class Workflow extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 主键ID */
  21 + private String id;
  22 +
  23 + /** 请假类型 */
  24 + @Excel(name = "请假类型")
  25 + private String type;
  26 +
  27 + /** 标题 */
  28 + @Excel(name = "标题")
  29 + private String title;
  30 +
  31 + /** 原因 */
  32 + @Excel(name = "原因")
  33 + private String reason;
  34 +
  35 + /** 开始时间 */
  36 + @JsonFormat(pattern = "yyyy-MM-dd")
  37 + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
  38 + private String startTime;
  39 +
  40 + /** 结束时间 */
  41 + @JsonFormat(pattern = "yyyy-MM-dd")
  42 + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
  43 + private String endTime;
  44 +
  45 +
  46 + private String instanceId;
  47 + private String taskName;
  48 +
  49 + /** 状态 */
  50 + @Excel(name = "状态")
  51 + private String state;
  52 +
  53 + /** 创建人 */
  54 + @Excel(name = "创建人")
  55 + private String createName;
  56 +
  57 + public void setId(String id)
  58 + {
  59 + this.id = id;
  60 + }
  61 +
  62 + public String getId()
  63 + {
  64 + return id;
  65 + }
  66 + public void setType(String type)
  67 + {
  68 + this.type = type;
  69 + }
  70 +
  71 + public String getType()
  72 + {
  73 + return type;
  74 + }
  75 + public void setTitle(String title)
  76 + {
  77 + this.title = title;
  78 + }
  79 +
  80 + public String getTitle()
  81 + {
  82 + return title;
  83 + }
  84 + public void setReason(String reason)
  85 + {
  86 + this.reason = reason;
  87 + }
  88 +
  89 + public String getReason()
  90 + {
  91 + return reason;
  92 + }
  93 +
  94 +
  95 + public void setInstanceId(String instanceId)
  96 + {
  97 + this.instanceId = instanceId;
  98 + }
  99 +
  100 + public String getInstanceId()
  101 + {
  102 + return instanceId;
  103 + }
  104 + public void setState(String state)
  105 + {
  106 + this.state = state;
  107 + }
  108 +
  109 + public String getState()
  110 + {
  111 + return state;
  112 + }
  113 +
  114 + public String getCreateName() {
  115 + return createName;
  116 + }
  117 +
  118 + public void setCreateName(String createName) {
  119 + this.createName = createName;
  120 + }
  121 +
  122 + public String getTaskName() {
  123 + return taskName;
  124 + }
  125 +
  126 + public void setTaskName(String taskName) {
  127 + this.taskName = taskName;
  128 + }
  129 +
  130 +
  131 +
  132 + public String getStartTime() {
  133 + return startTime;
  134 + }
  135 +
  136 + public void setStartTime(String startTime) {
  137 + this.startTime = startTime;
  138 + }
  139 +
  140 + public String getEndTime() {
  141 + return endTime;
  142 + }
  143 +
  144 + public void setEndTime(String endTime) {
  145 + this.endTime = endTime;
  146 + }
  147 +
  148 + @Override
  149 + public String toString() {
  150 + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  151 + .append("id", getId())
  152 + .append("type", getType())
  153 + .append("title", getTitle())
  154 + .append("reason", getReason())
  155 + .append("startTime", getStartTime())
  156 + .append("endTime", getEndTime())
  157 + .append("instanceId", getInstanceId())
  158 + .append("state", getState())
  159 + .append("createBy", getCreateBy())
  160 + .append("createTime", getCreateTime())
  161 + .append("updateTime", getUpdateTime())
  162 + .toString();
  163 + }
  164 +}
... ...
trash-workFlow/src/main/java/com/trash/leave/instener/EarthSitesEndStateListener.java 0 → 100644
  1 +package com.trash.leave.instener;
  2 +
  3 +import com.trash.leave.domain.WorkflowLeave;
  4 +import com.trash.leave.service.IWorkflowLeaveService;
  5 +import com.trash.common.utils.spring.SpringUtils;
  6 +
  7 +import org.activiti.engine.delegate.DelegateExecution;
  8 +import org.activiti.engine.delegate.ExecutionListener;
  9 +import org.activiti.engine.delegate.Expression;
  10 +
  11 +
  12 +public class EarthSitesEndStateListener implements ExecutionListener {
  13 +
  14 + private Expression state;
  15 +
  16 + @Override
  17 + public void notify(DelegateExecution delegateExecution) {
  18 + System.out.println("流程状态更新 更新ID:" + delegateExecution.getProcessInstanceBusinessKey() + "状态:" + state.getValue(delegateExecution).toString());
  19 + }
  20 +}
... ...
trash-workFlow/src/main/java/com/trash/leave/mapper/WorkflowMapper.java 0 → 100644
  1 +package com.trash.leave.mapper;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import com.trash.leave.domain.Workflow;
  8 +
  9 +/**
  10 + * 请假Mapper接口
  11 + *
  12 + * @author danny
  13 + * @date 2020-10-28
  14 + */
  15 +public interface WorkflowMapper
  16 +{
  17 + /**
  18 + * 查询请假
  19 + *
  20 + * @param id 请假ID
  21 + * @return 请假
  22 + */
  23 + public Workflow selectWorkflowById(String id); /**
  24 + * 查询请假
  25 + *
  26 + * @param instanceId 请假ID
  27 + * @return 请假
  28 + */
  29 + public Workflow selectWorkflowByInstanceId(String instanceId);
  30 +
  31 + /**
  32 + * 查询请假列表根据部门编号和Workflow
  33 + *
  34 + * @param Workflow 请假
  35 + * @return 请假集合
  36 + */
  37 + public List<Workflow> selectWorkflowListByWorkflowAndDeptId(@Param("Workflow")Workflow Workflow,@Param("deptId") Long deptId);
  38 + /**
  39 + * 查询请假列表
  40 + *
  41 + * @param Workflow 请假
  42 + * @return 请假集合
  43 + */
  44 + public List<Workflow> selectWorkflowList(Workflow Workflow);
  45 +
  46 +
  47 + /**
  48 + * 新增请假
  49 + *
  50 + * @param Workflow 请假
  51 + * @return 结果
  52 + */
  53 + public int insertWorkflow(Workflow Workflow);
  54 +
  55 + /**
  56 + * 修改请假
  57 + *
  58 + * @param Workflow 请假
  59 + * @return 结果
  60 + */
  61 + public int updateWorkflow(Workflow Workflow);
  62 +
  63 + /**
  64 + * 删除请假
  65 + *
  66 + * @param id 请假ID
  67 + * @return 结果
  68 + */
  69 + public int deleteWorkflowById(String id);
  70 +
  71 + /**
  72 + * 批量删除请假
  73 + *
  74 + * @param ids 需要删除的数据ID
  75 + * @return 结果
  76 + */
  77 + public int deleteWorkflowByIds(String[] ids);
  78 +}
... ...
trash-workFlow/src/main/java/com/trash/leave/service/IWorkflowLeaveService.java
1 1 package com.trash.leave.service;
2 2  
3 3 import java.util.List;
  4 +import java.util.Map;
4 5  
5 6 import com.trash.leave.domain.WorkflowLeave;
6 7 import com.trash.activiti.domain.dto.HistoryDataDTO;
... ... @@ -71,4 +72,5 @@ public interface IWorkflowLeaveService
71 72  
72 73  
73 74 public WorkflowLeave selectWorkflowLeaveByInstanceId(String instanceId);
  75 +
74 76 }
... ...
trash-workFlow/src/main/java/com/trash/leave/service/IWorkflowService.java 0 → 100644
  1 +package com.trash.leave.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.trash.leave.domain.Workflow;
  7 +import com.trash.activiti.domain.dto.HistoryDataDTO;
  8 +
  9 +/**
  10 + * 请假Service接口
  11 + *
  12 + * @author danny
  13 + * @date 2020-10-28
  14 + */
  15 +public interface IWorkflowService
  16 +{
  17 + public int createWorkFlow(Map<String,Object> map);
  18 + /**
  19 + * 查询请假
  20 + *
  21 + * @param id 请假ID
  22 + * @return 请假
  23 + */
  24 + public Workflow selectWorkflowById(String id);
  25 +
  26 + /**
  27 + * 查询请假列表
  28 + *
  29 + * @param Workflow 请假
  30 + * @return 请假集合
  31 + */
  32 + public List<Workflow> selectWorkflowList(Workflow Workflow);
  33 +
  34 + /**
  35 + * 查询请假列表
  36 + *
  37 + * @param Workflow 请假
  38 + * @return 请假集合
  39 + */
  40 + public List<Workflow> selectWorkflowAndTaskNameList(Workflow Workflow);
  41 +
  42 + /**
  43 + * 新增请假
  44 + *
  45 + * @param Workflow 请假
  46 + * @return 结果
  47 + */
  48 + public int insertWorkflow(Workflow Workflow);
  49 +
  50 + /**
  51 + * 修改请假
  52 + *
  53 + * @param Workflow 请假
  54 + * @return 结果
  55 + */
  56 + public int updateWorkflow(Workflow Workflow);
  57 +
  58 + /**
  59 + * 批量删除请假
  60 + *
  61 + * @param ids 需要删除的请假ID
  62 + * @return 结果
  63 + */
  64 + public int deleteWorkflowByIds(String[] ids);
  65 +
  66 + /**
  67 + * 删除请假信息
  68 + *
  69 + * @param id 请假ID
  70 + * @return 结果
  71 + */
  72 + public int deleteWorkflowById(String id);
  73 +
  74 +
  75 + public Workflow selectWorkflowByInstanceId(String instanceId);
  76 +}
... ...
trash-workFlow/src/main/java/com/trash/leave/service/impl/WorkflowLeaveServiceImpl.java
... ... @@ -95,13 +95,11 @@ public class WorkflowLeaveServiceImpl implements IWorkflowLeaveService {
95 95 String id = UUID.randomUUID().toString();
96 96 workflowLeave.setId(id);
97 97 workflowLeave.setCreateTime(DateUtils.getNowDate());
98   - String join = StringUtils.join(sysUserService.selectUserNameByPostCodeAndDeptId("se", SecurityUtils.getLoginUser().getUser().getDeptId()), ",");
99 98 ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder
100 99 .start()
101   - .withProcessDefinitionKey("leave")
  100 + .withProcessDefinitionKey("workflow_earthsites")
102 101 .withName(workflowLeave.getTitle())
103 102 .withBusinessKey(id)
104   - .withVariable("deptLeader",join)
105 103 .build());
106 104 workflowLeave.setInstanceId(processInstance.getId());
107 105 workflowLeave.setState("0");
... ...
trash-workFlow/src/main/java/com/trash/leave/service/impl/WorkflowServiceImpl.java 0 → 100644
  1 +package com.trash.leave.service.impl;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +import java.util.stream.Collectors;
  6 +
  7 +import org.activiti.api.process.model.ProcessInstance;
  8 +import org.activiti.api.process.model.builders.ProcessPayloadBuilder;
  9 +import org.activiti.api.process.runtime.ProcessRuntime;
  10 +import org.activiti.engine.TaskService;
  11 +import org.activiti.engine.task.Task;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import com.trash.common.utils.DateUtils;
  16 +import com.trash.common.utils.SecurityUtils;
  17 +import com.trash.common.utils.StringUtils;
  18 +import com.trash.common.utils.uuid.UUID;
  19 +import com.trash.leave.domain.Workflow;
  20 +import com.trash.leave.mapper.WorkflowMapper;
  21 +import com.trash.leave.service.IWorkflowService;
  22 +import com.trash.system.service.ISysUserService;
  23 +
  24 +/**
  25 + * 请假Service业务层处理
  26 + *
  27 + * @author danny
  28 + * @date 2020-10-28
  29 + */
  30 +@Service
  31 +public class WorkflowServiceImpl implements IWorkflowService {
  32 +
  33 + @Autowired
  34 + private WorkflowMapper workflowMapper;
  35 + @Autowired
  36 + private ProcessRuntime processRuntime;
  37 + @Autowired
  38 + private ISysUserService sysUserService;
  39 + @Autowired
  40 + private TaskService taskService;
  41 +
  42 + String siteType[] = {"消纳场","建筑垃圾资源化处置场","盾构土环保处置场","盾构土应急消纳场","回填场"};
  43 +
  44 + @Override
  45 + public int createWorkFlow(Map<String,Object> data) {
  46 +
  47 + String flowType = data.get("type").toString();
  48 + Map map = (Map) data.get("data");
  49 +
  50 + String businessKey = flowType + ":" + map.get("id"); //流程对应事务key
  51 + String title = siteType[Integer.parseInt(map.get("type").toString())] + map.get("certificateNo");
  52 +
  53 + String applyOpinion = map.get("applyOpinion").toString();
  54 +
  55 + String startTime = ((Map)map.get("site")).get("effectiveFrom").toString();
  56 + String endTime = ((Map)map.get("site")).get("effectiveEnd").toString();
  57 +
  58 + ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder
  59 + .start()
  60 + .withProcessDefinitionKey(flowType)
  61 + .withName(title)
  62 + .withBusinessKey(businessKey)
  63 + .build());
  64 +
  65 + Workflow workflow = new Workflow();
  66 + workflow.setId(businessKey);
  67 + workflow.setTitle(title);
  68 + workflow.setReason(applyOpinion);
  69 + workflow.setStartTime(startTime);
  70 + workflow.setEndTime(endTime);
  71 + workflow.setType(siteType[Integer.parseInt(map.get("type").toString())]);
  72 + workflow.setInstanceId(processInstance.getId());
  73 + workflow.setState("0");
  74 +
  75 +
  76 + return workflowMapper.insertWorkflow(workflow);
  77 + }
  78 +
  79 +
  80 + /**
  81 + * 查询请假
  82 + *
  83 + * @param id 请假ID
  84 + * @return 请假
  85 + */
  86 + @Override
  87 + public Workflow selectWorkflowById(String id) {
  88 + return workflowMapper.selectWorkflowById(id);
  89 + }
  90 +
  91 + /**
  92 + * 查询请假列表
  93 + *
  94 + * @param Workflow 请假
  95 + * @return 请假
  96 + */
  97 + @Override
  98 + public List<Workflow> selectWorkflowList(Workflow Workflow) {
  99 + return workflowMapper.selectWorkflowListByWorkflowAndDeptId(Workflow,SecurityUtils.getLoginUser().getUser().getDeptId());
  100 + }
  101 + /**
  102 + * 查询请假列表带任务状态
  103 + *
  104 + * @param Workflow 请假
  105 + * @return 请假
  106 + */
  107 + @Override
  108 + public List<Workflow> selectWorkflowAndTaskNameList(Workflow Workflow) {
  109 + List<Workflow> Workflows = workflowMapper.selectWorkflowList(Workflow);
  110 + List<String> collect = Workflows.parallelStream().map(wl -> wl.getInstanceId()).collect(Collectors.toList());
  111 + if(collect!=null&&!collect.isEmpty()) {
  112 + List<Task> tasks = taskService.createTaskQuery().processInstanceIdIn(collect).list();
  113 + Workflows.forEach(
  114 + wl->{
  115 + Task task = tasks.parallelStream().filter(t -> t.getProcessInstanceId().equals(wl.getInstanceId())).findAny().orElse(null);
  116 + if (task != null) {
  117 + wl.setTaskName(task.getName());
  118 + }
  119 + }
  120 + );
  121 + }
  122 + return Workflows;
  123 + }
  124 +
  125 + /**
  126 + * 新增请假
  127 + *
  128 + * @param Workflow 请假
  129 + * @return 结果
  130 + */
  131 + @Override
  132 + public int insertWorkflow(Workflow Workflow) {
  133 + String id = UUID.randomUUID().toString();
  134 + Workflow.setId(id);
  135 + Workflow.setCreateTime(DateUtils.getNowDate());
  136 + String join = StringUtils.join(sysUserService.selectUserNameByPostCodeAndDeptId("se", SecurityUtils.getLoginUser().getUser().getDeptId()), ",");
  137 + ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder
  138 + .start()
  139 + .withProcessDefinitionKey("leave")
  140 + .withName(Workflow.getTitle())
  141 + .withBusinessKey(id)
  142 + .withVariable("deptLeader",join)
  143 + .build());
  144 + Workflow.setInstanceId(processInstance.getId());
  145 + Workflow.setState("0");
  146 + Workflow.setCreateName(SecurityUtils.getNickName());
  147 + Workflow.setCreateBy(SecurityUtils.getUsername());
  148 + Workflow.setCreateTime(DateUtils.getNowDate());
  149 + return workflowMapper.insertWorkflow(Workflow);
  150 + }
  151 +
  152 + /**
  153 + * 修改请假
  154 + *
  155 + * @param Workflow 请假
  156 + * @return 结果
  157 + */
  158 + @Override
  159 + public int updateWorkflow(Workflow Workflow) {
  160 + Workflow.setUpdateTime(DateUtils.getNowDate());
  161 + return workflowMapper.updateWorkflow(Workflow);
  162 + }
  163 +
  164 + /**
  165 + * 批量删除请假
  166 + *
  167 + * @param ids 需要删除的请假ID
  168 + * @return 结果
  169 + */
  170 + @Override
  171 + public int deleteWorkflowByIds(String[] ids) {
  172 + return workflowMapper.deleteWorkflowByIds(ids);
  173 + }
  174 +
  175 + /**
  176 + * 删除请假信息
  177 + *
  178 + * @param id 请假ID
  179 + * @return 结果
  180 + */
  181 + @Override
  182 + public int deleteWorkflowById(String id) {
  183 + return workflowMapper.deleteWorkflowById(id);
  184 + }
  185 +
  186 + @Override
  187 + public Workflow selectWorkflowByInstanceId(String instanceId) {
  188 +
  189 + return workflowMapper.selectWorkflowByInstanceId(instanceId);
  190 + }
  191 +}
... ...
trash-workFlow/src/main/resources/mapper/leave/WorkflowLeaveMapper.xml
... ... @@ -9,8 +9,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
9 9 <result property="type" column="type" />
10 10 <result property="title" column="title" />
11 11 <result property="reason" column="reason" />
12   - <result property="leaveStartTime" column="leave_start_time" />
13   - <result property="leaveEndTime" column="leave_end_time" />
  12 + <result property="startTime" column="start_time" />
  13 + <result property="endTime" column="end_time" />
14 14 <result property="instanceId" column="instance_id" />
15 15 <result property="state" column="state" />
16 16 <result property="createName" column="create_name" />
... ... @@ -20,7 +20,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
20 20 </resultMap>
21 21  
22 22 <sql id="selectWorkflowLeaveVo">
23   - select id, type, title, reason, leave_start_time, leave_end_time, instance_id, state, create_name,create_by, create_time, update_time from workflow_leave
  23 + select id, type, title, reason, start_time, end_time, instance_id, state, create_name,create_by, create_time, update_time from workflow_leave
24 24 </sql>
25 25  
26 26 <select id="selectWorkflowLeaveListByWorkflowLeaveAndDeptId" resultMap="WorkflowLeaveResult">
... ... @@ -29,8 +29,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
29 29 <if test="workflowLeave.type != null and workflowLeave.type != ''"> and type = #{workflowLeave.type}</if>
30 30 <if test="workflowLeave.title != null and workflowLeave.title != ''"> and title = #{workflowLeave.title}</if>
31 31 <if test="workflowLeave.reason != null and workflowLeave.reason != ''"> and reason = #{workflowLeave.reason}</if>
32   - <if test="workflowLeave.leaveStartTime != null "> and leave_start_time = #{workflowLeave.leaveStartTime}</if>
33   - <if test="workflowLeave.leaveEndTime != null "> and leave_end_time = #{workflowLeave.leaveEndTime}</if>
  32 + <if test="workflowLeave.startTime != null "> and start_time = #{workflowLeave.startTime}</if>
  33 + <if test="workflowLeave.endTime != null "> and end_time = #{workflowLeave.endTime}</if>
34 34 <if test="workflowLeave.instanceId != null and workflowLeave.instanceId != ''"> and instance_id = #{workflowLeave.instanceId}</if>
35 35 <if test="workflowLeave.state != null and workflowLeave.state != ''"> and state = #{workflowLeave.state}</if>
36 36 <if test="workflowLeave.createName != null and workflowLeave.createName != ''"> and create_name = #{workflowLeave.createName}</if>
... ... @@ -44,8 +44,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
44 44 <if test="type != null and type != ''"> and type = #{type}</if>
45 45 <if test="title != null and title != ''"> and title = #{title}</if>
46 46 <if test="reason != null and reason != ''"> and reason = #{reason}</if>
47   - <if test="leaveStartTime != null "> and leave_start_time = #{leaveStartTime}</if>
48   - <if test="leaveEndTime != null "> and leave_end_time = #{leaveEndTime}</if>
  47 + <if test="startTime != null "> and start_time = #{startTime}</if>
  48 + <if test="endTime != null "> and end_time = #{endTime}</if>
49 49 <if test="instanceId != null and instanceId != ''"> and instance_id = #{instanceId}</if>
50 50 <if test="state != null and state != ''"> and state = #{state}</if>
51 51 <if test="createName != null and createName != ''"> and create_name = #{createName}</if>
... ... @@ -70,8 +70,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
70 70 <if test="type != null">type,</if>
71 71 <if test="title != null">title,</if>
72 72 <if test="reason != null">reason,</if>
73   - <if test="leaveStartTime != null">leave_start_time,</if>
74   - <if test="leaveEndTime != null">leave_end_time,</if>
  73 + <if test="startTime != null">start_time,</if>
  74 + <if test="endTime != null">end_time,</if>
75 75 <if test="instanceId != null">instance_id,</if>
76 76 <if test="state != null">state,</if>
77 77 <if test="createName != null">create_name,</if>
... ... @@ -84,8 +84,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
84 84 <if test="type != null">#{type},</if>
85 85 <if test="title != null">#{title},</if>
86 86 <if test="reason != null">#{reason},</if>
87   - <if test="leaveStartTime != null">#{leaveStartTime},</if>
88   - <if test="leaveEndTime != null">#{leaveEndTime},</if>
  87 + <if test="startTime != null">#{startTime},</if>
  88 + <if test="endTime != null">#{endTime},</if>
89 89 <if test="instanceId != null">#{instanceId},</if>
90 90 <if test="state != null">#{state},</if>
91 91 <if test="createName != null">#{createName},</if>
... ... @@ -101,8 +101,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
101 101 <if test="type != null">type = #{type},</if>
102 102 <if test="title != null">title = #{title},</if>
103 103 <if test="reason != null">reason = #{reason},</if>
104   - <if test="leaveStartTime != null">leave_start_time = #{leaveStartTime},</if>
105   - <if test="leaveEndTime != null">leave_end_time = #{leaveEndTime},</if>
  104 + <if test="startTime != null">start_time = #{startTime},</if>
  105 + <if test="endTime != null">end_time = #{endTime},</if>
106 106 <if test="instanceId != null">instance_id = #{instanceId},</if>
107 107 <if test="state != null">state = #{state},</if>
108 108 <if test="createName != null">create_name = #{createName},</if>
... ...
trash-workFlow/src/main/resources/mapper/leave/WorkflowMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.trash.leave.mapper.WorkflowMapper">
  6 +
  7 + <resultMap type="Workflow" id="WorkflowResult">
  8 + <result property="id" column="id" />
  9 + <result property="type" column="type" />
  10 + <result property="title" column="title" />
  11 + <result property="reason" column="reason" />
  12 + <result property="startTime" column="start_time" />
  13 + <result property="endTime" column="end_time" />
  14 + <result property="instanceId" column="instance_id" />
  15 + <result property="state" column="state" />
  16 + <result property="createName" column="create_name" />
  17 + <result property="createBy" column="create_by" />
  18 + <result property="createTime" column="create_time" />
  19 + <result property="updateTime" column="update_time" />
  20 + </resultMap>
  21 +
  22 + <sql id="selectWorkflowVo">
  23 + select id, type, title, reason, start_time, end_time, instance_id, state, create_name,create_by, create_time, update_time from workflow
  24 + </sql>
  25 +
  26 + <select id="selectWorkflowListByWorkflowAndDeptId" resultMap="WorkflowResult">
  27 + <include refid="selectWorkflowVo"/>
  28 + where create_by in (SELECT user_name FROM `sys_user` where dept_id in (SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} or find_in_set( #{deptId} , ancestors ) ))
  29 + <if test="Workflow.type != null and Workflow.type != ''"> and type = #{Workflow.type}</if>
  30 + <if test="Workflow.title != null and Workflow.title != ''"> and title = #{Workflow.title}</if>
  31 + <if test="Workflow.reason != null and Workflow.reason != ''"> and reason = #{Workflow.reason}</if>
  32 + <if test="Workflow.startTime != null "> and start_time = #{Workflow.startTime}</if>
  33 + <if test="Workflow.endTime != null "> and end_time = #{Workflow.endTime}</if>
  34 + <if test="Workflow.instanceId != null and Workflow.instanceId != ''"> and instance_id = #{Workflow.instanceId}</if>
  35 + <if test="Workflow.state != null and Workflow.state != ''"> and state = #{Workflow.state}</if>
  36 + <if test="Workflow.createName != null and Workflow.createName != ''"> and create_name = #{Workflow.createName}</if>
  37 + <if test="Workflow.createBy != null and Workflow.createBy != ''"> and create_by = #{Workflow.createBy}</if>
  38 + order by create_time desc
  39 + </select>
  40 +
  41 + <select id="selectWorkflowList" parameterType="Workflow" resultMap="WorkflowResult">
  42 + <include refid="selectWorkflowVo"/>
  43 + <where>
  44 + <if test="type != null and type != ''"> and type = #{type}</if>
  45 + <if test="title != null and title != ''"> and title = #{title}</if>
  46 + <if test="reason != null and reason != ''"> and reason = #{reason}</if>
  47 + <if test="startTime != null "> and start_time = #{startTime}</if>
  48 + <if test="endTime != null "> and end_time = #{endTime}</if>
  49 + <if test="instanceId != null and instanceId != ''"> and instance_id = #{instanceId}</if>
  50 + <if test="state != null and state != ''"> and state = #{state}</if>
  51 + <if test="createName != null and createName != ''"> and create_name = #{createName}</if>
  52 + <if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
  53 + </where>
  54 + order by create_time desc
  55 + </select>
  56 +
  57 + <select id="selectWorkflowById" parameterType="String" resultMap="WorkflowResult">
  58 + <include refid="selectWorkflowVo"/>
  59 + where id = #{id}
  60 + </select>
  61 + <select id="selectWorkflowByInstanceId" parameterType="String" resultMap="WorkflowResult">
  62 + <include refid="selectWorkflowVo"/>
  63 + where instance_id = #{instanceId}
  64 + </select>
  65 +
  66 + <insert id="insertWorkflow" parameterType="Workflow">
  67 + insert into workflow
  68 + <trim prefix="(" suffix=")" suffixOverrides=",">
  69 + <if test="id != null">id,</if>
  70 + <if test="type != null">type,</if>
  71 + <if test="title != null">title,</if>
  72 + <if test="reason != null">reason,</if>
  73 + <if test="startTime != null">start_time,</if>
  74 + <if test="endTime != null">end_time,</if>
  75 + <if test="instanceId != null">instance_id,</if>
  76 + <if test="state != null">state,</if>
  77 + <if test="createName != null">create_name,</if>
  78 + <if test="createBy != null">create_by,</if>
  79 + <if test="createTime != null">create_time,</if>
  80 + <if test="updateTime != null">update_time,</if>
  81 + </trim>
  82 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  83 + <if test="id != null">#{id},</if>
  84 + <if test="type != null">#{type},</if>
  85 + <if test="title != null">#{title},</if>
  86 + <if test="reason != null">#{reason},</if>
  87 + <if test="startTime != null">#{startTime},</if>
  88 + <if test="endTime != null">#{endTime},</if>
  89 + <if test="instanceId != null">#{instanceId},</if>
  90 + <if test="state != null">#{state},</if>
  91 + <if test="createName != null">#{createName},</if>
  92 + <if test="createBy != null">#{createBy},</if>
  93 + <if test="createTime != null">#{createTime},</if>
  94 + <if test="updateTime != null">#{updateTime},</if>
  95 + </trim>
  96 + </insert>
  97 +
  98 + <update id="updateWorkflow" parameterType="Workflow">
  99 + update workflow
  100 + <trim prefix="SET" suffixOverrides=",">
  101 + <if test="type != null">type = #{type},</if>
  102 + <if test="title != null">title = #{title},</if>
  103 + <if test="reason != null">reason = #{reason},</if>
  104 + <if test="startTime != null">start_time = #{startTime},</if>
  105 + <if test="endTime != null">end_time = #{endTime},</if>
  106 + <if test="instanceId != null">instance_id = #{instanceId},</if>
  107 + <if test="state != null">state = #{state},</if>
  108 + <if test="createName != null">create_name = #{createName},</if>
  109 + <if test="createBy != null">create_by = #{createBy},</if>
  110 + <if test="createTime != null">create_time = #{createTime},</if>
  111 + <if test="updateTime != null">update_time = #{updateTime},</if>
  112 + </trim>
  113 + where id = #{id}
  114 + </update>
  115 +
  116 + <delete id="deleteWorkflowById" parameterType="String">
  117 + delete from workflow where id = #{id}
  118 + </delete>
  119 +
  120 + <delete id="deleteWorkflowByIds" parameterType="String">
  121 + delete from workflow where id in
  122 + <foreach item="id" collection="array" open="(" separator="," close=")">
  123 + #{id}
  124 + </foreach>
  125 + </delete>
  126 +
  127 +</mapper>
0 128 \ No newline at end of file
... ...