class LideaLogService {

    public LideaLogErrorDetailResp listError(LideaLogReq req) {

        // 获取traceId列表
        LideaLogResp traceResp = null;
        if (req.getFrom() == req.getTo()) {

            traceResp = lideaLogDAO.get(req);

        } else {

            traceResp = lideaLogDAO.scan(req);
        }

        // 获取trace详情
        List<String> traceIds = traceResp.getData().stream().flatMap(m -> Arrays.stream(m.getTraceIds().split(","))).collect(Collectors.toList());

        List<LideaLogErrorDetailBO> datas = lideaLogErrorDAO.list(traceIds);

        LideaLogErrorDetailResp resp = new LideaLogErrorDetailResp();
        resp.setAppName(req.getAppName());
        resp.setServiceName(req.getServiceName());
        resp.setMethodName(req.getMethodName());

        resp.setData(datas);

        return resp;
    }

}