Merge branch 'feature/develop1.0' of https://gitee.com/qimingjin/snow into feature/develop1.0
This commit is contained in:
commit
9a31268153
|
@ -2,14 +2,13 @@ package com.snow.web.controller.flowable;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.snow.common.annotation.Log;
|
||||
import com.snow.common.core.controller.BaseController;
|
||||
import com.snow.common.core.domain.AjaxResult;
|
||||
import com.snow.common.core.page.TableDataInfo;
|
||||
import com.snow.common.enums.BusinessType;
|
||||
import com.snow.common.exception.BusinessException;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.flowable.domain.CompleteTaskDTO;
|
||||
import com.snow.flowable.domain.FileEntry;
|
||||
import com.snow.flowable.domain.FinishTaskDTO;
|
||||
import com.snow.flowable.domain.TaskVO;
|
||||
import com.snow.flowable.domain.*;
|
||||
import com.snow.flowable.service.impl.FlowableServiceImpl;
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.SysOaLeave;
|
||||
|
@ -17,6 +16,7 @@ import com.snow.system.domain.SysUser;
|
|||
import com.snow.system.service.ISysOaLeaveService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
**/
|
||||
@Controller
|
||||
@RequestMapping("/flow")
|
||||
public class FlowController {
|
||||
public class FlowController extends BaseController {
|
||||
private String prefix = "flow";
|
||||
|
||||
@Autowired
|
||||
|
@ -46,7 +46,7 @@ public class FlowController {
|
|||
|
||||
|
||||
/**
|
||||
* 跳转流程编译器
|
||||
* 跳转完成任务界面
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("modeler:flow:view")
|
||||
|
@ -80,4 +80,19 @@ public class FlowController {
|
|||
List<TaskVO> dynamicFlowNodeInfo = flowableService.getDynamicFlowNodeInfo(processInstanceId);
|
||||
return AjaxResult.success(dynamicFlowNodeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的流程实例
|
||||
* @param processInstanceDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getMyHistoricProcessInstance")
|
||||
@ResponseBody
|
||||
public TableDataInfo getMyHistoricProcessInstance(ProcessInstanceDTO processInstanceDTO){
|
||||
startPage();
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
processInstanceDTO.setStartedUserId(String.valueOf(sysUser.getUserId()));
|
||||
List<ProcessInstanceVO> historicProcessInstance = flowableService.getHistoricProcessInstance(processInstanceDTO);
|
||||
return getDataTable(historicProcessInstance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@ import java.util.Map;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.snow.common.constant.SequenceContants;
|
||||
import com.snow.common.enums.ProcessStatus;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.flowable.common.FlowConstants;
|
||||
import com.snow.flowable.domain.CompleteTaskDTO;
|
||||
import com.snow.flowable.domain.FileEntry;
|
||||
import com.snow.flowable.domain.FinishTaskDTO;
|
||||
|
@ -122,33 +124,7 @@ public class SysOaLeaveController extends BaseController
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
*/
|
||||
//@RequiresPermissions("system:leave:startLeaveProcess")
|
||||
@Log(title = "完成任务", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/finishTask")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult startLeaveProcess(String businessKey)
|
||||
|
||||
{
|
||||
SysOaLeave sysOaLeave=new SysOaLeave();
|
||||
sysOaLeave.setLeaveNo(businessKey);
|
||||
List<SysOaLeave> sysOaLeaves = sysOaLeaveService.selectSysOaLeaveList(sysOaLeave);
|
||||
if(StringUtils.isEmpty(sysOaLeaves)){
|
||||
return AjaxResult.error("该业务参数不存在");
|
||||
}
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
CompleteTaskDTO CompleteTaskDTO=new CompleteTaskDTO();
|
||||
CompleteTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
|
||||
flowableService.completeTask(CompleteTaskDTO);
|
||||
sysOaLeave.setProcessStatus(1);
|
||||
sysOaLeave.setCreateBy(sysUser.getUserName());
|
||||
sysOaLeave.setApplyPerson(String.valueOf(sysUser.getUserId()));
|
||||
int i = sysOaLeaveService.updateSysOaLeave(sysOaLeave);
|
||||
return toAjax(i);
|
||||
}
|
||||
/**
|
||||
* 修改请假单
|
||||
*/
|
||||
|
@ -161,7 +137,7 @@ public class SysOaLeaveController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 修改保存请假单
|
||||
* 修改保存并发起请假单
|
||||
*/
|
||||
@RequiresPermissions("system:leave:edit")
|
||||
@Log(title = "请假单", businessType = BusinessType.UPDATE)
|
||||
|
@ -174,7 +150,7 @@ public class SysOaLeaveController extends BaseController
|
|||
//发起审批
|
||||
StartProcessDTO startProcessDTO=new StartProcessDTO();
|
||||
startProcessDTO.setBusinessKey(oldSysOaLeave.getLeaveNo());
|
||||
startProcessDTO.setProcessDefinitionKey("snow_oa_leave");
|
||||
startProcessDTO.setProcessDefinitionKey(FlowConstants.SNOW_OA_LEAVE);
|
||||
startProcessDTO.setStartUserId(String.valueOf(sysUser.getUserId()));
|
||||
ProcessInstance processInstance = flowableService.startProcessInstanceByKey(startProcessDTO);
|
||||
CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
|
||||
|
@ -182,7 +158,7 @@ public class SysOaLeaveController extends BaseController
|
|||
Task task= flowableService.getTaskProcessInstanceById(processInstance.getProcessInstanceId());
|
||||
completeTaskDTO.setTaskId(task.getId());
|
||||
flowableService.completeTask(completeTaskDTO);
|
||||
sysOaLeave.setProcessStatus(1);
|
||||
sysOaLeave.setProcessStatus(ProcessStatus.CHECKING.ordinal());
|
||||
sysOaLeave.setCreateBy(sysUser.getUserName());
|
||||
sysOaLeave.setApplyPerson(sysUser.getUserName());
|
||||
BeanUtils.copyProperties(sysOaLeave,oldSysOaLeave);
|
||||
|
@ -233,4 +209,39 @@ public class SysOaLeaveController extends BaseController
|
|||
flowableService.completeTask(completeTaskDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* hr完成审批
|
||||
*/
|
||||
//@RequiresPermissions("system:leave:startLeaveProcess")
|
||||
@Log(title = "hr完成审批", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/hrFinishTask")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult hrFinishTask(FinishTaskDTO finishTaskDTO)
|
||||
{
|
||||
SysOaLeave sysOaLeave=new SysOaLeave();
|
||||
sysOaLeave.setLeaveNo(finishTaskDTO.getBusinessKey());
|
||||
List<SysOaLeave> sysOaLeaves = sysOaLeaveService.selectSysOaLeaveList(sysOaLeave);
|
||||
if(StringUtils.isEmpty(sysOaLeaves)){
|
||||
return AjaxResult.error("该业务参数不存在");
|
||||
}
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
|
||||
completeTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
|
||||
completeTaskDTO.setTaskId(finishTaskDTO.getTaskId());
|
||||
Integer checkStatus = finishTaskDTO.getCheckStatus();
|
||||
if(checkStatus==0){
|
||||
completeTaskDTO.setIsPass(true);
|
||||
sysOaLeave.setProcessStatus(ProcessStatus.PASS.ordinal());
|
||||
}else {
|
||||
completeTaskDTO.setIsPass(false);
|
||||
sysOaLeave.setProcessStatus(ProcessStatus.REJECT.ordinal());
|
||||
}
|
||||
completeTaskDTO.setComment(finishTaskDTO.getSuggestion());
|
||||
flowableService.completeTask(completeTaskDTO);
|
||||
sysOaLeave.setUpdateBy(sysUser.getUserName());
|
||||
int i = sysOaLeaveService.updateSysOaLeaveByLeaveNo(sysOaLeave);
|
||||
return toAjax(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
snow:
|
||||
# 名称
|
||||
name: snow
|
||||
# 版本
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
<table id="bootstrap-table1"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -100,7 +100,7 @@
|
|||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>我的已办</h5>
|
||||
<h5>我发起的流程</h5>
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
时间
|
||||
|
@ -133,6 +133,7 @@
|
|||
var prefixFlow = ctx + "flow";
|
||||
$(function() {
|
||||
var options = {
|
||||
id: "bootstrap-table1",
|
||||
url: prefix + "/findTasksByUserId",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
|
@ -141,6 +142,76 @@
|
|||
importUrl: prefix + "/importData",
|
||||
importTemplateUrl: prefix + "/importTemplate",
|
||||
modalName: "我的待办",
|
||||
columns: [{
|
||||
checkbox: false
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionName',
|
||||
title: '流程名称'
|
||||
},
|
||||
{
|
||||
field: 'businessKey',
|
||||
title: '单号'
|
||||
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionKey',
|
||||
title: '流程key'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
field: 'name',
|
||||
title: '任务名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'startUserName',
|
||||
title: '流程发起人'
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '流程创建时间'
|
||||
},
|
||||
{
|
||||
field: 'endTime',
|
||||
title: '流程结束时间'
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="cancelTask(\'' + row.businessKey + '\',\''+row.taskId+'\')"><i class="fa fa-edit"></i>处理</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.processInstanceId + '\')"><i class="fa fa-eye"></i>获取流程图</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function cancelTask(businessKey,taskId) {
|
||||
console.log(JSON.stringify(taskId));
|
||||
var preViewUrl=prefixFlow+'/toFinishTask?businessKey='+businessKey+'&taskId='+taskId;
|
||||
$.modal.openTab("审批", preViewUrl);
|
||||
}
|
||||
function getProcessDiagram(processInstanceId) {
|
||||
|
||||
var preViewUrl=prefix+'/getProcessDiagram?processInstanceId='+processInstanceId;
|
||||
$.modal.openTab("流程图", preViewUrl);
|
||||
}
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:flow:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
|
||||
var prefix = ctx + "modeler";
|
||||
var prefixFlow = ctx + "flow";
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefixFlow + "/getMyHistoricProcessInstance",
|
||||
modalName: "我的待办",
|
||||
columns: [{
|
||||
checkbox: false
|
||||
},
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('人事审批')" />
|
||||
<th:block th:include="include :: jsonview-css" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
|
||||
<form class="form-horizontal m-t" id="signupForm">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-0 col-sm-10">
|
||||
<button type="button" class="btn btn-sm btn-primary" onclick="submitCheckHandler()"><i class="fa fa-check"></i>通 过</button>
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="submitHandler()"><i class="fa fa-remove"></i>驳 回</button>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<input class="form-control" type="hidden" name="taskId" th:value="*{taskId}"/>
|
||||
<input class="form-control" type="hidden" name="businessKey" th:value="${sysOaLeave.leaveNo}"/>
|
||||
<h4 class="form-header h4">请假信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">单号:</label>
|
||||
<div class="form-control-static" th:text="${sysOaLeave.leaveNo}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">标题:</label>
|
||||
<div class="form-control-static" th:text="${sysOaLeave.name}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">请假理由:</label>
|
||||
<div class="form-control-static"><pre id="reason"></pre></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="form-control-static" th:text="${#dates.format(sysOaLeave.startTime, 'yyyy-MM-dd hh:mm:ss')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结束时间:</label>
|
||||
<div class="form-control-static" th:text="${#dates.format(sysOaLeave.endTime, 'yyyy-MM-dd HH:mm:ss')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">申请人:</label>
|
||||
<div class="form-control-static" th:text="${sysOaLeave.applyPerson}">
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">填写信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">人事审批意见:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="suggestion" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审批附件:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="hidden" name="suggestionFileUrl" >
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="suggestionFileUrl" name="file" type="file">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: jsonview-js" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
$(function() {
|
||||
var reason = [[${sysOaLeave.reason}]];
|
||||
console.log(reason);
|
||||
if ($.common.isNotEmpty(reason) && reason.length < 2000) {
|
||||
$("#reason").text(reason);
|
||||
} else {
|
||||
$("#reason").text(reason);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(".file-upload").each(function (i) {
|
||||
var val = $("input[name='" + this.id + "']").val();
|
||||
$(this).fileinput({
|
||||
'uploadUrl': '/common/upload',
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: [val],
|
||||
maxFileCount: 1,
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
$(this).fileinput('_initFileActions');
|
||||
});
|
||||
|
||||
function submitCheckHandler() {
|
||||
if ($.validate.form()) {
|
||||
var data = $("#signupForm").serializeArray();
|
||||
data.push({"name": "checkStatus", "value": 0});
|
||||
$.operate.saveTab("/system/leave/hrFinishTask", data);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -49,7 +49,7 @@
|
|||
</div>
|
||||
<h4 class="form-header h4">填写信息</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审批意见:</label>
|
||||
<label class="col-sm-3 control-label">主管审批意见:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="suggestion" class="form-control"></textarea>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.snow.common.enums;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*
|
||||
* @author snow
|
||||
*/
|
||||
public enum ProcessStatus
|
||||
{
|
||||
/**
|
||||
* 待发起
|
||||
*/
|
||||
WAITING_TO_SEND ,
|
||||
|
||||
/**
|
||||
* 审批中
|
||||
*/
|
||||
CHECKING,
|
||||
/**
|
||||
* 审批通过
|
||||
*/
|
||||
PASS,
|
||||
/**
|
||||
* 审批驳回
|
||||
*/
|
||||
REJECT
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.snow.common.utils.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -107,4 +109,9 @@ public class BeanUtils extends org.springframework.beans.BeanUtils
|
|||
{
|
||||
return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX));
|
||||
}
|
||||
|
||||
public static <FromType, ToType> List<ToType> transformList(List<FromType> sourceList, Class<ToType> resultClass) {
|
||||
return JSON.parseArray(JSON.toJSONString(sourceList), resultClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.snow.flowable.common;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2020/11/25 11:14
|
||||
*/
|
||||
public class FlowConstants {
|
||||
/**************************************************************************************/
|
||||
/**
|
||||
* 流程定义key
|
||||
*/
|
||||
public static final String SNOW_OA_LEAVE = "snow_oa_leave";
|
||||
|
||||
|
||||
|
||||
|
||||
/**************************************************************************************/
|
||||
}
|
|
@ -19,6 +19,7 @@ import java.io.Serializable;
|
|||
@AllArgsConstructor
|
||||
public class FinishTaskDTO implements Serializable {
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
private String suggestion;
|
||||
|
@ -28,4 +29,8 @@ public class FinishTaskDTO implements Serializable {
|
|||
* 0通过,1--驳回
|
||||
*/
|
||||
private Integer checkStatus;
|
||||
/**
|
||||
* 业务参数
|
||||
*/
|
||||
private String businessKey;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2020/11/25 16:24
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FlowBaseDTO implements Serializable {
|
||||
/**
|
||||
* 初始页
|
||||
*/
|
||||
private int firstResult=0;
|
||||
/**
|
||||
* 每页数
|
||||
*/
|
||||
private int maxResults=10;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2020/11/25 16:03
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProcessInstanceDTO extends FlowBaseDTO implements Serializable {
|
||||
|
||||
public String businessKey;
|
||||
|
||||
public String deploymentId;
|
||||
|
||||
|
||||
public boolean finished;
|
||||
|
||||
public boolean unfinished;
|
||||
|
||||
public boolean deleted;
|
||||
|
||||
public boolean notDeleted;
|
||||
|
||||
public String startedUserId;
|
||||
|
||||
public List<String> processDefinitionKeyIn;
|
||||
|
||||
public List<String> processKeyNotIn;
|
||||
|
||||
public Date startedBefore;
|
||||
|
||||
public Date startedAfter;
|
||||
|
||||
public Date finishedBefore;
|
||||
|
||||
public Date finishedAfter;
|
||||
|
||||
public String processDefinitionKey;
|
||||
|
||||
public String processDefinitionCategory;
|
||||
|
||||
public String processDefinitionName;
|
||||
public Integer processDefinitionVersion;
|
||||
public Set<String> processInstanceIds;
|
||||
public String involvedUser;
|
||||
public Set<String> involvedGroups;
|
||||
public boolean includeProcessVariables;
|
||||
public Integer processInstanceVariablesLimit;
|
||||
public boolean withJobException;
|
||||
public String tenantId;
|
||||
public String tenantIdLike;
|
||||
public boolean withoutTenantId;
|
||||
public String name;
|
||||
public String nameLike;
|
||||
public String nameLikeIgnoreCase;
|
||||
public String callbackId;
|
||||
public String callbackType;
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2020/11/25 16:03
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProcessInstanceVO implements Serializable {
|
||||
|
||||
|
||||
public String processDefinitionId;
|
||||
|
||||
public String processDefinitionName;
|
||||
|
||||
public String processDefinitionKey;
|
||||
|
||||
|
||||
public Integer processDefinitionVersion;
|
||||
|
||||
public String deploymentId;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
public Date startTime;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
public Date endTime;
|
||||
|
||||
public String endActivityId;
|
||||
|
||||
public String startUserId;
|
||||
|
||||
public String startActivityId;
|
||||
|
||||
public String deleteReason;
|
||||
|
||||
public String superProcessInstanceId;
|
||||
|
||||
public String tenantId;
|
||||
|
||||
public String name;
|
||||
|
||||
public String description;
|
||||
|
||||
public String callbackId;
|
||||
|
||||
public String callbackType;
|
||||
|
||||
private String id;
|
||||
|
||||
public String businessKey;
|
||||
|
||||
public boolean finished;
|
||||
|
||||
public boolean unfinished;
|
||||
|
||||
public boolean deleted;
|
||||
|
||||
public boolean notDeleted;
|
||||
|
||||
|
||||
public String processDefinitionCategory;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -47,8 +47,6 @@ public interface FlowableService {
|
|||
*/
|
||||
ProcessInstance startProcessInstanceByKey(StartProcessDTO startProcessDTO);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据任务ID获取代办
|
||||
* @param taskId
|
||||
|
@ -110,4 +108,11 @@ public interface FlowableService {
|
|||
* @param processInstanceId
|
||||
*/
|
||||
List<TaskVO> getDynamicFlowNodeInfo(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 查询历史流程实例
|
||||
* @param processInstanceDTO
|
||||
* @return
|
||||
*/
|
||||
List<ProcessInstanceVO> getHistoricProcessInstance(ProcessInstanceDTO processInstanceDTO);
|
||||
}
|
||||
|
|
|
@ -16,10 +16,12 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.flowable.bpmn.model.*;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.common.engine.impl.util.IoUtil;
|
||||
import org.flowable.engine.*;
|
||||
import org.flowable.engine.history.HistoricActivityInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.impl.el.JuelExpression;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.DeploymentQuery;
|
||||
|
@ -35,6 +37,7 @@ import org.flowable.variable.api.history.HistoricVariableInstance;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
@ -247,19 +250,22 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void completeTask(CompleteTaskDTO completeTaskDTO) {
|
||||
Task task = this.getTask(completeTaskDTO.getTaskId());
|
||||
if(StringUtils.isEmpty(task)){
|
||||
log.info("完成任务时,该任务ID:%不存在",completeTaskDTO.getTaskId());
|
||||
throw new BusinessException(String.format("该任务ID:%不存在",completeTaskDTO.getTaskId()));
|
||||
}
|
||||
////设置审批人,若不设置则数据表userid字段为null
|
||||
Authentication.setAuthenticatedUserId(completeTaskDTO.getUserId());
|
||||
if(!StringUtils.isEmpty(completeTaskDTO.getComment())){
|
||||
taskService.addComment(task.getId(),task.getProcessInstanceId(),completeTaskDTO.getComment());
|
||||
}
|
||||
List<FileEntry> files = completeTaskDTO.getFiles();
|
||||
if(!CollectionUtils.isEmpty(files)){
|
||||
files.stream().forEach(t->
|
||||
taskService.createAttachment("",task.getId(),task.getProcessInstanceId(),t.getKey(),t.getName(),t.getUrl())
|
||||
taskService.createAttachment("url",task.getId(),task.getProcessInstanceId(),t.getKey(),t.getName(),t.getUrl())
|
||||
);
|
||||
}
|
||||
runtimeService.setVariable(task.getExecutionId(),CompleteTaskDTO.IS_PASS,completeTaskDTO.getIsPass());
|
||||
|
@ -271,7 +277,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
);
|
||||
}
|
||||
paramMap.put(CompleteTaskDTO.IS_PASS,completeTaskDTO.getIsPass());
|
||||
taskService.claim(task.getId(),completeTaskDTO.getUserId());
|
||||
// taskService.claim(task.getId(),completeTaskDTO.getUserId());//claim the task,当任务分配给了某一组人员时,需要该组人员进行抢占。抢到了就将该任务给谁处理,其他人不能处理。
|
||||
taskService.complete(task.getId(),paramMap,true);
|
||||
}
|
||||
|
||||
|
@ -440,6 +446,36 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
return hisTaskVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcessInstanceVO> getHistoricProcessInstance(ProcessInstanceDTO processInstanceDTO) {
|
||||
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
|
||||
if(!StringUtils.isEmpty(processInstanceDTO.getBusinessKey())){
|
||||
historicProcessInstanceQuery.processInstanceBusinessKey(processInstanceDTO.getBusinessKey());
|
||||
}
|
||||
if(!StringUtils.isEmpty(processInstanceDTO.getProcessDefinitionKey())){
|
||||
historicProcessInstanceQuery.processDefinitionKey(processInstanceDTO.getProcessDefinitionKey());
|
||||
}
|
||||
if(!StringUtils.isEmpty(processInstanceDTO.getStartedBefore())){
|
||||
historicProcessInstanceQuery.startedAfter(processInstanceDTO.getStartedBefore());
|
||||
}
|
||||
if(!StringUtils.isEmpty(processInstanceDTO.getStartedAfter())){
|
||||
historicProcessInstanceQuery.startedAfter(processInstanceDTO.getStartedAfter());
|
||||
}
|
||||
if(!StringUtils.isEmpty(processInstanceDTO.getFinishedBefore())){
|
||||
historicProcessInstanceQuery.finishedBefore(processInstanceDTO.getFinishedBefore());
|
||||
}
|
||||
if(!StringUtils.isEmpty(processInstanceDTO.getFinishedAfter())){
|
||||
historicProcessInstanceQuery.finishedAfter(processInstanceDTO.getFinishedAfter());
|
||||
}
|
||||
|
||||
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.
|
||||
orderByProcessInstanceStartTime().
|
||||
desc().
|
||||
listPage(processInstanceDTO.getFirstResult(), processInstanceDTO.getMaxResults());
|
||||
List<ProcessInstanceVO> processInstanceVOS = com.snow.common.utils.bean.BeanUtils.transformList(historicProcessInstances, ProcessInstanceVO.class);
|
||||
return processInstanceVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的任务节点
|
||||
* @param processInstance
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.snow.quartz.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.snow.quartz.domain.SysJobLog;
|
||||
import com.snow.quartz.service.impl.SysJobServiceImpl;
|
||||
|
||||
/**
|
||||
* 定时任务调度日志信息信息 服务层
|
||||
|
|
|
@ -43,6 +43,13 @@ public interface SysOaLeaveMapper
|
|||
*/
|
||||
public int updateSysOaLeave(SysOaLeave sysOaLeave);
|
||||
|
||||
/**
|
||||
* 根据单号修改请假单
|
||||
* @param sysOaLeave
|
||||
* @return
|
||||
*/
|
||||
public int updateSysOaLeaveByLeaveNo(SysOaLeave sysOaLeave);
|
||||
|
||||
/**
|
||||
* 删除请假单
|
||||
*
|
||||
|
|
|
@ -43,6 +43,13 @@ public interface ISysOaLeaveService
|
|||
*/
|
||||
public int updateSysOaLeave(SysOaLeave sysOaLeave);
|
||||
|
||||
/**
|
||||
* 根据单号修改请假单
|
||||
* @param sysOaLeave
|
||||
* @return
|
||||
*/
|
||||
public int updateSysOaLeaveByLeaveNo(SysOaLeave sysOaLeave);
|
||||
|
||||
/**
|
||||
* 批量删除请假单
|
||||
*
|
||||
|
|
|
@ -71,6 +71,12 @@ public class SysOaLeaveServiceImpl implements ISysOaLeaveService
|
|||
return sysOaLeaveMapper.updateSysOaLeave(sysOaLeave);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateSysOaLeaveByLeaveNo(SysOaLeave sysOaLeave) {
|
||||
sysOaLeave.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysOaLeaveMapper.updateSysOaLeaveByLeaveNo(sysOaLeave);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除请假单对象
|
||||
*
|
||||
|
|
|
@ -107,7 +107,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateSysOaLeaveByLeaveNo" parameterType="SysOaLeave">
|
||||
update sys_oa_leave
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="reason != null">reason = #{reason},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="processStatus != null">process_status = #{processStatus},</if>
|
||||
<if test="processInstanceId != null">process_instance_id = #{processInstanceId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="applyPerson != null">apply_person = #{applyPerson},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="fileUrl != null">file_url = #{fileUrl},</if>
|
||||
</trim>
|
||||
where leave_no = #{leaveNo}
|
||||
</update>
|
||||
<delete id="deleteSysOaLeaveById" parameterType="Integer">
|
||||
delete from sys_oa_leave where id = #{id}
|
||||
</delete>
|
||||
|
|
Loading…
Reference in New Issue