提交代码

dev_xds
姜玉琦 2023-09-17 02:06:22 +08:00
parent 7bd6985565
commit 84416591b6
30 changed files with 471 additions and 70 deletions

View File

@ -84,13 +84,4 @@
</dependencies>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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("流程启动成功");

View File

@ -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,36 +1137,39 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
public AjaxResult flowXmlAndNode(String procInsId, String deployId) {
try {
List<FlowViewerDto> flowViewerList = new ArrayList<>();
// 获取已经完成的节点
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.finished()
.list();
if(StringUtils.isNotEmpty(procInsId)){
// 获取已经完成的节点
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.finished()
.list();
// 保存已经完成的流程节点编号
listFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(true);
flowViewerList.add(flowViewerDto);
});
// 保存已经完成的流程节点编号
listFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(true);
flowViewerList.add(flowViewerDto);
});
// 获取代办节点
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.unfinished()
.list();
// 获取代办节点
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.unfinished()
.list();
// 保存需要代办的节点编号
listUnFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(false);
flowViewerList.add(flowViewerDto);
});
// 保存需要代办的节点编号
listUnFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
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);

View File

@ -33,6 +33,9 @@ public class FlowProcDefDto implements Serializable {
@ApiModelProperty("流程分类")
private String category;
@ApiModelProperty("流程分类名称")
private String categoryName;
@ApiModelProperty("配置表单名称")
private String formName;

View File

@ -11,6 +11,14 @@ import com.ruoyi.system.domain.SysUserRole;
*/
public interface SysUserRoleMapper
{
/**
*
*
* @param phonenumber
* @return
*/
public List<Long> selectUserRoles(String phonenumber);
/**
* ID
*

View File

@ -10,6 +10,15 @@ import com.ruoyi.common.core.domain.entity.SysUser;
*/
public interface ISysUserService
{
/**
*
*
* @param phonenumber
* @return
*/
public List<Long> selectUserRoles(String phonenumber);
/**
*
*

View File

@ -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);
}
}

View File

@ -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>

View File

@ -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

View File

@ -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=")">

View File

@ -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;

View File

@ -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 => {

View File

@ -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 => {

View File

@ -106,7 +106,7 @@
<el-input
type="textarea"
v-model="form.remark"
placeholder="请输入申请说明"
placeholder="请输入请假事由"
rows="5"
max="1"
/>

View File

@ -19,9 +19,9 @@
label-width="120px"
style="padding-right: 35px"
>
<div>
<div class="canvas" ref="flowCanvas"></div>
<div class="maskLayer" />
<div class="mycanvas">
<div class="canvas" ref="flowCanvas"></div>
<div class="maskLayer" />
</div>
<el-form-item label="所属项目" prop="businessKey">
<el-select

View File

@ -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"
>

View File

@ -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>

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -132,4 +132,12 @@ public interface SmzSspProblemmodifyMapper
public int countTimeout(SmzSspProblemmodifyWhere where);
/**
*
*
* @param smzSspProblemmodify
* @return
*/
public SmzSspProblemmodify findLastDataByParams(SmzSspProblemmodify smzSspProblemmodify);
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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=",">