| | |
| | | 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.apache.commons.collections4.CollectionUtils; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.history.HistoricActivityInstance; |
| | | import org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | public HistoricActivityInstance getPreviousNode(String taskId) { |
| | | // 获取当前任务的执行实例 ID |
| | | String executionId = historyService.createHistoricTaskInstanceQuery() |
| | | String processInstanceId = historyService.createHistoricTaskInstanceQuery() |
| | | .taskId(taskId) |
| | | .singleResult() |
| | | .getExecutionId(); |
| | | .getProcessInstanceId(); |
| | | |
| | | // 查询历史活动实例 |
| | | List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery() |
| | | .executionId(executionId) |
| | | .processInstanceId(processInstanceId) |
| | | .activityType("userTask") |
| | | .finished() |
| | | .orderByHistoricActivityInstanceEndTime() |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FlowMyBusiness getFlowMyBusiness(String instanceId, String taskId) { |
| | | List<FlowMyBusiness> businessList = super.list( |
| | | new QueryWrapper<FlowMyBusiness>().eq("process_instance_id", instanceId).eq("task_id", taskId)); |
| | | return businessList.isEmpty() ? null : businessList.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public FlowMyBusiness selectByDataId(String dataId) { |
| | | List<FlowMyBusiness> businessList = super.list( |
| | | new QueryWrapper<FlowMyBusiness>().eq("data_id", dataId)); |
| | | return businessList.isEmpty() ? null : businessList.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public List<FlowMyBusiness> selectListByDataId(String dataId) { |
| | | //如果保存数据前未调用必调的FlowCommonService.initActBusiness方法,就会有问题 |
| | | LambdaQueryWrapper<FlowMyBusiness> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(FlowMyBusiness::getDataId, dataId); |
| | | List<FlowMyBusiness> list = flowMyBusinessMapper.selectList(queryWrapper); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return Collections.emptyList(); |
| | | } |
| | | return list; |
| | | } |
| | | } |