fix:统计近线上会议

pg_adapter
wangxy 6 months ago
parent e47df2984e
commit a78f187833

@ -10,9 +10,7 @@ import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField; import java.time.temporal.ChronoField;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
/** /**
@ -38,6 +36,7 @@ public class ObtainLastSixMonthsUtil {
String dateMonth = DateUtil.format(dateTime, "yyyy-MM"); String dateMonth = DateUtil.format(dateTime, "yyyy-MM");
previousMonths.add(dateMonth); previousMonths.add(dateMonth);
} }
Collections.sort(previousMonths);
return previousMonths; return previousMonths;
} }
@ -46,7 +45,7 @@ public class ObtainLastSixMonthsUtil {
* *
* @return List<String> * @return List<String>
*/ */
public static List<String> getRecentlySixMonth() { public static List<String> getRecentlySixMonth2() {
List<String> previousMonths = new ArrayList<>(); List<String> previousMonths = new ArrayList<>();
String currentMonth = DateUtil.format(LocalDateTime.now(), "yyyy-MM"); String currentMonth = DateUtil.format(LocalDateTime.now(), "yyyy-MM");
previousMonths.add(currentMonth); previousMonths.add(currentMonth);
@ -55,6 +54,7 @@ public class ObtainLastSixMonthsUtil {
String dateMonth = DateUtil.format(dateTime, "yyyy-MM"); String dateMonth = DateUtil.format(dateTime, "yyyy-MM");
previousMonths.add(dateMonth); previousMonths.add(dateMonth);
} }
Collections.sort(previousMonths);
return previousMonths; return previousMonths;
} }
@ -106,11 +106,38 @@ public class ObtainLastSixMonthsUtil {
return DateUtil.between(nowDate, endDate, DateUnit.HOUR); return DateUtil.between(nowDate, endDate, DateUnit.HOUR);
} }
/**
* 12
* @return
*/
public static List<String> getRecentlySixMonth() {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
List<String> list = new ArrayList<>();
for (int i = 1; i < 13; i++) {
String month = i + "";
if (i < 10) {
month = "0" + i;
}
list.add(year + "-" + month);
}
return list;
}
public static void main(String[] args) { public static void main(String[] args) {
// System.out.println(getRecentlySixMonth());
List<String> recentlySixMonth = getRecentlySixMonth(); List<String> recentlySixMonth = getRecentlySixMonth();
recentlySixMonth.forEach(s -> System.out.println(getLastDayOfMonth(s))); recentlySixMonth.forEach(s -> System.out.println(getLastDayOfMonth(s)));
/* List<String> yearMonth = getYearMonth();
for (int i = 0; i < yearMonth.size(); i++) {
System.out.println(yearMonth.get(i));
}*/
} }
} }

Loading…
Cancel
Save