|
@@ -7,9 +7,8 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Author Joburgess
|
|
@@ -27,6 +26,24 @@ public class IndexBaseDto {
|
|
|
|
|
|
private List<IndexBaseMonthData> indexMonthDataDetail;
|
|
|
|
|
|
+ private Map<Integer,BigDecimal> organIndexMonthData;
|
|
|
+
|
|
|
+ public Map<Integer,BigDecimal> getOrganIndexMonthData() {
|
|
|
+ return organIndexMonthData;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setOrganIndexMonthData(List<IndexBaseMonthData> organIndexMonthData) {
|
|
|
+ Map<Integer,BigDecimal> organData = new HashMap<>(20);
|
|
|
+ if (!CollectionUtils.isEmpty(organIndexMonthData)){
|
|
|
+ List<IndexBaseMonthData> collect = organIndexMonthData.stream().filter(e -> e.getOrganId() != 0).collect(Collectors.toList());
|
|
|
+ if(!CollectionUtils.isEmpty(collect)){
|
|
|
+ Map<Integer, List<IndexBaseMonthData>> listMap = collect.stream().collect(Collectors.groupingBy(IndexBaseMonthData::getOrganId));
|
|
|
+ listMap.keySet().stream().forEach(organId->organData.put(organId,listMap.get(organId).stream().map(e->e.getPercent()).reduce(BigDecimal.ZERO,BigDecimal::add)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.organIndexMonthData = organData;
|
|
|
+ }
|
|
|
+
|
|
|
public List<IndexBaseMonthData> getIndexMonthDataDetail() {
|
|
|
return indexMonthDataDetail;
|
|
|
}
|
|
@@ -103,7 +120,8 @@ public class IndexBaseDto {
|
|
|
this.percent = total;
|
|
|
}
|
|
|
}else{
|
|
|
- this.percent = indexMonthData.stream().filter(i->currentMonth.compareTo(i.getMonth())>=0).max(Comparator.comparing(IndexBaseMonthData::getMonth)).get().getPercent();
|
|
|
+ this.percent = indexMonthData.stream().filter(i->currentMonth.compareTo(i.getMonth())>=0).
|
|
|
+ max(Comparator.comparing(IndexBaseMonthData::getMonth)).get().getPercent();
|
|
|
}
|
|
|
}
|
|
|
}
|