wangmiaomiao 11 miesięcy temu
rodzic
commit
4f75d0355e

+ 14 - 7
slibra-admin/src/main/java/com/slibra/web/controller/business/HandleDataController.java

@@ -482,8 +482,8 @@ public class HandleDataController extends BaseController
             for (TXinyiLaboratory tXinyiLaboratory : tXinyiLaboratories) {
                 String handleTime = handleDate(tXinyiLaboratory.getTestTime());
                 tXinyiLaboratory.setTestTime(handleTime);//到分为止
-                tXinyiLaboratory.setTestDate(handleTime.substring(0, 12));
-                tXinyiLaboratory.setTestHour(handleTime.substring(0, 9));
+                tXinyiLaboratory.setTestDate(handleTime.substring(0, 10));
+                tXinyiLaboratory.setTestHour(handleTime.substring(0, 13));
                 //更新
                 this.xinyiLaboratoryMapper.updateTXinyiLaboratory(tXinyiLaboratory);
             }
@@ -514,13 +514,18 @@ public class HandleDataController extends BaseController
 //        }
 
 
-        String str = "2022/7/11 19:00";
+        String str = "2022/07/11 19:00";
 //        String str = "2022/7/1";
 //        String str = "0:0:1";
-        String newStr = handleDate(str);
-        System.out.println(newStr);
-        System.out.println(str.substring(0, 12));
-        System.out.println(str.substring(0, 9));
+//        String newStr = handleDate(str);
+//        System.out.println(newStr);
+//        System.out.println(str.substring(0, 12));
+//        System.out.println(str.substring(0, 9));
+
+//        System.out.println(handleDate("2024-3-9"));
+        System.out.println(handleDate("2023/12/26 02:00"));
+        System.out.println(handleDate("2023/12/26 02:00").substring(0, 10));
+        System.out.println(handleDate("2023/12/26 02:00").substring(0, 13));
 
     }
 
@@ -537,6 +542,8 @@ public class HandleDataController extends BaseController
                 addBeforeZero(sb, str, "/");
             }else if(str.contains(":")){//时分秒
                 addBeforeZero(sb, str, ":");
+            }else if(str.contains("-")){//只有年月日
+                addBeforeZero(sb, str, "-");
             }else {
                 sb.append(str);
             }