退款模式
This commit is contained in:
@@ -226,17 +226,6 @@ public class ProductController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-退款退至库存 开关
|
||||
*/
|
||||
@PostMapping("refundToStock")
|
||||
@OperationLog("商品-退款退至库存")
|
||||
//@SaAdminCheckPermission("product:update")
|
||||
public CzgResult<Void> refundToStock(@RequestBody @Validated({DefaultGroup.class}) ProdRefundToStockParam param) {
|
||||
productService.refundToStock(param);
|
||||
asyncProductToShop(param.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-报损
|
||||
|
||||
@@ -143,25 +143,11 @@ public class ShopProdCategoryController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
@PostMapping("upRefundStock")
|
||||
@OperationLog("商品分类-退菜退库存")
|
||||
public CzgResult<Void> enableShopProdCategory(ShopProdCategoryDTO dto) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(dto, "{}不能为空", "id");
|
||||
shopProdCategoryService.upRefundStock(dto.getId(),dto.getIsRefundStock());
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncCategoryBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
ThreadUtil.execAsync(() -> shopSyncService.syncCategoryBySourceShop(shopId, id, sysUserId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import java.io.Serial;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 商品 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProductDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private Long specId;
|
||||
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 短标题--促销语
|
||||
*/
|
||||
private String shortTitle;
|
||||
|
||||
/**
|
||||
* 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 0 固定套餐 1可选套餐
|
||||
*/
|
||||
private Integer groupType;
|
||||
|
||||
/**
|
||||
* 包装费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
private String coverImg;
|
||||
|
||||
/**
|
||||
* 商品图片(第一张为缩略图,其他为详情)
|
||||
*/
|
||||
private String images;
|
||||
|
||||
/**
|
||||
* 套餐内容
|
||||
*/
|
||||
private String groupSnap;
|
||||
|
||||
/**
|
||||
* 库存警戒线
|
||||
*/
|
||||
private Integer warnLine;
|
||||
|
||||
/**
|
||||
* 称重 价格/千克
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 是否允许临时改价
|
||||
*/
|
||||
private Integer isAllowTempModifyPrice;
|
||||
|
||||
/**
|
||||
* 周 数组 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday'
|
||||
*/
|
||||
private String days;
|
||||
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private Time startTime;
|
||||
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private Time endTime;
|
||||
|
||||
/**
|
||||
* 规格选详情
|
||||
*/
|
||||
private String selectSpecInfo;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否热销
|
||||
*/
|
||||
private Integer isHot;
|
||||
|
||||
/**
|
||||
* 是否开启库存
|
||||
*/
|
||||
private Integer isStock;
|
||||
|
||||
/**
|
||||
* 是否售罄
|
||||
*/
|
||||
private Integer isSoldStock;
|
||||
|
||||
/**
|
||||
* 团购卷分类,可有多个分类
|
||||
*/
|
||||
private String groupCategoryId;
|
||||
|
||||
/**
|
||||
* 商品级库存数量
|
||||
*/
|
||||
private Integer stockNumber;
|
||||
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
private Boolean isSale;
|
||||
|
||||
/**
|
||||
* 退款是否退回库存
|
||||
*/
|
||||
private Boolean isRefundStock;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
private Integer isDel;
|
||||
|
||||
}
|
||||
@@ -172,10 +172,7 @@ public class ProductDTO implements Serializable {
|
||||
*/
|
||||
@NotNull(message = "是否上架不能为空", groups = DefaultGroup.class)
|
||||
private Integer isSale;
|
||||
/**
|
||||
* 退款是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -84,8 +84,4 @@ public class ShopProdCategoryDTO implements Serializable {
|
||||
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||
*/
|
||||
private Integer refundMode;
|
||||
/**
|
||||
* 退菜是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
}
|
||||
@@ -134,10 +134,6 @@ public class Product implements Serializable {
|
||||
* 是否上架
|
||||
*/
|
||||
private Integer isSale;
|
||||
/**
|
||||
* 退款是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
/**
|
||||
* 相关推荐
|
||||
*/
|
||||
|
||||
@@ -68,10 +68,6 @@ public class ShopProdCategory implements Serializable {
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 退菜是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
/**
|
||||
* 退菜是否退库存 1退菜退库存 2仅退菜不退库存 3每次询问-退菜后弹窗提示
|
||||
*/
|
||||
|
||||
@@ -104,14 +104,6 @@ public interface ProductService extends IService<Product> {
|
||||
*/
|
||||
void markProductIsAutoSoldOut(Long shopId, ProductIsAutoSaleParam param);
|
||||
|
||||
/**
|
||||
* 退货到库存
|
||||
*
|
||||
* @param param 退货到库存参数
|
||||
*/
|
||||
void refundToStock(ProdRefundToStockParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 商品报损
|
||||
*
|
||||
|
||||
@@ -83,8 +83,4 @@ public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
||||
*/
|
||||
void enableShopProdCategory(Long id);
|
||||
|
||||
/**
|
||||
* 编辑店铺商品分类的退款库存开关
|
||||
*/
|
||||
void upRefundStock(Long id,Integer isRefundStock);
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import com.czg.config.RedisCst;
|
||||
import com.czg.constant.MarketConstants;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.constants.PayTypeConstants;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||
import com.czg.enums.ShopTableStatusEnum;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
@@ -1841,7 +1840,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
*/
|
||||
@Override
|
||||
public void refundStock(ShopInfo shopInfo, Long orderId, Map<Long, BigDecimal> products, boolean refundStock) {
|
||||
List<Product> list = productService.list(new QueryWrapper().select(Product::getId, Product::getCategoryId, Product::getRefundMode, Product::getIsRefundStock)
|
||||
List<Product> list = productService.list(new QueryWrapper().select(Product::getId, Product::getCategoryId, Product::getRefundMode)
|
||||
.eq(Product::getShopId, shopInfo.getId())
|
||||
.in(Product::getId, products.keySet()));
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
@@ -1855,7 +1854,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
//分类
|
||||
if (!categoryMap.containsKey(product.getCategoryId())) {
|
||||
refundMode = shopProdCategoryService.getOneAs(new QueryWrapper().select(ShopProdCategory::getRefundMode)
|
||||
.eq(ShopProdCategory::getShopId, shopInfo.getId()).eq(ShopProdCategory::getIsRefundStock, SystemConstants.OneZero.ONE)
|
||||
.eq(ShopProdCategory::getShopId, shopInfo.getId())
|
||||
.eq(ShopProdCategory::getId, product.getCategoryId()), Integer.class);
|
||||
if (refundMode == null) {
|
||||
refundMode = 2;
|
||||
@@ -1866,11 +1865,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
}
|
||||
} else if (shopInfo.getRefundMode().equals(2)) {
|
||||
//单商品
|
||||
if (product.getIsRefundStock().equals(SystemConstants.OneZero.ONE)) {
|
||||
refundMode = product.getRefundMode();
|
||||
} else {
|
||||
refundMode = 2;
|
||||
}
|
||||
refundMode = 2;
|
||||
} else {
|
||||
log.error("退菜模式错误 店铺{},退款模式{},商品Id{}分类Id{}", shopInfo.getShopName(), shopInfo.getRefundMode(), product.getId(), product.getCategoryId());
|
||||
throw new CzgException("退菜模式错误");
|
||||
|
||||
@@ -714,17 +714,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
update(update, query().eq(Product::getId, param.getId()).eq(Product::getShopId, shopId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refundToStock(ProdRefundToStockParam param) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Product entity = super.getOne(query().eq(Product::getId, param.getId()).eq(Product::getShopId, shopId));
|
||||
if (entity == null) {
|
||||
throw new CzgException("商品不存在");
|
||||
}
|
||||
entity.setIsRefundStock(param.getIsReturn());
|
||||
super.updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -148,15 +148,4 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
|
||||
update(prodCategory, query().eq(ShopProdCategory::getId, id).eq(ShopProdCategory::getShopId, shopId));
|
||||
productService.clearProductCache(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void upRefundStock(Long id, Integer isRefundStock) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
ShopProdCategory prodCategory = new ShopProdCategory();
|
||||
prodCategory.setIsRefundStock(isRefundStock);
|
||||
update(prodCategory, query().eq(ShopProdCategory::getId, id).eq(ShopProdCategory::getShopId, shopId));
|
||||
productService.clearProductCache(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.enums.BranchDataSyncMethodEnum;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.SyncNoticeService;
|
||||
import com.czg.constant.CacheConstant;
|
||||
import com.czg.exception.CzgException;
|
||||
@@ -73,8 +72,6 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
||||
@Resource
|
||||
private ProductRpcService productRpcService;
|
||||
@Resource
|
||||
private ShopUserService shopUserService;
|
||||
@Resource
|
||||
private ShopVendorService vendorService;
|
||||
@DubboReference
|
||||
private ShopCouponService couponService;
|
||||
@@ -658,7 +655,6 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
||||
newEntity.setIsHot(null);
|
||||
newEntity.setIsSoldStock(null);
|
||||
newEntity.setIsSale(null);
|
||||
newEntity.setIsRefundStock(null);
|
||||
productService.updateById(newEntity);
|
||||
} else {
|
||||
newEntity.setId(null);
|
||||
|
||||
Reference in New Issue
Block a user