feat(workflow): 添加当前用户待办和抄送任务数量查询接口

- 在 FlwTaskController 中添加了 countTaskWaitByCurrentUser 和 countTaskCopyByCurrentUser 方法
- 在 FlwTaskMapper 中添加了 countTaskWait 和 countTaskCopy 方法
- 在 FlwTaskMapper.xml 中添加了对应的 SQL 查询语句
- 在 FlwTaskServiceImpl 和 IFlwTaskService 中实现了相关业务逻辑
master
zangchenhao 6 days ago
parent e26499e9ee
commit 1b6ac13b51

@ -209,4 +209,20 @@ public class FlwTaskController extends BaseController {
return R.ok(flwTaskService.currentTaskAllUser(taskId));
}
/**
*
*/
@GetMapping("/countTaskWaitByCurrentUser")
public R<Long> countTaskWaitByCurrentUser() {
return R.ok(flwTaskService.countTaskWaitByCurrentUser());
}
/**
*
*/
@GetMapping("/countTaskCopyByCurrentUser")
public R<Long> countTaskCopyByCurrentUser() {
return R.ok(flwTaskService.countTaskCopyByCurrentUser());
}
}

@ -54,4 +54,20 @@ public interface FlwTaskMapper {
* @return
*/
Page<FlowTaskVo> getTaskCopyByPage(@Param("page") Page<FlowTaskVo> page, @Param(Constants.WRAPPER) QueryWrapper<FlowTaskBo> queryWrapper);
/**
*
*
* @param queryWrapper
* @return
*/
Long countTaskWait(@Param(Constants.WRAPPER) Wrapper<FlowTaskBo> queryWrapper);
/**
*
*
* @param queryWrapper
* @return
*/
Long countTaskCopy(@Param(Constants.WRAPPER) QueryWrapper<FlowTaskBo> queryWrapper);
}

@ -207,4 +207,18 @@ public interface IFlwTaskService {
*/
FlowNode getByNodeCode(String nodeCode, Long definitionId);
/**
*
*
* @return
*/
Long countTaskWaitByCurrentUser();
/**
*
*
* @return
*/
Long countTaskCopyByCurrentUser();
}

@ -814,4 +814,32 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
.eq(FlowNode::getDefinitionId, definitionId));
}
/**
*
*
* @return
*/
@Override
public Long countTaskWaitByCurrentUser() {
FlowTaskBo flowTaskBo = new FlowTaskBo();
QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo);
queryWrapper.eq("t.node_type", NodeType.BETWEEN.getKey());
queryWrapper.in("t.processed_by", SpringUtils.getBean(WorkflowPermissionHandler.class).permissions());
queryWrapper.in("t.flow_status", BusinessStatusEnum.WAITING.getStatus());
return flwTaskMapper.countTaskWait(queryWrapper);
}
/**
*
*
* @return
*/
@Override
public Long countTaskCopyByCurrentUser() {
FlowTaskBo flowTaskBo = new FlowTaskBo();
QueryWrapper<FlowTaskBo> queryWrapper = buildQueryWrapper(flowTaskBo);
queryWrapper.in("t.processed_by", LoginHelper.getUserIdStr());
return flwTaskMapper.countTaskCopy(queryWrapper);
}
}

@ -112,4 +112,63 @@
) t
${ew.getCustomSqlSegment}
</select>
<!-- 查询当前用户的待办任务数量 -->
<select id="countTaskWait" resultType="java.lang.Long">
select count(distinct t.id) from (
select
t.id,
t.node_type,
t.definition_id,
t.instance_id,
t.create_time,
t.update_time,
t.tenant_id,
i.business_id,
i.flow_status,
i.create_by,
d.flow_name,
d.flow_code,
d.category,
d.version,
uu.processed_by,
uu.type
from flow_task t
left join flow_user uu on uu.associated = t.id
left join flow_definition d on t.definition_id = d.id
left join flow_instance i on t.instance_id = i.id
where t.node_type = 1
and t.del_flag = '0'
and uu.del_flag = '0'
and uu.type in ('1','2','3')
) t
${ew.getCustomSqlSegment}
</select>
<!-- 查询当前用户的抄送任务数量 -->
<select id="countTaskCopy" resultType="java.lang.Long">
select count(*) from (
select
b.id,
b.update_time,
c.business_id,
c.flow_status,
c.create_by,
a.processed_by,
a.create_time,
d.flow_name,
d.flow_code,
d.category,
d.version
from flow_user a
left join flow_his_task b on a.associated = b.task_id
left join flow_instance c on b.instance_id = c.id
left join flow_definition d on c.definition_id=d.id
where a.type = '4'
and a.del_flag = '0'
and b.del_flag = '0'
and d.del_flag = '0'
) t
${ew.getCustomSqlSegment}
</select>
</mapper>

Loading…
Cancel
Save