class ProcessActivityHistoryServiceImpl extends ServiceImpl<OaProcessActivityHistoryMapper, OaProcessActivityHistory>
        implements ProcessActivityHistoryService, DataProxy<OaProcessActivityHistory> {

    @Autowired
    private TaskHistoryService taskHistoryService;

    @Override
    public List<OaProcessActivityHistory> listByProcInstId(Long instId, boolean active) {
        LambdaQueryWrapper<OaProcessActivityHistory> queryWrapper = new LambdaQueryWrapper<OaProcessActivityHistory>()
                .eq(OaProcessActivityHistory::getProcessInstId, instId)
                .eq(OaProcessActivityHistory::getActive, active)
                .orderByAsc(OaProcessActivityHistory::getFinishDate);
        List<OaProcessActivityHistory> list = super.list(queryWrapper);
        //查询任务历史
        list.forEach(h -> {
            List<OaTaskHistory> taskHistories = taskHistoryService.listByActivityId(h.getId());
            h.setTasks(taskHistories);
        });
        return list;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public OaProcessActivityHistory copyAndSave(OaProcessActivity activity) {
        OaProcessActivityHistory oaTaskHistory = new OaProcessActivityHistory();
        BeanUtils.copyProperties(activity, oaTaskHistory);
        super.saveOrUpdate(oaTaskHistory);
        return oaTaskHistory;
    }

    @Override
    public List<OaProcessActivityHistory> listFinishedByExecutionId(Long executionId) {<FILL_FUNCTION_BODY>}
}

        LambdaQueryWrapper<OaProcessActivityHistory> queryWrapper = new LambdaQueryWrapper<OaProcessActivityHistory>()
                .eq(OaProcessActivityHistory::getExecutionId, executionId)
                .eq(OaProcessActivityHistory::getFinished, true)
                .orderByAsc(OaProcessActivityHistory::getFinishDate);
        List<OaProcessActivityHistory> list = super.list(queryWrapper);
        //查询任务历史
        list.forEach(h -> {
            List<OaTaskHistory> taskHistories = taskHistoryService.listByActivityId(h.getId());
            h.setTasks(taskHistories);
        });
        return list;
    
<no_super_class>