use of com.webank.wedatasphere.qualitis.response.RuleMetricValueResponse in project Qualitis by WeBankFinTech.
the class RuleMetricServiceImpl method getResultsByRuleMetric.
@Override
public DataInfo<RuleMetricValueResponse> getResultsByRuleMetric(long ruleMetricId, int page, int size) throws UnExpectedRequestException {
DataInfo<RuleMetricValueResponse> dataInfo = new DataInfo<>();
int total = taskResultDao.countValuesByRuleMetric(ruleMetricId);
List<TaskResult> values = taskResultDao.findValuesByRuleMetric(ruleMetricId, page, size);
List<RuleMetricValueResponse> responses = new ArrayList<>(values.size());
for (TaskResult taskResult : values) {
if (taskResult == null) {
continue;
}
RuleMetricValueResponse ruleMetricValueResponse = new RuleMetricValueResponse();
ruleMetricValueResponse.setGenerateTime(taskResult.getCreateTime());
Rule currentRule = ruleDao.findById(taskResult.getRuleId());
ruleMetricValueResponse.setRelatedRuleName(currentRule == null ? "Deleted" : currentRule.getName());
ruleMetricValueResponse.setRuleMetricValue(StringUtils.isBlank(taskResult.getValue()) ? "0" : taskResult.getValue());
responses.add(ruleMetricValueResponse);
}
dataInfo.setContent(responses);
dataInfo.setTotalCount(total);
return dataInfo;
}
Aggregations