| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.flowable.engine.task.Comment; |
| | |
| | | import org.springblade.mdm.flow.entity.MdmFlowProcess; |
| | | import org.springblade.mdm.flow.util.MdmFlowCache; |
| | | import org.springblade.mdm.flow.vo.FlowVO; |
| | | import org.springblade.mdm.program.entity.ProcessProgRef; |
| | | import org.springblade.mdm.program.service.ProcessProgRefService; |
| | | import org.springblade.system.feign.IUserClient; |
| | | import org.springblade.system.pojo.entity.User; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class FlowBusinessService { |
| | | |
| | | private final RuntimeService runtimeService; |
| | | private final TaskService taskService; |
| | | private final HistoryService historyService; |
| | | private final IUserClient userClient; |
| | | private final ProcessProgRefService processProgRefService; |
| | | private final ApproveRecordService approveRecordService; |
| | | |
| | | /** |
| | | * 查询我的流程(个人待办列表) |
| | |
| | | page.setRecords(flowList); |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * 流程查询 功能 的分页 |
| | | * @param page |
| | | * @param createTimeBegin |
| | | * @param createTimeEnd |
| | | * @param keyword |
| | | * @return |
| | | */ |
| | | public IPage<FlowVO> selectSearchPage(IPage<FlowVO> page, LocalDate createTimeBegin, LocalDate createTimeEnd, String keyword) { |
| | | |
| | | List<FlowVO> flowList = new LinkedList<>(); |
| | | Date now = new Date(); |
| | | TaskQuery taskQuery = taskService.createTaskQuery().active().includeProcessVariables(); |
| | | if(Func.isNotEmpty(createTimeBegin)) { |
| | | taskQuery.taskCreatedAfter(DateUtil.toDate(createTimeBegin)); |
| | | } |
| | | if(Func.isNotEmpty(createTimeEnd)) { |
| | | taskQuery.taskCreatedBefore(DateUtil.toDate(createTimeEnd.plusDays(1))); |
| | | } |
| | | |
| | | addKeywordCondition(taskQuery, keyword); |
| | | |
| | | taskQuery.orderByTaskCreateTime().desc(); |
| | | |
| | | // 构建列表数据 |
| | | FlowVO bladeFlow = new FlowVO(); |
| | | buildFlowTaskList(bladeFlow, flowList, taskQuery);//FlowEngineConstant.STATUS_TODO |
| | | |
| | | // 计算总数 |
| | | long count = taskQuery.count(); |
| | | // 设置页数 |
| | | page.setSize(count); |
| | | // 设置总数 |
| | | page.setTotal(count); |
| | | // 设置数据 |
| | | page.setRecords(flowList); |
| | | return page; |
| | | } |
| | | |
| | | public void deleteProcessInstance(String processInstancesId) { |
| | | runtimeService.deleteProcessInstance(processInstancesId, "流程查询-删除"); |
| | | //TODO 删除出关联字段 |
| | | } |
| | | } |