From 08b8ec4a68570f8fec1aa4e5a6d992d0c4aa3ccf Mon Sep 17 00:00:00 2001 From: jinqiming <45981669@qq.com> Date: Wed, 25 Nov 2020 20:18:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=88=97=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/flowable/FlowController.java | 27 ++++- .../system/SysOaLeaveController.java | 69 ++++++----- snow-admin/src/main/resources/application.yml | 2 +- .../src/main/resources/templates/main_v1.html | 75 +++++++++++- .../templates/system/leave/hrFinishTask.html | 110 ++++++++++++++++++ .../system/leave/managerFinishTask.html | 2 +- .../com/snow/common/enums/ProcessStatus.java | 27 +++++ .../com/snow/common/utils/bean/BeanUtils.java | 7 ++ .../snow/flowable/common/FlowConstants.java | 20 ++++ .../snow/flowable/domain/FinishTaskDTO.java | 5 + .../com/snow/flowable/domain/FlowBaseDTO.java | 29 +++++ .../flowable/domain/ProcessInstanceDTO.java | 72 ++++++++++++ .../flowable/domain/ProcessInstanceVO.java | 82 +++++++++++++ .../flowable/service/FlowableService.java | 9 +- .../service/impl/FlowableServiceImpl.java | 40 ++++++- .../quartz/service/ISysJobLogService.java | 1 + .../snow/system/mapper/SysOaLeaveMapper.java | 7 ++ .../system/service/ISysOaLeaveService.java | 7 ++ .../service/impl/SysOaLeaveServiceImpl.java | 6 + .../mapper/system/SysOaLeaveMapper.xml | 21 +++- 20 files changed, 574 insertions(+), 44 deletions(-) create mode 100644 snow-admin/src/main/resources/templates/system/leave/hrFinishTask.html create mode 100644 snow-common/src/main/java/com/snow/common/enums/ProcessStatus.java create mode 100644 snow-flowable/src/main/java/com/snow/flowable/common/FlowConstants.java create mode 100644 snow-flowable/src/main/java/com/snow/flowable/domain/FlowBaseDTO.java create mode 100644 snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceDTO.java create mode 100644 snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceVO.java diff --git a/snow-admin/src/main/java/com/snow/web/controller/flowable/FlowController.java b/snow-admin/src/main/java/com/snow/web/controller/flowable/FlowController.java index 52e4630..8eb34e0 100644 --- a/snow-admin/src/main/java/com/snow/web/controller/flowable/FlowController.java +++ b/snow-admin/src/main/java/com/snow/web/controller/flowable/FlowController.java @@ -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") @@ -113,4 +113,19 @@ public class FlowController { List 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 historicProcessInstance = flowableService.getHistoricProcessInstance(processInstanceDTO); + return getDataTable(historicProcessInstance); + } } diff --git a/snow-admin/src/main/java/com/snow/web/controller/system/SysOaLeaveController.java b/snow-admin/src/main/java/com/snow/web/controller/system/SysOaLeaveController.java index c920956..efb1104 100644 --- a/snow-admin/src/main/java/com/snow/web/controller/system/SysOaLeaveController.java +++ b/snow-admin/src/main/java/com/snow/web/controller/system/SysOaLeaveController.java @@ -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 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 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); + } } diff --git a/snow-admin/src/main/resources/application.yml b/snow-admin/src/main/resources/application.yml index de933aa..2b6f7ec 100644 --- a/snow-admin/src/main/resources/application.yml +++ b/snow-admin/src/main/resources/application.yml @@ -1,5 +1,5 @@ # 项目相关配置 -ruoyi: +snow: # 名称 name: snow # 版本 diff --git a/snow-admin/src/main/resources/templates/main_v1.html b/snow-admin/src/main/resources/templates/main_v1.html index 27bfbc6..b2503d7 100644 --- a/snow-admin/src/main/resources/templates/main_v1.html +++ b/snow-admin/src/main/resources/templates/main_v1.html @@ -88,7 +88,7 @@
-
+
@@ -100,7 +100,7 @@
-
我的已办
+
我发起的流程
时间 @@ -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('处理 '); + actions.push('获取流程图'); + 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); + } + + + + \ No newline at end of file diff --git a/snow-admin/src/main/resources/templates/system/leave/managerFinishTask.html b/snow-admin/src/main/resources/templates/system/leave/managerFinishTask.html index dd0f6df..7d846f4 100644 --- a/snow-admin/src/main/resources/templates/system/leave/managerFinishTask.html +++ b/snow-admin/src/main/resources/templates/system/leave/managerFinishTask.html @@ -49,7 +49,7 @@

