From 3750dc76c7689ba4b6454ceabe6115346a5d73a0 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 30 Jun 2023 22:45:03 +0800 Subject: [PATCH] =?UTF-8?q?mall=20+=20trade=EF=BC=9A=201=E3=80=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=AE=A2=E5=8D=95=E7=BB=93=E7=AE=97=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=A7=AF=E5=88=86=E7=9A=84=20mock?= =?UTF-8?q?=20=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/AppTradeOrderSettlementReqVO.java | 26 +++++++++++++--- .../vo/AppTradeOrderSettlementRespVO.java | 31 ++++++++++--------- .../convert/order/TradeOrderConvert.java | 12 +++---- .../dal/dataobject/order/TradeOrderDO.java | 2 ++ .../api/address/dto/AddressRespDTO.java | 8 +---- 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementReqVO.java index c0acfce04..31b2f3faa 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementReqVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementReqVO.java @@ -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 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") diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementRespVO.java index 5c3854035..bd0312753 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementRespVO.java @@ -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 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; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java index f4c0d3736..9fb449040 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java @@ -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; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java index f4d27a3ae..1e132a990 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java @@ -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 芋艿:需要记录使用的积分; /** * 积分抵扣的金额,单位:分 * diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/dto/AddressRespDTO.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/dto/AddressRespDTO.java index 3fbb70f80..5a5e44ff1 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/dto/AddressRespDTO.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/dto/AddressRespDTO.java @@ -30,19 +30,13 @@ public class AddressRespDTO { * 地区编号 */ private Integer areaId; - /** - * 邮编 - */ - private String postCode; /** * 收件详细地址 */ private String detailAddress; /** * 是否默认 - * - * true - 默认收件地址 */ - private Boolean defaulted; + private Boolean defaultStatus; }