List<String> targetParamters = this.getParamIdsList();
List<Double> valueNow = new ArrayList<>();
List<Double> valueLastMonth = new ArrayList<>();
List<TargetLog> logNow = targetLogMapper.getTargetValueById(targetParamters,nowAndLastMonth.get(0),unitId);
List<TargetLog> logLastMonth = targetLogMapper.getTargetValueById(targetParamters,nowAndLastMonth.get(1),unitId);
Map<String,Double> logNowHashMap = new HashMap<>();
Map<String,Double> logLastMonthHashMap = new HashMap<>();
logNow.forEach(item -> {
logNowHashMap.put(item.getItemId(),item.getValue());
});
logLastMonth.forEach(item -> {
logLastMonthHashMap.put(item.getItemId(),item.getValue());
});
for (int i =0;i<targetParamters.size();i++) {
if (logNowHashMap.containsKey(targetParamters.get(i))) {
valueNow.add(logNowHashMap.get(targetParamters.get(i)));
} else {
valueNow.add(0.0);
}
if (logLastMonthHashMap.containsKey(targetParamters.get(i))) {
valueLastMonth.add(logLastMonthHashMap.get(targetParamters.get(i)));
} else {
valueLastMonth.add(0.0);
}
}