填写信息

- +
diff --git a/snow-common/src/main/java/com/snow/common/enums/ProcessStatus.java b/snow-common/src/main/java/com/snow/common/enums/ProcessStatus.java new file mode 100644 index 0000000..6efb84a --- /dev/null +++ b/snow-common/src/main/java/com/snow/common/enums/ProcessStatus.java @@ -0,0 +1,27 @@ +package com.snow.common.enums; + +/** + * 操作状态 + * + * @author snow + */ +public enum ProcessStatus +{ + /** + * 待发起 + */ + WAITING_TO_SEND , + + /** + * 审批中 + */ + CHECKING, + /** + * 审批通过 + */ + PASS, + /** + * 审批驳回 + */ + REJECT +} diff --git a/snow-common/src/main/java/com/snow/common/utils/bean/BeanUtils.java b/snow-common/src/main/java/com/snow/common/utils/bean/BeanUtils.java index a270317..8558a85 100644 --- a/snow-common/src/main/java/com/snow/common/utils/bean/BeanUtils.java +++ b/snow-common/src/main/java/com/snow/common/utils/bean/BeanUtils.java @@ -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 List transformList(List sourceList, Class resultClass) { + return JSON.parseArray(JSON.toJSONString(sourceList), resultClass); + } + } diff --git a/snow-flowable/src/main/java/com/snow/flowable/common/FlowConstants.java b/snow-flowable/src/main/java/com/snow/flowable/common/FlowConstants.java new file mode 100644 index 0000000..48ce401 --- /dev/null +++ b/snow-flowable/src/main/java/com/snow/flowable/common/FlowConstants.java @@ -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"; + + + + + /**************************************************************************************/ +} diff --git a/snow-flowable/src/main/java/com/snow/flowable/domain/FinishTaskDTO.java b/snow-flowable/src/main/java/com/snow/flowable/domain/FinishTaskDTO.java index f7779d7..e8fc802 100644 --- a/snow-flowable/src/main/java/com/snow/flowable/domain/FinishTaskDTO.java +++ b/snow-flowable/src/main/java/com/snow/flowable/domain/FinishTaskDTO.java @@ -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; } diff --git a/snow-flowable/src/main/java/com/snow/flowable/domain/FlowBaseDTO.java b/snow-flowable/src/main/java/com/snow/flowable/domain/FlowBaseDTO.java new file mode 100644 index 0000000..2892aaa --- /dev/null +++ b/snow-flowable/src/main/java/com/snow/flowable/domain/FlowBaseDTO.java @@ -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; +} diff --git a/snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceDTO.java b/snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceDTO.java new file mode 100644 index 0000000..9f19934 --- /dev/null +++ b/snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceDTO.java @@ -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 processDefinitionKeyIn; + + public List 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 processInstanceIds; + public String involvedUser; + public Set 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; + +} diff --git a/snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceVO.java b/snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceVO.java new file mode 100644 index 0000000..c5fad75 --- /dev/null +++ b/snow-flowable/src/main/java/com/snow/flowable/domain/ProcessInstanceVO.java @@ -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; + + + + +} diff --git a/snow-flowable/src/main/java/com/snow/flowable/service/FlowableService.java b/snow-flowable/src/main/java/com/snow/flowable/service/FlowableService.java index 079d829..d98d22d 100644 --- a/snow-flowable/src/main/java/com/snow/flowable/service/FlowableService.java +++ b/snow-flowable/src/main/java/com/snow/flowable/service/FlowableService.java @@ -47,8 +47,6 @@ public interface FlowableService { */ ProcessInstance startProcessInstanceByKey(StartProcessDTO startProcessDTO); - - /** * 根据任务ID获取代办 * @param taskId @@ -110,4 +108,11 @@ public interface FlowableService { * @param processInstanceId */ List getDynamicFlowNodeInfo(String processInstanceId); + + /** + * 查询历史流程实例 + * @param processInstanceDTO + * @return + */ + List getHistoricProcessInstance(ProcessInstanceDTO processInstanceDTO); } diff --git a/snow-flowable/src/main/java/com/snow/flowable/service/impl/FlowableServiceImpl.java b/snow-flowable/src/main/java/com/snow/flowable/service/impl/FlowableServiceImpl.java index 0b90f2f..fd9883d 100644 --- a/snow-flowable/src/main/java/com/snow/flowable/service/impl/FlowableServiceImpl.java +++ b/snow-flowable/src/main/java/com/snow/flowable/service/impl/FlowableServiceImpl.java @@ -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 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 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 historicProcessInstances = historicProcessInstanceQuery. + orderByProcessInstanceStartTime(). + desc(). + listPage(processInstanceDTO.getFirstResult(), processInstanceDTO.getMaxResults()); + List processInstanceVOS = com.snow.common.utils.bean.BeanUtils.transformList(historicProcessInstances, ProcessInstanceVO.class); + return processInstanceVOS; + } + /** * 获取所有的任务节点 * @param processInstance diff --git a/snow-quartz/src/main/java/com/snow/quartz/service/ISysJobLogService.java b/snow-quartz/src/main/java/com/snow/quartz/service/ISysJobLogService.java index d881873..ccdad47 100644 --- a/snow-quartz/src/main/java/com/snow/quartz/service/ISysJobLogService.java +++ b/snow-quartz/src/main/java/com/snow/quartz/service/ISysJobLogService.java @@ -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; /** * 定时任务调度日志信息信息 服务层 diff --git a/snow-system/src/main/java/com/snow/system/mapper/SysOaLeaveMapper.java b/snow-system/src/main/java/com/snow/system/mapper/SysOaLeaveMapper.java index 989b8dd..4f7ff13 100644 --- a/snow-system/src/main/java/com/snow/system/mapper/SysOaLeaveMapper.java +++ b/snow-system/src/main/java/com/snow/system/mapper/SysOaLeaveMapper.java @@ -43,6 +43,13 @@ public interface SysOaLeaveMapper */ public int updateSysOaLeave(SysOaLeave sysOaLeave); + /** + * 根据单号修改请假单 + * @param sysOaLeave + * @return + */ + public int updateSysOaLeaveByLeaveNo(SysOaLeave sysOaLeave); + /** * 删除请假单 * diff --git a/snow-system/src/main/java/com/snow/system/service/ISysOaLeaveService.java b/snow-system/src/main/java/com/snow/system/service/ISysOaLeaveService.java index dc6bdad..eb5aca4 100644 --- a/snow-system/src/main/java/com/snow/system/service/ISysOaLeaveService.java +++ b/snow-system/src/main/java/com/snow/system/service/ISysOaLeaveService.java @@ -43,6 +43,13 @@ public interface ISysOaLeaveService */ public int updateSysOaLeave(SysOaLeave sysOaLeave); + /** + * 根据单号修改请假单 + * @param sysOaLeave + * @return + */ + public int updateSysOaLeaveByLeaveNo(SysOaLeave sysOaLeave); + /** * 批量删除请假单 * diff --git a/snow-system/src/main/java/com/snow/system/service/impl/SysOaLeaveServiceImpl.java b/snow-system/src/main/java/com/snow/system/service/impl/SysOaLeaveServiceImpl.java index a740adf..259b1aa 100644 --- a/snow-system/src/main/java/com/snow/system/service/impl/SysOaLeaveServiceImpl.java +++ b/snow-system/src/main/java/com/snow/system/service/impl/SysOaLeaveServiceImpl.java @@ -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); + } + /** * 删除请假单对象 * diff --git a/snow-system/src/main/resources/mapper/system/SysOaLeaveMapper.xml b/snow-system/src/main/resources/mapper/system/SysOaLeaveMapper.xml index ca8df0d..95547cc 100644 --- a/snow-system/src/main/resources/mapper/system/SysOaLeaveMapper.xml +++ b/snow-system/src/main/resources/mapper/system/SysOaLeaveMapper.xml @@ -107,7 +107,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - + + update sys_oa_leave + + name = #{name}, + reason = #{reason}, + start_time = #{startTime}, + end_time = #{endTime}, + process_status = #{processStatus}, + process_instance_id = #{processInstanceId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_time = #{updateTime}, + update_by = #{updateBy}, + apply_person = #{applyPerson}, + remark = #{remark}, + is_delete = #{isDelete}, + file_url = #{fileUrl}, + + where leave_no = #{leaveNo} + delete from sys_oa_leave where id = #{id}