penghao před 3 měsíci
rodič
revize
f3fb372ad1

+ 47 - 33
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -5636,20 +5636,18 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         Integer totalCount = 0;
         double storeScore;
         Object ratingObj =  commonRatingService.getRatingCount(storeInfo.getId(), 1);
-        if (ratingObj != null && ratingObj instanceof Map) {
+        if (ratingObj != null) {
             Map<String, Object> ratingMap = (Map<String, Object>) ratingObj;
-
-            // 校验外层状态(success、code)
-            Boolean isSuccess = (Boolean) ratingMap.get("success");
-            Integer code = (Integer) ratingMap.get("code");
-            if (isSuccess != null && isSuccess && code != null && code == 200) {
-                // 提取核心数据层data
-                Map<String, Object> dataMap = (Map<String, Object>) ratingMap.get("data");
-                if (dataMap != null) {
-                    // 解析各字段(非空校验+类型转换)
-                    storeScore = dataMap.get("storeScore") != null ? Double.parseDouble(dataMap.get("storeScore").toString()) : 0.0;
-                    totalCount = dataMap.get("totalCount") != null ? Integer.parseInt(dataMap.get("totalCount").toString()) : 0;
+            Object totalCountObj = ratingMap.get("totalCount");
+            if (totalCountObj != null) {
+                // 安全转换为整数
+                try {
+                    totalCount = Integer.parseInt(totalCountObj.toString().trim());
+                } catch (NumberFormatException e) {
+                    totalCount = 0; // 转换失败时默认值
                 }
+            } else {
+                totalCount = 0;
             }
         }
 
@@ -5863,19 +5861,27 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                             );
 
                             boolean isInBusiness;
-                            // 处理跨天营业
-                            if (start.isBefore(end) || start.equals(end)) {
-                                // 同一天营业:包含边界值
-                                isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
-                                        && (currentTime.isBefore(end) || currentTime.equals(end));
+                            // 判断是否是全天营业(00:00到00:00)
+                            LocalTime midnight = LocalTime.of(0, 0);
+                            if (start.equals(midnight) && end.equals(midnight)) {
+                                // 全天营业
+                                isInBusiness = true;
+                                log.info("特殊日期营业时间判断 - 全天营业(00:00-00:00),当前时间: {},是否在营业时间内: true", currentTime);
                             } else {
-                                // 跨天营业:包含边界值
-                                isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
-                                        || (currentTime.isBefore(end) || currentTime.equals(end));
+                                // 处理跨天营业
+                                if (start.isBefore(end) || start.equals(end)) {
+                                    // 同一天营业:包含边界值
+                                    isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
+                                            && (currentTime.isBefore(end) || currentTime.equals(end));
+                                } else {
+                                    // 跨天营业:包含边界值
+                                    isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
+                                            || (currentTime.isBefore(end) || currentTime.equals(end));
+                                }
+                                log.info("特殊日期营业时间判断 - 开始时间: {}, 结束时间: {}, 当前时间: {}, 是否在营业时间内: {}",
+                                        start, end, currentTime, isInBusiness);
                             }
 
-                            log.info("特殊日期营业时间判断 - 开始时间: {}, 结束时间: {}, 当前时间: {}, 是否在营业时间内: {}",
-                                    start, end, currentTime, isInBusiness);
                             result.setYyFlag(isInBusiness ? 1 : 0);
                             isCurrentSpecialBusinessTime = isInBusiness;
                         } else {
@@ -5942,19 +5948,27 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                                     );
 
                                     boolean isInBusiness;
-                                    // 处理跨天营业
-                                    if (start.isBefore(end) || start.equals(end)) {
-                                        // 同一天营业:包含边界值
-                                        isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
-                                                && (currentTime.isBefore(end) || currentTime.equals(end));
+                                    // 判断是否是全天营业(00:00到00:00)
+                                    LocalTime midnight = LocalTime.of(0, 0);
+                                    if (start.equals(midnight) && end.equals(midnight)) {
+                                        // 全天营业
+                                        isInBusiness = true;
+                                        log.info("正常营业时间判断 - 全天营业(00:00-00:00),当前时间: {},是否在营业时间内: true", currentTime);
                                     } else {
-                                        // 跨天营业:包含边界值
-                                        isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
-                                                || (currentTime.isBefore(end) || currentTime.equals(end));
+                                        // 处理跨天营业
+                                        if (start.isBefore(end) || start.equals(end)) {
+                                            // 同一天营业:包含边界值
+                                            isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
+                                                    && (currentTime.isBefore(end) || currentTime.equals(end));
+                                        } else {
+                                            // 跨天营业:包含边界值
+                                            isInBusiness = (currentTime.isAfter(start) || currentTime.equals(start))
+                                                    || (currentTime.isBefore(end) || currentTime.equals(end));
+                                        }
+                                        log.info("正常营业时间判断 - 开始时间: {}, 结束时间: {}, 当前时间: {}, 是否在营业时间内: {}",
+                                                start, end, currentTime, isInBusiness);
                                     }
 
-                                    log.info("正常营业时间判断 - 开始时间: {}, 结束时间: {}, 当前时间: {}, 是否在营业时间内: {}",
-                                            start, end, currentTime, isInBusiness);
                                     result.setYyFlag(isInBusiness ? 1 : 0);
                                 } else {
                                     log.warn("正常营业时间格式错误 - 开始时间: {}, 结束时间: {}",
@@ -6402,7 +6416,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         storeInfo.setId(storeImg.getStoreId());
         storeInfo.setBusinessLicenseStatus(2); // 2-待审核
         storeInfo.setUpdateBusinessLicenseTime(new Date());
-
+        
         storeInfoMapper.updateById(storeInfo);
         
         // 异步调用证照审核AI接口并处理审核结果