商家用户登录之后,补偿创建店铺遗漏的信息。 增加打烊状态兼顾时间段逻辑,账号体系优化 getOne 异常处理

This commit is contained in:
Jack 2025-09-02 00:00:26 +08:00
parent 497df13540
commit e45a1df7a1
7 changed files with 229 additions and 82 deletions

View File

@ -2426,20 +2426,35 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
/**
* 根据账号和账号类型获取一条记录
*
* @param user_account
* @param user_is_admin
* @return
* @param userAccount 用户账号
* @param userIsAdmin 用户类型: null-普通用户; 1-管理员; 2-入驻商家;
* @return AccountUserBase 用户基础信息如果未找到则返回null
*/
public AccountUserBase getByAccountAndType(String user_account, Integer user_is_admin) {
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>();
if (user_is_admin == null) {
user_is_admin = CommonConstant.USER_TYPE_NORMAL;
public AccountUserBase getByAccountAndType(String userAccount, Integer userIsAdmin) {
// 参数校验
if (StrUtil.isBlank(userAccount)) {
return null;
}
try {
// 如果用户类型为null默认设置为普通用户类型
if (userIsAdmin == null) {
userIsAdmin = CommonConstant.USER_TYPE_NORMAL;
}
// 构建查询条件
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_account", userAccount)
.eq("user_is_admin", userIsAdmin)
.orderByAsc("user_id");
// 执行查询并返回结果
return getOne(queryWrapper);
} catch (Exception e) {
// 记录异常日志避免影响主流程
logger.error("根据账号和类型查询用户信息时发生异常userAccount: {}, userIsAdmin: {}", userAccount, userIsAdmin, e);
return null;
}
queryWrapper.eq("user_account", user_account)
.eq("user_is_admin", user_is_admin)
.orderByAsc("user_id");
AccountUserBase data = findOne(queryWrapper);
return data;
}
@Override

View File

@ -173,17 +173,20 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
public boolean checkAccessToken(Integer bind_type, AccountUserBindConnect bind_data, Integer user_id) {
String bind_id = bind_data.getBind_id();
Integer user_type = bind_data.getUser_type() == null ? CommonConstant.USER_TYPE_NORMAL : bind_data.getUser_type();
// todo 验证验证码
bind_data.setBind_active(CommonConstant.Enable);
bind_data.setUser_id(user_id);
bind_data.setBind_type(bind_type);
bind_data.setUser_type(user_type);
// 判断是否已经绑定
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id", bind_id).eq("bind_type", bind_type).orderByAsc("bind_time");
queryWrapper.eq("bind_id", bind_id).eq("bind_type", bind_type)
.eq("user_type", user_type).orderByAsc("bind_time");
AccountUserBindConnect bind_row = findOne(queryWrapper);
//getBindByBindId(bind_id, bind_type, user_id, CommonConstant.USER_TYPE_NORMAL); //findOne(queryWrapper);
if (bind_row != null) {
Integer bind_active = bind_row.getBind_active();
@ -334,23 +337,32 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
*/
@Override
public Integer getUserBindConnectUserIdByCondition(String bindId, Integer bindType, Integer userType) {
if (StrUtil.isEmpty(bindId) || ObjectUtil.isEmpty(bindType)) {
if (StrUtil.isBlank(bindId) || ObjectUtil.isEmpty(bindType)) {
return null;
}
bindId = bindType == BindCode.MOBILE ? PhoneNumberUtils.convZhPhoneNumber(bindId) : bindId;
try {
bindId = bindType == BindCode.MOBILE ? PhoneNumberUtils.convZhPhoneNumber(bindId) : bindId;
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id", bindId).eq("bind_type", bindType).eq("bind_active", CommonConstant.Enable);
if (ObjectUtil.isNotEmpty(userType)) {
queryWrapper.eq("user_type", userType);
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id", bindId).eq("bind_type", bindType).eq("bind_active", CommonConstant.Enable);
if (ObjectUtil.isNotEmpty(userType)) {
queryWrapper.eq("user_type", userType);
}
// 只查询 user_id 字段以提高性能
queryWrapper.select("user_id").orderByAsc("bind_time");
AccountUserBindConnect accountUserBindConnect = getOne(queryWrapper);
// 确保 accountUserBindConnect 不为 null user_id 不为 null
return (accountUserBindConnect != null && accountUserBindConnect.getUser_id() != null)
? accountUserBindConnect.getUser_id()
: null;
} catch (Exception e) {
// 记录异常日志避免影响主流程
log.error("查询用户绑定信息时发生异常bindId: {}, bindType: {}, userType: {}", bindId, bindType, userType, e);
return null;
}
queryWrapper.select("user_id").orderByAsc("bind_time");
AccountUserBindConnect accountUserBindConnect = getOne(queryWrapper);
return accountUserBindConnect != null ? accountUserBindConnect.getUser_id() : null;
}
/**

View File

@ -5,10 +5,7 @@ import org.springframework.data.util.Pair;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DateTimeException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
@ -233,6 +230,61 @@ public class DateTimeUtils {
return count;
}
/**
* 判断指定时间是否在两个时间点之间包含边界
*
* @param startTimeStr 开始时间字符串格式为 HH:mm
* @param endTimeStr 结束时间字符串格式为 HH:mm
* @param currentTime 要判断的时间点
* @return 如果在时间段内返回true否则返回false出现异常时返回false不影响主流程
*/
public static boolean isTimeInRange(String startTimeStr, String endTimeStr, LocalDateTime currentTime) {
try {
// 参数校验
if (startTimeStr == null || endTimeStr == null || currentTime == null) {
log.warn("时间参数不能为空startTimeStr: {}, endTimeStr: {}, currentTime: {}",
startTimeStr, endTimeStr, currentTime);
return false;
}
// 解析开始时间
LocalTime startTime = LocalTime.parse(startTimeStr, DateTimeFormatter.ofPattern("HH:mm"));
// 解析结束时间
LocalTime endTime = LocalTime.parse(endTimeStr, DateTimeFormatter.ofPattern("HH:mm"));
// 获取当前时间的时间部分
LocalTime nowTime = currentTime.toLocalTime();
// 处理跨天情况例如 22:00 - 06:00
if (endTime.isBefore(startTime)) {
// 如果结束时间小于开始时间说明跨越了午夜
// 当前时间需要满足大于等于开始时间 或者 小于等于结束时间
return !nowTime.isBefore(startTime) || !nowTime.isAfter(endTime);
} else {
// 正常情况不跨天当前时间需要在开始时间和结束时间之间包含边界
return !nowTime.isBefore(startTime) && !nowTime.isAfter(endTime);
}
} catch (Exception e) {
// 捕获解析异常记录日志并返回false避免影响主流程
log.error("判断时间是否在范围内时发生异常startTimeStr: {}, endTimeStr: {}, currentTime: {}",
startTimeStr, endTimeStr, currentTime, e);
return false;
}
}
/**
* 判断当前时间是否在两个时间点之间包含边界
*
* @param startTimeStr 开始时间字符串格式为 HH:mm
* @param endTimeStr 结束时间字符串格式为 HH:mm
* @return 如果在时间段内返回true否则返回false
* @throws IllegalArgumentException 当时间字符串格式不正确时抛出异常
*/
public static boolean isCurrentTimeInRange(String startTimeStr, String endTimeStr) {
return isTimeInRange(startTimeStr, endTimeStr, LocalDateTime.now());
}
public static void main(String[] args) {
// System.out.println(convertLklDate("2021-02-19")); // 2025-01-02
@ -249,9 +301,19 @@ public class DateTimeUtils {
// System.out.println(convertLklDate("永久")); // 9999-12-31
// System.out.println(convertLklDate(null)); // 9999-12-31
// System.out.println(convertLklDate("2025.2.30")); // 9999-12-31无效日期
System.out.println(convertLklDate("2045-01-10")); // 2025-01-10
// System.out.println(convertLklDate("2045-01-10")); // 2025-01-10
// System.out.println(formatLocalDate(LocalDate.now(), "yyyy-MM-dd"));
// 判断当前时间是否在工作时间9:00-18:00
boolean isWorkTime = isCurrentTimeInRange("09:00", "22:36");
// 判断特定时间是否在夜间时间22:00-06:00
LocalDateTime testTime = LocalDateTime.of(2025, 1, 1, 23, 30);
boolean isNight = isTimeInRange("22:00", "06:00", testTime);
System.out.println("当前时间是否在工作时间内:" + isWorkTime);
System.out.println("特定时间是否在夜间时间段内:" + isNight);
}
}

View File

@ -56,7 +56,6 @@ import com.suisung.mall.shop.product.mapper.ShopProductItemMapper;
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
import com.suisung.mall.shop.product.service.*;
import com.suisung.mall.shop.store.service.*;
import com.suisung.mall.shop.sync.keymanage.RedisKey;
import com.suisung.mall.shop.user.service.ShopUserFavoritesItemService;
import com.suisung.mall.shop.user.service.ShopUserProductBrowseService;
import io.seata.spring.annotation.GlobalTransactional;
@ -484,6 +483,11 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
Integer im_enable = accountBaseConfigService.getConfig("im_enable", 0);
baseMap.put("im_chat", im_enable);
data.put("product_analytics", analytics_row);
// 营业时间段直接影响到 营业状态字段
// store_biz_state 店铺营业状态1-营业中2-已打烊
baseMap.put("store_biz_state", shopStoreBaseService.getStoreBizState(shopStoreBase, shopStoreInfo));
data.put("store_info", baseMap);
data.put("multishop_enable", multishop_enable);
@ -2247,25 +2251,25 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
}
@Override
public Map<String,String> getProductItemIdByStore(Integer store_id,List<String> productNumbers) {
public Map<String, String> getProductItemIdByStore(Integer store_id, List<String> productNumbers) {
QueryWrapper<ShopProductItem> queryWrapper = new QueryWrapper<>();
/**
* 一对多如product_id:1002,item_number:120_121;数据格式为item_id,item_id item_unit_price,item_unit_price
* 最终组合item_id,item_id_item_unit_price,item_unit_price
*/
queryWrapper.select("product_id","GROUP_CONCAT(item_id SEPARATOR ',') AS mergedItemId","GROUP_CONCAT(item_unit_price SEPARATOR ',') AS mergedUnitPrices,category_id");
queryWrapper.select("product_id", "GROUP_CONCAT(item_id SEPARATOR ',') AS mergedItemId", "GROUP_CONCAT(item_unit_price SEPARATOR ',') AS mergedUnitPrices,category_id");
productNumbers.forEach(productNumber -> {
queryWrapper.or(q->q.eq("store_id",store_id).eq("item_src_id",productNumber));
queryWrapper.or(q -> q.eq("store_id", store_id).eq("item_src_id", productNumber));
});
queryWrapper.eq("store_id",store_id);
queryWrapper.eq("store_id", store_id);
queryWrapper.groupBy("product_id");
List<ShopProductItem> shopProductItems= this.list(queryWrapper);
List<ShopProductItem> shopProductItems = this.list(queryWrapper);
// Map map=shopProductItems.stream().collect(Collectors.toMap(ShopProductItem::getProduct_id,shopProductItem->shopProductItem.getMergedItemId()
// +"_"+shopProductItem.getMergedUnitPrices()));
Map<String,String> map=new HashMap();
Map<String, String> map = new HashMap();
shopProductItems.forEach(item -> {
map.put(String.valueOf(item.getProduct_id()),item.getMergedItemId()+"_"+item.getMergedUnitPrices());
map.put(item.getProduct_id()+":category_id",String.valueOf(item.getCategory_id()));
map.put(String.valueOf(item.getProduct_id()), item.getMergedItemId() + "_" + item.getMergedUnitPrices());
map.put(item.getProduct_id() + ":category_id", String.valueOf(item.getCategory_id()));
});
return map;
@ -2289,71 +2293,71 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
// 通过product_id 批量更新
@Override
public void batchUpdateByCondition(List<ShopProductItem> shopProductItemList) {
shopProductItemMapper.updateBatchByProductId(shopProductItemList,shopProductItemList.get(0).getItem_enable());
shopProductItemMapper.updateBatchByProductId(shopProductItemList, shopProductItemList.get(0).getItem_enable());
}
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResult editQuantity(List<ShopProductItem> shopProductItemList) {
if(shopProductItemList.isEmpty()){
if (shopProductItemList.isEmpty()) {
return CommonResult.failed("修改数据不能为空");
}
if(shopProductItemList.size()>10){
if (shopProductItemList.size() > 10) {
return CommonResult.failed("修改数据不能超过10条");
}
QueryWrapper<ShopProductItem> queryWrapper = new QueryWrapper<>();
List<ShopProductItem> updateShopProductItem=new ArrayList<>();
List<ShopProductBase> updateShopProductBase=new ArrayList<>();
List<ShopProductIndex> updateShopProductIndex=new ArrayList<>();
List<ShopProductItem> updateShopProductItem = new ArrayList<>();
List<ShopProductBase> updateShopProductBase = new ArrayList<>();
List<ShopProductIndex> updateShopProductIndex = new ArrayList<>();
//校验数据
Iterator<ShopProductItem> itemIs=shopProductItemList.iterator();
StringBuilder ids= new StringBuilder();
Long productId=shopProductItemList.get(0).getProduct_id();
Iterator<ShopProductItem> itemIs = shopProductItemList.iterator();
StringBuilder ids = new StringBuilder();
Long productId = shopProductItemList.get(0).getProduct_id();
while (itemIs.hasNext()) {//去重
ShopProductItem shopProductItem=itemIs.next();
if(ObjectUtil.isEmpty(shopProductItem.getProduct_id())){
ShopProductItem shopProductItem = itemIs.next();
if (ObjectUtil.isEmpty(shopProductItem.getProduct_id())) {
return CommonResult.failed("产品id不能为空");
}
if(ObjectUtil.isEmpty(shopProductItem.getItem_id())){
if (ObjectUtil.isEmpty(shopProductItem.getItem_id())) {
return CommonResult.failed("商品sku不能为空");
}
if(ObjectUtil.isEmpty(shopProductItem.getItem_quantity())){
if (ObjectUtil.isEmpty(shopProductItem.getItem_quantity())) {
return CommonResult.failed("库存不能为空");
}
if(ObjectUtil.isEmpty(shopProductItem.getItem_unit_price())){
if (ObjectUtil.isEmpty(shopProductItem.getItem_unit_price())) {
return CommonResult.failed("价格不能为空");
}
if(!productId.equals(shopProductItem.getProduct_id())){
if (!productId.equals(shopProductItem.getProduct_id())) {
return CommonResult.failed("只能修改相同产品的sku列表");
}
if(ids.toString().contains(shopProductItem.getItem_id().toString())){
if (ids.toString().contains(shopProductItem.getItem_id().toString())) {
itemIs.remove();
}else {
} else {
ids.append(shopProductItem.getItem_id());
}
}
BigDecimal item_unit_price = shopProductItemList.stream().map(ShopProductItem::getItem_unit_price).min(BigDecimal::compareTo).get();
BigDecimal item_unit_price_max =shopProductItemList.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
BigDecimal item_unit_price_max = shopProductItemList.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
queryWrapper.eq("product_id",productId);
List<ShopProductItem> oldShopProductItems= shopProductItemService.list(queryWrapper);
queryWrapper.eq("product_id", productId);
List<ShopProductItem> oldShopProductItems = shopProductItemService.list(queryWrapper);
BigDecimal item_unit_price_old = oldShopProductItems.stream().map(ShopProductItem::getItem_unit_price).min(BigDecimal::compareTo).get();
BigDecimal item_unit_price_max_old=oldShopProductItems.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
BigDecimal item_unit_price_max_old = oldShopProductItems.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
for (ShopProductItem shopProductItem : shopProductItemList) {
List<ShopProductItem> oldShopProductItemList= oldShopProductItems.stream().filter(s -> s.getItem_id().equals(shopProductItem.getItem_id())).collect(Collectors.toList());
if(CollUtil.isEmpty(oldShopProductItemList)){
List<ShopProductItem> oldShopProductItemList = oldShopProductItems.stream().filter(s -> s.getItem_id().equals(shopProductItem.getItem_id())).collect(Collectors.toList());
if (CollUtil.isEmpty(oldShopProductItemList)) {
return CommonResult.failed("不存在商品sku");
}
ShopProductItem oldShopProductItem=oldShopProductItemList.get(0);
ShopProductItem oldShopProductItem = oldShopProductItemList.get(0);
oldShopProductItem.setItem_quantity(shopProductItem.getItem_quantity());
oldShopProductItem.setItem_unit_price(shopProductItem.getItem_unit_price());
updateShopProductItem.add(oldShopProductItem);
// shopProductItemService.updateById(oldShopProductItem);
// shopProductItemService.updateById(oldShopProductItem);
}
ShopProductIndex shopProductIndex=new ShopProductIndex();
ShopProductBase shopProductBase=new ShopProductBase();
if(item_unit_price_old.compareTo(item_unit_price)>0&&oldShopProductItems.size()>1){
ShopProductIndex shopProductIndex = new ShopProductIndex();
ShopProductBase shopProductBase = new ShopProductBase();
if (item_unit_price_old.compareTo(item_unit_price) > 0 && oldShopProductItems.size() > 1) {
shopProductBase.setProduct_id(productId);
shopProductBase.setProduct_unit_price(item_unit_price);
shopProductIndex.setProduct_unit_price(item_unit_price);
@ -2362,12 +2366,12 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
}
if(item_unit_price_max.compareTo(item_unit_price_max_old)>0&&oldShopProductItems.size()>1){
if (item_unit_price_max.compareTo(item_unit_price_max_old) > 0 && oldShopProductItems.size() > 1) {
shopProductIndex.setProduct_id(productId);
shopProductIndex.setProduct_unit_price_max(item_unit_price_max);
}
if(oldShopProductItems.size()==1){
if (oldShopProductItems.size() == 1) {
shopProductBase.setProduct_id(productId);
shopProductBase.setProduct_unit_price(item_unit_price);
shopProductIndex.setProduct_id(productId);
@ -2377,13 +2381,13 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
updateShopProductBase.add(shopProductBase);
}
if(ObjectUtil.isNotEmpty(shopProductIndex.getProduct_id())){
if (ObjectUtil.isNotEmpty(shopProductIndex.getProduct_id())) {
updateShopProductIndex.add(shopProductIndex);
}
if(!updateShopProductBase.isEmpty()){
if (!updateShopProductBase.isEmpty()) {
shopProductBaseService.updateBatchById(updateShopProductBase);
}
if(!updateShopProductIndex.isEmpty()){
if (!updateShopProductIndex.isEmpty()) {
shopProductIndexService.updateBatchById(updateShopProductIndex);
}
shopProductItemService.updateBatchById(updateShopProductItem);

View File

@ -10,6 +10,7 @@ import com.suisung.mall.common.modules.base.ShopBaseProductType;
import com.suisung.mall.common.modules.base.ShopBaseStoreCategory;
import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.store.ShopStoreCompany;
import com.suisung.mall.common.modules.store.ShopStoreInfo;
import com.suisung.mall.common.pojo.dto.StandardAddressDTO;
import com.suisung.mall.core.web.service.IBaseService;
import org.springframework.data.util.Pair;
@ -227,6 +228,15 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
*/
BigDecimal getStorePackingFee(Integer storeId);
/**
* 根据当前时间检查并获取店铺营业状态
*
* @param shopStoreBase 店铺基础信息
* @param shopStoreInfo 店铺详细信息
* @return 店铺营业状态1-营业中2-已打烊
*/
Integer getStoreBizState(ShopStoreBase shopStoreBase, ShopStoreInfo shopStoreInfo);
// Page<ShopStoreBase> getMobileStoreList(Integer page, Integer rows);
}

View File

@ -756,8 +756,8 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
// 4.2 检查入驻状态
boolean isValidStatus =
CommonConstant.MCH_APPR_STA_PASS.equals(entry.getApproval_status()) ||
CommonConstant.Enable.equals(entry.getHas_ec_signed()) ||
CommonConstant.MCH_APPR_STA_PASS.equals(entry.getApproval_status()) &&
CommonConstant.Enable.equals(entry.getHas_ec_signed()) &&
CommonConstant.Enable.equals(entry.getHas_apply_mer());
if (!isValidStatus) {
@ -773,20 +773,23 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
}
// 4.4 获取店铺员工信息
ShopStoreEmployee storeEmployee = shopStoreEmployeeService.getStoreEmployeeByUserId(
Convert.toInt(entry.getStore_id()),
currentUser.getId()
);
ShopStoreEmployee storeEmployee = null;
if (StrUtil.isNotBlank(entry.getStore_id())) {
storeEmployee = shopStoreEmployeeService.getStoreEmployeeByUserId(
Convert.toInt(entry.getStore_id()),
currentUser.getId()
);
}
// 4.5 检查店铺关联关系
boolean hasStoreRelation = userBase.getStore_ids() != null &&
boolean hasStoreRelation = StrUtil.isNotBlank(userBase.getStore_ids()) &&
userBase.getStore_ids().contains(entry.getStore_id());
// 4.6 检查权限组信息
boolean hasPermission = storeEmployee != null &&
StrUtil.isNotBlank(storeEmployee.getRights_group_id());
// 4.7 只有当不满足以下条件时才需要修复
// 4.7 当以下任一条件满足时需要进行修复
// - 无店铺员工信息
// - 无权限组信息
// - 无店铺关联
@ -800,7 +803,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
fixCount++;
log.warn("商户信息修复成功入驻ID: {}", entry.getId());
} else {
log.error("商户信息修复失败入驻ID: {}, 错误信息:{}", entry.getId(), result.getSecond());
log.error("商户信息修复失败入驻ID: {}, 错误信息:{}", entry.getId(), result != null ? result.getSecond() : "未知错误");
}
}
}

View File

@ -3980,6 +3980,47 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
return BigDecimal.ZERO;
}
/**
* 根据当前时间检查并获取店铺营业状态
*
* @param shopStoreBase 店铺基础信息
* @param shopStoreInfo 店铺详细信息
* @return 店铺营业状态1-营业中2-已打烊
*/
@Override
public Integer getStoreBizState(ShopStoreBase shopStoreBase, ShopStoreInfo shopStoreInfo) {
try {
// 参数校验
if (shopStoreBase == null || shopStoreInfo == null) {
log.warn("店铺基础信息或详细信息为空,无法确定营业状态");
return CommonConstant.Enable;
}
Integer storeBizState = shopStoreBase.getStore_biz_state();
String openingHours = shopStoreInfo.getStore_opening_hours();
String closingHours = shopStoreInfo.getStore_close_hours();
// 检查店铺是否营业中且营业时间已设置
if (CommonConstant.Enable.equals(storeBizState)
&& StrUtil.isNotEmpty(openingHours)
&& StrUtil.isNotEmpty(closingHours)) {
// 检查当前时间是否在营业时间内
if (!DateTimeUtils.isCurrentTimeInRange(openingHours, closingHours)) {
// 不在营业时间内返回已打烊状态
return CommonConstant.Disable2;
}
}
// 返回原始营业状态
return storeBizState;
} catch (Exception e) {
// 处理异常避免影响主流程
log.error("检查店铺营业状态时发生异常shopStoreBase: {}, shopStoreInfo: {}",
shopStoreBase, shopStoreInfo, e);
return CommonConstant.Enable;
}
}
// @Override
// public Page<ShopStoreBase> getMobileStoreList(Integer page, Integer rows) {
// QueryWrapper<ShopStoreBase> queryWrapper=new QueryWrapper<>();