|
@@ -173,6 +173,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
*/
|
|
*/
|
|
|
private final LicenseAuditAsyncService licenseAuditAsyncService;
|
|
private final LicenseAuditAsyncService licenseAuditAsyncService;
|
|
|
|
|
|
|
|
|
|
+ private final CommonRatingService commonRatingService;
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private StoreIncomeDetailsRecordService storeIncomeDetailsRecordService;
|
|
private StoreIncomeDetailsRecordService storeIncomeDetailsRecordService;
|
|
|
|
|
|
|
@@ -5629,9 +5631,29 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> commitCountAndScore = storeCommentService.getCommitCountAndScore(null, 5, Integer.parseInt(storeId), null, null);
|
|
Map<String, Object> commitCountAndScore = storeCommentService.getCommitCountAndScore(null, 5, Integer.parseInt(storeId), null, null);
|
|
|
- result.setScore(Double.parseDouble(commitCountAndScore.get("score").toString()));
|
|
|
|
|
- result.setCommitCount(commitCountAndScore.get("commitCount").toString());
|
|
|
|
|
|
|
+// result.setScore(Double.parseDouble(commitCountAndScore.get("score").toString()));
|
|
|
|
|
+// result.setCommitCount(commitCountAndScore.get("commitCount").toString());
|
|
|
|
|
+ Integer totalCount = 0;
|
|
|
|
|
+ double storeScore;
|
|
|
|
|
+ Object ratingObj = commonRatingService.getRatingCount(storeInfo.getId(), 1);
|
|
|
|
|
+ if (ratingObj != null && ratingObj instanceof Map) {
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ result.setCommitCount(totalCount.toString());
|
|
|
|
|
|
|
|
// 在该店铺的打卡次数
|
|
// 在该店铺的打卡次数
|
|
|
result.setClockInStoreNum(clockStoreList.size());
|
|
result.setClockInStoreNum(clockStoreList.size());
|
|
@@ -5705,35 +5727,332 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// result.setTotalDynamicsNum(storeDynamicslist.size());
|
|
// result.setTotalDynamicsNum(storeDynamicslist.size());
|
|
|
|
|
|
|
|
//营业时间
|
|
//营业时间
|
|
|
- List<StoreBusinessInfo> storeBusinessInfos = storeBusinessInfoMapper.selectList(new LambdaQueryWrapper<StoreBusinessInfo>().eq(StoreBusinessInfo::getStoreId, storeId).eq(StoreBusinessInfo::getDeleteFlag, 0));
|
|
|
|
|
|
|
+ List<StoreBusinessInfo> storeBusinessInfos = storeBusinessInfoMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<StoreBusinessInfo>()
|
|
|
|
|
+ .eq(StoreBusinessInfo::getStoreId, storeId)
|
|
|
|
|
+ .eq(StoreBusinessInfo::getDeleteFlag, 0)
|
|
|
|
|
+ );
|
|
|
|
|
+ // 回显所有营业时间信息(特殊营业时间和正常营业时间)
|
|
|
if (ObjectUtils.isNotEmpty(storeBusinessInfos)) {
|
|
if (ObjectUtils.isNotEmpty(storeBusinessInfos)) {
|
|
|
result.setStoreBusinessInfo(storeBusinessInfos.get(0));
|
|
result.setStoreBusinessInfo(storeBusinessInfos.get(0));
|
|
|
result.setStoreBusinessInfos(storeBusinessInfos);
|
|
result.setStoreBusinessInfos(storeBusinessInfos);
|
|
|
- StoreBusinessInfo storeBusinessInfo = result.getStoreBusinessInfos().stream().filter(item -> item.getBusinessType() == 1).findFirst().orElse(null);
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(storeBusinessInfo)) {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if(storeInfo.getBusinessStatus() == 0){
|
|
|
|
|
+ // 优先判断当前时间是否是特殊日期
|
|
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
|
|
+ LocalTime currentTime = LocalTime.now();
|
|
|
|
|
|
|
|
- Calendar calendar = Calendar.getInstance(); // 获取Calendar实例
|
|
|
|
|
- int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // 获取星期几,注意Calendar中的DAY_OF_WEEK是从1(代表星期天)开始的
|
|
|
|
|
- String[] days = {"7", "1", "2", "3", "4", "5", "6"};
|
|
|
|
|
- String day = days[dayOfWeek - 1];
|
|
|
|
|
- if (storeBusinessInfo.getBusinessDate().contains(day)) {
|
|
|
|
|
- if (StringUtils.isNotEmpty(storeBusinessInfo.getStartTime()) && StringUtils.isNotEmpty(storeBusinessInfo.getEndTime())) {
|
|
|
|
|
- LocalTime now = LocalTime.now();
|
|
|
|
|
- List<String> startList = Arrays.asList(storeBusinessInfo.getStartTime().split(":"));
|
|
|
|
|
- List<String> endList = Arrays.asList(storeBusinessInfo.getEndTime().split(":"));
|
|
|
|
|
- LocalTime start = LocalTime.of(Integer.parseInt(startList.get(0)), Integer.parseInt(startList.get(1)));
|
|
|
|
|
- LocalTime end = LocalTime.of(Integer.parseInt(endList.get(0)), Integer.parseInt(startList.get(1)));
|
|
|
|
|
- if (now.isAfter(start) && now.isBefore(end)) {
|
|
|
|
|
- result.setYyFlag(1);
|
|
|
|
|
|
|
+ log.info("开始判断营业状态 - 当前日期: {}, 当前时间: {}, 店铺ID: {}", currentDate, currentTime, storeId);
|
|
|
|
|
+
|
|
|
|
|
+ // 标记当前是否是特殊营业时间
|
|
|
|
|
+ boolean isCurrentSpecialBusinessTime = false;
|
|
|
|
|
+
|
|
|
|
|
+ // 查找特殊营业时间(businessType == 2)
|
|
|
|
|
+ StoreBusinessInfo specialBusinessInfo = storeBusinessInfos.stream()
|
|
|
|
|
+ .filter(item -> item.getBusinessType() != null && item.getBusinessType() == 2)
|
|
|
|
|
+ .filter(item -> {
|
|
|
|
|
+ // 判断当前日期是否匹配特殊日期
|
|
|
|
|
+ if (StringUtils.isEmpty(item.getBusinessDate())) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ String businessDate = item.getBusinessDate().trim();
|
|
|
|
|
+
|
|
|
|
|
+ // 移除开头的数字和空格(如 "2 元旦、春节、儿童节" -> "元旦、春节、儿童节")
|
|
|
|
|
+ String holidayNames = businessDate.replaceAll("^\\d+\\s*", "").trim();
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否包含节假日名称(支持所有特殊日期:元旦、春节、情人节、元宵节、清明节、劳动节、儿童节、端午节、七夕、中秋节、国庆节、冬至、平安夜、圣诞节)
|
|
|
|
|
+ boolean isHolidayName = holidayNames.contains("元旦") || holidayNames.contains("春节") ||
|
|
|
|
|
+ holidayNames.contains("情人节") || holidayNames.contains("元宵") ||
|
|
|
|
|
+ holidayNames.contains("七夕") || holidayNames.contains("冬至") ||
|
|
|
|
|
+ holidayNames.contains("平安夜") || holidayNames.contains("圣诞") ||
|
|
|
|
|
+ holidayNames.contains("清明") || holidayNames.contains("劳动") ||
|
|
|
|
|
+ holidayNames.contains("端午") || holidayNames.contains("中秋") ||
|
|
|
|
|
+ holidayNames.contains("国庆") || holidayNames.contains("儿童");
|
|
|
|
|
+
|
|
|
|
|
+ if (isHolidayName) {
|
|
|
|
|
+
|
|
|
|
|
+ List<LocalDate[]> holidayRanges = getHolidayDateRanges(currentDate.getYear(), holidayNames);
|
|
|
|
|
+ for (LocalDate[] range : holidayRanges) {
|
|
|
|
|
+ if (range != null && range.length == 2) {
|
|
|
|
|
+ LocalDate startDate = range[0];
|
|
|
|
|
+ LocalDate endDate = range[1];
|
|
|
|
|
+ if (!currentDate.isBefore(startDate) && !currentDate.isAfter(endDate)) {
|
|
|
|
|
+ log.info("特殊日期判断(节假日) - 节假日: {}, 日期范围: {}至{}, 当前日期: {}, 是否在范围内: true",
|
|
|
|
|
+ holidayNames, startDate, endDate, currentDate);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("特殊日期判断(节假日) - 节假日: {}, 当前日期: {}, 是否在范围内: false",
|
|
|
|
|
+ holidayNames, currentDate);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果不是节假日名称,尝试解析日期格式(兼容旧格式)
|
|
|
|
|
+ String[] dateFormats = {"yyyy-MM-dd", "yyyy/MM/dd", "yyyyMMdd"};
|
|
|
|
|
+
|
|
|
|
|
+ // 先检查是否包含"至"(日期范围)
|
|
|
|
|
+ if (businessDate.contains("至")) {
|
|
|
|
|
+ String[] dateRange = businessDate.split("至");
|
|
|
|
|
+ if (dateRange.length >= 2) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ LocalDate startDate = null;
|
|
|
|
|
+ LocalDate endDate = null;
|
|
|
|
|
+ for (String format : dateFormats) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
|
|
|
|
+ startDate = LocalDate.parse(dateRange[0].trim(), formatter);
|
|
|
|
|
+ endDate = LocalDate.parse(dateRange[1].trim(), formatter);
|
|
|
|
|
+ break;
|
|
|
|
|
+ } catch (Exception ignored) {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (startDate != null && endDate != null) {
|
|
|
|
|
+ boolean inRange = !currentDate.isBefore(startDate) && !currentDate.isAfter(endDate);
|
|
|
|
|
+ log.info("特殊日期范围判断 - 日期范围: {}至{}, 当前日期: {}, 是否在范围内: {}",
|
|
|
|
|
+ startDate, endDate, currentDate, inRange);
|
|
|
|
|
+ return inRange;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析特殊日期范围失败: {}", businessDate, e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 尝试解析单个日期格式
|
|
|
|
|
+ for (String format : dateFormats) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
|
|
|
|
+ LocalDate specialDate = LocalDate.parse(businessDate, formatter);
|
|
|
|
|
+ boolean matches = specialDate.equals(currentDate);
|
|
|
|
|
+ log.info("特殊日期判断 - 特殊日期: {}, 当前日期: {}, 是否匹配: {}",
|
|
|
|
|
+ specialDate, currentDate, matches);
|
|
|
|
|
+ if (matches) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception ignored) {
|
|
|
|
|
+ // 继续尝试下一个格式
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析特殊日期失败: {}", item.getBusinessDate(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ })
|
|
|
|
|
+ .findFirst()
|
|
|
|
|
+ .orElse(null);
|
|
|
|
|
+
|
|
|
|
|
+ // 如果找到匹配的特殊日期,判断是否在营业时间内
|
|
|
|
|
+ if (specialBusinessInfo != null) {
|
|
|
|
|
+ log.info("找到匹配的特殊日期营业时间 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ specialBusinessInfo.getStartTime(), specialBusinessInfo.getEndTime());
|
|
|
|
|
+ if (StringUtils.isNotEmpty(specialBusinessInfo.getStartTime())
|
|
|
|
|
+ && StringUtils.isNotEmpty(specialBusinessInfo.getEndTime())) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String[] startArr = specialBusinessInfo.getStartTime().split(":");
|
|
|
|
|
+ String[] endArr = specialBusinessInfo.getEndTime().split(":");
|
|
|
|
|
+ if (startArr.length >= 2 && endArr.length >= 2) {
|
|
|
|
|
+ LocalTime start = LocalTime.of(
|
|
|
|
|
+ Integer.parseInt(startArr[0]),
|
|
|
|
|
+ Integer.parseInt(startArr[1])
|
|
|
|
|
+ );
|
|
|
|
|
+ LocalTime end = LocalTime.of(
|
|
|
|
|
+ Integer.parseInt(endArr[0]),
|
|
|
|
|
+ Integer.parseInt(endArr[1])
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ boolean isInBusiness;
|
|
|
|
|
+ // 处理跨天营业
|
|
|
|
|
+ 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);
|
|
|
|
|
+ result.setYyFlag(isInBusiness ? 1 : 0);
|
|
|
|
|
+ isCurrentSpecialBusinessTime = isInBusiness;
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ log.warn("特殊日期营业时间格式错误 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ specialBusinessInfo.getStartTime(), specialBusinessInfo.getEndTime());
|
|
|
result.setYyFlag(0);
|
|
result.setYyFlag(0);
|
|
|
|
|
+ isCurrentSpecialBusinessTime = false;
|
|
|
}
|
|
}
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ log.warn("解析特殊日期营业时间失败 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ specialBusinessInfo.getStartTime(), specialBusinessInfo.getEndTime(), e);
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ isCurrentSpecialBusinessTime = false;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ log.warn("特殊日期营业时间为空 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ specialBusinessInfo.getStartTime(), specialBusinessInfo.getEndTime());
|
|
|
result.setYyFlag(0);
|
|
result.setYyFlag(0);
|
|
|
|
|
+ isCurrentSpecialBusinessTime = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果不是特殊日期,判断正常营业时间(businessType == 1)
|
|
|
|
|
+ StoreBusinessInfo normalBusinessInfo = storeBusinessInfos.stream()
|
|
|
|
|
+ .filter(item -> item.getBusinessType() != null && item.getBusinessType() == 1)
|
|
|
|
|
+ .findFirst()
|
|
|
|
|
+ .orElse(null);
|
|
|
|
|
+
|
|
|
|
|
+ if (normalBusinessInfo != null) {
|
|
|
|
|
+ log.info("判断正常营业时间 - 营业日期: {}, 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ normalBusinessInfo.getBusinessDate(),
|
|
|
|
|
+ normalBusinessInfo.getStartTime(),
|
|
|
|
|
+ normalBusinessInfo.getEndTime());
|
|
|
|
|
+ // 获取当前星期并转换为业务格式
|
|
|
|
|
+// Calendar calendar = Calendar.getInstance();
|
|
|
|
|
+// int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // 1=周日,2=周一...7=周六
|
|
|
|
|
+// String[] days = {"7", "1", "2", "3", "4", "5", "6"};
|
|
|
|
|
+// String day = days[dayOfWeek - 1];
|
|
|
|
|
+
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
|
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // 1=周日,2=周一...7=周六
|
|
|
|
|
+ // 映射数组:索引对应dayOfWeek-1,值为中文星期
|
|
|
|
|
+ String[] weekDaysCN = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
|
|
|
|
|
+ String day = weekDaysCN[dayOfWeek - 1];
|
|
|
|
|
+
|
|
|
|
|
+ log.info("当前星期: {}, 转换后: {}", dayOfWeek, day);
|
|
|
|
|
+
|
|
|
|
|
+ // 判断当前日期是否在营业日期范围内
|
|
|
|
|
+ if (StringUtils.isNotEmpty(normalBusinessInfo.getBusinessDate())
|
|
|
|
|
+ && normalBusinessInfo.getBusinessDate().contains(day)) {
|
|
|
|
|
+ log.info("当前星期在营业日期范围内");
|
|
|
|
|
+ if (StringUtils.isNotEmpty(normalBusinessInfo.getStartTime())
|
|
|
|
|
+ && StringUtils.isNotEmpty(normalBusinessInfo.getEndTime())) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String[] startArr = normalBusinessInfo.getStartTime().split(":");
|
|
|
|
|
+ String[] endArr = normalBusinessInfo.getEndTime().split(":");
|
|
|
|
|
+ if (startArr.length >= 2 && endArr.length >= 2) {
|
|
|
|
|
+ LocalTime start = LocalTime.of(
|
|
|
|
|
+ Integer.parseInt(startArr[0]),
|
|
|
|
|
+ Integer.parseInt(startArr[1])
|
|
|
|
|
+ );
|
|
|
|
|
+ LocalTime end = LocalTime.of(
|
|
|
|
|
+ Integer.parseInt(endArr[0]),
|
|
|
|
|
+ Integer.parseInt(endArr[1])
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ boolean isInBusiness;
|
|
|
|
|
+ // 处理跨天营业
|
|
|
|
|
+ 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);
|
|
|
|
|
+ result.setYyFlag(isInBusiness ? 1 : 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("正常营业时间格式错误 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ normalBusinessInfo.getStartTime(), normalBusinessInfo.getEndTime());
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ log.warn("解析正常营业时间失败 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ normalBusinessInfo.getStartTime(), normalBusinessInfo.getEndTime(), e);
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("正常营业时间为空 - 开始时间: {}, 结束时间: {}",
|
|
|
|
|
+ normalBusinessInfo.getStartTime(), normalBusinessInfo.getEndTime());
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("当前星期不在营业日期范围内 - 营业日期: {}, 当前星期: {}",
|
|
|
|
|
+ normalBusinessInfo.getBusinessDate(), day);
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("没有找到正常营业时间配置");
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("最终营业状态 - yyFlag: {}", result.getYyFlag());
|
|
|
|
|
+
|
|
|
|
|
+ // 根据当前是否是特殊营业时间,对storeBusinessInfos进行排序
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(storeBusinessInfos)) {
|
|
|
|
|
+ final boolean isSpecial = isCurrentSpecialBusinessTime;
|
|
|
|
|
+ List<StoreBusinessInfo> sortedBusinessInfos = storeBusinessInfos.stream()
|
|
|
|
|
+ .sorted((a, b) -> {
|
|
|
|
|
+ Integer typeA = a.getBusinessType() != null ? a.getBusinessType() : 0;
|
|
|
|
|
+ Integer typeB = b.getBusinessType() != null ? b.getBusinessType() : 0;
|
|
|
|
|
+
|
|
|
|
|
+ // 如果当前是特殊营业时间,businessType == 2 排在前面
|
|
|
|
|
+ if (isSpecial) {
|
|
|
|
|
+ if (typeA == 2 && typeB != 2) {
|
|
|
|
|
+ return -1; // a排在前面
|
|
|
|
|
+ } else if (typeA != 2 && typeB == 2) {
|
|
|
|
|
+ return 1; // b排在前面
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果当前不是特殊营业时间,businessType == 1 排在前面
|
|
|
|
|
+ if (typeA == 1 && typeB != 1) {
|
|
|
|
|
+ return -1; // a排在前面
|
|
|
|
|
+ } else if (typeA != 1 && typeB == 1) {
|
|
|
|
|
+ return 1; // b排在前面
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 相同类型,保持原有顺序
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ })
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 重新设置排序后的列表
|
|
|
|
|
+ result.setStoreBusinessInfos(sortedBusinessInfos);
|
|
|
|
|
+ if (!sortedBusinessInfos.isEmpty()) {
|
|
|
|
|
+ result.setStoreBusinessInfo(sortedBusinessInfos.get(0));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ log.info("营业时间列表排序完成 - 当前是特殊营业时间: {}, 排序后第一个businessType: {}",
|
|
|
|
|
+ isSpecial, sortedBusinessInfos.isEmpty() ? "无" : sortedBusinessInfos.get(0).getBusinessType());
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("店铺营业状态不为0,不判断营业时间 - businessStatus: {}", storeInfo.getBusinessStatus());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// List<StoreBusinessInfo> storeBusinessInfos = storeBusinessInfoMapper.selectList(new LambdaQueryWrapper<StoreBusinessInfo>().eq(StoreBusinessInfo::getStoreId, storeId).eq(StoreBusinessInfo::getDeleteFlag, 0));
|
|
|
|
|
+// if (ObjectUtils.isNotEmpty(storeBusinessInfos)) {
|
|
|
|
|
+// result.setStoreBusinessInfo(storeBusinessInfos.get(0));
|
|
|
|
|
+// result.setStoreBusinessInfos(storeBusinessInfos);
|
|
|
|
|
+// StoreBusinessInfo storeBusinessInfo = result.getStoreBusinessInfos().stream().filter(item -> item.getBusinessType() == 1).findFirst().orElse(null);
|
|
|
|
|
+// if (ObjectUtils.isNotEmpty(storeBusinessInfo)) {
|
|
|
|
|
+//
|
|
|
|
|
+// Calendar calendar = Calendar.getInstance(); // 获取Calendar实例
|
|
|
|
|
+// int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // 获取星期几,注意Calendar中的DAY_OF_WEEK是从1(代表星期天)开始的
|
|
|
|
|
+// String[] days = {"7", "1", "2", "3", "4", "5", "6"};
|
|
|
|
|
+// String day = days[dayOfWeek - 1];
|
|
|
|
|
+// if (storeBusinessInfo.getBusinessDate().contains(day)) {
|
|
|
|
|
+// if (StringUtils.isNotEmpty(storeBusinessInfo.getStartTime()) && StringUtils.isNotEmpty(storeBusinessInfo.getEndTime())) {
|
|
|
|
|
+// LocalTime now = LocalTime.now();
|
|
|
|
|
+// List<String> startList = Arrays.asList(storeBusinessInfo.getStartTime().split(":"));
|
|
|
|
|
+// List<String> endList = Arrays.asList(storeBusinessInfo.getEndTime().split(":"));
|
|
|
|
|
+// LocalTime start = LocalTime.of(Integer.parseInt(startList.get(0)), Integer.parseInt(startList.get(1)));
|
|
|
|
|
+// LocalTime end = LocalTime.of(Integer.parseInt(endList.get(0)), Integer.parseInt(startList.get(1)));
|
|
|
|
|
+// if (now.isAfter(start) && now.isBefore(end)) {
|
|
|
|
|
+// result.setYyFlag(1);
|
|
|
|
|
+// } else {
|
|
|
|
|
+// result.setYyFlag(0);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// } else {
|
|
|
|
|
+// result.setYyFlag(0);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
LambdaQueryWrapper<StoreDictionary> storeDictionaryLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<StoreDictionary> storeDictionaryLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
storeDictionaryLambdaQueryWrapper.eq(StoreDictionary::getTypeName, "businessStatus")
|
|
storeDictionaryLambdaQueryWrapper.eq(StoreDictionary::getTypeName, "businessStatus")
|
|
|
.eq(StringUtils.isNotEmpty(result.getBusinessStatus().toString()), StoreDictionary::getDictId, result.getBusinessStatus());
|
|
.eq(StringUtils.isNotEmpty(result.getBusinessStatus().toString()), StoreDictionary::getDictId, result.getBusinessStatus());
|
|
@@ -6089,7 +6408,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
storeInfo.setId(storeImg.getStoreId());
|
|
storeInfo.setId(storeImg.getStoreId());
|
|
|
storeInfo.setBusinessLicenseStatus(2); // 2-待审核
|
|
storeInfo.setBusinessLicenseStatus(2); // 2-待审核
|
|
|
storeInfo.setUpdateBusinessLicenseTime(new Date());
|
|
storeInfo.setUpdateBusinessLicenseTime(new Date());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
storeInfoMapper.updateById(storeInfo);
|
|
storeInfoMapper.updateById(storeInfo);
|
|
|
|
|
|
|
|
// 异步调用证照审核AI接口并处理审核结果
|
|
// 异步调用证照审核AI接口并处理审核结果
|
|
@@ -6170,7 +6489,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
|
|
|
|
|
// 收集所有图片URL
|
|
// 收集所有图片URL
|
|
|
List<String> imgUrlList = new ArrayList<>();
|
|
List<String> imgUrlList = new ArrayList<>();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 插入新的其他资质证明图片(最多9张)
|
|
// 插入新的其他资质证明图片(最多9张)
|
|
|
for (int i = 0; i < maxCount; i++) {
|
|
for (int i = 0; i < maxCount; i++) {
|
|
|
StoreImg storeImg = storeImgList.get(i);
|
|
StoreImg storeImg = storeImgList.get(i);
|
|
@@ -6186,7 +6505,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
imgUrlList.add(storeImg.getImgUrl());
|
|
imgUrlList.add(storeImg.getImgUrl());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 将所有图片URL合并存入一条store_license_history记录(用逗号分隔)
|
|
// 将所有图片URL合并存入一条store_license_history记录(用逗号分隔)
|
|
|
if (!imgUrlList.isEmpty()) {
|
|
if (!imgUrlList.isEmpty()) {
|
|
|
String allImgUrls = String.join(",", imgUrlList);
|
|
String allImgUrls = String.join(",", imgUrlList);
|
|
@@ -6797,6 +7116,256 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
return resultPage;
|
|
return resultPage;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据节假日名称获取当前年度的日期范围
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param year 年份
|
|
|
|
|
+ * @param holidayNames 节假日名称,如"元旦、春节、儿童节"
|
|
|
|
|
+ * @return 节假日日期范围列表,每个元素是一个数组[开始日期, 结束日期]
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<LocalDate[]> getHolidayDateRanges(int year, String holidayNames) {
|
|
|
|
|
+ List<LocalDate[]> ranges = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isEmpty(holidayNames)) {
|
|
|
|
|
+ return ranges;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 分割节假日名称(支持多种分隔符:、, ,)
|
|
|
|
|
+ String[] holidays = holidayNames.split("[、,,]");
|
|
|
|
|
+
|
|
|
|
|
+ for (String holiday : holidays) {
|
|
|
|
|
+ String holidayName = holiday.trim();
|
|
|
|
|
+ if (StringUtils.isEmpty(holidayName)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ LocalDate[] range = getHolidayDateRange(year, holidayName);
|
|
|
|
|
+ if (range != null && range.length == 2) {
|
|
|
|
|
+ ranges.add(range);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return ranges;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据单个节假日名称获取当前年度的日期范围
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param year 年份
|
|
|
|
|
+ * @param holidayName 节假日名称,如"元旦"、"春节"、"国庆"、"儿童节"等
|
|
|
|
|
+ * @return 节假日日期范围 [开始日期, 结束日期]
|
|
|
|
|
+ */
|
|
|
|
|
+ private LocalDate[] getHolidayDateRange(int year, String holidayName) {
|
|
|
|
|
+ String name = holidayName.trim();
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 元旦:1月1日,通常3天假期(1月1日-1月3日)
|
|
|
|
|
+ if (name.contains("元旦")) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 1, 1),
|
|
|
|
|
+ LocalDate.of(year, 1, 3)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 春节:农历正月初一,通常7天假期
|
|
|
|
|
+ if (name.contains("春节")) {
|
|
|
|
|
+ // 春节日期每年不同,这里提供近几年的数据,建议使用农历工具精确计算
|
|
|
|
|
+ // 2024年春节:2月10日(农历正月初一)-2月16日
|
|
|
|
|
+ // 2025年春节:1月29日(农历正月初一)-2月4日
|
|
|
|
|
+ // 2026年春节:2月17日(农历正月初一)-2月23日
|
|
|
|
|
+ if (year == 2024) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 2, 10),
|
|
|
|
|
+ LocalDate.of(year, 2, 16)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (year == 2025) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 1, 29),
|
|
|
|
|
+ LocalDate.of(year, 2, 4)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (year == 2026) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 2, 15),
|
|
|
|
|
+ LocalDate.of(year, 2, 23)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 默认:根据年份大致估算(建议使用农历工具精确计算)
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 2, 10),
|
|
|
|
|
+ LocalDate.of(year, 2, 16)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 情人节:2月14日,1天
|
|
|
|
|
+ if (name.contains("情人节")) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 2, 14);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 元宵节:农历正月十五,1天(通常在2月或3月)
|
|
|
|
|
+ if (name.contains("元宵")) {
|
|
|
|
|
+ // 元宵节是春节后的第15天,这里简化处理
|
|
|
|
|
+ // 2024年元宵节:2月24日,2025年元宵节:2月12日,2026年元宵节:3月4日
|
|
|
|
|
+ if (year == 2024) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 2, 24);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ } else if (year == 2025) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 2, 12);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ } else if (year == 2026) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 3, 4);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 默认:大致在2月底3月初
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 2, 24);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 清明节:通常4月4日或5日,通常3天假期
|
|
|
|
|
+ if (name.contains("清明")) {
|
|
|
|
|
+ // 清明节通常在4月4日或5日,这里以4月4日为基准,包含前后各1天
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 4, 4),
|
|
|
|
|
+ LocalDate.of(year, 4, 6)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 劳动节:5月1日,通常5天假期(5月1日-5月5日)
|
|
|
|
|
+ if (name.contains("劳动") || name.contains("五一")) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 5, 1),
|
|
|
|
|
+ LocalDate.of(year, 5, 5)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 儿童节:6月1日,1天
|
|
|
|
|
+ if (name.contains("儿童")) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 6, 1);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 端午节:农历五月初五,通常3天假期
|
|
|
|
|
+ if (name.contains("端午")) {
|
|
|
|
|
+ // 端午节通常在6月,这里提供近几年的数据
|
|
|
|
|
+ // 2024年端午节:6月10日,2025年端午节:5月31日,2026年端午节:6月19日
|
|
|
|
|
+ if (year == 2024) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 6, 10),
|
|
|
|
|
+ LocalDate.of(year, 6, 12)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (year == 2025) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 5, 31),
|
|
|
|
|
+ LocalDate.of(year, 6, 2)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (year == 2026) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 6, 19),
|
|
|
|
|
+ LocalDate.of(year, 6, 21)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 默认:大致在6月中旬
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 6, 10),
|
|
|
|
|
+ LocalDate.of(year, 6, 12)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 七夕:农历七月初七,1天(通常在8月)
|
|
|
|
|
+ if (name.contains("七夕")) {
|
|
|
|
|
+ // 七夕通常在8月,这里提供近几年的数据
|
|
|
|
|
+ // 2024年七夕:8月10日,2025年七夕:7月31日,2026年七夕:8月20日
|
|
|
|
|
+ if (year == 2024) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 8, 10);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ } else if (year == 2025) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 7, 31);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ } else if (year == 2026) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 8, 20);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 默认:大致在8月上旬
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 8, 10);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 中秋节:农历八月十五,通常3天假期
|
|
|
|
|
+ if (name.contains("中秋")) {
|
|
|
|
|
+ // 中秋节通常在9月或10月,这里提供近几年的数据
|
|
|
|
|
+ // 2024年中秋节:9月17日,2025年中秋节:10月6日,2026年中秋节:9月25日
|
|
|
|
|
+ if (year == 2024) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 9, 17),
|
|
|
|
|
+ LocalDate.of(year, 9, 19)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (year == 2025) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 10, 6),
|
|
|
|
|
+ LocalDate.of(year, 10, 8)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (year == 2026) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 9, 25),
|
|
|
|
|
+ LocalDate.of(year, 9, 27)
|
|
|
|
|
+ };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 默认:大致在9月下旬
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 9, 29),
|
|
|
|
|
+ LocalDate.of(year, 10, 1)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 国庆节:10月1日,通常7天假期(10月1日-10月7日)
|
|
|
|
|
+ if (name.contains("国庆")) {
|
|
|
|
|
+ return new LocalDate[]{
|
|
|
|
|
+ LocalDate.of(year, 10, 1),
|
|
|
|
|
+ LocalDate.of(year, 10, 7)
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 冬至:通常12月21日或22日,1天
|
|
|
|
|
+ if (name.contains("冬至")) {
|
|
|
|
|
+ // 冬至通常在12月21日或22日,这里统一为12月22日
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 12, 22);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 平安夜:12月24日,1天
|
|
|
|
|
+ if (name.contains("平安夜")) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 12, 24);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 圣诞节:12月25日,1天
|
|
|
|
|
+ if (name.contains("圣诞")) {
|
|
|
|
|
+ LocalDate date = LocalDate.of(year, 12, 25);
|
|
|
|
|
+ return new LocalDate[]{date, date};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("计算节假日日期范围失败 - 年份: {}, 节假日: {}", year, holidayName, e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public boolean isBusinessTime(LocalTime currentTime, LocalTime openTime, LocalTime closeTime) {
|
|
|
|
|
+ if (openTime.isBefore(closeTime)) {
|
|
|
|
|
+ // 正常时间段(不跨天):09:00-18:00
|
|
|
|
|
+ return !currentTime.isBefore(openTime) && currentTime.isBefore(closeTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 跨天时间段:14:00-03:00
|
|
|
|
|
+ return !currentTime.isBefore(openTime) || currentTime.isBefore(closeTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|