Administrator 1 rok temu
rodzic
commit
7e87524357

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/reservat/BomanReservatController.java

@@ -1,5 +1,7 @@
 package com.ruoyi.web.controller.reservat;
 
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -20,6 +22,7 @@ import com.ruoyi.system.domain.BomanReservat;
 import com.ruoyi.system.service.IBomanReservatService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
+import sun.misc.BASE64Encoder;
 
 /**
  * 陵园预约Controller

+ 2 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatConfigTimeServiceImpl.java

@@ -1,9 +1,6 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import com.alibaba.fastjson2.JSONArray;
@@ -158,7 +155,7 @@ public class BomanReservatConfigTimeServiceImpl implements IBomanReservatConfigT
                         jsonObject.put("title","可预约");
                     }
                     //1: AM 2: PM
-                    Map<String, List<BomanReservatConfigTime>> collect = bomanReservatConfigTimeList.stream().collect(Collectors.groupingBy(BomanReservatConfigTime::getReservatConfigType));
+                    Map<String, List<BomanReservatConfigTime>> collect = bomanReservatConfigTimeList.stream().sorted(Comparator.comparing(BomanReservatConfigTime::getReservatConfigTimeBegin)).collect(Collectors.groupingBy(BomanReservatConfigTime::getReservatConfigType));
 
                     for (String key : collect.keySet()) {
                         if ("1".equals(key)){

+ 8 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.system.service.impl;
 
 import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -21,11 +22,13 @@ import com.ruoyi.system.mapper.ReceptionPersonnelMapper;
 import com.ruoyi.system.mapper.SysUserMapper;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.logging.log4j.util.Base64Util;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.BomanReservatMapper;
 import com.ruoyi.system.domain.BomanReservat;
 import com.ruoyi.system.service.IBomanReservatService;
+import sun.misc.BASE64Encoder;
 
 import static com.ruoyi.common.constant.Constants.RESERVAT_PERSONNEL_NUM;
 
@@ -127,10 +130,12 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
                 int num = receptionPersonnelMapper.selectReceptionPersonnelCount();
                 if (bomanReservats != null){
                     if (bomanReservats.size() >= num ){
+                        return 0;
+                    }
+                    if (bomanReservats.size() + 1 == num){
                         //插入redis该时段接待人员已满
                         String keyPersonnel = Constants.RESERVAT_PERSONNEL_NUM + bomanReservat.getVisitDate() + "_" + reservatConfigTimeId;
                         redisCache.setCacheObject(keyPersonnel,"Y",24, TimeUnit.HOURS);
-                        return 0;
                     }
                 }
             }
@@ -237,15 +242,13 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
 
         //审核通过给团队发送通过短信
         if ("3".equals(bomanReservat.getVisitType())) {
-            String visitPhone = bomanReservat.getVisitPhone();
+            String visitPhone = reservat.getVisitPhone();
             JSONObject jsonObject = new JSONObject();
-
-            jsonObject.put("code", bomanReservat.getReservatId());
+            jsonObject.put("code", new BASE64Encoder().encodeBuffer(String.valueOf(reservat.getReservatId()).getBytes(StandardCharsets.UTF_8)));
             //陵园预约通过通知 = SMS_464336030
             SendSmsUtils.sendSms(visitPhone, "SMS_464336030", jsonObject.toString());
             System.out.println("给(" + visitPhone + ")团队发送了审核通过的短信");
         }
-
         return i > 0 ? AjaxResult.success() : AjaxResult.error();
     }