|
@@ -78,7 +78,7 @@ import java.util.stream.Collectors;
|
|
|
* @Description 流程管理 流程创建、发布 流程节点绑定角色/用户(绑定用户 开始ing) 控制器
|
|
|
* @Author chenyuehu
|
|
|
* @Date 2020-01-16 18:01:34
|
|
|
- * @Version Copyright (c) 2019,安徽阡陌网络科技有限公司 All rights reserved.
|
|
|
+ * @Version Copyright (c) 2019,合肥乾元坤合科技有限公司 All rights reserved.
|
|
|
*/
|
|
|
@Controller
|
|
|
@AllArgsConstructor
|
|
@@ -492,8 +492,6 @@ public class ActivitiController {
|
|
|
endRow = endRow > taskList.size() ? taskList.size() : endRow;
|
|
|
for (int i = startRow; i < endRow; i++) {
|
|
|
HistoricTaskInstance task = taskList.get(i);
|
|
|
- String taskId = task.getId();
|
|
|
- List<HistoricVariableInstance> historicVars = historyService.createHistoricVariableInstanceQuery().processInstanceId(task.getProcessInstanceId()).list();
|
|
|
List<HistoricDetail> list = historyService.createHistoricDetailQuery().
|
|
|
processInstanceId(task.getProcessInstanceId()).orderByTime().desc().list();
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
@@ -505,11 +503,11 @@ public class ActivitiController {
|
|
|
log.info(applyInfo.toString());
|
|
|
applyInfo.setProcessInstanceId(task.getProcessInstanceId());
|
|
|
applyInfo.setTaskId(task.getId());
|
|
|
- /**如果是自己*/
|
|
|
- if (userId.equals(applyInfo.getUserId())) {
|
|
|
- applyInfo.setSelf(true);
|
|
|
+ /**如果是自己发起的,不展示*/
|
|
|
+ if (!userId.equals(applyInfo.getUserId())) {
|
|
|
+ tasks.add(applyInfo);
|
|
|
}
|
|
|
- tasks.add(applyInfo);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -523,6 +521,86 @@ public class ActivitiController {
|
|
|
return R.success(page);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 展示我发起的任务
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping("/my-task/start/page")
|
|
|
+ public R showTaskListStart(Integer pageNum, Integer pageSize) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ String userId = userInfo.getUserId();
|
|
|
+ //保证运行ing
|
|
|
+ List<ActApplyInfo> infos = new ArrayList<>();
|
|
|
+ List<Task> tasks = this.taskService.createTaskQuery().taskCandidateOrAssigned(userId).orderByTaskCreateTime().desc().list();
|
|
|
+ if (CollectionUtil.isNotEmpty(tasks)) {
|
|
|
+ tasks.forEach(item -> {
|
|
|
+ String taskId = item.getId();
|
|
|
+ Map<String, Object> map = taskService.getVariables(taskId);
|
|
|
+ ActApplyInfo applyInfo = (ActApplyInfo) map.get("data");
|
|
|
+ applyInfo.setProcessInstanceId(item.getProcessInstanceId());
|
|
|
+ applyInfo.setTaskId(item.getId());
|
|
|
+
|
|
|
+ // 找到自己发起的
|
|
|
+ if (userId.equals(applyInfo.getUserId())) {
|
|
|
+ applyInfo.setSelf(true);
|
|
|
+ infos.add(applyInfo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<HistoricTaskInstance> tastListFinish = historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).finished().list();
|
|
|
+ if (CollectionUtil.isNotEmpty(tastListFinish)) {
|
|
|
+ for(HistoricTaskInstance task: tastListFinish){
|
|
|
+ List<HistoricDetail> list = historyService.createHistoricDetailQuery().
|
|
|
+ processInstanceId(task.getProcessInstanceId()).orderByTime().desc().list();
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
+ for(HistoricDetail historicDetail: list){
|
|
|
+ HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
|
|
|
+ String variableName = variable.getVariableName();
|
|
|
+ if ("data".equals(variableName)) {
|
|
|
+ ActApplyInfo applyInfo = (ActApplyInfo)variable.getValue();
|
|
|
+ log.info(applyInfo.toString());
|
|
|
+ applyInfo.setProcessInstanceId(task.getProcessInstanceId());
|
|
|
+ applyInfo.setTaskId(task.getId());
|
|
|
+ /**如果是自己发起的,展示*/
|
|
|
+ if (userId.equals(applyInfo.getUserId())) {
|
|
|
+ infos.add(applyInfo);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ long total = infos.size();
|
|
|
+ int pages = (int) total / pageSize;
|
|
|
+ pages = total % pageSize == 0 ? pages : (pages + 1);
|
|
|
+ List<ActApplyInfo> result = new ArrayList<>();
|
|
|
+ if (pageNum > pages) {
|
|
|
+ MyPage<ActApplyInfo> page = new MyPage<>(result);
|
|
|
+ page.setTotal(total);
|
|
|
+ page.setPages(pages);
|
|
|
+ page.setPageNum(pageNum);
|
|
|
+ page.setRows(result);
|
|
|
+ page.setPageSize(pageSize);
|
|
|
+ return R.success(page);
|
|
|
+ }
|
|
|
+ int startRow = pageNum > 0 ? (pageNum - 1) * pageSize : 0;
|
|
|
+ int endRow = startRow + pageSize * (pageNum > 0 ? 1 : 0);
|
|
|
+ endRow = endRow > infos.size() ? infos.size() : endRow;
|
|
|
+ for (int i = startRow; i < endRow; i++) {
|
|
|
+ result.add(infos.get(i));
|
|
|
+ }
|
|
|
+ MyPage<ActApplyInfo> page = new MyPage<>(result);
|
|
|
+ page.setTotal(total);
|
|
|
+ page.setPages(pages);
|
|
|
+ page.setPageNum(pageNum);
|
|
|
+ page.setRows(result);
|
|
|
+ page.setPageSize(pageSize);
|
|
|
+ return R.success(page);
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/audit")
|
|
|
@ResponseBody
|
|
|
public R audit(@RequestBody ActApplyInfoDTO applyInfoDTO) {
|
|
@@ -538,7 +616,7 @@ public class ActivitiController {
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@GetMapping("/audit/history/{processInstanceId}")
|
|
|
- public R leaveDetail(@PathVariable("processInstanceId") String processInstanceId) {
|
|
|
+ public R history(@PathVariable("processInstanceId") String processInstanceId) {
|
|
|
ProcessInstance instance = runtimeService.createProcessInstanceQuery()
|
|
|
.processInstanceId(processInstanceId).singleResult();
|
|
|
//保证运行ing
|
|
@@ -575,7 +653,7 @@ public class ActivitiController {
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@GetMapping("/audit/history/user/{userId}")
|
|
|
- public R history(@PathVariable("userId") String userId) {
|
|
|
+ public R userHistory(@PathVariable("userId") String userId) {
|
|
|
//保证运行ing
|
|
|
List<ActApplyInfo> infos = new ArrayList<>();
|
|
|
List<Task> tasks = this.taskService.createTaskQuery().taskCandidateOrAssigned(userId).orderByTaskCreateTime().desc().list();
|
|
@@ -613,78 +691,6 @@ public class ActivitiController {
|
|
|
return R.success(infos);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据 执行对象id获取审批信息
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
- @GetMapping("/audit/all/page")
|
|
|
- public R all(Integer pageNum, Integer pageSize) {
|
|
|
- UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
- String userId = userInfo.getUserId();
|
|
|
- //保证运行ing
|
|
|
- List<ActApplyInfo> infos = new ArrayList<>();
|
|
|
- List<Task> tasks = this.taskService.createTaskQuery().taskCandidateOrAssigned(userId).orderByTaskCreateTime().desc().list();
|
|
|
- if (CollectionUtil.isNotEmpty(tasks)) {
|
|
|
- tasks.forEach(item -> {
|
|
|
- String taskId = item.getId();
|
|
|
-
|
|
|
- Map<String, Object> map = taskService.getVariables(taskId);
|
|
|
- ActApplyInfo applyInfo = (ActApplyInfo) map.get("data");
|
|
|
- applyInfo.setProcessInstanceId(item.getProcessInstanceId());
|
|
|
- applyInfo.setTaskId(item.getId());
|
|
|
-
|
|
|
- /**如果是自己*/
|
|
|
- if (userId.equals(applyInfo.getUserId())) {
|
|
|
- applyInfo.setSelf(true);
|
|
|
- }
|
|
|
- infos.add(applyInfo);
|
|
|
- });
|
|
|
- }
|
|
|
- List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).orderByTaskCreateTime().desc().list();
|
|
|
- if (CollectionUtil.isNotEmpty(list)) {
|
|
|
- list.forEach(item -> {
|
|
|
- ActApplyInfo applyInfo = (ActApplyInfo) item.getProcessVariables().get("data");
|
|
|
- applyInfo.setProcessInstanceId(item.getProcessInstanceId());
|
|
|
- applyInfo.setTaskId(item.getId());
|
|
|
- applyInfo.setHandleFlag(true);
|
|
|
-
|
|
|
- /**如果是自己*/
|
|
|
- if (userId.equals(applyInfo.getUserId())) {
|
|
|
- applyInfo.setSelf(true);
|
|
|
- }
|
|
|
- infos.add(applyInfo);
|
|
|
- });
|
|
|
- }
|
|
|
- long total = infos.size();
|
|
|
- int pages = (int) total / pageSize;
|
|
|
- pages = total % pageSize == 0 ? pages : (pages + 1);
|
|
|
- List<ActApplyInfo> result = new ArrayList<>();
|
|
|
- if (pageNum > pages) {
|
|
|
- MyPage<ActApplyInfo> page = new MyPage<>(result);
|
|
|
- page.setTotal(total);
|
|
|
- page.setPages(pages);
|
|
|
- page.setPageNum(pageNum);
|
|
|
- page.setRows(result);
|
|
|
- page.setPageSize(pageSize);
|
|
|
- return R.success(page);
|
|
|
- }
|
|
|
- int startRow = pageNum > 0 ? (pageNum - 1) * pageSize : 0;
|
|
|
- int endRow = startRow + pageSize * (pageNum > 0 ? 1 : 0);
|
|
|
- endRow = endRow > infos.size() ? infos.size() : endRow;
|
|
|
- for (int i = startRow; i < endRow; i++) {
|
|
|
- result.add(infos.get(i));
|
|
|
- }
|
|
|
- MyPage<ActApplyInfo> page = new MyPage<>(result);
|
|
|
- page.setTotal(total);
|
|
|
- page.setPages(pages);
|
|
|
- page.setPageNum(pageNum);
|
|
|
- page.setRows(result);
|
|
|
- page.setPageSize(pageSize);
|
|
|
- return R.success(page);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取图片:根据流程定义(流程实例,请调用下面方法)
|
|
|
*
|