lyh
2025-04-01 4e2be858f4ccbb7490b59ed584fd1c829eb4d556
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.jeecg.modules.flowable.service.impl;
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.flowable.engine.history.HistoricActivityInstance;
import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl;
import org.jeecg.modules.flowable.domain.vo.FlowMy;
import org.jeecg.modules.flowable.domain.vo.WorkTaskDataVo;
import org.jeecg.modules.flowable.mapper.IWorkTaskVoMapper;
import org.jeecg.modules.flowable.service.IWorkTaskServiceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service
public class WorkTaskServiceImplVo extends ServiceImpl<IWorkTaskVoMapper, WorkTaskDataVo> implements IWorkTaskServiceVo {
    @Autowired
    FlowMyBusinessServiceImpl flowMyBusinessService;
    @Override
    public IPage<WorkTaskDataVo> toTaskBySelf(FlowMy flowMy, Page page) {
        IPage<WorkTaskDataVo> workTaskDataVoIPage=baseMapper.taskBySelf(flowMy,page);
        workTaskDataVoIPage.getRecords().forEach(workTaskDataVo -> {
            HistoricActivityInstance historicActivityInstance=flowMyBusinessService.getPreviousNode(workTaskDataVo.getId());
            if (historicActivityInstance != null){
                workTaskDataVo.setPreNode(historicActivityInstance.getActivityName());
                workTaskDataVo.setPreNodeAssignee(historicActivityInstance.getAssignee());
            }
            if (StrUtil.isEmpty(workTaskDataVo.getAssignee())){
                workTaskDataVo.setAssignee(flowMy.getUsername());
            }
        });
        return workTaskDataVoIPage;
    }
}