主开关
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user