whyclxw
2025-05-29 b341245d84fb1e4743e8d34bc9a4f742b0fb9a5e
src/main/java/com/whyc/util/ActionUtil.java
@@ -17,9 +17,8 @@
import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.time.LocalDate;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.whyc.pojo.db_user.User;
@@ -418,6 +417,32 @@
            return 0;
        }
        }
   //计算当前月的上一个季度年_月份集合
   public static List<String> getLastQuarterYearMonths() {
      LocalDate currentDate = LocalDate.now();
      int currentYear = currentDate.getYear();
      int currentMonth = currentDate.getMonthValue();
      int quarter = (currentMonth - 1) / 3 + 1; // 计算当前季度
      int lastQuarter = quarter - 1; // 上一季度
      if (lastQuarter == 0) {
         lastQuarter = 4; // 如果当前是第一季度,则上一季度为第四季度
      }
      List<String> yearMonths = new ArrayList<>();
      for (int i = 1; i <= 3; i++) {
         int month = (lastQuarter - 1) * 3 + i;
         int year = currentYear;
         // 如果上一季度是第四季度,则年份需要减一年
         if (lastQuarter == 4) {
            year = currentYear - 1;
         }
         yearMonths.add(year + "_" + (month < 10 ? "0" + month : month)); // 保证月份为两位格式
      }
      return yearMonths;
   }
    /**
     * @Description: 根据图片地址转换为base64编码字符串
     * @Author: