From 30e858fa504b268b9b436afca0a1259cf6e8c488 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 19 八月 2025 11:01:40 +0800
Subject: [PATCH] 优化

---
 server/src/main/java/com/doumee/core/utils/DateUtil.java |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/com/doumee/core/utils/DateUtil.java b/server/src/main/java/com/doumee/core/utils/DateUtil.java
index 17439fd..dcf6ec1 100644
--- a/server/src/main/java/com/doumee/core/utils/DateUtil.java
+++ b/server/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -577,15 +577,16 @@
      * @return String
      * @throws Exception
      */
-    public static String getNowYear() throws Exception {
+    public static String getNowYear() {
         String nowYear = "";
         try {
             String strTemp = getNowLongTime();
             nowYear = strTemp.substring(0, 4);
             return nowYear;
         } catch (Exception e) {
-            throw e;
+          e.printStackTrace();
         }
+        return nowYear;
     }
 
     /**
@@ -594,15 +595,16 @@
      * @return String
      * @throws Exception
      */
-    public static Integer getNowMonth() throws Exception {
+    public static Integer getNowMonth()   {
         String nowMonth = "";
         try {
             String strTemp = getNowLongTime();
             nowMonth = strTemp.substring(4, 6);
             return Integer.valueOf(nowMonth);
         } catch (Exception e) {
-            throw e;
+            e.printStackTrace();
         }
+        return null;
     }
 
     /**
@@ -611,15 +613,16 @@
      * @return String
      * @throws Exception
      */
-    public static String getNowDay() throws Exception {
+    public static String getNowDay()  {
         String nowDay = "";
         try {
             String strTemp = getNowLongTime();
             nowDay = strTemp.substring(6, 8);
             return nowDay;
         } catch (Exception e) {
-            throw e;
+            e.printStackTrace();
         }
+        return  nowDay;
     }
 
     /**
@@ -3539,6 +3542,23 @@
         cal.set(Calendar.DATE, 1);
         return getDayStartTime(cal.getTime());
     }
+    public static Date getBeginDayOfSeason(int addYears) {
+        Integer nowMonth =  getNowMonth();
+        int month = Calendar.JANUARY;
+        Integer quarter  = (nowMonth - 1) / 3 + 1;//瀛e害
+        if(quarter == 2){
+            month = Calendar.APRIL;
+        }else if(quarter == 3){
+            month = Calendar.JUNE;
+        }else if(quarter == 4){
+            month = Calendar.OCTOBER;
+        }
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.YEAR, getNowYearNum()+addYears);
+        cal.set(Calendar.MONTH, month);
+        cal.set(Calendar.DATE, 1);
+        return getDayStartTime(cal.getTime());
+    }
 
     // 鑾峰彇鏈勾鐨勭粨鏉熸椂闂�
     public static Date getEndDayOfYear(int addYears){

--
Gitblit v1.9.3