mall + trade:

1、获取订单结算信息,增加积分的 mock 返回
This commit is contained in:
YunaiV 2023-06-30 22:45:03 +08:00
parent ef656cf762
commit 3750dc76c7
5 changed files with 45 additions and 34 deletions

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,6 +11,7 @@ import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ -19,17 +22,32 @@ public class AppTradeOrderSettlementReqVO {
@NotNull(message = "交易类型不能为空")
@InEnum(value = TradeOrderTypeEnum.class, message = "交易类型必须是 {value}")
@Deprecated // TODO 芋艿后续干掉这个字段对于前端不需要关注这个
private Integer type;
private Integer type = 1;
@Schema(description = "商品项数组", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "商品不能为空")
@NotEmpty(message = "商品不能为空")
private List<Item> items;
@Schema(description = "优惠劵编号", example = "1024")
private Long couponId;
@Schema(description = "是否使用积分", required = true, example = "true")
@NotNull(message = "是否使用积分不能为空")
private Boolean pointStatus;
// ========== 配送相关相关字段 ==========
@Schema(description = "配送方式", required = true, example = "1")
@InEnum(value = DeliveryTypeEnum.class, message = "配送方式不正确")
private Integer deliveryType;
@Schema(description = "收件地址编号", example = "1")
private Long addressId;
@Schema(description = "优惠劵编号", example = "1024")
private Long couponId;
@Schema(description = "收件人名称", example = "芋艿") // 选择门店自提时该字段为联系人名
private String receiverName;
@Schema(description = "收件人手机", example = "15601691300") // 选择门店自提时该字段为联系人手机
@Mobile(message = "收件人手机格式不正确")
private String receiverMobile;
// ========== 秒杀活动相关字段 ==========
@Schema(description = "秒杀活动编号", example = "1024")

View File

@ -6,12 +6,16 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "用户 App - 交易订单结算信息 Response VO")
@Data
public class AppTradeOrderSettlementRespVO {
@Schema(description = "交易类型", required = true, example = "1") // 对应 TradeOrderTypeEnum 枚举
private Integer type = 1; // TODO 芋艿改成计算
@Schema(description = "购物项数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items;
@ -21,6 +25,12 @@ public class AppTradeOrderSettlementRespVO {
@Schema(description = "收件地址", requiredMode = Schema.RequiredMode.REQUIRED)
private Address address;
@Schema(description = "已使用的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Integer usedPoint;
@Schema(description = "总积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Integer totalPoint;
@Schema(description = "购物项")
@Data
public static class Item {
@ -90,26 +100,17 @@ public class AppTradeOrderSettlementRespVO {
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
private String mobile;
@Schema(description = "省份编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer provinceId;
@Schema(description = "省份名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "北京")
private String provinceName;
@Schema(description = "城市编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer cityId;
@Schema(description = "城市名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "北京")
private String cityName;
@Schema(description = "地区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer districtId;
@Schema(description = "地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "朝阳区")
private String districtName;
@Schema(description = "地区编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "地区编号不能为空")
private Long areaId;
@Schema(description = "地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海上海市普陀区")
private String areaName;
@Schema(description = "详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "望京悠乐汇 A 座")
private String detailAddress;
@Schema(description = "是否默认收件地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean defaulted;
private Boolean defaultStatus;
}

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.trade.convert.order;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.ip.core.Area;
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
@ -303,14 +302,11 @@ public interface TradeOrderConvert {
default AppTradeOrderSettlementRespVO convert(TradePriceCalculateRespBO calculate, AddressRespDTO address) {
AppTradeOrderSettlementRespVO respVO = convert0(calculate, address);
if (address != null) {
Area area = AreaUtils.getArea(address.getAreaId());
respVO.getAddress().setDistrictId(area.getId());
respVO.getAddress().setDistrictName(area.getName());
respVO.getAddress().setCityId(area.getParent().getId());
respVO.getAddress().setCityName(area.getParent().getName());
respVO.getAddress().setProvinceId(area.getParent().getParent().getId());
respVO.getAddress().setProvinceName(area.getParent().getParent().getName());
respVO.getAddress().setAreaName(AreaUtils.format(address.getAreaId()));
}
// TODO 芋艿积分的接入
respVO.setUsedPoint(1);
respVO.setTotalPoint(100);
return respVO;
}

View File

@ -176,6 +176,7 @@ public class TradeOrderDO extends BaseDO {
*
* 关联 DeliveryTemplateDO id 编号
*/
// TODO 芋艿需要删除
private Long deliveryTemplateId;
/**
* 发货物流公司编号
@ -243,6 +244,7 @@ public class TradeOrderDO extends BaseDO {
* 对应 taobao trade.coupon_fee 字段
*/
private Integer couponPrice;
// TODO 芋艿需要记录使用的积分
/**
* 积分抵扣的金额单位
*

View File

@ -30,19 +30,13 @@ public class AddressRespDTO {
* 地区编号
*/
private Integer areaId;
/**
* 邮编
*/
private String postCode;
/**
* 收件详细地址
*/
private String detailAddress;
/**
* 是否默认
*
* true - 默认收件地址
*/
private Boolean defaulted;
private Boolean defaultStatus;
}