增加了商品库相关的方法

This commit is contained in:
Jack 2025-06-19 09:06:31 +08:00
parent af4a334421
commit c5c5e7d929
4 changed files with 72 additions and 8 deletions

View File

@ -157,7 +157,6 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
@Autowired
private ShopStoreBaseService shopStoreBaseService;
@Autowired
private ShopStoreInfoService shopStoreInfoService;
@ -401,9 +400,9 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl<ShopProductItemM
} else {
// todo 判断是否有配送地区
Integer district_id;
if (params.get("district_id")==null) {
if (params.get("district_id") == null) {
district_id = shopBaseDistrictService.getDefaultDistrictId();
}else{
} else {
district_id = Convert.toInt(params.get("district_id"));
}

View File

@ -184,6 +184,19 @@ public class ShopStoreBaseController extends BaseControllerImpl {
return shopStoreBaseService.enable();
}
/**
* 更新店铺营业状态.
*
* @param storeId 店铺ID, 不能为空
* @param bizState 营业状态 (1: 营业, 2: 打烊), 不能为空
* @return 成功返回CommonResult.success(), 失败返回CommonResult.failed()
*/
@ApiOperation(value = "修改店铺营业状态", notes = "修改店铺营业状态")
@RequestMapping(value = "/update/storeBizState", method = RequestMethod.POST)
public CommonResult updateStoreBizState(@RequestParam(name = "store_id") Integer storeId, @RequestParam(name = "store_biz_state") Integer bizState) {
return shopStoreBaseService.updateStoreBizState(storeId, bizState) ? CommonResult.success() : CommonResult.failed();
}
@ApiOperation(value = "店铺审核", notes = "店铺审核")
@RequestMapping(value = "/storeVerify", method = RequestMethod.POST)

View File

@ -12,7 +12,6 @@ import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.store.ShopStoreCompany;
import com.suisung.mall.common.pojo.dto.StandardAddressDTO;
import com.suisung.mall.core.web.service.IBaseService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.data.util.Pair;
import javax.servlet.http.HttpServletResponse;
@ -183,4 +182,13 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
*/
BigDecimal getStorePlatformRatio(Integer storeId, boolean reCalculate);
/**
* 修改店铺的营业状态
*
* @param storeId
* @param bizState 营业状态 1-营业2-打烊
* @return
*/
Boolean updateStoreBizState(Integer storeId, Integer bizState);
}

View File

@ -6,7 +6,6 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -65,7 +64,6 @@ import com.suisung.mall.shop.store.service.*;
import com.suisung.mall.shop.user.service.ShopUserFavoritesStoreService;
import com.suisung.mall.shop.wechat.service.WxQrCodeService;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -740,6 +738,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
params.put("sidx", sidx);
Integer store_type = getParameter("store_type", Integer.class);
Integer store_biz_state = getParameter("store_biz_state", Integer.class);
UserDto user = getCurrentUser();
if (store_type == null) {
@ -751,6 +750,12 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
queryWrapper.eq("store_id", store_id);
params.put("store_id", store_id);
}
if (CheckUtil.isNotEmpty(store_biz_state)) {
queryWrapper.eq("store_biz_state", store_biz_state);
params.put("store_biz_state", store_biz_state);
}
if (CheckUtil.isNotEmpty(store_category_id)) {
queryWrapper.eq("store_category_id", store_category_id);
params.put("store_category_id", store_category_id);
@ -3523,6 +3528,45 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
return splitRatio;
}
/**
* 修改店铺的营业状态
*
* @param storeId
* @param bizState 营业状态 1-营业2-打烊
* @return
*/
@Override
public Boolean updateStoreBizState(Integer storeId, Integer bizState) {
// 检查参数是否为空
if (storeId == null || storeId == 0 || bizState == null) {
logger.warn("店铺ID或营业状态为空. storeId: {}, bizState: {}", storeId, bizState);
return false;
}
if (bizState <= 0) {
bizState = CommonConstant.Disable2;
}
try {
// 使用 UpdateWrapper 更新店铺营业状态
boolean updated = update(new UpdateWrapper<ShopStoreBase>()
.eq("store_id", storeId)
.set("store_biz_state", bizState));
if (updated) {
logger.info("成功更新店铺营业状态店铺ID: {},营业状态: {}", storeId, bizState);
} else {
logger.warn("更新店铺营业状态失败店铺ID: {}。更新操作返回 false。", storeId);
}
return updated;
} catch (Exception e) {
// 捕获并记录异常
logger.error("更新店铺营业状态时发生异常店铺ID: {}", storeId, e);
return false; // 发生异常时返回 false
}
}
/**
* 处理 store_slide 字段
*
@ -3680,7 +3724,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
@Override
public List<ShopBaseProductType> fixStoreDataShopBaseProductType(List<ShopBaseProductType> rows) {
if (CollUtil.isNotEmpty(rows)) {
List<ShopBaseProductType> shopBaseProductTypes= rows;
List<ShopBaseProductType> shopBaseProductTypes = rows;
List<Integer> store_ids = shopBaseProductTypes.stream().map(s -> Convert.toInt(s.getStore_id())).distinct().collect(Collectors.toList());
List<Map> store_rows = gets(store_ids);
for (ShopBaseProductType row : shopBaseProductTypes) {
@ -3702,7 +3746,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
@Override
public List<ShopBaseProductSpec> fixStoreDataShopBaseProductSpec(List<ShopBaseProductSpec> rows) {
if (CollUtil.isNotEmpty(rows)) {
List<ShopBaseProductSpec> shopBaseProductSpecs= rows;
List<ShopBaseProductSpec> shopBaseProductSpecs = rows;
List<Integer> store_ids = shopBaseProductSpecs.stream().map(s -> Convert.toInt(s.getStore_id())).distinct().collect(Collectors.toList());
List<Map> store_rows = gets(store_ids);
for (ShopBaseProductSpec row : shopBaseProductSpecs) {