parent
ed336cac61
commit
0ffa1863c6
|
|
@ -97,6 +97,11 @@ public class SysUser extends BaseEntity
|
|||
/** 岗位组 */
|
||||
private Long[] postIds;
|
||||
|
||||
/**
|
||||
* 岗位编码组
|
||||
*/
|
||||
private List<String> postCode;
|
||||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
|
|
@ -318,6 +323,15 @@ public class SysUser extends BaseEntity
|
|||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public List<String> getPostCode() {
|
||||
return postCode;
|
||||
}
|
||||
|
||||
public void setPostCode(List<String> postCode) {
|
||||
this.postCode = postCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysPostMapper
|
||||
{
|
||||
/**
|
||||
* 查询岗位数据集合
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 岗位数据集合
|
||||
*/
|
||||
|
|
@ -20,14 +21,14 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<SysPost> selectPostAll();
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
|
|
@ -35,15 +36,22 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
public List<Long> selectPostListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户id获取岗位的编码
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> selectPostCodeListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询用户所属岗位组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -51,7 +59,7 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -59,7 +67,7 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -67,7 +75,7 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 修改岗位信息
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -75,7 +83,7 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 新增岗位信息
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -83,7 +91,7 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
*
|
||||
* @param postName 岗位名称
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -91,7 +99,7 @@ public interface SysPostMapper
|
|||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
*
|
||||
* @param postCode 岗位编码
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -106,7 +106,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Override
|
||||
public SysUser selectUserByUserName(String userName)
|
||||
{
|
||||
return userMapper.selectUserByUserName(userName);
|
||||
SysUser sysUser = userMapper.selectUserByUserName(userName);
|
||||
Long userId = sysUser.getUserId();
|
||||
List<String> postCodes = postMapper.selectPostCodeListByUserId(userId);
|
||||
sysUser.setPostCode(postCodes);
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectPostVo">
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
|
||||
from sys_post
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
<where>
|
||||
|
|
@ -36,16 +36,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostAll" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_id = #{postId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer">
|
||||
select p.post_id
|
||||
from sys_post p
|
||||
|
|
@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
|
||||
select p.post_id, p.post_name, p.post_code
|
||||
from sys_post p
|
||||
|
|
@ -61,17 +61,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_name = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_name=#{postName} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_code=#{postCode} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostCodeListByUserId" resultType="java.lang.String">
|
||||
select p.post_code
|
||||
from sys_post p
|
||||
left join sys_user_post up on up.post_id = p.post_id
|
||||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="updatePost" parameterType="SysPost">
|
||||
update sys_post
|
||||
<set>
|
||||
|
|
@ -85,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</set>
|
||||
where post_id = #{postId}
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
|
||||
insert into sys_post(
|
||||
<if test="postId != null and postId != 0">post_id,</if>
|
||||
|
|
@ -107,16 +115,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deletePostById" parameterType="Long">
|
||||
delete from sys_post where post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deletePostByIds" parameterType="Long">
|
||||
delete from sys_post where post_id in
|
||||
<foreach collection="array" item="postId" open="(" separator="," close=")">
|
||||
#{postId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
formDataSave(this.id,this.form.formData).then(response => {
|
||||
this.msgSuccess("审批成功");
|
||||
this.$modal.notifySuccess("审批成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="标题" align="center" prop="title" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="原因" align="center" prop="reason" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="流程进度" align="center" prop="taskName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="任务节点名称" align="center" prop="taskName" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="创建者" align="center" prop="createName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="开始时间" align="center" prop="leaveStartTime" width="180" :show-overflow-tooltip="true">
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="historyFory(scope.row)"
|
||||
v-hasPermi="['workflow:leave:edit']"
|
||||
v-hasPermi="['workflow:leave:query']"
|
||||
>审批详情
|
||||
</el-button>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
请假流程:
|
||||
发起人:任何人
|
||||
流程key:leave
|
||||
领导审核:当前账号的部门的 leader 编号的岗位
|
||||
|
||||
待办任务:
|
||||
分页获取该任务的候选人或候选组
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TODO
|
||||
待办任务根据 组 查询
|
||||
|
|
@ -78,7 +78,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@Log(title = "流程定义管理", businessType = BusinessType.IMPORT)
|
||||
@PostMapping(value = "/uploadStreamAndDeployment")
|
||||
@ApiOperation("上传并部署流程定义")
|
||||
@RequiresPermissions("activiti:definition")
|
||||
public AjaxResult uploadStreamAndDeployment(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
processDefinitionService.uploadStreamAndDeployment(file);
|
||||
return AjaxResult.success();
|
||||
|
|
@ -94,7 +93,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@Log(title = "流程定义管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/suspendOrActiveApply")
|
||||
@ApiOperation("启动挂起流程流程定义")
|
||||
@RequiresPermissions("activiti:definition")
|
||||
public AjaxResult suspendOrActiveApply(@RequestBody ProcessDefinitionDTO processDefinition) {
|
||||
processDefinitionService.suspendOrActiveApply(processDefinition.getId(), processDefinition.getSuspendState());
|
||||
return AjaxResult.success();
|
||||
|
|
@ -110,7 +108,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@Log(title = "流程定义管理", businessType = BusinessType.IMPORT)
|
||||
@PostMapping(value = "/upload")
|
||||
@ApiOperation("上传流程流程定义")
|
||||
@RequiresPermissions("activiti:definition")
|
||||
public AjaxResult upload(@RequestParam("processFile") MultipartFile multipartFile) throws IOException {
|
||||
|
||||
if (!multipartFile.isEmpty()) {
|
||||
|
|
@ -130,7 +127,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
*/
|
||||
@PostMapping(value = "/addDeploymentByString")
|
||||
@ApiOperation("通过stringBPMN添加流程定义")
|
||||
@RequiresPermissions("activiti:definition")
|
||||
public AjaxResult addDeploymentByString(@RequestParam("stringBPMN") String stringBPMN) {
|
||||
processDefinitionService.addDeploymentByString(stringBPMN);
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
|
|||
import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.web.page.TableSupport;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.activiti.domain.dto.ActTaskDTO;
|
||||
import com.xjs.activiti.domain.dto.ActWorkflowFormDataDTO;
|
||||
import com.xjs.activiti.service.IActTaskService;
|
||||
|
|
@ -30,6 +31,7 @@ public class TaskController extends BaseController {
|
|||
|
||||
//获取我的代办任务
|
||||
@GetMapping(value = "/list")
|
||||
@RequiresPermissions("activiti:task:list")
|
||||
public TableDataInfo getTasks() {
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<ActTaskDTO> hashMaps = actTaskService.selectProcessDefinitionList(pageDomain);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.xjs.activiti.domain;
|
|||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import com.xjs.activiti.domain.dto.ActWorkflowFormDataDTO;
|
||||
import org.activiti.api.task.model.Task;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package com.xjs.activiti.service.impl;
|
|||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.xjs.activiti.domain.ActWorkflowFormData;
|
||||
import com.xjs.activiti.domain.dto.ActTaskDTO;
|
||||
import com.xjs.activiti.domain.dto.ActWorkflowFormDataDTO;
|
||||
|
|
@ -13,19 +14,21 @@ import org.activiti.api.runtime.shared.query.Pageable;
|
|||
import org.activiti.api.task.model.Task;
|
||||
import org.activiti.api.task.model.builders.TaskPayloadBuilder;
|
||||
import org.activiti.api.task.runtime.TaskRuntime;
|
||||
import org.activiti.bpmn.model.BaseElement;
|
||||
import org.activiti.bpmn.model.FormProperty;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.activiti.runtime.api.model.impl.APITaskConverter;
|
||||
import org.activiti.runtime.api.query.impl.PageImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -41,6 +44,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private TaskRuntime taskRuntime;
|
||||
@Autowired
|
||||
|
|
@ -48,29 +53,37 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||
@Autowired
|
||||
private IActWorkflowFormDataService actWorkflowFormDataService;
|
||||
|
||||
@Autowired
|
||||
private APITaskConverter taskConverter;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ActTaskDTO> selectProcessDefinitionList(PageDomain pageDomain) {
|
||||
Page<ActTaskDTO> list = new Page<ActTaskDTO>();
|
||||
org.activiti.api.runtime.shared.query.Page<Task> pageTasks = taskRuntime.tasks(Pageable.of((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize()));
|
||||
List<Task> tasks = pageTasks.getContent();
|
||||
int totalItems = pageTasks.getTotalItems();
|
||||
|
||||
//org.activiti.api.runtime.shared.query.Page<Task> pageTasks = taskRuntime
|
||||
// .tasks(Pageable.of((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize()));
|
||||
|
||||
org.activiti.api.runtime.shared.query.Page<Task> taskQuery = this.createTaskQuery(pageDomain);
|
||||
List<Task> tasks = taskQuery.getContent();
|
||||
|
||||
int totalItems = taskQuery.getTotalItems();
|
||||
list.setTotal(totalItems);
|
||||
if (totalItems != 0) {
|
||||
Set<String> processInstanceIdIds = tasks.parallelStream().map(t -> t.getProcessInstanceId()).collect(Collectors.toSet());
|
||||
Set<String> processInstanceIdIds = tasks.parallelStream().map(Task::getProcessInstanceId).collect(Collectors.toSet());
|
||||
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().processInstanceIds(processInstanceIdIds).list();
|
||||
List<ActTaskDTO> actTaskDTOS = tasks.stream()
|
||||
.map(t -> new ActTaskDTO(t, processInstanceList.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get()))
|
||||
.collect(Collectors.toList());
|
||||
List<ActTaskDTO> actTaskDTOS = tasks.stream().map(t -> new ActTaskDTO(t, processInstanceList.parallelStream().filter(pi -> t.getProcessInstanceId().equals(pi.getId())).findAny().get())).collect(Collectors.toList());
|
||||
list.addAll(actTaskDTOS);
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> formDataShow(String taskID) {
|
||||
Task task = taskRuntime.task(taskID);
|
||||
//Task task = taskRuntime.task(taskID);
|
||||
|
||||
org.activiti.engine.task.Task task = taskService.createTaskQuery().taskId(taskID).singleResult();
|
||||
|
||||
/* ------------------------------------------------------------------------------
|
||||
FormProperty_0ueitp2--__!!类型--__!!名称--__!!是否参数--__!!默认值
|
||||
例子:
|
||||
|
|
@ -83,24 +96,28 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||
*/
|
||||
|
||||
//注意!!!!!!!!:表单Key必须要任务编号一模一样,因为参数需要任务key,但是无法获取,只能获取表单key“task.getFormKey()”当做任务key
|
||||
UserTask userTask = (UserTask) repositoryService.getBpmnModel(task.getProcessDefinitionId())
|
||||
.getFlowElement(task.getFormKey());
|
||||
UserTask userTask = (UserTask) repositoryService.getBpmnModel(task.getProcessDefinitionId()).getFlowElement(task.getFormKey());
|
||||
|
||||
if (userTask == null) {
|
||||
return null;
|
||||
}
|
||||
List<FormProperty> formProperties = userTask.getFormProperties();
|
||||
List<String> collect = formProperties.stream().map(fp -> fp.getId()).collect(Collectors.toList());
|
||||
return formProperties.stream().map(BaseElement::getId).collect(Collectors.toList());
|
||||
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int formDataSave(String taskID, List<ActWorkflowFormDataDTO> awfs) throws ParseException {
|
||||
Task task = taskRuntime.task(taskID);
|
||||
//Task task = taskRuntime.task(taskID);
|
||||
|
||||
org.activiti.engine.task.Task task = taskService.createTaskQuery().taskId(taskID).singleResult();
|
||||
|
||||
/*org.activiti.engine.task.Task task = taskService.createTaskQuery().taskCandidateOrAssigned(authenticatedUserId,
|
||||
userGroups).taskId(taskId).singleResult();*/
|
||||
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
|
||||
|
||||
Boolean hasVariables = false;//没有任何参数
|
||||
boolean hasVariables = false;//没有任何参数
|
||||
HashMap<String, Object> variables = new HashMap<String, Object>();
|
||||
//前端传来的字符串,拆分成每个控件
|
||||
List<ActWorkflowFormData> acwfds = new ArrayList<>();
|
||||
|
|
@ -118,16 +135,34 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||
}
|
||||
if (hasVariables) {
|
||||
//带参数完成任务
|
||||
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID)
|
||||
.withVariables(variables)
|
||||
.build());
|
||||
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID).withVariables(variables).build());
|
||||
} else {
|
||||
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID)
|
||||
.build());
|
||||
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskID).build());
|
||||
}
|
||||
|
||||
|
||||
//写入数据库
|
||||
return actWorkflowFormDataService.insertActWorkflowFormDatas(acwfds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* task创建查询
|
||||
*
|
||||
* @param pageDomain 分页参数
|
||||
* @return 分页数据
|
||||
*/
|
||||
private org.activiti.api.runtime.shared.query.Page<Task> createTaskQuery(PageDomain pageDomain) {
|
||||
Pageable pageable = Pageable.of((pageDomain.getPageNum() - 1) * pageDomain.getPageSize(), pageDomain.getPageSize());
|
||||
String username = SecurityUtils.getUsername();
|
||||
List<String> postCode = SecurityUtils.getLoginUser().getSysUser().getPostCode();
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.or()
|
||||
//待办任务根据 组 查询
|
||||
.taskCandidateOrAssigned(username, postCode)
|
||||
.taskOwner(username)
|
||||
.endOr();
|
||||
List<Task> tasks = taskConverter.from(taskQuery.listPage(pageable.getStartIndex(), pageable.getMaxItems()));
|
||||
return new PageImpl<>(tasks, Math.toIntExact(taskQuery.count()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.xjs.activiti.domain.dto.ProcessDefinitionDTO;
|
|||
import com.xjs.activiti.domain.vo.ActReDeploymentVO;
|
||||
import com.xjs.activiti.mapper.ActReDeploymentMapper;
|
||||
import com.xjs.activiti.service.IProcessDefinitionService;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
|
|
@ -82,7 +83,11 @@ public class ProcessDefinitionServiceImpl implements IProcessDefinitionService {
|
|||
|
||||
@Override
|
||||
public int deleteProcessDefinitionById(String id) {
|
||||
repositoryService.deleteDeployment(id, false);
|
||||
try {
|
||||
repositoryService.deleteDeployment(id, true);
|
||||
} catch (Exception e) {
|
||||
throw new ActivitiException("该流程已使用!无法删除!如需删除,请先删除相关任务!");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
package com.xjs.workflow.leave.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.core.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.text.UUID;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.RemoteUserService;
|
||||
import com.xjs.exception.BusinessException;
|
||||
import com.xjs.workflow.leave.domain.WorkflowLeave;
|
||||
import com.xjs.workflow.leave.mapper.WorkflowLeaveMapper;
|
||||
import com.xjs.workflow.leave.service.IWorkflowLeaveService;
|
||||
import org.activiti.api.process.runtime.ProcessRuntime;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.ActivitiObjectNotFoundException;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
|
|
@ -104,16 +109,30 @@ public class WorkflowLeaveServiceImpl implements IWorkflowLeaveService {
|
|||
String id = UUID.randomUUID().toString();
|
||||
workflowLeave.setId(id);
|
||||
workflowLeave.setCreateTime(DateUtils.getNowDate());
|
||||
String join = StringUtils.join(remoteUserService.selectUserNameByPostCodeAndDeptId("se", SecurityUtils.getLoginUser().getSysUser().getDeptId()), ",");
|
||||
|
||||
//查询当前用户同一个部门的领导岗位用户
|
||||
R<List<String>> listR = remoteUserService.selectUserNameByPostCodeAndDeptId("leader", SecurityUtils.getLoginUser().getSysUser().getDeptId());
|
||||
if (listR.getCode() != HttpStatus.SUCCESS) {
|
||||
throw new BusinessException("远程调用异常");
|
||||
}
|
||||
List<String> data = listR.getData();
|
||||
String join = StringUtils.join(data, ",");
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("deptLeader", join);
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder()
|
||||
.variables(map)
|
||||
.processDefinitionKey("leave")
|
||||
.businessKey(id)
|
||||
.name(workflowLeave.getTitle())
|
||||
.start();
|
||||
ProcessInstance processInstance = null;
|
||||
try {
|
||||
processInstance = runtimeService.createProcessInstanceBuilder()
|
||||
.variables(map)
|
||||
.processDefinitionKey("leave")
|
||||
.businessKey(id)
|
||||
.name(workflowLeave.getTitle())
|
||||
.start();
|
||||
} catch (ActivitiObjectNotFoundException e) {
|
||||
throw new ActivitiObjectNotFoundException("没有部署key:leave 的流程");
|
||||
} catch (ActivitiException e) {
|
||||
throw new ActivitiException("leave" + "-流程被挂起");
|
||||
}
|
||||
|
||||
workflowLeave.setInstanceId(processInstance.getId());
|
||||
workflowLeave.setState(String.valueOf(ING.getCode()));
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@
|
|||
<appender-ref ref="console" />
|
||||
</logger>
|
||||
|
||||
<!--开启activiti日志-->
|
||||
<logger name="org.activiti.engine.impl.persistence.entity" level="trace">
|
||||
<appender-ref ref="console"/>
|
||||
</logger>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
|
|
|||
Loading…
Reference in New Issue