主开关

This commit is contained in:
2025-12-17 11:17:36 +08:00
parent bf2eb85233
commit 8a7d63911e
8 changed files with 39 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ public class GbWareController {
@SaAdminCheckPermission(parentName = "拼团商品", value = "ware:info:up", name = "拼团商品-修改")
public CzgResult<Boolean> upShopConfig(@RequestBody GbWareDTO param) {
AssertUtil.isNull(param.getOnlineStatus(), "操作失败,请选择状态");
return CzgResult.success(wareService.upShopConfig(param.getOnlineStatus(), StpKit.USER.getShopId()));
return CzgResult.success(gbOrderService.upShopConfig(param.getOnlineStatus(), StpKit.USER.getShopId()));
}
@GetMapping("/getGbWarePage")

View File

@@ -119,6 +119,12 @@ public class ShopConfig implements Serializable {
* 上菜时间 分钟
*/
private Integer serveTime;
/**
* 拼团开关 1-是 0-否
*/
private Integer isGroupBuy;
private String dingAppKey;
private String dingAppSecret;

View File

@@ -350,6 +350,8 @@ public class ShopInfo implements Serializable {
*/
@Column(ignore = true)
private Integer serveTime;
@Column(ignore = true)
private Integer isGroupBuy;
/**
* 运营端余额

View File

@@ -78,6 +78,11 @@ public class GbWare implements Serializable {
*/
private BigDecimal groupPrice;
/**
* 拼团库存
*/
private Integer groupedNum;
/**
* 成团人数 最小为1
*/

View File

@@ -14,9 +14,6 @@ import com.mybatisflex.core.service.IService;
*/
public interface GbWareService extends IService<GbWare> {
//操作店铺功能开关
boolean upShopConfig(Integer status, Long shopId);
//拼团 活动 注意分店 主店的 问题
Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId);

View File

@@ -20,6 +20,8 @@ import java.util.Map;
*/
public interface GbOrderService extends IService<GbOrder> {
boolean upShopConfig(Integer status, Long shopId);
//列表 详细列表 detail的
Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param);

View File

@@ -14,7 +14,6 @@ import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
/**
@@ -29,13 +28,6 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
private ShopInfoService shopInfoService;
@CacheEvict(cacheNames = "shopInfo", key = "#shopId")
@Override
public boolean upShopConfig(Integer status, Long shopId) {
return false;
}
@Override
public Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId) {
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
@@ -88,6 +80,6 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
private void checkStatus(Long id) {
GbWare ware = getById(id);
AssertUtil.isNotEqual(ware.getOnlineStatus(), 1, "操作失败,请下架后,重试");
AssertUtil.isNotEqual(ware.getOnlineStatus(), 0, "操作失败,请下架后,重试");
}
}

View File

@@ -2,10 +2,13 @@ package com.czg.service.order.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.entity.ShopConfig;
import com.czg.account.entity.ShopInfo;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.ShopConfigService;
import com.czg.account.service.ShopInfoService;
import com.czg.account.service.ShopUserService;
import com.czg.constant.MarketConstants;
import com.czg.enums.OrderNoPrefixEnum;
import com.czg.enums.YesNoEnum;
import com.czg.exception.CzgException;
@@ -29,6 +32,7 @@ import com.czg.service.order.mapper.GbOrderMapper;
import com.czg.service.order.service.PayService;
import com.czg.utils.AssertUtil;
import com.czg.utils.CzgRandomUtils;
import com.czg.utils.FunUtils;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -38,6 +42,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -69,6 +74,21 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
@Lazy
private PayService payService;
@DubboReference
private ShopConfigService shopConfigService;
@CacheEvict(cacheNames = "shopInfo", key = "#shopId")
@Override
public boolean upShopConfig(Integer status, Long shopId) {
ShopConfig shopConfig = new ShopConfig();
shopConfig.setIsGroupBuy(status);
boolean update = shopConfigService.update(shopConfig, query().eq(ShopConfig::getId, shopId));
if (update && status == 0) {
shopDownRefund(shopId);
}
return update;
}
@Override
public Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param) {
Long mainIdByShopId = shopInfoService.getMainIdByShopId(param.getShopId());
@@ -133,7 +153,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
if (ware.getOnlineStatus() == 0) {
throw new CzgException("拼团失败,商品已下架");
}
if (ware.getLimitBuyNum() > param.getNumber()) {
if (ware.getLimitBuyNum() != MarketConstants.Num.NOT_LIMIT && ware.getLimitBuyNum() > param.getNumber()) {
throw new CzgException("拼团失败,该商品每人限购" + ware.getLimitBuyNum() + "");
}
if (StrUtil.isNotBlank(param.getGroupOrderNo())) {
@@ -383,7 +403,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
.eq(GbOrderDetail::getGroupOrderNo, gbOrder.getGroupOrderNo())
.ne(GbOrderDetail::getStatus, "已退款")
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value()));
details.forEach(item -> refundAmount(item, reason));
details.forEach(item -> FunUtils.safeRunVoid(() -> refundAmount(item, reason), "订单详情{}退款失败", item.getId()));
return true;
}