主开关
This commit is contained in:
@@ -34,7 +34,7 @@ public class GbWareController {
|
|||||||
@SaAdminCheckPermission(parentName = "拼团商品", value = "ware:info:up", name = "拼团商品-修改")
|
@SaAdminCheckPermission(parentName = "拼团商品", value = "ware:info:up", name = "拼团商品-修改")
|
||||||
public CzgResult<Boolean> upShopConfig(@RequestBody GbWareDTO param) {
|
public CzgResult<Boolean> upShopConfig(@RequestBody GbWareDTO param) {
|
||||||
AssertUtil.isNull(param.getOnlineStatus(), "操作失败,请选择状态");
|
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")
|
@GetMapping("/getGbWarePage")
|
||||||
|
|||||||
@@ -119,6 +119,12 @@ public class ShopConfig implements Serializable {
|
|||||||
* 上菜时间 分钟
|
* 上菜时间 分钟
|
||||||
*/
|
*/
|
||||||
private Integer serveTime;
|
private Integer serveTime;
|
||||||
|
/**
|
||||||
|
* 拼团开关 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isGroupBuy;
|
||||||
|
|
||||||
|
|
||||||
private String dingAppKey;
|
private String dingAppKey;
|
||||||
private String dingAppSecret;
|
private String dingAppSecret;
|
||||||
|
|
||||||
|
|||||||
@@ -350,6 +350,8 @@ public class ShopInfo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
private Integer serveTime;
|
private Integer serveTime;
|
||||||
|
@Column(ignore = true)
|
||||||
|
private Integer isGroupBuy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营端余额
|
* 运营端余额
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ public class GbWare implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal groupPrice;
|
private BigDecimal groupPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Integer groupedNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成团人数 最小为1
|
* 成团人数 最小为1
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ import com.mybatisflex.core.service.IService;
|
|||||||
*/
|
*/
|
||||||
public interface GbWareService extends IService<GbWare> {
|
public interface GbWareService extends IService<GbWare> {
|
||||||
|
|
||||||
//操作店铺功能开关
|
|
||||||
boolean upShopConfig(Integer status, Long shopId);
|
|
||||||
|
|
||||||
//拼团 活动 注意分店 主店的 问题
|
//拼团 活动 注意分店 主店的 问题
|
||||||
Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId);
|
Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface GbOrderService extends IService<GbOrder> {
|
public interface GbOrderService extends IService<GbOrder> {
|
||||||
|
|
||||||
|
boolean upShopConfig(Integer status, Long shopId);
|
||||||
|
|
||||||
//列表 详细列表 detail的
|
//列表 详细列表 detail的
|
||||||
Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param);
|
Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import com.mybatisflex.core.paginate.Page;
|
|||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,13 +28,6 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
|
|||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
|
|
||||||
|
|
||||||
@CacheEvict(cacheNames = "shopInfo", key = "#shopId")
|
|
||||||
@Override
|
|
||||||
public boolean upShopConfig(Integer status, Long shopId) {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId) {
|
public Page<GbWare> getGbWarePage(GbWareQueryParamDTO param, Long shopId) {
|
||||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||||
@@ -88,6 +80,6 @@ public class GbWareServiceImpl extends ServiceImpl<GbWareMapper, GbWare> impleme
|
|||||||
|
|
||||||
private void checkStatus(Long id) {
|
private void checkStatus(Long id) {
|
||||||
GbWare ware = getById(id);
|
GbWare ware = getById(id);
|
||||||
AssertUtil.isNotEqual(ware.getOnlineStatus(), 1, "操作失败,请下架后,重试");
|
AssertUtil.isNotEqual(ware.getOnlineStatus(), 0, "操作失败,请下架后,重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package com.czg.service.order.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.entity.ShopConfig;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
|
import com.czg.account.service.ShopConfigService;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
|
import com.czg.constant.MarketConstants;
|
||||||
import com.czg.enums.OrderNoPrefixEnum;
|
import com.czg.enums.OrderNoPrefixEnum;
|
||||||
import com.czg.enums.YesNoEnum;
|
import com.czg.enums.YesNoEnum;
|
||||||
import com.czg.exception.CzgException;
|
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.service.order.service.PayService;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.utils.CzgRandomUtils;
|
import com.czg.utils.CzgRandomUtils;
|
||||||
|
import com.czg.utils.FunUtils;
|
||||||
import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
@@ -38,6 +42,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -69,6 +74,21 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
|||||||
@Lazy
|
@Lazy
|
||||||
private PayService payService;
|
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
|
@Override
|
||||||
public Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param) {
|
public Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param) {
|
||||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(param.getShopId());
|
Long mainIdByShopId = shopInfoService.getMainIdByShopId(param.getShopId());
|
||||||
@@ -133,7 +153,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
|||||||
if (ware.getOnlineStatus() == 0) {
|
if (ware.getOnlineStatus() == 0) {
|
||||||
throw new CzgException("拼团失败,商品已下架");
|
throw new CzgException("拼团失败,商品已下架");
|
||||||
}
|
}
|
||||||
if (ware.getLimitBuyNum() > param.getNumber()) {
|
if (ware.getLimitBuyNum() != MarketConstants.Num.NOT_LIMIT && ware.getLimitBuyNum() > param.getNumber()) {
|
||||||
throw new CzgException("拼团失败,该商品每人限购" + ware.getLimitBuyNum() + "份");
|
throw new CzgException("拼团失败,该商品每人限购" + ware.getLimitBuyNum() + "份");
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(param.getGroupOrderNo())) {
|
if (StrUtil.isNotBlank(param.getGroupOrderNo())) {
|
||||||
@@ -383,7 +403,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
|||||||
.eq(GbOrderDetail::getGroupOrderNo, gbOrder.getGroupOrderNo())
|
.eq(GbOrderDetail::getGroupOrderNo, gbOrder.getGroupOrderNo())
|
||||||
.ne(GbOrderDetail::getStatus, "已退款")
|
.ne(GbOrderDetail::getStatus, "已退款")
|
||||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value()));
|
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value()));
|
||||||
details.forEach(item -> refundAmount(item, reason));
|
details.forEach(item -> FunUtils.safeRunVoid(() -> refundAmount(item, reason), "订单详情{}退款失败", item.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user