Administrator пре 1 година
родитељ
комит
27ac52443b

+ 24 - 25
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatConfigTimeServiceImpl.java

@@ -121,34 +121,33 @@ public class BomanReservatConfigTimeServiceImpl implements IBomanReservatConfigT
                 //去查询对应日期是否还有时段可以预约
                 if (bomanReservatConfigTimes != null && bomanReservatConfigTimes.size() > 0) {
                     for (BomanReservatConfigTime reservatConfigTime : bomanReservatConfigTimes) {
-                        //判断时间段结束时间是否大于当前时间
-                            BomanReservatConfigTime bomanReservatConfigTime = new BomanReservatConfigTime();
-                            BeanUtils.copyBeanProp(bomanReservatConfigTime, reservatConfigTime);
-                        if (DateUtils.sameDayCompare(reservatConfigTime.getReservatConfigTimeEnd(), DateUtils.getNowDate())) {
-                            //查询所有时段和最大人数
-                            //去redis找对应日期,对应时段id的预约数量 reservat_num:2023-10-10_1
-                            //已经预约人数
-                            Object reservatNum = redisCache.getCacheObject(Constants.RESERVAT_NUM + dateMonth + "_" + reservatConfigTime.getReservatConfigTimeId());
-                            bomanReservatConfigTime.setReservatConfigStatus("Y");
-                            if (ObjectUtils.isNotEmpty(reservatNum)) {
-                                //判断人数是否大于可预约人数
-                                //如果 x==y 返回0;x<y 返回负数(-1);x>y 返回正数(1)
-                                if (NumberUtils.compare(bomanReservatConfigTime.getReservatConfigNum(), (long) reservatNum) < 1) {
-                                    bomanReservatConfigTime.setReservatConfigStatus("N");
-                                    index++;
-                                }
-                            }
-                            bomanReservatConfigTimeList.add(bomanReservatConfigTime);
-                            bomanReservatConfigTime.setReceptionPersonnelType("N");
-                            //去查询该时间段接待人员是否已满
-                            Object cacheObject = redisCache.getCacheObject(Constants.RESERVAT_PERSONNEL_NUM + dateMonth + "_" + reservatConfigTime.getReservatConfigTimeId());
-                            if (ObjectUtils.isNotEmpty(cacheObject)) {
-                                bomanReservatConfigTime.setReceptionPersonnelType("Y");
+                        BomanReservatConfigTime bomanReservatConfigTime = new BomanReservatConfigTime();
+                        BeanUtils.copyBeanProp(bomanReservatConfigTime, reservatConfigTime);
+                        //查询所有时段和最大人数
+                        //去redis找对应日期,对应时段id的预约数量 reservat_num:2023-10-10_1
+                        //已经预约人数
+                        Object reservatNum = redisCache.getCacheObject(Constants.RESERVAT_NUM + dateMonth + "_" + reservatConfigTime.getReservatConfigTimeId());
+                        bomanReservatConfigTime.setReservatConfigStatus("Y");
+                        if (ObjectUtils.isNotEmpty(reservatNum)) {
+                            //判断人数是否大于可预约人数
+                            //如果 x==y 返回0;x<y 返回负数(-1);x>y 返回正数(1)
+                            if (NumberUtils.compare(bomanReservatConfigTime.getReservatConfigNum(), (long) reservatNum) < 1) {
+                                bomanReservatConfigTime.setReservatConfigStatus("N");
+                                index++;
                             }
-                        }else {
+                        }
+                        bomanReservatConfigTime.setReceptionPersonnelType("N");
+                        //去查询该时间段接待人员是否已满
+                        Object cacheObject = redisCache.getCacheObject(Constants.RESERVAT_PERSONNEL_NUM + dateMonth + "_" + reservatConfigTime.getReservatConfigTimeId());
+                        if (ObjectUtils.isNotEmpty(cacheObject)) {
+                            bomanReservatConfigTime.setReceptionPersonnelType("Y");
+                        }
+                        //判断时间段结束时间是否大于当前时间
+                        if (dateMonth.equals(DateUtils.getDate()) && DateUtils.sameDayCompare(DateUtils.getNowDate(),reservatConfigTime.getReservatConfigTimeEnd())) {
                             bomanReservatConfigTime.setReservatConfigStatus("N");
-                            bomanReservatConfigTimeList.add(bomanReservatConfigTime);
+
                         }
+                        bomanReservatConfigTimeList.add(bomanReservatConfigTime);
                     }
                     if (index < bomanReservatConfigTimes.size()) {
                         jsonObject.put("title", "可预约");