From 7049a3710a5d38ac72303eae01704c1a82bc38bf Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 02 九月 2024 16:01:03 +0800
Subject: [PATCH] 检测 当天预约

---
 jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java                           |    3 ++-
 jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java                                   |   10 ++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java |    5 ++---
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java b/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java
index ef06435..51ef5ed 100644
--- a/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java
+++ b/jh-framework/jh-common/src/main/java/cn/lihu/jh/framework/common/util/date/DateUtils.java
@@ -137,6 +137,16 @@
     }
 
     /**
+     * 鏄惁浠婂ぉ
+     *
+     * @param date 鏃ユ湡
+     * @return 鏄惁
+     */
+    public static boolean isToday(LocalDate date) {
+        return LocalDateTimeUtil.isSameDay(date, LocalDate.now());
+    }
+
+    /**
      * 鏄惁鏄ㄥぉ
      *
      * @param date 鏃ユ湡
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
index e12702c..a54cb16 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -12,8 +12,9 @@
     ErrorCode ECG_INNER_ERROR = new ErrorCode(1_010_000_000, "ECG鍐呴儴閿欒");
 
     ErrorCode APPOINTMENT_NOT_EXISTS = new ErrorCode(1_010_001_000, "棰勭害涓嶅瓨鍦�");
+    ErrorCode APPOINTMENT_NOT_TODAY = new ErrorCode(1_010_001_001, "涓嶆槸褰撳ぉ棰勭害");
     ErrorCode ROOM_NOT_EXISTS = new ErrorCode(1_010_002_000, "璇婂鍜岃瘖鐤楀簥涓嶅瓨鍦�");
-    ErrorCode ROOM_NOT_SIT = new ErrorCode(1_010_002_000, "璇烽噸鏂板氨搴�");
+    ErrorCode ROOM_NOT_SIT = new ErrorCode(1_010_002_001, "璇烽噸鏂板氨搴�");
     ErrorCode ROOM_INVALID_STATUS = new ErrorCode(1_010_002_001, "璇婂鍜岃瘖鐤楀簥鐘舵�佸紓甯�");
     ErrorCode QUEUE_NOT_EXISTS = new ErrorCode(1_010_003_000, "鎺掗槦涓嶅瓨鍦�");
     ErrorCode QUEUE_BED_NOT_EXIST = new ErrorCode(1_010_003_001, "宸ヤ綅闃熷垪涓嶅瓨鍦�");
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
index a563539..4956792 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -38,6 +38,7 @@
 
 import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog;
 import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*;
+import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
 import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE;
 import static java.time.format.DateTimeFormatter.ISO_LOCAL_TIME;
 
@@ -185,10 +186,8 @@
         //TODO 鍏堜粠棰勭害琛ㄥ彇鏁版嵁锛屽悗缁鎺ユ暟鎹钩鍙版煡棰勭害鏁版嵁
         AppointmentDO appointment = appointmentService.getAppointment(confirmReqVO.getId());
 
-/*  TODO  for Testing
         if ( !DateUtils.isToday(appointment.getBookDate()) )
-            return error( new ErrorCode(101, "涓嶆槸浠婂ぉ鐨勯绾︾敤鎴�"));
-*/
+            return error( APPOINTMENT_NOT_TODAY);
 
         try {
             QueueSaveReqVO queueSaveReqVO = new QueueSaveReqVO();

--
Gitblit v1.9.3