File was renamed from flowable/src/main/java/com/ycl/service/impl/FlowLogServiceImpl.java |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ycl.common.enums.business.FlowLogEventTypeEnum; |
| | | import com.ycl.domain.entity.FlowLog; |
| | | import com.ycl.mapper.FlowLogMapper; |
| | | import com.ycl.service.FlowLogService; |
| | | import com.ycl.common.enums.business.ProcessLogEventTypeEnum; |
| | | import com.ycl.domain.entity.ProcessLog; |
| | | import com.ycl.mapper.ProcessLogMapper; |
| | | import com.ycl.service.ProcessLogService; |
| | | import com.ycl.common.base.Result; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.domain.vo.FlowLogVO; |
| | | import com.ycl.domain.query.FlowLogQuery; |
| | | import com.ycl.domain.vo.ProcessLogVO; |
| | | import com.ycl.domain.query.ProcessLogQuery; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class FlowLogServiceImpl extends ServiceImpl<FlowLogMapper, FlowLog> implements FlowLogService { |
| | | public class ProcessLogServiceImpl extends ServiceImpl<ProcessLogMapper, ProcessLog> implements ProcessLogService { |
| | | |
| | | private final FlowLogMapper flowLogMapper; |
| | | private final ProcessLogMapper processLogMapper; |
| | | |
| | | /** |
| | | * 添加日志 |
| | |
| | | * @param eventDataJson json扩展内容 |
| | | */ |
| | | @Override |
| | | public void add(String taskId, String flowInsId, FlowLogEventTypeEnum eventType, Long projectId, String eventDataJson) { |
| | | FlowLog log = new FlowLog(); |
| | | public void add(String taskId, String flowInsId, ProcessLogEventTypeEnum eventType, Long projectId, String eventDataJson) { |
| | | ProcessLog log = new ProcessLog(); |
| | | log.setTaskId(taskId); |
| | | log.setFlowInsId(flowInsId); |
| | | log.setProcessInsId(flowInsId); |
| | | log.setProjectId(projectId); |
| | | log.setEventType(eventType); |
| | | log.setEventDataJson(eventDataJson); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result page(FlowLogQuery query) { |
| | | IPage<FlowLogVO> page = PageUtil.getPage(query, FlowLogVO.class); |
| | | public Result page(ProcessLogQuery query) { |
| | | IPage<ProcessLogVO> page = PageUtil.getPage(query, ProcessLogVO.class); |
| | | baseMapper.getPage(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Result detail(Long id) { |
| | | FlowLogVO vo = baseMapper.getById(id); |
| | | ProcessLogVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | return Result.ok().data(vo); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Result all() { |
| | | List<FlowLog> entities = baseMapper.selectList(null); |
| | | List<FlowLogVO> vos = entities.stream() |
| | | .map(entity -> FlowLogVO.getVoByEntity(entity, null)) |
| | | List<ProcessLog> entities = baseMapper.selectList(null); |
| | | List<ProcessLogVO> vos = entities.stream() |
| | | .map(entity -> ProcessLogVO.getVoByEntity(entity, null)) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean taskDelegation(String processInstanceId, String taskId) { |
| | | List<FlowLog> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(FlowLog::getFlowInsId, processInstanceId) |
| | | .eq(FlowLog::getTaskId, taskId) |
| | | .eq(FlowLog::getEventType, FlowLogEventTypeEnum.DELEGATE) |
| | | List<ProcessLog> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProcessLog::getProcessInsId, processInstanceId) |
| | | .eq(ProcessLog::getTaskId, taskId) |
| | | .eq(ProcessLog::getEventType, ProcessLogEventTypeEnum.DELEGATE) |
| | | .list(); |
| | | return CollectionUtils.isNotEmpty(list); |
| | | } |