xiangpei
2025-01-17 e870ae252f020b745bb6eb1b0f6f74ff29fa79bc
flowable/src/main/java/com/ycl/service/impl/ProcessLogServiceImpl.java
File was renamed from flowable/src/main/java/com/ycl/service/impl/FlowLogServiceImpl.java
@@ -2,14 +2,14 @@
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;
@@ -27,9 +27,9 @@
 */
@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;
    /**
     * 添加日志
@@ -40,10 +40,10 @@
     * @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);
@@ -78,8 +78,8 @@
     * @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());
    }
@@ -91,7 +91,7 @@
     */
    @Override
    public Result detail(Long id) {
        FlowLogVO vo = baseMapper.getById(id);
        ProcessLogVO vo = baseMapper.getById(id);
        Assert.notNull(vo, "记录不存在");
        return Result.ok().data(vo);
    }
@@ -102,19 +102,19 @@
     */
    @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);
    }