代码生成功能中,点击同步,会清除已添加并存在的字段
This commit is contained in:
parent
29fff03f93
commit
e5c4c747a4
@ -154,12 +154,12 @@ public class CodegenServiceImpl implements CodegenService {
|
||||
// 构建 CodegenColumnDO 数组,只同步新增的字段
|
||||
List<CodegenColumnDO> codegenColumns = codegenColumnMapper.selectListByTableId(tableId);
|
||||
Set<String> codegenColumnNames = CollectionUtils.convertSet(codegenColumns, CodegenColumnDO::getColumnName);
|
||||
// 移除已经存在的字段
|
||||
tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()));
|
||||
// 计算需要删除的字段
|
||||
Set<String> tableFieldNames = CollectionUtils.convertSet(tableFields, TableField::getName);
|
||||
Set<Long> deleteColumnIds = codegenColumns.stream().filter(column -> !tableFieldNames.contains(column.getColumnName()))
|
||||
.map(CodegenColumnDO::getId).collect(Collectors.toSet());
|
||||
// 移除已经存在的字段
|
||||
tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()));
|
||||
if (CollUtil.isEmpty(tableFields) && CollUtil.isEmpty(deleteColumnIds)) {
|
||||
throw exception(CODEGEN_SYNC_NONE_CHANGE);
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.price;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* Title:
|
||||
* Description:
|
||||
*
|
||||
* @author zhuyang
|
||||
* @version 1.0 2021/10/9
|
||||
*/
|
||||
@FeignClient("promotion-service")
|
||||
public interface PriceFeign {
|
||||
@PostMapping("/promotion/price/calcProductPrice")
|
||||
public CommonResult<PriceProductCalcRespDTO> calcProductPrice(@RequestBody PriceProductCalcReqDTO calcReqDTO) ;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.price.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品价格计算 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PriceProductCalcReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 优惠劵编号
|
||||
*/
|
||||
private Integer couponCardId;
|
||||
|
||||
/**
|
||||
* 商品 SKU 数组
|
||||
*/
|
||||
@NotNull(message = "商品数组不能为空")
|
||||
private List<Item> items;
|
||||
|
||||
/**
|
||||
* 商品 SKU
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Item implements Serializable {
|
||||
|
||||
/**
|
||||
* SKU 编号
|
||||
*/
|
||||
@NotNull(message = "商品 SKU 编号不能为空")
|
||||
private Integer skuId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@NotNull(message = "商品 SKU 数量不能为空")
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
@NotNull(message = "是否选中不能为空")
|
||||
private Boolean selected;
|
||||
|
||||
public Item() {
|
||||
}
|
||||
|
||||
public Item(Integer skuId, Integer quantity, Boolean selected) {
|
||||
this.skuId = skuId;
|
||||
this.quantity = quantity;
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,200 +0,0 @@
|
||||
package cn.iocoder.mall.promotion.api.rpc.price.dto;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品价格计算 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PriceProductCalcRespDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 商品分组数组
|
||||
*/
|
||||
private List<ItemGroup> itemGroups;
|
||||
/**
|
||||
* 优惠劵编号
|
||||
*/
|
||||
private Integer couponCardId;
|
||||
/**
|
||||
* 优惠劵减少的金额
|
||||
*
|
||||
* 1. 若未使用优惠劵,返回 null
|
||||
* 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
|
||||
*/
|
||||
private Integer couponCardDiscountTotal;
|
||||
/**
|
||||
* 邮费信息
|
||||
*
|
||||
* TODO 芋艿,暂时未弄
|
||||
*/
|
||||
private Postage postage;
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
private Fee fee;
|
||||
|
||||
/**
|
||||
* 商品分组
|
||||
*
|
||||
* 多个商品,参加同一个活动,从而形成分组。
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class ItemGroup implements Serializable {
|
||||
|
||||
/**
|
||||
* 优惠活动
|
||||
*
|
||||
* 目前会有满减送 {@link PromotionActivityTypeEnum#FULL_PRIVILEGE} 类型的活动
|
||||
*
|
||||
* // TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组
|
||||
*/
|
||||
private Integer activityId;
|
||||
/**
|
||||
* 促销减少的金额
|
||||
*
|
||||
* 1. 若未参与促销活动,或不满足促销条件,返回 null
|
||||
* 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
|
||||
*/
|
||||
private Integer activityDiscountTotal;
|
||||
/**
|
||||
* 商品数组
|
||||
*/
|
||||
private List<Item> items;
|
||||
// /**
|
||||
// * 费用
|
||||
// *
|
||||
// * TODO 芋艿,这里先偷懒,postageTotal 字段用不到。
|
||||
// */
|
||||
// private Fee fee; // 注释原因,不用这里了
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Item implements Serializable {
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号
|
||||
*/
|
||||
private Integer spuId;
|
||||
/**
|
||||
* 商品 SKU 编号
|
||||
*/
|
||||
private Integer skuId;
|
||||
/**
|
||||
* 商品 Category 编号
|
||||
*/
|
||||
private Integer cid;
|
||||
|
||||
// 非 SKU 自带信息
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
private Boolean selected;
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
private Integer buyQuantity;
|
||||
/**
|
||||
* 优惠活动
|
||||
*
|
||||
* 目前会有限时折扣 {@link PromotionActivityTypeEnum#TIME_LIMITED_DISCOUNT} 类型的活动
|
||||
*/
|
||||
private Integer activityId;
|
||||
/**
|
||||
* 原始单价,单位:分。
|
||||
*/
|
||||
private Integer originPrice;
|
||||
/**
|
||||
* 购买单价,单位:分
|
||||
*/
|
||||
private Integer buyPrice;
|
||||
/**
|
||||
* 最终价格,单位:分。
|
||||
*/
|
||||
private Integer presentPrice;
|
||||
/**
|
||||
* 购买总金额,单位:分
|
||||
*
|
||||
* 用途类似 {@link #presentTotal}
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总金额,单位:分。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 最终总金额,单位:分。
|
||||
*
|
||||
* 注意,presentPrice * quantity 不一定等于 presentTotal 。
|
||||
* 因为,存在无法整除的情况。
|
||||
* 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
|
||||
* 所以,需要存储一个该字段。
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用(合计)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Fee implements Serializable {
|
||||
|
||||
/**
|
||||
* 购买总价
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总价
|
||||
*
|
||||
* 注意,满多少元包邮,不算在优惠中。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 邮费 TODO 芋艿,将 postage 改成 logistics
|
||||
*/
|
||||
private Integer postageTotal;
|
||||
/**
|
||||
* 最终价格
|
||||
*
|
||||
* 计算公式 = 总价 - 优惠总价 + 邮费
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
public Fee() {
|
||||
}
|
||||
|
||||
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
|
||||
this.buyTotal = buyTotal;
|
||||
this.discountTotal = discountTotal;
|
||||
this.postageTotal = postageTotal;
|
||||
this.presentTotal = presentTotal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮费信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Postage implements Serializable {
|
||||
|
||||
/**
|
||||
* 需要满足多少钱,可以包邮。单位:分
|
||||
*/
|
||||
private Integer threshold;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.shopweb.controller.trade.vo.cart.CartDetailVO;
|
||||
import cn.iocoder.mall.shopweb.service.trade.CartManager;
|
||||
import cn.iocoder.security.annotations.RequiresAuthenticate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@Api(tags = "购物车 API")
|
||||
@RestController
|
||||
@RequestMapping("/cart")
|
||||
@Validated
|
||||
public class CartController {
|
||||
|
||||
@Autowired
|
||||
private CartManager cartManager;
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation("添加商品到购物车")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Boolean> addCartItem(@RequestParam("skuId") Integer skuId,
|
||||
@RequestParam("quantity") Integer quantity) {
|
||||
cartManager.addCartItem(UserSecurityContextHolder.getUserId(), skuId, quantity);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("sum-quantity")
|
||||
@ApiOperation("查询用户在购物车中的商品数量")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Integer> sumCartItemQuantity() {
|
||||
return success(cartManager.sumCartItemQuantity(UserSecurityContextHolder.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/get-detail")
|
||||
@ApiOperation("查询用户的购物车的商品列表")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<CartDetailVO> getCartDetail() {
|
||||
return success(cartManager.getCartDetail(UserSecurityContextHolder.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("update-quantity")
|
||||
@ApiOperation("更新购物车商品数量")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Boolean> updateCartItemQuantity(@RequestParam("skuId") Integer skuId,
|
||||
@RequestParam("quantity") Integer quantity) {
|
||||
cartManager.updateCartItemQuantity(UserSecurityContextHolder.getUserId(), skuId, quantity);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("update-selected")
|
||||
@ApiOperation("更新购物车商品是否选中")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuIds", value = "商品 SKU 编号数组", required = true, example = "1,3"),
|
||||
@ApiImplicitParam(name = "selected", value = "是否选中", required = true, example = "true")
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Boolean> updateCartItemSelected(@RequestParam("skuIds") Set<Integer> skuIds,
|
||||
@RequestParam("selected") Boolean selected) {
|
||||
cartManager.updateCartItemSelected(UserSecurityContextHolder.getUserId(), skuIds, selected);
|
||||
// 获得目前购物车明细
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
### /trade-order/confirm-create-order-info 基于商品,确认创建订单
|
||||
GET {{shop-api-base-url}}/trade-order/confirm-create-order-info?skuId=33&quantity=1
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
|
||||
### /trade-order/confirm-create-order-info-from-cart 基于购物车,确认创建订单
|
||||
GET {{shop-api-base-url}}/trade-order/confirm-create-order-info-from-cart
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
|
||||
### /trade-order/confirm-create-order-info-from-cart 基于商品,创建订单
|
||||
POST {{shop-api-base-url}}/trade-order/create
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
|
||||
{
|
||||
"userAddressId": 19,
|
||||
"remark": "我是备注",
|
||||
"orderItems": [
|
||||
{
|
||||
"skuId": 3,
|
||||
"quantity": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
### /trade-order/page 获得订单交易分页
|
||||
GET {{shop-api-base-url}}/trade-order/page?status=1&pageNo=1&pageSize=10
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
###
|
@ -1,84 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade;
|
||||
|
||||
import cn.iocoder.common.framework.util.HttpUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.shopweb.controller.trade.vo.order.*;
|
||||
import cn.iocoder.mall.shopweb.service.trade.TradeOrderService;
|
||||
import cn.iocoder.security.annotations.RequiresAuthenticate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@Api(tags = "交易订单 API")
|
||||
@RestController
|
||||
@RequestMapping("/trade-order")
|
||||
@Validated
|
||||
public class TradeOrderController {
|
||||
|
||||
@Autowired
|
||||
private TradeOrderService tradeOrderService;
|
||||
|
||||
@GetMapping("confirm-create-order-info")
|
||||
@ApiOperation("基于商品,确认创建订单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "skuId", required = true, value = "商品 SKU 编号", example = "1024"),
|
||||
@ApiImplicitParam(name = "quantity", required = true, value = "购买数量", example = "2"),
|
||||
@ApiImplicitParam(name = "couponCardId", value = "优惠劵编号", example = "1"),
|
||||
})
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<TradeOrderConfirmCreateInfoRespVO> getTradeOrderConfirmCreateInfo(
|
||||
@RequestParam("skuId") Integer skuId,
|
||||
@RequestParam("quantity") Integer quantity,
|
||||
@RequestParam(value = "couponCardId", required = false) Integer couponCardId) {
|
||||
return success(tradeOrderService.getOrderConfirmCreateInfo(UserSecurityContextHolder.getUserId(), skuId, quantity, couponCardId));
|
||||
}
|
||||
|
||||
@GetMapping("confirm-create-order-info-from-cart")
|
||||
@ApiOperation("基于购物车,确认创建订单")
|
||||
@ApiImplicitParam(name = "couponCardId", value = "优惠劵编号", example = "1")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<TradeOrderConfirmCreateInfoRespVO> getTradeOrderConfirmCreateInfoFromCart(
|
||||
@RequestParam(value = "couponCardId", required = false) Integer couponCardId) {
|
||||
return success(tradeOrderService.getOrderConfirmCreateInfoFromCart(UserSecurityContextHolder.getUserId(), couponCardId));
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
@ApiOperation("基于商品,创建订单")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Integer> createTradeOrder(@RequestBody TradeOrderCreateReqVO createReqVO,
|
||||
HttpServletRequest servletRequest) {
|
||||
return success(tradeOrderService.createTradeOrder(UserSecurityContextHolder.getUserId(),
|
||||
HttpUtil.getIp(servletRequest), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("create-from-cart")
|
||||
@ApiOperation("基于购物车,创建订单")
|
||||
@RequiresAuthenticate
|
||||
public CommonResult<Integer> createTradeOrder(TradeOrderCreateFromCartReqVO createReqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得交易订单")
|
||||
@ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true)
|
||||
public CommonResult<TradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
|
||||
return success(tradeOrderService.getTradeOrder(tradeOrderId));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得订单交易分页")
|
||||
public CommonResult<PageResult<TradeOrderRespVO>> pageTradeOrder(TradeOrderPageReqVO pageVO) {
|
||||
return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO));
|
||||
}
|
||||
|
||||
}
|
@ -1,213 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.cart;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO;
|
||||
import cn.iocoder.mall.shopweb.controller.product.vo.attr.ProductAttrKeyValueRespVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "用户的购物车明细 Response VO") // TODO 芋艿:swagger 文档完善
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CartDetailVO {
|
||||
|
||||
/**
|
||||
* 商品分组数组
|
||||
*/
|
||||
private List<ItemGroup> itemGroups;
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
private Fee fee;
|
||||
|
||||
/**
|
||||
* 商品分组
|
||||
*
|
||||
* 多个商品,参加同一个活动,从而形成分组。
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class ItemGroup {
|
||||
|
||||
/**
|
||||
* 优惠活动
|
||||
*/
|
||||
private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
|
||||
/**
|
||||
* 促销减少的金额
|
||||
*
|
||||
* 1. 若未参与促销活动,或不满足促销条件,返回 null
|
||||
* 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
|
||||
*/
|
||||
private Integer activityDiscountTotal;
|
||||
/**
|
||||
* 商品数组
|
||||
*/
|
||||
private List<Sku> items;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Sku {
|
||||
|
||||
// SKU 自带信息
|
||||
/**
|
||||
* sku 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* SPU 信息
|
||||
*/
|
||||
private Spu spu;
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String picURL;
|
||||
/**
|
||||
* 规格值数组
|
||||
*/
|
||||
private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
// 非 SKU 自带信息
|
||||
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
private Integer buyQuantity;
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
private Boolean selected;
|
||||
/**
|
||||
* 优惠活动
|
||||
*/
|
||||
private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
|
||||
/**
|
||||
* 原始单价,单位:分。
|
||||
*/
|
||||
private Integer originPrice;
|
||||
/**
|
||||
* 购买单价,单位:分
|
||||
*/
|
||||
private Integer buyPrice;
|
||||
/**
|
||||
* 最终价格,单位:分。
|
||||
*/
|
||||
private Integer presentPrice;
|
||||
/**
|
||||
* 购买总金额,单位:分
|
||||
*
|
||||
* 用途类似 {@link #presentTotal}
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总金额,单位:分。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 最终总金额,单位:分。
|
||||
*
|
||||
* 注意,presentPrice * quantity 不一定等于 presentTotal 。
|
||||
* 因为,存在无法整除的情况。
|
||||
* 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
|
||||
* 所以,需要存储一个该字段。
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Spu {
|
||||
|
||||
/**
|
||||
* SPU 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
/**
|
||||
* SPU 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer cid;
|
||||
/**
|
||||
* 商品主图地址
|
||||
*
|
||||
* 数组,以逗号分隔
|
||||
*
|
||||
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
|
||||
*/
|
||||
private List<String> picUrls;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用(合计)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Fee {
|
||||
|
||||
/**
|
||||
* 购买总价
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总价
|
||||
*
|
||||
* 注意,满多少元包邮,不算在优惠中。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 邮费
|
||||
*/
|
||||
private Integer postageTotal;
|
||||
/**
|
||||
* 最终价格
|
||||
*
|
||||
* 计算公式 = 总价 - 优惠总价 + 邮费
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
public Fee() {
|
||||
}
|
||||
|
||||
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
|
||||
this.buyTotal = buyTotal;
|
||||
this.discountTotal = discountTotal;
|
||||
this.postageTotal = postageTotal;
|
||||
this.presentTotal = presentTotal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮费信息 TODO 芋艿,未完成
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Postage {
|
||||
|
||||
/**
|
||||
* 需要满足多少钱,可以包邮。单位:分
|
||||
*/
|
||||
private Integer threshold;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableRespDTO;
|
||||
import cn.iocoder.mall.shopweb.controller.trade.vo.cart.CartDetailVO;
|
||||
import cn.iocoder.mall.shopweb.controller.product.vo.attr.ProductAttrKeyValueRespVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "订单确认创建信息 Response VO") // TODO 芋艿:swagger 文档完善
|
||||
@Data
|
||||
@Accessors(chain = true) // TODO 芋艿:和 CartDetailVO、ProductSkuCalcPriceRespVO 有点重复,后续要优化下;
|
||||
public class TradeOrderConfirmCreateInfoRespVO {
|
||||
|
||||
/**
|
||||
* 商品分组数组
|
||||
*/
|
||||
private List<ItemGroup> itemGroups;
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
private Fee fee;
|
||||
|
||||
/**
|
||||
* 优惠劵列表 TODO 芋艿,后续改改
|
||||
*/
|
||||
private List<CouponCardAvailableRespDTO> couponCards;
|
||||
|
||||
/**
|
||||
* 商品分组
|
||||
*
|
||||
* 多个商品,参加同一个活动,从而形成分组。
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class ItemGroup {
|
||||
|
||||
/**
|
||||
* 优惠活动
|
||||
*/
|
||||
private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
|
||||
/**
|
||||
* 促销减少的金额
|
||||
*
|
||||
* 1. 若未参与促销活动,或不满足促销条件,返回 null
|
||||
* 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
|
||||
*/
|
||||
private Integer activityDiscountTotal;
|
||||
/**
|
||||
* 商品数组
|
||||
*/
|
||||
private List<CartDetailVO.Sku> items;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Sku {
|
||||
|
||||
// SKU 自带信息
|
||||
/**
|
||||
* sku 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* SPU 信息
|
||||
*/
|
||||
private Spu spu;
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String picURL;
|
||||
/**
|
||||
* 规格值数组
|
||||
*/
|
||||
private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
// 非 SKU 自带信息
|
||||
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
private Integer buyQuantity;
|
||||
/**
|
||||
* 优惠活动
|
||||
*/
|
||||
private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
|
||||
/**
|
||||
* 原始单价,单位:分。
|
||||
*/
|
||||
private Integer originPrice;
|
||||
/**
|
||||
* 购买单价,单位:分
|
||||
*/
|
||||
private Integer buyPrice;
|
||||
/**
|
||||
* 最终价格,单位:分。
|
||||
*/
|
||||
private Integer presentPrice;
|
||||
/**
|
||||
* 购买总金额,单位:分
|
||||
*
|
||||
* 用途类似 {@link #presentTotal}
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总金额,单位:分。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 最终总金额,单位:分。
|
||||
*
|
||||
* 注意,presentPrice * quantity 不一定等于 presentTotal 。
|
||||
* 因为,存在无法整除的情况。
|
||||
* 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
|
||||
* 所以,需要存储一个该字段。
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Spu {
|
||||
|
||||
/**
|
||||
* SPU 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
/**
|
||||
* SPU 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer cid;
|
||||
/**
|
||||
* 商品主图地址
|
||||
*
|
||||
* 数组,以逗号分隔
|
||||
*
|
||||
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
|
||||
*/
|
||||
private List<String> picUrls;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用(合计)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Fee {
|
||||
|
||||
/**
|
||||
* 购买总价
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总价
|
||||
*
|
||||
* 注意,满多少元包邮,不算在优惠中。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 邮费
|
||||
*/
|
||||
private Integer postageTotal;
|
||||
/**
|
||||
* 最终价格
|
||||
*
|
||||
* 计算公式 = 总价 - 优惠总价 + 邮费
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
public Fee() {
|
||||
}
|
||||
|
||||
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
|
||||
this.buyTotal = buyTotal;
|
||||
this.discountTotal = discountTotal;
|
||||
this.postageTotal = postageTotal;
|
||||
this.presentTotal = presentTotal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮费信息 TODO 芋艿,未完成
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Postage {
|
||||
|
||||
/**
|
||||
* 需要满足多少钱,可以包邮。单位:分
|
||||
*/
|
||||
private Integer threshold;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel(value = "创建交易订单 VO,基于购物车")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeOrderCreateFromCartReqVO {
|
||||
|
||||
@ApiModelProperty(name = "收件地址编号", required = true, example = "1")
|
||||
@NotNull(message = "用户地址不能为空")
|
||||
private Integer userAddressId;
|
||||
@ApiModelProperty(name = "优惠劵编号", example = "1024")
|
||||
private Integer couponCardId;
|
||||
@ApiModelProperty(name = "备注", example = "1024")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "创建交易订单 VO,基于商品")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeOrderCreateReqVO {
|
||||
|
||||
@ApiModelProperty(name = "收件地址编号", required = true, example = "1")
|
||||
@NotNull(message = "收件地址不能为空")
|
||||
private Integer userAddressId;
|
||||
@ApiModelProperty(name = "优惠劵编号", example = "1024")
|
||||
private Integer couponCardId;
|
||||
@ApiModelProperty(name = "备注", example = "1024")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 订单商品项列表
|
||||
*/
|
||||
@NotNull(message = "必须选择购买的商品")
|
||||
private List<OrderItem> orderItems;
|
||||
|
||||
@ApiModel(value = "订单商品项")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class OrderItem {
|
||||
|
||||
@ApiModelProperty(name = "商品 SKU 编号", required = true, example = "111")
|
||||
@NotNull(message = "商品 SKU 编号不能为空")
|
||||
private Integer skuId;
|
||||
@ApiModelProperty(name = "商品 SKU 购买数量", required = true, example = "1024")
|
||||
@NotNull(message = "商品 SKU 购买数量不能为空")
|
||||
@Min(value = 1, message = "商品 SKU 购买数量必须大于 0")
|
||||
private Integer quantity;
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("交易订单项 Response VO")
|
||||
@Data
|
||||
public class TradeOrderItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "id自增长", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "订单编号", required = true)
|
||||
private Integer orderId;
|
||||
@ApiModelProperty(value = "订单项状态", required = true)
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "商品 SKU 编号", required = true)
|
||||
private Integer skuId;
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true)
|
||||
private Integer spuId;
|
||||
@ApiModelProperty(value = "商品名字", required = true)
|
||||
private String skuName;
|
||||
@ApiModelProperty(value = "图片名字", required = true)
|
||||
private String skuImage;
|
||||
@ApiModelProperty(value = "商品数量", required = true)
|
||||
private Integer quantity;
|
||||
@ApiModelProperty(value = "原始单价,单位:分", required = true)
|
||||
private Integer originPrice;
|
||||
@ApiModelProperty(value = "购买单价,单位:分", required = true)
|
||||
private Integer buyPrice;
|
||||
@ApiModelProperty(value = "最终价格,单位:分", required = true)
|
||||
private Integer presentPrice;
|
||||
@ApiModelProperty(value = "购买总金额,单位:分", required = true)
|
||||
private Integer buyTotal;
|
||||
@ApiModelProperty(value = "优惠总金额,单位:分", required = true)
|
||||
private Integer discountTotal;
|
||||
@ApiModelProperty(value = "最终总金额,单位:分", required = true)
|
||||
private Integer presentTotal;
|
||||
@ApiModelProperty(value = "退款总金额,单位:分", required = true)
|
||||
private Integer refundTotal;
|
||||
@ApiModelProperty(value = "物流id")
|
||||
private Integer logisticsId;
|
||||
@ApiModelProperty(value = "售后状态", required = true)
|
||||
private Integer afterSaleStatus;
|
||||
@ApiModelProperty(value = "售后订单编号")
|
||||
private Integer afterSaleOrderId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("交易订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TradeOrderPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
|
||||
private Integer orderStatus;
|
||||
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package cn.iocoder.mall.shopweb.controller.trade.vo.order;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("订单交易 Response VO")
|
||||
@Data
|
||||
public class TradeOrderRespVO {
|
||||
|
||||
@ApiModelProperty(value = "订单编号", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "用户编号", required = true)
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "订单单号", required = true)
|
||||
private String orderNo;
|
||||
@ApiModelProperty(value = "订单状态", required = true)
|
||||
private Integer orderStatus;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "订单结束时间")
|
||||
private Date endTime;
|
||||
@ApiModelProperty(value = "订单金额(总金额),单位:分", required = true)
|
||||
private Integer buyPrice;
|
||||
@ApiModelProperty(value = "优惠总金额,单位:分", required = true)
|
||||
private Integer discountPrice;
|
||||
@ApiModelProperty(value = "物流金额,单位:分", required = true)
|
||||
private Integer logisticsPrice;
|
||||
@ApiModelProperty(value = "最终金额,单位:分", required = true)
|
||||
private Integer presentPrice;
|
||||
@ApiModelProperty(value = "支付金额,单位:分", required = true)
|
||||
private Integer payPrice;
|
||||
@ApiModelProperty(value = "退款金额,单位:分", required = true)
|
||||
private Integer refundPrice;
|
||||
@ApiModelProperty(value = "付款时间")
|
||||
private Date payTime;
|
||||
@ApiModelProperty(value = "支付订单编号")
|
||||
private Integer payTransactionId;
|
||||
@ApiModelProperty(value = "支付渠道")
|
||||
private Integer payChannel;
|
||||
@ApiModelProperty(value = "配送类型", required = true)
|
||||
private Integer deliveryType;
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private Date deliveryTime;
|
||||
@ApiModelProperty(value = "收货时间")
|
||||
private Date receiveTime;
|
||||
@ApiModelProperty(value = "收件人名称", required = true)
|
||||
private String receiverName;
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String receiverMobile;
|
||||
@ApiModelProperty(value = "地区编码", required = true)
|
||||
private Integer receiverAreaCode;
|
||||
@ApiModelProperty(value = "收件详细地址", required = true)
|
||||
private String receiverDetailAddress;
|
||||
@ApiModelProperty(value = "售后状态", required = true)
|
||||
private Integer afterSaleStatus;
|
||||
@ApiModelProperty(value = "优惠劵编号")
|
||||
private Integer couponCardId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*
|
||||
* // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto
|
||||
*/
|
||||
private List<TradeOrderItemRespVO> orderItems;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user