将List中元素转为另一个类型的List

将List中元素转为另一个类型的List

public List<CheckResult> exectorRule(List<ScanResult> scanResults) {
        return Lists.transform(scanResults, this::checkRule);
    }

    private CheckResult checkRule(ScanResult scanResult) {
        CheckResult checkResult = new CheckResult();
        checkResult.setJobId(scanResult.getJobId());
        checkResult.setScanItemId(scanResult.getScanItemId());
        checkResult.setScanItem(scanResult.getScanItem());
        checkResult.setScanBatch(scanResult.getScanBatch());
        checkResult.setResource(scanResult.getResource());
        checkResult.setAppName(scanResult.getAppName());
        checkResult.setPlatform(scanResult.getPlatform());
        checkResult.setSysName(scanResult.getAppName());
        checkResult.setOwner(scanResult.getOwner());
        checkResult.setFullDeptCode(scanResult.getFullDeptCode());
        checkResult.setFullDeptName(scanResult.getFullDeptName());
        checkResult.setLevel(scanResult.getLevel());
        checkResult.setCreateTime(LocalDateTime.now());
        checkRule(checkResult, scanResult.getScanValue());
        return checkResult;
    }
posted @ 2023-09-13 14:02  SpecialSpeculator  阅读(179)  评论(0编辑  收藏  举报