update 调整获取当前登录任务实例
This commit is contained in:
parent
f789ecf418
commit
5e3de64805
@ -120,4 +120,9 @@ public class FlowInstanceVo {
|
|||||||
*/
|
*/
|
||||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
|
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
|
||||||
private String createByName;
|
private String createByName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程分类id
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import org.dromara.warm.flow.core.entity.Definition;
|
|||||||
import org.dromara.warm.flow.core.entity.Instance;
|
import org.dromara.warm.flow.core.entity.Instance;
|
||||||
import org.dromara.warm.flow.core.entity.Node;
|
import org.dromara.warm.flow.core.entity.Node;
|
||||||
import org.dromara.warm.flow.core.entity.Task;
|
import org.dromara.warm.flow.core.entity.Task;
|
||||||
import org.dromara.warm.flow.core.enums.FlowStatus;
|
|
||||||
import org.dromara.warm.flow.core.enums.NodeType;
|
import org.dromara.warm.flow.core.enums.NodeType;
|
||||||
import org.dromara.warm.flow.core.enums.SkipType;
|
import org.dromara.warm.flow.core.enums.SkipType;
|
||||||
import org.dromara.warm.flow.core.service.DefService;
|
import org.dromara.warm.flow.core.service.DefService;
|
||||||
@ -109,6 +108,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用查询条件
|
* 通用查询条件
|
||||||
|
*
|
||||||
* @param flowInstanceBo 查询条件
|
* @param flowInstanceBo 查询条件
|
||||||
* @return 查询条件构造方法
|
* @return 查询条件构造方法
|
||||||
*/
|
*/
|
||||||
@ -117,11 +117,12 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getNodeName()), "fi.node_name", flowInstanceBo.getNodeName());
|
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getNodeName()), "fi.node_name", flowInstanceBo.getNodeName());
|
||||||
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowName()), "fd.flow_name", flowInstanceBo.getFlowName());
|
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowName()), "fd.flow_name", flowInstanceBo.getFlowName());
|
||||||
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowCode()), "fd.flow_code", flowInstanceBo.getFlowCode());
|
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowCode()), "fd.flow_code", flowInstanceBo.getFlowCode());
|
||||||
queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getCategory()),"category", flowInstanceBo.getCategory());
|
queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getCategory()), "fd.category", flowInstanceBo.getCategory());
|
||||||
queryWrapper.in(CollUtil.isNotEmpty(flowInstanceBo.getCreateByIds()), "fi.create_by", flowInstanceBo.getCreateByIds());
|
queryWrapper.in(CollUtil.isNotEmpty(flowInstanceBo.getCreateByIds()), "fi.create_by", flowInstanceBo.getCreateByIds());
|
||||||
queryWrapper.orderByDesc("fi.create_time");
|
queryWrapper.orderByDesc("fi.create_time");
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据业务id查询流程实例
|
* 根据业务id查询流程实例
|
||||||
*
|
*
|
||||||
@ -225,34 +226,11 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<FlowInstanceVo> pageByCurrent(FlowInstanceBo instanceBo, PageQuery pageQuery) {
|
public TableDataInfo<FlowInstanceVo> pageByCurrent(FlowInstanceBo instanceBo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<FlowInstance> wrapper = Wrappers.lambdaQuery();
|
QueryWrapper<FlowInstanceBo> queryWrapper = buildQueryWrapper(instanceBo);
|
||||||
if (StringUtils.isNotBlank(instanceBo.getFlowCode())) {
|
queryWrapper.eq("fi.create_by", LoginHelper.getUserIdStr());
|
||||||
List<FlowDefinition> flowDefinitions = flowDefinitionMapper.selectList(
|
Page<FlowInstanceVo> page = flwInstanceMapper.page(pageQuery.build(), queryWrapper);
|
||||||
new LambdaQueryWrapper<FlowDefinition>().eq(FlowDefinition::getFlowCode, instanceBo.getFlowCode()));
|
|
||||||
if (CollUtil.isNotEmpty(flowDefinitions)) {
|
|
||||||
List<Long> defIdList = StreamUtils.toList(flowDefinitions, FlowDefinition::getId);
|
|
||||||
wrapper.in(FlowInstance::getDefinitionId, defIdList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wrapper.eq(FlowInstance::getCreateBy, LoginHelper.getUserIdStr());
|
|
||||||
wrapper.orderByDesc(FlowInstance::getCreateTime);
|
|
||||||
Page<FlowInstance> page = flowInstanceMapper.selectPage(pageQuery.build(), wrapper);
|
|
||||||
TableDataInfo<FlowInstanceVo> build = TableDataInfo.build();
|
TableDataInfo<FlowInstanceVo> build = TableDataInfo.build();
|
||||||
List<FlowInstanceVo> flowInstanceVos = BeanUtil.copyToList(page.getRecords(), FlowInstanceVo.class);
|
build.setRows(BeanUtil.copyToList(page.getRecords(), FlowInstanceVo.class));
|
||||||
if (CollUtil.isNotEmpty(flowInstanceVos)) {
|
|
||||||
List<Long> definitionIds = StreamUtils.toList(flowInstanceVos, FlowInstanceVo::getDefinitionId);
|
|
||||||
List<FlowDefinition> flowDefinitions = flowDefinitionMapper.selectByIds(definitionIds);
|
|
||||||
for (FlowInstanceVo vo : flowInstanceVos) {
|
|
||||||
flowDefinitions.stream().filter(e -> e.getId().toString().equals(vo.getDefinitionId().toString())).findFirst().ifPresent(e -> {
|
|
||||||
vo.setFlowName(e.getFlowName());
|
|
||||||
vo.setFlowCode(e.getFlowCode());
|
|
||||||
vo.setVersion(e.getVersion());
|
|
||||||
vo.setFlowStatusName(FlowStatus.getValueByKey(vo.getFlowStatus()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
build.setRows(flowInstanceVos);
|
|
||||||
build.setTotal(page.getTotal());
|
build.setTotal(page.getTotal());
|
||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<result property="delFlag" column="del_flag"/>
|
<result property="delFlag" column="del_flag"/>
|
||||||
<result property="ext" column="ext"/>
|
<result property="ext" column="ext"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="category" column="category"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="page" resultMap="FlowInstanceResult">
|
<select id="page" resultMap="FlowInstanceResult">
|
||||||
select fi.id,
|
select fi.id,
|
||||||
@ -42,7 +43,8 @@
|
|||||||
fd.flow_name,
|
fd.flow_name,
|
||||||
fd.flow_code,
|
fd.flow_code,
|
||||||
fd.version,
|
fd.version,
|
||||||
fi.create_by
|
fi.create_by,
|
||||||
|
fd.category
|
||||||
from flow_instance fi
|
from flow_instance fi
|
||||||
left join flow_definition fd on fi.definition_id = fd.id
|
left join flow_definition fd on fi.definition_id = fd.id
|
||||||
and fi.del_flag = '0'
|
and fi.del_flag = '0'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user