Просмотр исходного кода

Merge branch 'master' of https://e.coding.net/chuanghaikeji/smartCampus/backend_code

夏文涛 2 лет назад
Родитель
Сommit
ed4b97a438

+ 3 - 3
src/main/java/com/template/common/utils/TimeExchange.java

@@ -335,17 +335,17 @@ public class TimeExchange {
 
     public static String getMonth(Date dateNow) {
         SimpleDateFormat sp = new SimpleDateFormat("MM");
-        return sp.format(new Date());
+        return sp.format(dateNow);
     }
 
     public static String getDay(Date dateNow) {
         SimpleDateFormat sp = new SimpleDateFormat("dd");
-        return sp.format(new Date());
+        return sp.format(dateNow);
     }
 
     public static String getTime(Date dateNow) {
         SimpleDateFormat sp = new SimpleDateFormat("HH:mm:ss");
-        return sp.format(new Date());
+        return sp.format(dateNow);
     }
 
     /**

+ 8 - 4
src/main/java/com/template/controller/SmartVisitorController.java

@@ -202,7 +202,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
         }
 
         String startTime = par.getVisitorTime();
-        String endTime = TimeExchange.getEndOfDayStr(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
+        String endTime = TimeExchange.AddTimeDesH(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"),4);
 
         //要进行家长数据重复判断
         //那是不是第二次预约的时间不能在那个可访问的时间段内
@@ -346,7 +346,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
         }
 
         String startTime = oar.getVisitorTime();
-        String endTime = TimeExchange.getEndOfDayStr(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
+        String endTime = TimeExchange.AddTimeDesH(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"),4);
 
         //要进行访客数据重复判断
         //那是不是第二次预约的时间不能在那个可访问的时间段内
@@ -813,7 +813,11 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
                     //发送短信给其他访客用户
                     if (!ObjectUtils.isEmpty(sv.getVisitorCode())) {
-                        String message = SendSms.sendVisitorSms("+86" + sv.getUserPhone(), TimeExchange.getYear(sv.getVisitorTime()), TimeExchange.getMonth(sv.getVisitorTime()), TimeExchange.getDay(sv.getVisitorTime()), TimeExchange.getTime(sv.getVisitorTime()), TimeExchange.getTime(sv.getVisitorDeadline()), sv.getVisitorCode());
+                        Date visitorTime = sv.getVisitorTime();
+                        Date visitorDeadline = sv.getVisitorDeadline();
+                        String start = TimeExchange.getTime(visitorTime);
+                        String end = TimeExchange.getTime(visitorDeadline);
+                        String message = SendSms.sendVisitorSms("+86" + sv.getUserPhone(), TimeExchange.getYear(sv.getVisitorTime()), TimeExchange.getMonth(sv.getVisitorTime()), TimeExchange.getDay(sv.getVisitorTime()), start, end, sv.getVisitorCode());
                         if (!message.contains("success")) {
                             throw new Exception("发送失败");
                         }
@@ -859,7 +863,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
         LocalDateTime date = LocalDateTime.now();
         String startTime = date.format(dateTimeFormatter1);
 
-        String endTime = TimeExchange.getEndOfDayStr(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
+        String endTime = TimeExchange.AddTimeDesH(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"),4);
 
         //要进行家长数据重复判断
         //那是不是第二次预约的时间不能在那个可访问的时间段内