提交代码
parent
7bd6985565
commit
84416591b6
|
@ -84,13 +84,4 @@
|
|||
|
||||
</dependencies>
|
||||
|
||||
<!-- <build>-->
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- </build>-->
|
||||
|
||||
</project>
|
||||
|
|
|
@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 业务工作流程自定义
|
||||
|
@ -106,6 +108,7 @@ public class FlowBusinessKeyController extends BaseController {
|
|||
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
|
||||
}
|
||||
flowTaskEntity.setNowUser(Convert.toStr(SecurityUtils.getUserId()));
|
||||
flowTaskEntity.setRoleIds(SecurityUtils.getLoginUser().getUser().getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.dto.FlowSaveXmlVo;
|
||||
import com.ruoyi.flowable.service.IFlowDefinitionService;
|
||||
import com.ruoyi.system.domain.FlowProcDefDto;
|
||||
|
@ -165,10 +167,12 @@ public class FlowDefinitionController extends BaseController {
|
|||
|
||||
|
||||
@ApiOperation(value = "发起流程")
|
||||
@Log(title = "发起流程", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/start/{procDefId}")
|
||||
public AjaxResult start(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId,
|
||||
@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
|
||||
return flowDefinitionService.startProcessInstanceById(procDefId, variables);
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
return flowDefinitionService.startProcessInstanceById(procDefId, sysUser.getUserId().toString(), sysUser.getNickName(), variables);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
|
||||
import com.ruoyi.flowable.service.IFlowInstanceService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -53,6 +54,7 @@ public class FlowInstanceController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "删除流程实例")
|
||||
@Log(title = "删除流程", businessType = BusinessType.INSERT)
|
||||
@DeleteMapping(value = "/delete/{instanceIds}")
|
||||
public AjaxResult delete(@ApiParam(value = "流程实例ID", required = true) @PathVariable String[] instanceIds,
|
||||
@ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.flowable.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.dto.FlowTaskDto;
|
||||
import com.ruoyi.flowable.domain.vo.FlowQueryVo;
|
||||
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
|
||||
|
@ -41,12 +43,14 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
|
||||
@Log(title = "终止申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/stopProcess")
|
||||
public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.stopProcess(flowTaskVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
|
||||
@Log(title = "撤回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/revokeProcess")
|
||||
public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.revokeProcess(flowTaskVo);
|
||||
|
@ -85,12 +89,14 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "审批任务")
|
||||
@Log(title = "审批流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/complete")
|
||||
public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.complete(flowTaskVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "驳回任务")
|
||||
@Log(title = "驳回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/reject")
|
||||
public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReject(flowTaskVo);
|
||||
|
@ -98,6 +104,7 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "退回任务")
|
||||
@Log(title = "退回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/return")
|
||||
public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReturn(flowTaskVo);
|
||||
|
@ -111,6 +118,7 @@ public class FlowTaskController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "删除任务")
|
||||
@Log(title = "删除流程", businessType = BusinessType.UPDATE)
|
||||
@DeleteMapping(value = "/delete")
|
||||
public AjaxResult delete(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.deleteTask(flowTaskVo);
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package com.ruoyi.flowable.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程实例启动
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2020-07-07
|
||||
*/
|
||||
public class StartTaskVO implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//流程实例ID
|
||||
private String procDefId;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String nickName;
|
||||
private Map<String, Object> variables;
|
||||
|
||||
public String getProcDefId() {
|
||||
return procDefId;
|
||||
}
|
||||
|
||||
public void setProcDefId(String procDefId) {
|
||||
this.procDefId = procDefId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVariables() {
|
||||
return variables;
|
||||
}
|
||||
|
||||
public void setVariables(Map<String, Object> variables) {
|
||||
this.variables = variables;
|
||||
}
|
||||
}
|
|
@ -3,9 +3,11 @@ package com.ruoyi.flowable.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.FlowProcDefDto;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +66,7 @@ public interface IFlowDefinitionService {
|
|||
* @return
|
||||
*/
|
||||
|
||||
AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables);
|
||||
AjaxResult startProcessInstanceById(String procDefId, String userId, String nickName, Map<String, Object> variables);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -90,4 +92,6 @@ public interface IFlowDefinitionService {
|
|||
* @return
|
||||
*/
|
||||
InputStream readImage(String deployId);
|
||||
|
||||
public List<FlowElement> readNodes(String deployId);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@ public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService {
|
|||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectMyAwaitFlowTask(FlowTaskEntity flowTaskEntity){
|
||||
flowTaskEntity.setRoleIds(SecurityUtils.getLoginUser().getUser().getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
|
||||
return flowBusinessKeyMapper.selectMyAwaitFlowTask(flowTaskEntity);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ import com.ruoyi.system.service.ISysUserService;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.GraphicInfo;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
|
@ -35,6 +37,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 流程定义
|
||||
|
@ -114,13 +117,13 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
PageHelper.startPage(pageNum, pageSize);
|
||||
final List<FlowProcDefDto> dataList = flowDeployMapper.selectMyDeployList(username, category ,name);
|
||||
// 加载挂表单
|
||||
for (FlowProcDefDto procDef : dataList) {
|
||||
SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
|
||||
if (Objects.nonNull(sysForm)) {
|
||||
procDef.setFormName(sysForm.getFormName());
|
||||
procDef.setFormId(sysForm.getFormId());
|
||||
}
|
||||
}
|
||||
//for (FlowProcDefDto procDef : dataList) {
|
||||
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
|
||||
// if (Objects.nonNull(sysForm)) {
|
||||
// procDef.setFormName(sysForm.getFormName());
|
||||
// procDef.setFormId(sysForm.getFormId());
|
||||
// }
|
||||
//}
|
||||
page.setTotal(new PageInfo(dataList).getTotal());
|
||||
page.setRecords(dataList);
|
||||
return page;
|
||||
|
@ -184,6 +187,23 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowElement> readNodes(String deployId) {
|
||||
List<FlowElement> list = new ArrayList<>();
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
//获得图片流
|
||||
DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
|
||||
Collection<FlowElement> flowElements = bpmnModel.getProcesses().get(0).getFlowElements();
|
||||
if(flowElements.size()>0){
|
||||
for(FlowElement fe:flowElements){
|
||||
list.add(fe);
|
||||
}
|
||||
}
|
||||
//输出为节点描述
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
*
|
||||
|
@ -193,17 +213,16 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables) {
|
||||
public AjaxResult startProcessInstanceById(String procDefId, String userId, String nickName, Map<String, Object> variables) {
|
||||
try {
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId)
|
||||
.latestVersion().singleResult();
|
||||
if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) {
|
||||
return AjaxResult.error("流程已被挂起,请先激活流程");
|
||||
return AjaxResult.error("流程已被挂起,请联系管理员先激活流程");
|
||||
}
|
||||
// 设置流程发起人Id到流程中
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
|
||||
variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId());
|
||||
identityService.setAuthenticatedUserId(userId);
|
||||
variables.put(ProcessConstants.PROCESS_INITIATOR, userId);
|
||||
ProcessInstance processInstance;
|
||||
if(variables.get("businessKey")!=null){
|
||||
processInstance = runtimeService.startProcessInstanceById(procDefId, Convert.toStr(variables.get("businessKey")),variables);
|
||||
|
@ -213,8 +232,8 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
// 给第一步申请人节点设置任务执行人和意见
|
||||
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
|
||||
if (Objects.nonNull(task)) {
|
||||
taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getNickName() + "发起流程申请");
|
||||
taskService.setAssignee(task.getId(), Convert.toStr(sysUser.getUserId()));
|
||||
taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), nickName + "发起流程申请");
|
||||
taskService.setAssignee(task.getId(), Convert.toStr(userId));
|
||||
taskService.complete(task.getId(), variables);
|
||||
}
|
||||
return AjaxResult.success("流程启动成功");
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.flowable.bpmn.model.Process;
|
|||
import org.flowable.bpmn.model.*;
|
||||
import org.flowable.common.engine.api.FlowableException;
|
||||
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.engine.ProcessEngineConfiguration;
|
||||
import org.flowable.engine.history.HistoricActivityInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
|
@ -105,10 +106,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
|
||||
taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables());
|
||||
} else {
|
||||
if(task.getName().equals("提交申请")){
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), "重新提交流程申请!!");
|
||||
}else{
|
||||
if(StringUtils.isNotEmpty(taskVo.getComment())){
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
|
||||
}else{
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getAssignee()+"重新提交流程申请!!");
|
||||
}
|
||||
taskService.setAssignee(taskVo.getTaskId(), taskVo.getUserId());
|
||||
taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
|
||||
|
@ -305,6 +306,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
}));
|
||||
// 设置回退意见
|
||||
currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()));
|
||||
taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getUserId());
|
||||
|
||||
try {
|
||||
// 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1)
|
||||
|
@ -608,11 +610,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false);
|
||||
if (CollectionUtils.isNotEmpty(endNodes)) {
|
||||
// TODO 取消流程为什么要设置流程发起人?
|
||||
// SysUser loginUser = SecurityUtils.getLoginUser().getUser();
|
||||
// Authentication.setAuthenticatedUserId(loginUser.getUserId().toString());
|
||||
|
||||
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
|
||||
// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
|
||||
Authentication.setAuthenticatedUserId(flowTaskVo.getUserId());
|
||||
taskService.addComment(task.get(0).getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
|
||||
StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
|
||||
taskService.setAssignee(task.get(0).getId(), flowTaskVo.getUserId());
|
||||
// 获取当前流程最后一个节点
|
||||
String endId = endNodes.get(0).getId();
|
||||
List<Execution> executions = runtimeService.createExecutionQuery()
|
||||
|
@ -1136,6 +1137,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
public AjaxResult flowXmlAndNode(String procInsId, String deployId) {
|
||||
try {
|
||||
List<FlowViewerDto> flowViewerList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(procInsId)){
|
||||
// 获取已经完成的节点
|
||||
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
|
@ -1163,9 +1165,11 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|||
flowViewerDto.setCompleted(false);
|
||||
flowViewerList.add(flowViewerDto);
|
||||
});
|
||||
}
|
||||
Map<String, Object> result = new HashMap();
|
||||
// xmlData 数据
|
||||
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
|
||||
|
||||
InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
|
||||
String xmlData = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
||||
result.put("nodeData", flowViewerList);
|
||||
|
|
|
@ -33,6 +33,9 @@ public class FlowProcDefDto implements Serializable {
|
|||
@ApiModelProperty("流程分类")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty("流程分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty("配置表单名称")
|
||||
private String formName;
|
||||
|
||||
|
|
|
@ -11,6 +11,14 @@ import com.ruoyi.system.domain.SysUserRole;
|
|||
*/
|
||||
public interface SysUserRoleMapper
|
||||
{
|
||||
/**
|
||||
* 通过用户手机查询用户角色
|
||||
*
|
||||
* @param phonenumber 用户手机
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectUserRoles(String phonenumber);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户和角色关联
|
||||
*
|
||||
|
|
|
@ -10,6 +10,15 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|||
*/
|
||||
public interface ISysUserService
|
||||
{
|
||||
|
||||
/**
|
||||
* 通过用户手机查询用户角色
|
||||
*
|
||||
* @param phonenumber 用户手机
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectUserRoles(String phonenumber);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
|
|
@ -554,4 +554,14 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户手机查询用户角色
|
||||
*
|
||||
* @param phonenumber 用户手机
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Long> selectUserRoles(String phonenumber) {
|
||||
return userRoleMapper.selectUserRoles(phonenumber);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
where
|
||||
1=1
|
||||
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
|
||||
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
|
||||
<if test="businessKeyName != null and businessKeyName != ''"> and fa.businessKeyName like concat('%', #{businessKeyName}, '%')</if>
|
||||
<if test="category != null and category != ''"> and fa.category = #{category}</if>
|
||||
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and fa.createTime between #{params.beginDate} and #{params.endDate}</if>
|
||||
|
|
|
@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
rp.deployment_id_ as deploymentId,
|
||||
rd.name_ as name,
|
||||
rd.category_ as category,
|
||||
sdd.dict_label as categoryName,
|
||||
rp.key_ as flowKey,
|
||||
rp.version_ as version,
|
||||
rp.suspension_state_ as suspensionState,
|
||||
|
@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
act_re_procdef rp
|
||||
LEFT JOIN act_re_deployment rd ON rp.deployment_id_ = rd.id_
|
||||
left join sys_dict_data sdd on sdd.dict_type='sys_process_category' and sdd.dict_value = rd.category_
|
||||
left join act_re_procdef_role rpr on rp.key_ = rpr.PROCDEF_KEY_
|
||||
left join sys_user_role sur on sur.role_id = rpr.ROLE_ID_
|
||||
left join sys_user su on su.user_id = sur.user_id
|
||||
|
|
|
@ -17,6 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select count(1) from sys_user_role where role_id=#{roleId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserRoles" parameterType="string" resultType="Long">
|
||||
select DISTINCT ur.role_id from sys_user_role ur
|
||||
left join sys_user su on su.user_id = ur.user_id
|
||||
where su.phonenumber=#{phonenumber}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserRole" parameterType="Long">
|
||||
delete from sys_user_role where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<el-input
|
||||
type="textarea"
|
||||
v-model="form.remark"
|
||||
placeholder="请输入申请说明"
|
||||
placeholder="请输入请假事由"
|
||||
rows="5"
|
||||
max="1"
|
||||
/>
|
||||
|
@ -227,6 +227,7 @@ export default {
|
|||
this.form.taskId = this.options.taskId;
|
||||
this.form.taskName = this.options.taskName;
|
||||
this.form.userId = store.getters.userId;
|
||||
this.form.assignee = store.getters.name;
|
||||
this.form.procInsId = this.options.procInsId;
|
||||
this.form.instanceId = this.options.procInsId;
|
||||
this.times = res.data.day;
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
this.form.taskId = this.options.taskId;
|
||||
this.form.taskName = this.options.taskName;
|
||||
this.form.userId = store.getters.userId;
|
||||
this.form.assignee = store.getters.name;
|
||||
this.form.procInsId = this.options.procInsId;
|
||||
this.form.instanceId = this.options.procInsId;
|
||||
}).catch(res => {
|
||||
|
|
|
@ -132,8 +132,8 @@
|
|||
<el-table-column label="操作" width="150" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="getActivate(scope.row)" @click="handleActivate(scope.row)" type="text" size="small" icon="el-icon-edit-outline">处理</el-button>
|
||||
<el-button v-if="scope.row.finishTime == null" @click="handleStop(scope.row)" type="text" size="small" icon="el-icon-switch-button">终止</el-button>
|
||||
<el-button @click="handleFlowRecord(scope.row)" type="text" size="small" icon="el-icon-finished">详情</el-button>
|
||||
<el-button v-if="scope.row.finishTime == null" @click="handleStop(scope.row)" type="text" size="small" icon="el-icon-switch-button">终止</el-button>
|
||||
<el-button v-if="scope.row.finishTime == null" @click="handleDelete(scope.row)" type="text" size="small" icon="el-icon-delete" v-hasPermi="['system:deployment:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -452,7 +452,7 @@ export default {
|
|||
instanceId: row.procInsId
|
||||
}
|
||||
let that = this;
|
||||
this.$modal.confirm('撤销流程会终止,是否继续?').then(function() {
|
||||
this.$modal.confirm('是否终止当前流程申请?').then(function() {
|
||||
that.loading = true;
|
||||
return stopProcess(params);
|
||||
}).then(res => {
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<el-input
|
||||
type="textarea"
|
||||
v-model="form.remark"
|
||||
placeholder="请输入申请说明"
|
||||
placeholder="请输入请假事由"
|
||||
rows="5"
|
||||
max="1"
|
||||
/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
label-width="120px"
|
||||
style="padding-right: 35px"
|
||||
>
|
||||
<div>
|
||||
<div class="mycanvas">
|
||||
<div class="canvas" ref="flowCanvas"></div>
|
||||
<div class="maskLayer" />
|
||||
</div>
|
||||
|
|
|
@ -277,8 +277,8 @@
|
|||
:label="group.unitName + ' [' + group.unitTypeName + '] '"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in group.userinfoList"
|
||||
:key="item.phonenumber"
|
||||
v-for="(item,index) in group.userinfoList"
|
||||
:key="index"
|
||||
:label="item.nickName + ' [' + item.jobTypeName + '] '"
|
||||
:value="item.phonenumber"
|
||||
>
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-flowable</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.yanzhu.jh</groupId>
|
||||
<artifactId>yanzhu-jh</artifactId>
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
package com.ruoyi.web.flowable.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.flowable.domain.dto.FlowTaskDto;
|
||||
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
|
||||
import com.ruoyi.flowable.domain.vo.StartTaskVO;
|
||||
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
|
||||
import com.ruoyi.flowable.service.IFlowDefinitionService;
|
||||
import com.ruoyi.flowable.service.IFlowInstanceService;
|
||||
import com.ruoyi.flowable.service.IFlowTaskService;
|
||||
import com.ruoyi.system.domain.FlowTaskEntity;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version : V1.0
|
||||
* @ClassName: FlowTaskController
|
||||
* @Description: 工作流任务
|
||||
* @Auther: JiangYuQi
|
||||
* @Date: 2020/7/7 18:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wechat/flowTask")
|
||||
public class FlowableController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private IFlowTaskService flowTaskService;
|
||||
|
||||
@Autowired
|
||||
private IFlowDefinitionService flowDefinitionService;
|
||||
|
||||
@Autowired
|
||||
IFlowInstanceService flowInstanceService;
|
||||
|
||||
@Autowired
|
||||
private IFlowBusinessKeyService flowBusinessKeyService;
|
||||
|
||||
/**
|
||||
* 启动流程实例
|
||||
* @param startTaskVO
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "发起流程", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/startProcessInstance")
|
||||
public AjaxResult startProcessInstance(@RequestBody StartTaskVO startTaskVO) {
|
||||
return flowDefinitionService.startProcessInstanceById(startTaskVO.getProcDefId(), startTaskVO.getUserId(), startTaskVO.getNickName(), startTaskVO.getVariables());
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的流程实例列表
|
||||
* @param username
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/myFlowDefinitionList")
|
||||
public AjaxResult myFlowDefinitionList(String username, String category) {
|
||||
return AjaxResult.success(flowDefinitionService.myList(username, category, null, 1, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程节点
|
||||
* @param deployId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询流程节点")
|
||||
@GetMapping("/readNotes/{deployId}")
|
||||
public AjaxResult readNotes(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) {
|
||||
return success(flowDefinitionService.readNodes(deployId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消申请
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
|
||||
@Log(title = "终止流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/stopProcess")
|
||||
public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.stopProcess(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回流程
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
|
||||
@Log(title = "撤回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/revokeProcess")
|
||||
public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.revokeProcess(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "审批任务")
|
||||
@Log(title = "审批流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/complete")
|
||||
public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.complete(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "驳回任务")
|
||||
@Log(title = "驳回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/reject")
|
||||
public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReject(flowTaskVo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回任务
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "退回任务")
|
||||
@Log(title = "退回流程", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/return")
|
||||
public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
flowTaskService.taskReturn(flowTaskVo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除流程实例")
|
||||
@Log(title = "删除流程", businessType = BusinessType.INSERT)
|
||||
@DeleteMapping(value = "/delete/{instanceId}")
|
||||
public AjaxResult delete(@ApiParam(value = "流程实例ID", required = true) @PathVariable String instanceId,
|
||||
@ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) {
|
||||
flowInstanceService.delete(instanceId,deleteReason);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有可回退的节点
|
||||
* @param flowTaskVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取所有可回退的节点")
|
||||
@PostMapping(value = "/returnList")
|
||||
public AjaxResult findReturnTaskList(@RequestBody FlowTaskVo flowTaskVo) {
|
||||
return flowTaskService.findReturnTaskList(flowTaskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询操作日志
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findCommentByProcInsId")
|
||||
public AjaxResult findCommentByProcInsId(String procInsId) {
|
||||
return success(flowBusinessKeyService.selectCommentByProcInsId(procInsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程Id查询表单数据
|
||||
* @param procInsId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findFormDatasByProcInsId")
|
||||
public AjaxResult findFormDatasByProcInsId(String procInsId) {
|
||||
return success(flowBusinessKeyService.selectFormDatasByProcInsId(procInsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的代办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/myAwaitFlowTaskList")
|
||||
public TableDataInfo myAwaitFlowTaskList(@RequestBody FlowTaskEntity flowTaskEntity) {
|
||||
//这里不分页,这里实时查询用户角色
|
||||
flowTaskEntity.setRoleIds(sysUserService.selectUserRoles(flowTaskEntity.getNowUserName()));
|
||||
return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询我的已办任务
|
||||
* @param flowTaskEntity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/myFinishedFlowTaskList")
|
||||
public TableDataInfo myFinishedFlowTaskList(FlowTaskEntity flowTaskEntity) {
|
||||
startPage();
|
||||
return getDataTable(flowBusinessKeyService.selectMyFinishedFlowTask(flowTaskEntity));
|
||||
}
|
||||
|
||||
}
|
|
@ -153,5 +153,13 @@ public class ProjectProblemmodifyController extends BaseController {
|
|||
return success(smzSspProblemmodifyService.findGroupCountByProjectId(smzSspProblemmodify));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户上次在该项目提交的隐患信息
|
||||
* @param smzSspProblemmodify
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findLastDataByParams")
|
||||
public AjaxResult findLastDataByParams(SmzSspProblemmodify smzSspProblemmodify){
|
||||
return success(smzSspProblemmodifyService.findLastDataByParams(smzSspProblemmodify));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,4 +132,12 @@ public interface SmzSspProblemmodifyMapper
|
|||
|
||||
public int countTimeout(SmzSspProblemmodifyWhere where);
|
||||
|
||||
/**
|
||||
* 根据条件查询最后一条隐患数据
|
||||
*
|
||||
* @param smzSspProblemmodify 隐患排查
|
||||
* @return 结果
|
||||
*/
|
||||
public SmzSspProblemmodify findLastDataByParams(SmzSspProblemmodify smzSspProblemmodify);
|
||||
|
||||
}
|
||||
|
|
|
@ -103,6 +103,14 @@ public interface ISmzSspProblemmodifyService
|
|||
*/
|
||||
public List<Map<String,Object>> findGroupCountByProjectId(SmzSspProblemmodify smzSspProblemmodify);
|
||||
|
||||
/**
|
||||
* 根据条件查询最后一条隐患数据
|
||||
*
|
||||
* @param smzSspProblemmodify 隐患排查
|
||||
* @return 结果
|
||||
*/
|
||||
public SmzSspProblemmodify findLastDataByParams(SmzSspProblemmodify smzSspProblemmodify);
|
||||
|
||||
/**
|
||||
* 分类汇总(按项目)
|
||||
* @param deptId 部门编号 0为全部
|
||||
|
|
|
@ -269,8 +269,20 @@ public class SmzSspProblemmodifyServiceImpl implements ISmzSspProblemmodifyServi
|
|||
* @param smzSspProblemmodify 隐患排查
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,Object>> findGroupCountByProjectId(SmzSspProblemmodify smzSspProblemmodify){
|
||||
return smzSspProblemmodifyMapper.findGroupCountByProjectId(smzSspProblemmodify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询最后一条隐患数据
|
||||
*
|
||||
* @param smzSspProblemmodify 隐患排查
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public SmzSspProblemmodify findLastDataByParams(SmzSspProblemmodify smzSspProblemmodify) {
|
||||
return smzSspProblemmodifyMapper.findLastDataByParams(smzSspProblemmodify);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -262,6 +262,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where ssp.id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询当前用户最后一条隐患数据-->
|
||||
<select id="findLastDataByParams" parameterType="SmzSspProblemmodify" resultMap="SmzSspProblemmodifyResult">
|
||||
<include refid="selectSmzSspProblemmodifyVo"/>
|
||||
<where>
|
||||
isDel=0
|
||||
<if test="projectId != null "> and projectId = #{projectId}</if>
|
||||
<if test="infoType !=null">and infoType=#{infoType}</if>
|
||||
<if test="createUser !=null and createUser != ''">and createUser=#{createUser}</if>
|
||||
order by createTime desc
|
||||
limit 0,1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertSmzSspProblemmodify" parameterType="SmzSspProblemmodify" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into smz_ssp_problemmodify
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
Loading…
Reference in New Issue