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

修改其他访客预约发送短信信息错误问题

liu 2 лет назад
Родитель
Сommit
47e18e6458

+ 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);
     }
 
     /**

+ 5 - 1
src/main/java/com/template/controller/SmartVisitorController.java

@@ -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("发送失败");
                         }