调整代办逻辑代码
This commit is contained in:
parent
be36de4e13
commit
2f04c79eda
@ -3,6 +3,7 @@ package ink.wgink.module.activiti.controller.api.oa;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaProcdefDTO;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaTaskDTO;
|
||||
import ink.wgink.module.activiti.service.oa.IOaService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
@ -52,4 +53,10 @@ public class OaController extends DefaultBaseController {
|
||||
return oaService.listPageProcdef(page.getPage(), page.getRows());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "我的任务(待办)", notes = "我的任务(待办)接口")
|
||||
@GetMapping("list-task-of-mine")
|
||||
public List<OaTaskDTO> listTaskOfMine() {
|
||||
return oaService.listTaskOfMine();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package ink.wgink.module.activiti.controller.api.oa;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaTaskDTO;
|
||||
import ink.wgink.module.activiti.service.oa.IOaFormReportService;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -13,7 +12,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -47,12 +45,6 @@ public class OaFormReportController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "我的任务(待办)", notes = "我的任务(待办)接口")
|
||||
@GetMapping("list-task-of-mine")
|
||||
public List<OaTaskDTO> listTaskOfMine() {
|
||||
return oaFormReportService.listTaskOfMine();
|
||||
}
|
||||
|
||||
private void checkParams(Map<String, Object> body) {
|
||||
if (body.isEmpty()) {
|
||||
throw new ParamsException("提交内容不能为空");
|
||||
|
@ -14,7 +14,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
* @Date: 2021/12/7 10:26 PM
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "流程定义路由")
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "流程定义路由")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/activiti/procdef")
|
||||
public class ActivitiProcdefRouteController {
|
||||
|
@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @Date: 2021/9/1 11:09 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "activiti路由")
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "activiti路由")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/activiti")
|
||||
public class ActivitiRouteController {
|
||||
|
@ -13,7 +13,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
* @Date: 2022/3/19 10:19
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "节点字段路由")
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "节点字段路由")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/oa/node-field")
|
||||
public class NodeFieldRouteController {
|
||||
|
@ -0,0 +1,29 @@
|
||||
package ink.wgink.module.activiti.controller.route.oa;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* @ClassName: OaController
|
||||
* @Description: Oa管理
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/3/23 09:54
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "oa管理")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/oa")
|
||||
public class OaRouteController extends DefaultBaseController {
|
||||
|
||||
@GetMapping("list-procdef")
|
||||
public ModelAndView listProcdef() {
|
||||
ModelAndView mv = new ModelAndView("oa/list-procdef");
|
||||
return mv;
|
||||
}
|
||||
|
||||
}
|
@ -28,11 +28,6 @@ public interface IOaFormReportService {
|
||||
*/
|
||||
void save(String processDefinitionId, String formCode, Integer formVersion, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 我的任务(待办)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OaTaskDTO> listTaskOfMine();
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.module.activiti.service.oa;
|
||||
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaProcdefDTO;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaTaskDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
@ -30,4 +31,11 @@ public interface IOaService {
|
||||
*/
|
||||
SuccessResultList<List<OaProcdefDTO>> listPageProcdef(int page, int rows);
|
||||
|
||||
/**
|
||||
* 我的任务(待办)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OaTaskDTO> listTaskOfMine();
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,14 @@
|
||||
package ink.wgink.module.activiti.service.oa.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaTaskDTO;
|
||||
import ink.wgink.module.activiti.service.oa.IOaFormReportService;
|
||||
import ink.wgink.module.form.service.report.IFormReportService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -46,28 +41,4 @@ public class OaFormReportServiceImpl extends DefaultBaseService implements IOaFo
|
||||
formReportService.updateProcessInstanceId(formCode, formVersion, uid, processInstance.getProcessInstanceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OaTaskDTO> listTaskOfMine() {
|
||||
String userId = securityComponent.getCurrentUser().getUserId();
|
||||
TaskQuery taskQuery = taskService.createTaskQuery().taskCandidateOrAssigned(userId);
|
||||
List<Task> tasks = taskQuery.list();
|
||||
List<OaTaskDTO> oaTaskDTOs = new ArrayList<>();
|
||||
tasks.forEach(task -> {
|
||||
OaTaskDTO oaTaskDTO = new OaTaskDTO();
|
||||
oaTaskDTO.setTaskId(task.getId());
|
||||
oaTaskDTO.setTaskName(task.getName());
|
||||
oaTaskDTO.setTaskDescription(task.getDescription());
|
||||
oaTaskDTO.setOwner(task.getOwner());
|
||||
|
||||
Map<String, Object> variables = task.getProcessVariables();
|
||||
oaTaskDTO.setFormCode(variables.get(KEY_FORM_CODE).toString());
|
||||
oaTaskDTO.setFormVersion(Integer.parseInt(variables.get(KEY_FORM_VERSION).toString()));
|
||||
oaTaskDTO.setReportUid(variables.get(KEY_REPORT_UID).toString());
|
||||
|
||||
oaTaskDTOs.add(oaTaskDTO);
|
||||
});
|
||||
return oaTaskDTOs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,20 +2,27 @@ package ink.wgink.module.activiti.service.oa.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaProcdefDTO;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.OaTaskDTO;
|
||||
import ink.wgink.module.activiti.service.oa.IOaFormReportService;
|
||||
import ink.wgink.module.activiti.service.oa.IOaService;
|
||||
import ink.wgink.module.form.pojo.dtos.design.FormDTO;
|
||||
import ink.wgink.module.form.service.design.IFormService;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import org.activiti.engine.FormService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.repository.ProcessDefinitionQuery;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: OaServiceImpl
|
||||
@ -30,8 +37,12 @@ public class OaServiceImpl extends DefaultBaseService implements IOaService {
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private FormService formService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private IFormService iFormService;
|
||||
|
||||
@Override
|
||||
@ -63,7 +74,7 @@ public class OaServiceImpl extends DefaultBaseService implements IOaService {
|
||||
List<OaProcdefDTO> oaProcdefDTOs = new ArrayList<>();
|
||||
processDefinitions.forEach(processDefinition -> {
|
||||
String formKey = formService.getStartFormData(processDefinition.getId()).getFormKey();
|
||||
|
||||
processDefinition.getKey();
|
||||
OaProcdefDTO oaProcdefDTO = new OaProcdefDTO();
|
||||
oaProcdefDTO.setId(processDefinition.getId());
|
||||
oaProcdefDTO.setDeploymentId(processDefinition.getDeploymentId());
|
||||
@ -87,4 +98,30 @@ public class OaServiceImpl extends DefaultBaseService implements IOaService {
|
||||
});
|
||||
return oaProcdefDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OaTaskDTO> listTaskOfMine() {
|
||||
String userId = securityComponent.getCurrentUser().getUserId();
|
||||
TaskQuery taskQuery = taskService.createTaskQuery().taskCandidateOrAssigned(userId);
|
||||
List<Task> tasks = taskQuery.list();
|
||||
List<OaTaskDTO> oaTaskDTOs = new ArrayList<>();
|
||||
tasks.forEach(task -> {
|
||||
OaTaskDTO oaTaskDTO = new OaTaskDTO();
|
||||
oaTaskDTOs.add(oaTaskDTO);
|
||||
|
||||
oaTaskDTO.setTaskId(task.getId());
|
||||
oaTaskDTO.setTaskName(task.getName());
|
||||
oaTaskDTO.setTaskDescription(task.getDescription());
|
||||
oaTaskDTO.setOwner(task.getOwner());
|
||||
|
||||
Map<String, Object> variables = runtimeService.getVariables(task.getProcessInstanceId());
|
||||
if(variables.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
oaTaskDTO.setFormCode(variables.get(IOaFormReportService.KEY_FORM_CODE).toString());
|
||||
oaTaskDTO.setFormVersion(Integer.parseInt(variables.get(IOaFormReportService.KEY_FORM_VERSION).toString()));
|
||||
oaTaskDTO.setReportUid(variables.get(IOaFormReportService.KEY_REPORT_UID).toString());
|
||||
});
|
||||
return oaTaskDTOs;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,172 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'} ">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/oa/listpage-procdef';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 50,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'id', width:150, title: '主键', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field:'version', width:80, title: '版本', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field:'name', width:150, title: '名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field:'description', width:150, title: '描述', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'diagramResourceName', width: 80, title: '流程图', align:'center',
|
||||
templet: function(row) {
|
||||
if(!row.deploymentId) {
|
||||
return '-';
|
||||
}
|
||||
var flowChatImg = '<img id="flowChat'+ row.id +'" src="route/activiti/get-process-image/'+ row.deploymentId +'" style="width: 30px; height: 30px;"/>'
|
||||
setTimeout(function() {
|
||||
new Viewer(document.getElementById('flowChat'+ row.id));
|
||||
}, 50);
|
||||
return flowChatImg;
|
||||
}
|
||||
},
|
||||
{field: 'form', width: 100, title: '操作', align:'center', fixed: 'right',
|
||||
templet: function(row) {
|
||||
if(!row.formCode || !row.formVersion) {
|
||||
return '-';
|
||||
}
|
||||
return '<div class="layui-btn-group">' +
|
||||
'<button class="layui-btn layui-btn-xs" lay-event="startProcess">发起流程</button>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 50,
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
|
||||
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var data = obj.data;
|
||||
var layEvent = obj.event;
|
||||
if(layEvent === 'startProcess') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/form-report/save/code/{formCode}/version/{formVersion}?processDefinitionId={processDefinitionId}', [data.formCode, data.formVersion, data.id]),
|
||||
title: '发起流程',
|
||||
width: '500px',
|
||||
height: '80%',
|
||||
onClose: function() {}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user