promotion:去除已经不使用的代码
parent
a778c25075
commit
054569a3d3
@ -1,10 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.api.combination;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼团活动 Api 接口
|
|
||||||
*
|
|
||||||
* @author HUIHUI
|
|
||||||
*/
|
|
||||||
public interface CombinationActivityApi {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.api.price;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 价格 API 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface PriceApi {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算商品的价格
|
|
||||||
*
|
|
||||||
* @param calculateReqDTO 价格请求
|
|
||||||
* @return 价格相应
|
|
||||||
*/
|
|
||||||
PriceCalculateRespDTO calculatePrice(PriceCalculateReqDTO calculateReqDTO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.api.price.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 价格计算 Request DTO
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Deprecated
|
|
||||||
public class PriceCalculateReqDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户编号
|
|
||||||
*
|
|
||||||
* 对应 MemberUserDO 的 id 编号
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠劵编号
|
|
||||||
*/
|
|
||||||
private Long couponId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 收货地址编号
|
|
||||||
*/
|
|
||||||
private Long addressId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品 SKU 数组
|
|
||||||
*/
|
|
||||||
@NotNull(message = "商品数组不能为空")
|
|
||||||
private List<Item> items;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品 SKU
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public static class Item {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SKU 编号
|
|
||||||
*/
|
|
||||||
@NotNull(message = "商品 SKU 编号不能为空")
|
|
||||||
private Long skuId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SKU 数量
|
|
||||||
*/
|
|
||||||
@NotNull(message = "商品 SKU 数量不能为空")
|
|
||||||
@Min(value = 0L, message = "商品 SKU 数量必须大于等于 0") // 可传递 0 数量,用于购物车未选中的情况
|
|
||||||
private Integer count;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.api.combination;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼团活动 Api 接口实现类
|
|
||||||
*
|
|
||||||
* @author HUIHUI
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CombinationActivityApiImpl implements CombinationActivityApi {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.api.price;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.service.price.PriceService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 价格 API 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class PriceApiImpl implements PriceApi {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private PriceService priceService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PriceCalculateRespDTO calculatePrice(PriceCalculateReqDTO calculateReqDTO) {
|
|
||||||
//return priceService.calculatePrice(calculateReqDTO); TODO 没有 calculatePrice 这个方法
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.convert.price;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.CouponMeetRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PriceConvert {
|
|
||||||
|
|
||||||
PriceConvert INSTANCE = Mappers.getMapper(PriceConvert.class);
|
|
||||||
|
|
||||||
default PriceCalculateRespDTO convert(PriceCalculateReqDTO calculateReqDTO, List<ProductSkuRespDTO> skuList) {
|
|
||||||
// 创建 PriceCalculateRespDTO 对象
|
|
||||||
PriceCalculateRespDTO priceCalculate = new PriceCalculateRespDTO();
|
|
||||||
// 创建它的 Order 属性
|
|
||||||
PriceCalculateRespDTO.Order order = new PriceCalculateRespDTO.Order().setTotalPrice(0).setDiscountPrice(0)
|
|
||||||
.setCouponPrice(0).setPointPrice(0).setDeliveryPrice(0).setPayPrice(0)
|
|
||||||
.setItems(new ArrayList<>()).setCouponId(calculateReqDTO.getCouponId());
|
|
||||||
priceCalculate.setOrder(order).setPromotions(new ArrayList<>());
|
|
||||||
// 创建它的 OrderItem 属性
|
|
||||||
Map<Long, Integer> skuIdCountMap = CollectionUtils.convertMap(calculateReqDTO.getItems(),
|
|
||||||
PriceCalculateReqDTO.Item::getSkuId, PriceCalculateReqDTO.Item::getCount);
|
|
||||||
skuList.forEach(sku -> {
|
|
||||||
Integer count = skuIdCountMap.get(sku.getId());
|
|
||||||
PriceCalculateRespDTO.OrderItem orderItem = new PriceCalculateRespDTO.OrderItem()
|
|
||||||
.setSpuId(sku.getSpuId()).setSkuId(sku.getId()).setCount(count)
|
|
||||||
.setOriginalUnitPrice(sku.getPrice()).setOriginalPrice(sku.getPrice() * count)
|
|
||||||
.setDiscountPrice(0).setOrderPartPrice(0);
|
|
||||||
orderItem.setPayPrice(orderItem.getOriginalPrice()).setOrderDividePrice(orderItem.getOriginalPrice());
|
|
||||||
priceCalculate.getOrder().getItems().add(orderItem);
|
|
||||||
// 补充价格信息到 Order 中
|
|
||||||
order.setTotalPrice(order.getTotalPrice() + orderItem.getOriginalPrice())
|
|
||||||
.setPayPrice(order.getTotalPrice());
|
|
||||||
});
|
|
||||||
return priceCalculate;
|
|
||||||
}
|
|
||||||
|
|
||||||
CouponMeetRespDTO convert(CouponDO coupon);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.service.price;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.CouponMeetRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 价格计算 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface PriceService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得优惠劵的匹配信息列表
|
|
||||||
*
|
|
||||||
* @param calculateReqDTO 价格请求
|
|
||||||
* @return 价格响应
|
|
||||||
*/
|
|
||||||
List<CouponMeetRespDTO> getMeetCouponList(PriceCalculateReqDTO calculateReqDTO);
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue