|
@@ -95,12 +95,27 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
}
|
|
|
|
|
|
Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
|
|
|
+
|
|
|
+ for (IndexDataType dataType : IndexDataType.values()) {
|
|
|
+ if(typeDateMap.containsKey(dataType)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ IndexBaseMonthData indexBaseMonthData = new IndexBaseMonthData();
|
|
|
+ indexBaseMonthData.setMonth(Date.from(endDate.atStartOfDay(DateUtil.zoneId).toInstant()));
|
|
|
+ indexBaseMonthData.setTotalNum(BigDecimal.ZERO);
|
|
|
+ indexBaseMonthData.setActivateNum(BigDecimal.ZERO);
|
|
|
+ indexBaseMonthData.setPercent(BigDecimal.ZERO);
|
|
|
+ indexBaseMonthData.setDataType(dataType);
|
|
|
+ typeDateMap.put(dataType, new ArrayList<>(Arrays.asList(indexBaseMonthData)));
|
|
|
+ }
|
|
|
+
|
|
|
for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
|
|
|
Set<String> hasMonths = typeDateMapEntry.getValue().stream().map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
|
|
|
LocalDate currentMonthDate = startDate;
|
|
|
while (currentMonthDate.compareTo(endDate)<=0){
|
|
|
if(hasMonths.contains(currentMonthDate.toString())){
|
|
|
- currentMonthDate = currentMonthDate.plusMonths(1);
|
|
|
+ currentMonthDate = currentMonthDate.plusDays(1);
|
|
|
continue;
|
|
|
}
|
|
|
IndexBaseMonthData indexBaseMonthData = new IndexBaseMonthData();
|