将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;
}
原创:做时间的朋友