diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/cart/CartItemStatusEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/cart/CartItemStatusEnum.java new file mode 100644 index 000000000..03ed5bacc --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/cart/CartItemStatusEnum.java @@ -0,0 +1,46 @@ +package cn.iocoder.mall.order.biz.enums.cart; + +import java.util.Arrays; + +public enum CartItemStatusEnum { + + ENABLE(1, "正常"), + DELETE_BY_MANUAL(2, "主动删除"), + DELETE_BY_ORDER(3, "下单删除"), + ; + + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CartItemStatusEnum::getValue).toArray(); + + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + CartItemStatusEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public CartItemStatusEnum setValue(Integer value) { + this.value = value; + return this; + } + + public String getName() { + return name; + } + + public CartItemStatusEnum setName(String name) { + this.name = name; + return this; + } + +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderCommentRelpyTypeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderCommentRelpyTypeEnum.java new file mode 100644 index 000000000..77fdf976e --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderCommentRelpyTypeEnum.java @@ -0,0 +1,35 @@ +package cn.iocoder.mall.order.biz.enums.comment; + +/** + * + * 评论回复类型 + * + * @author wtz + * @time 2019-06-01 10:30:00 + */ +public enum OrderCommentRelpyTypeEnum { + + REPLY_REPLY(0, "回复的回复"), + COMMENT_REPLY(1, "评论的回复"); + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + OrderCommentRelpyTypeEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderCommentStatusEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderCommentStatusEnum.java new file mode 100644 index 000000000..fb91ff347 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderCommentStatusEnum.java @@ -0,0 +1,34 @@ +package cn.iocoder.mall.order.biz.enums.comment; + +/** + * 订单评论状态 + * + * @author wtz + * @time 2019-06-15 14:26 + */ +public enum OrderCommentStatusEnum { + + WAIT_COMMENT(0, "待评论"), + SUCCESS_COMMENT(1, "评论成功"); + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + OrderCommentStatusEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderReplyUserTypeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderReplyUserTypeEnum.java new file mode 100644 index 000000000..1cf2d3a28 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/comment/OrderReplyUserTypeEnum.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.order.biz.enums.comment; + +/** + * + * 评论回复 - 回复的用户的类型 + * + * @author wtz + * @time 2019-05-19 15:19 + */ +public enum OrderReplyUserTypeEnum { + + USER(0, "普通用户"), + MERCHANT(1, "商家"); + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + OrderReplyUserTypeEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } + +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/DictKeyConstants.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/DictKeyConstants.java new file mode 100644 index 000000000..caf9f14d3 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/DictKeyConstants.java @@ -0,0 +1,27 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 字典 keys 定义 + * + * @author Sin + * @time 2019-04-14 17:46 + */ +public class DictKeyConstants { + + /** + * 订单 - status + */ + public static final String ORDER_STATUS = "order_status"; + /** + * 订单 - 物流商家 + */ + public static final String ORDER_LOGISTICS_COMPANY = "logistics_company"; + /** + * 订单 - 退货原因 + */ + public static final String ORDER_RETURN_REASON = "order_return_reason"; + /** + * 订单退货 - 退货类型 + */ + public static final String ORDER_RETURN_SERVICE_TYPE = "order_return_service_type"; +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/ErrorCodeInterval.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/ErrorCodeInterval.java new file mode 100644 index 000000000..0ab045ea9 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/ErrorCodeInterval.java @@ -0,0 +1,17 @@ +package cn.iocoder.mall.order.biz.enums.order; + +import cn.iocoder.common.framework.constant.ModuleErrorCodeInterval; + +/** + * 错误码区间 + * + * 当前模块化区间:[1-008-000-000 ~ 1-008-000-000] + * + * @author Sin + * @time 2019-03-23 11:35 + */ +public class ErrorCodeInterval extends ModuleErrorCodeInterval { + + // OrderErrorCodeEnum 错误码区间 [1-008-000-000 ~ 1-008-000-000] + +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/LogisticsEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/LogisticsEnum.java new file mode 100644 index 000000000..f4282404c --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/LogisticsEnum.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 物流信息 + * + * @author Sin + * @time 2019-03-30 22:33 + */ +public enum LogisticsEnum { + + LOGISTICS_1(1, "顺丰快递"), + LOGISTICS_2(2, "圆通快递"), + LOGISTICS_3(3, "申通快递"), + LOGISTICS_4(4, "韵答快递"), + LOGISTICS_5(5, "天天快递"), + LOGISTICS_6(6, "EMS中国邮政"), + + ; + + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + LogisticsEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/MQConstants.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/MQConstants.java new file mode 100644 index 000000000..24212e481 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/MQConstants.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * MQ 订阅消息 + * + * @author Sin + * @time 2019-03-16 15:04 + */ +public class MQConstants { + + /** + * 订单 - 创建成功 消息 + */ + public static final String ORDER_CREATE_SUCCESS = "order.orderCreateSuccess"; +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderCancelReasonsEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderCancelReasonsEnum.java new file mode 100644 index 000000000..dd14a3973 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderCancelReasonsEnum.java @@ -0,0 +1,54 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单取消原因 + * order_cancel_reasons + * @author Sin + * @time 2019-03-30 15:08 + */ +public enum OrderCancelReasonsEnum { + + CANCEL_1(1, "无法联系上买家"), + CANCEL_2(2, "买家误拍或重拍了"), + CANCEL_3(3, "买家无诚意完成交易"), + CANCEL_4(4, "已通过银行线下汇款"), + CANCEL_5(5, "已通过同城见面交易"), + CANCEL_6(6, "已通过货到付款交易"), + CANCEL_7(7, "已通过网上银行直接汇款"), + CANCEL_8(8, "已经缺货无法交易"), + CANCEL_20(20, "其他"), + ; + + // 无法联系上买家 + // 买家误拍或重拍了 + // 买家无诚意完成交易 + // 已通过银行线下汇款 + // 已通过同城见面交易 + // 已通过货到付款交易 + // 已通过网上银行直接汇款 + // 已经缺货无法交易 + + private final int code; + private final String message; + + OrderCancelReasonsEnum(int code, String message) { + this.code = code; + this.message = message; + } + + @Override + public String toString() { + return "OrderCancelEnum{" + + "code=" + code + + ", message='" + message + '\'' + + '}'; + } + + public int getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderDeliveryTypeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderDeliveryTypeEnum.java new file mode 100644 index 000000000..5d8dbc925 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderDeliveryTypeEnum.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 发货类型/发货方式 + * + * @author Sin + * @time 2019-04-05 16:03 + */ +public enum OrderDeliveryTypeEnum { + + NONE(1, "未选择"), + ORDER_ONLINE(2, "快递"), + CONTACT_YOURSELF(3, "自己联系"), + NO_DELIVERY(4, "无物流信息"), + ; + + private Integer value; + + private String name; + + OrderDeliveryTypeEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String toString() { + return "OrderRecipientTypeEnum{" + + "value=" + value + + ", name='" + name + '\'' + + '}'; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderErrorCodeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderErrorCodeEnum.java new file mode 100644 index 000000000..13ca7185f --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderErrorCodeEnum.java @@ -0,0 +1,68 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单错误码 + * + * 错误码区间 [1-008-000-000 ~ 1-008-000-000] + * + * @author Sin + * @time 2019-03-23 11:23 + */ +public enum OrderErrorCodeEnum { + + // order + ORDER_NOT_EXISTENT(1008000000, "获取订单不存在!"), + ORDER_GET_SKU_FAIL(1008000001, "获取商品失败!"), + ORDER_GET_SKU_NOT_EXISTENT(1008000002, "获取的商品不存在!"), + ORDER_PAY_AMOUNT_NOT_NEGATIVE(1008000003, "支付金额不能为负数!"), + ORDER_STATUS_NOT_CANCEL(1008000004, "订单状态不能取消!"), + ORDER_DELIVERY_INCORRECT_DATA(1008000005, "订单发货数据不正确!"), + ORDER_INSUFFICIENT_INVENTORY(1008000006, "库存不足!"), + ORDER_GOODS_AMOUNT_INCORRECT(1008000007, "商品金额非法!"), + ORDER_GET_GOODS_INFO_INCORRECT(1008000008, "获取额商品信息不正确!"), + ORDER_GET_USER_ADDRESS_FAIL(1008000009, "获取用户地址失败!"), + ORDER_GET_PAY_FAIL(1008000010, "调用pay失败!"), + ORDER_NOT_USER_ORDER(1008000011, "不是该用户的订单!"), + ORDER_UNABLE_CONFIRM_ORDER(1008000012, "状态不对不能确认订单!"), + ORDER_CREATE_CART_IS_EMPTY(1008000013, "购物车无选中的商品,无法创建订单"), + ORDER_STATUS_NOT_WAITING_PAYMENT(1008000014, "订单不处于等待支付状态"), + ORDER_PAY_AMOUNT_ERROR(1008000015, "订单金额不正确"), + + // order item + ORDER_ITEM_ONLY_ONE(1008000200, "订单Item只有一个!"), + ORDER_ITEM_SOME_NOT_EXISTS(1008000201, "有不存在的商品!"), + + // 订单退货 + ORDER_RETURN_NO_RETURN_APPLY(1008000400, "未退货申请"), + ORDER_RETURN_NOT_EXISTENT(1008000401, "退货订单不存在"), + ORDER_RETURN_REFUND_FAILED(1008000402, "退款失败"), + + // ========== 购物车 ========== + CARD_ITEM_NOT_FOUND(1008003000, "购物车项不存在"), + CARD_ITEM_SKU_NOT_FOUND(1008003001, "商品不存在"), + CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH(1008003002, "商品库存不足"), + + // 工具类服务 1008004000 + DICT_SERVER_INVOKING_FAIL(1008004000, "字典服务调用失败!"), + ORDER_LOGISTICS_INVOKING_FAIL(1008004001, "订单物流调用失败!"), + + + ; + + private final int code; + private final String message; + + OrderErrorCodeEnum(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public String getMessage() { + return message; + } + +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderExchangeReasonEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderExchangeReasonEnum.java new file mode 100644 index 000000000..f426ac2a6 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderExchangeReasonEnum.java @@ -0,0 +1,40 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单换货原因 + * + * @author Sin + * @time 2019-03-20 21:17 + */ +public enum OrderExchangeReasonEnum { + + REASON_000(0, "其他"), + REASON_001(1, "尺码不合适"), + REASON_002(2, "质量问题"), + REASON_003(3, "不喜欢"), + ; + + private Integer value; + + private String name; + + OrderExchangeReasonEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String toString() { + return "OrderCommonReasonEnum{" + + "value=" + value + + ", name=" + name + + '}'; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + }} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderHasReturnExchangeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderHasReturnExchangeEnum.java new file mode 100644 index 000000000..bd12c3230 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderHasReturnExchangeEnum.java @@ -0,0 +1,37 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单 - 是否退换货状态 + * + * @author Sin + * @time 2019-03-22 21:34 + */ +public enum OrderHasReturnExchangeEnum { + + NO(1, "没有"), + RETURN_GOODS(2, "退货"), + EXCHANGE_GOODS(3, "换货"), + RETURN_EXCHANGE_GOODS(4, "退换货"); + + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + OrderHasReturnExchangeEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderPayStatus.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderPayStatus.java new file mode 100644 index 000000000..46fcae38e --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderPayStatus.java @@ -0,0 +1,34 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单状态 status + * + * @author Sin + * @time 2019-03-16 14:32 + */ +public enum OrderPayStatus { + + WAITING_PAYMENT(0, "等待支付"), + SUCCESSFUL_PAYMENT(1, "支付成功"), + REFUND_PAYMENT(2, "退款成功"), + + ; + + + private final int value; + + private final String name; + + OrderPayStatus(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderRecipientTypeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderRecipientTypeEnum.java new file mode 100644 index 000000000..9d89607cb --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderRecipientTypeEnum.java @@ -0,0 +1,39 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单收件信息 type(配送信息) + * + * @author Sin + * @time 2019-04-05 16:03 + */ +public enum OrderRecipientTypeEnum { + + EXPRESS(1, "快递") + + ; + + private Integer value; + + private String name; + + OrderRecipientTypeEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String toString() { + return "OrderRecipientTypeEnum{" + + "value=" + value + + ", name='" + name + '\'' + + '}'; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnReasonEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnReasonEnum.java new file mode 100644 index 000000000..d972c9d2d --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnReasonEnum.java @@ -0,0 +1,52 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单退货原因 + * + * @author Sin + * @time 2019-03-20 21:17 + */ +public enum OrderReturnReasonEnum { + + /// + /// 未发货情况 + + REASON_000(0, "其他"), + REASON_001(1, "拍错/勿拍/多拍"), + REASON_002(2, "缺货"), + + /// + /// 已发货情况 + + REASON_020(20, "七天无理由"), + REASON_021(21, "质量问题"), + REASON_022(22, "不想要了"), + + ; + + // TODO: 2019-03-20 Sin 已发货情况 补全,需要对照一下 淘宝 + + private Integer value; + + private String name; + + OrderReturnReasonEnum(Integer value, String name) { + this.value = value; + this.name = name; + } + + @Override + public String toString() { + return "OrderCommonReasonEnum{" + + "value=" + value + + ", name=" + name + + '}'; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + }} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnServiceTypeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnServiceTypeEnum.java new file mode 100644 index 000000000..19dde5297 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnServiceTypeEnum.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单退货 - returnType + * + * @author Sin + * @time 2019-04-27 11:53 + */ +public enum OrderReturnServiceTypeEnum { + + /** + * 状态 + * + * - 1、退货退款 + * - 2、退款 + */ + RETURN_REFUND(1, "退货退款"), + REFUND(2, "退款") + ; + private final int value; + + private final String name; + + OrderReturnServiceTypeEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnStatusEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnStatusEnum.java new file mode 100644 index 000000000..3fe0fdfc8 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnStatusEnum.java @@ -0,0 +1,45 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单退货 status + * + * @author Sin + * @time 2019-03-30 15:56 + */ +public enum OrderReturnStatusEnum { + + /** + * 状态 + * + * - 1、退货申请 + * - 2、申请成功 + * - 3、申请失败 + * - 4、退货中 + * - 5、已收货 + * - 6、拒绝退款 + */ + RETURN_APPLICATION(1, "退货申请"), + APPLICATION_SUCCESSFUL(2, "申请成功"), + APPLICATION_FAIL(3, "申请失败"), + RETURN_IN(4, "退货中"), + ORDER_RECEIPT(5, "确认收货"), + RETURN_SUCCESS(6, "退货成功"), + ; + private final int value; + + private final String name; + + OrderReturnStatusEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } + +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnTypeEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnTypeEnum.java new file mode 100644 index 000000000..a4bfbb2b3 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderReturnTypeEnum.java @@ -0,0 +1,31 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单退货 类型 + * + * @author Sin + * @time 2019-03-30 15:42 + */ +public enum OrderReturnTypeEnum { + + ORDER(1, "订单"), + ORDER_ITEM(2, "订单item"), + ; + + private final int value; + + private final String name; + + OrderReturnTypeEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderStatusEnum.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderStatusEnum.java new file mode 100644 index 000000000..d7a0933e2 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/OrderStatusEnum.java @@ -0,0 +1,38 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 订单 - status + * + * @author Sin + * @time 2019-03-16 14:06 + */ +public enum OrderStatusEnum { + + WAITING_PAYMENT(1, "等待付款"), + WAIT_SHIPMENT(2, "等待发货"), + ALREADY_SHIPMENT(3, "已发货"), + COMPLETED(4, "已完成"), + CLOSED(5, "已关闭"); + + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + OrderStatusEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/PayAppId.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/PayAppId.java new file mode 100644 index 000000000..dd6f66bba --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/enums/order/PayAppId.java @@ -0,0 +1,16 @@ +package cn.iocoder.mall.order.biz.enums.order; + +/** + * 支付 AppId + * + * @author Sin + * @time 2019-04-08 19:54 + */ +public class PayAppId { + + /** + * 电商 + */ + public static final String APP_ID_SHOP_ORDER = "POd4RC6a"; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentBO.java new file mode 100644 index 000000000..55cd1de1b --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentBO.java @@ -0,0 +1,86 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * 订单评价 + * + * @author wtz + * @time 2019-05-14 20:00:00 + */ +@Data +@Accessors(chain = true) +public class OrderCommentBO implements Serializable { + + /** + * 总条数 + */ + private Integer total; + + /** + * 好评 + */ + private Integer positiveTotal; + + /** + * 中评 + */ + private Integer moderateTotal; + + /** + * 差评 + */ + private Integer negativeTotal; + + /** + * 评论 id + */ + private Integer id; + + /** + * 用户头像 + */ + private String userAvatar; + + /** + * 用户的真实姓名 + */ + private String userNickName; + + /** + * 评价星 + */ + private Integer star; + + /** + * 评论的内容 + */ + private String commentContent; + + /** + * 评论的图片地址 + */ + private String commentPics; + + /** + * 回复条数 + */ + private Integer replayCount; + + /** + * 点赞数 + */ + private Integer collectCount; + + /** + * 创建时间 + */ + private Date createTime; + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentCreateBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentCreateBO.java new file mode 100644 index 000000000..dd354b468 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentCreateBO.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * 订单评论创建 + * + * @author wtz + * @time 2019-05-19 18:32 + * + */ +@Data +@Accessors(chain = true) +public class OrderCommentCreateBO implements Serializable { + + /** + * 订单评论 id + */ + private Integer id; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoAndMerchantReplyBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoAndMerchantReplyBO.java new file mode 100644 index 000000000..cbe7a996f --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoAndMerchantReplyBO.java @@ -0,0 +1,29 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * + * 评论详情和商家评论回复 + * + * @author wtz + * @time 2019-06-03 20:30 + */ +@Data +@Accessors(chain = true) +public class OrderCommentInfoAndMerchantReplyBO { + + /** + * 评论详情 + */ + private OrderCommentInfoBO orderCommentInfoBO; + + /** + * 商家评论回复 + */ + private List orderCommentMerchantReplyBOS; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoBO.java new file mode 100644 index 000000000..f227e530a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentInfoBO.java @@ -0,0 +1,84 @@ +package cn.iocoder.mall.order.biz.bo.comment; + + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * 订单回复评价详情 + * + * @author wtz + * @time 2019-05-16 18:40 + * + */ +@Data +@Accessors(chain = true) +public class OrderCommentInfoBO implements Serializable { + + /** + * 评论 id + */ + private Integer id; + + /** + * 用户头像 + */ + private String userAvatar; + + /** + * 用户昵称 + */ + private String userNickName; + + /** + * 评价星 + */ + private Integer star; + + /** + * 评论的内容 + */ + private String commentContent; + + /** + * 评论的图片地址 + */ + private String commentPics; + + + /** + * 点赞数 + */ + private Integer likeCount; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 商品 sku id + */ + private int productSkuId; + + /** + * 商品 sku 属性 + */ + private String productSkuAttrs; + + /** + * 商品 sku 价格 + */ + private String productSkuPrice; + + /** + * 商品 sku 地址 + */ + private String productSkuPicUrl; + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentMerchantReplyBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentMerchantReplyBO.java new file mode 100644 index 000000000..31444cf41 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentMerchantReplyBO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * + * 商家评论回复 + * + * @author wtz + * @time 2019-06-03 19:30 + */ +@Data +@Accessors(chain = true) +public class OrderCommentMerchantReplyBO { + + /** + * 商家评论回复 + */ + private String replyContent; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentPageBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentPageBO.java new file mode 100644 index 000000000..cc198a069 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentPageBO.java @@ -0,0 +1,107 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +/** + * + * 订单评论分页展示 + * + * @author wtz + * @time 2019-05-14 20:00:00 + */ +@Data +@Accessors(chain = true) +public class OrderCommentPageBO implements Serializable { + + /** + * 总条数 + */ + private Integer total; + +// 评论标签化等等在做 +// /** +// * 好评 +// */ +// private Integer positiveTotal; +// +// /** +// * 中评 +// */ +// private Integer moderateTotal; +// +// /** +// * 差评 +// */ +// private Integer negativeTotal; + + /** + * 评论列表 + */ + private List orderCommentItems; + + + @Data + @Accessors(chain = true) + @AllArgsConstructor + public static class OrderCommentItem{ + /** + * 评论 id + */ + private Integer id; + + /** + * 用户头像 + */ + private String userAvatar; + + /** + * 用户的真实姓名 + */ + private String userNickName; + + /** + * 评价星 + */ + private Integer star; + + /** + * 评论的内容 + */ + private String commentContent; + + /** + * 评论的图片地址 + */ + private String commentPics; + + /** + * 回复条数 + */ + private Integer replayCount; + + /** + * 点赞数 + */ + private Integer likeCount; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 商家回复列表 + * 只展示最近的一条 + */ + private String replyContent; + + } + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyCreateBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyCreateBO.java new file mode 100644 index 000000000..dcfe860a1 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyCreateBO.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * 订单回复创建 + * + * @author wtz + * @time 2019-05-19 18:35 + */ +@Data +@Accessors(chain = true) +public class OrderCommentReplyCreateBO implements Serializable { + + + /** + * 评论回复 id + */ + private Integer id; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyPageBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyPageBO.java new file mode 100644 index 000000000..3415c8caa --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentReplyPageBO.java @@ -0,0 +1,83 @@ +package cn.iocoder.mall.order.biz.bo.comment; + + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * 评论回复分页展示 + * + * @author wtz + * @time 2019-05-19 14:19 + * + */ +@Data +@Accessors(chain = true) +public class OrderCommentReplyPageBO implements Serializable { + + /** + * 评论回复总数 + */ + private Integer total; + + /** + * 用户回复 + */ + List orderCommentReplayItems; + + + @Data + @Accessors(chain = true) + public static class OrderCommentReplayItem{ + /** + * 回复 id + */ + private Integer id; + + /** + * 回复的类型 + */ + private Integer replyType; + + /** + * 回复的内容 + */ + private String replyContent; + + /** + * 回复的用户 id + */ + private int replyUserId; + + /** + * 回复用户的真实姓名 + */ + private String replyUserNickName; + + /** + * 回复用户的头像 + */ + private String replyUserAvatar; + + /** + * 回复的点赞数 + */ + private int replyCollectCount; + + /** + * 回复目标用户昵称 + */ + private String parentUserNickName; + + /** + * 创建时间 + */ + private Date createTime; + + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentStateInfoPageBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentStateInfoPageBO.java new file mode 100644 index 000000000..894a2a239 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentStateInfoPageBO.java @@ -0,0 +1,87 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * + * 订单评论状态详情分页(这么设计因为这个接口需要登陆以后才能看到所以与订单分页接口分开) + * + * @author wtz + * @time 2019-06-07 10:39 + */ +@Data +@Accessors(chain = true) +public class OrderCommentStateInfoPageBO implements Serializable { + + /** + * (待/已)评论总数 + */ + private Integer total; + + /** + * 评论状态 + */ + private List orderCommentStateInfoItems; + + @Data + @Accessors(chain = true) + public static class OrderCommentStateInfoItem{ + + /** + * 订单 id + */ + private Integer orderId; + + /** + * 订单编号 + */ + private String orderNo; + + /** + * 商品 id + */ + private Integer productSpuId; + + /** + * 商品名称 + */ + private String productSpuName; + + /** + * 商品 sku id + */ + private Integer productSkuId; + + /** + * 商品 sku 属性 + */ + private String productSkuAttrs; + + /** + * 商品 sku 价格 + */ + private Integer productSkuPrice; + + /** + * 商品 sku url + */ + private String productSkuPicUrl; + + /** + * 订单评论状态 + */ + private Integer commentState; + + /** + * 创建时间 + */ + private Date createTime; + } + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentTimeOutBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentTimeOutBO.java new file mode 100644 index 000000000..d5728f7c5 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/comment/OrderCommentTimeOutBO.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.order.biz.bo.comment; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.Serializable; + + +/** + * 订单评论超时 + * + * @author wtz + * @time 2019-06-15 13:52 + */ +@Data +@Accessors(chain = true) +public class OrderCommentTimeOutBO implements Serializable { + + /** + * 评论 id + */ + private Integer id; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java new file mode 100644 index 000000000..696eb7b03 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcOrderPriceBO.java @@ -0,0 +1,180 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import cn.iocoder.mall.product.api.bo.ProductSkuDetailBO; +import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 计算订单价格结果 BO + */ +@Data +@Accessors(chain = true) +public class CalcOrderPriceBO { + + /** + * 商品分组数组 + */ + private List 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 { + + /** + * 优惠活动 + */ + // TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组 + private PromotionActivityBO activity; + /** + * 促销减少的金额 + * + * 1. 若未参与促销活动,或不满足促销条件,返回 null + * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。 + */ + private Integer activityDiscountTotal; + /** + * 商品数组 + */ + private List items; +// /** +// * 费用 +// * +// * TODO 芋艿,这里先偷懒,postageTotal 字段用不到。 +// */ +// private Fee fee; // 注释原因,不用这里了 + + } + + @Data + @Accessors(chain = true) + public static class Item extends ProductSkuDetailBO { // TODO 芋艿,此处先偷懒继承 + + /** + * 是否选中 + */ + private Boolean selected; + /** + * 购买数量 + */ + private Integer buyQuantity; + /** + * 优惠活动 + */ + private PromotionActivityBO activity; + /** + * 原始单价,单位:分。 + */ + 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 { + + /** + * 购买总价 + */ + 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 { + + /** + * 需要满足多少钱,可以包邮。单位:分 + */ + private Integer threshold; + + } + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java new file mode 100644 index 000000000..fc84f1a60 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CalcSkuPriceBO.java @@ -0,0 +1,33 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 计算商品 SKU 价格结果 BO + */ +@Data +@Accessors(chain = true) +public class CalcSkuPriceBO implements Serializable { + + /** + * 满减送促销活动 + */ + private PromotionActivityBO fullPrivilege; + /** + * 限时折扣促销活动 + */ + private PromotionActivityBO timeLimitedDiscount; + /** + * 原价格,单位:分。 + */ + private Integer originalPrice; + /** + * 购买价格,单位:分。 + */ + private Integer buyPrice; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java new file mode 100644 index 000000000..ad25c6df0 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/CartItemBO.java @@ -0,0 +1,100 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * 购物车的商品信息 DO + */ +@Data +@Accessors(chain = true) +public class CartItemBO { + + // ========= 基础字段 BEGIN ========= + + /** + * 编号,唯一自增。 + */ + private Integer id; + /** + * 状态 + * + * 1-正常 + * 2-主动删除 + * 3-下单删除 + */ + private Integer status; + /** + * 是否选中 + */ + private Boolean selected; + + // ========= 基础字段 END ========= + + // ========= 买家信息 BEGIN ========= + + /** + * 用户编号 + */ + private Integer userId; +// /** +// * 会话 key +// */ +// private String nobody; + + // ========= 买家信息 END ========= + + // ========= 商品信息 BEGIN ========= + + /** + * 商品 SPU 编号 + */ + private Integer spuId; + /** + * 商品 SKU 编号 + */ + private Integer skuId; + /** + * 商品购买数量 + */ + private Integer quantity; + + // TODO 冗余字段 + + + // ========= 商品信息 END ========= + + // ========= 交易信息 BEGIN ========= + + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单创建时间 + */ + private Date orderCreateTime; + + // ========= 交易信息 BEGIN ========= + + // ========= 优惠信息 BEGIN ========= + +// /** +// * 商品营销活动编号 +// */ +// private Integer activityId; +// /** +// * 商品营销活动类型 +// */ +// private Integer activityType; + + // ========= 优惠信息 END ========= + + /** + * 创建时间 + */ + private Date createTime; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java new file mode 100644 index 000000000..c4c06334e --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderBO.java @@ -0,0 +1,115 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单 page + * + * @author Sin + * @time 2019-03-23 14:30 + */ +@Data +@Accessors(chain = true) +public class OrderBO implements Serializable { + + /** + * id + */ + private Integer id; + /** + * 用户编号 + */ + private Integer userId; + /** + * 订单编号 + */ + private String orderNo; + /** + * 购买(商品)总金额,单位:分 + */ + private Integer buyPrice; + /** + * 优惠总金额,单位:分。 + */ + private Integer discountPrice; + /** + * 物流金额 (分) + */ + private Integer logisticsPrice; + /** + * 最终金额,单位:分 + * + * buyPrice + logisticsPrice - discountPrice = presentPrice + */ + private Integer presentPrice; + /** + * 实际已支付金额,单位:分 + * + * 初始时,金额为 0 。等到支付成功后,会进行更新。 + */ + private Integer payAmount; + + /// + /// 时间信息 + + /** + * 付款时间(待发货) + */ + private Date paymentTime; + /** + * 发货时间(待收货) + */ + private Date deliveryTime; + /** + * 收货时间(已签收) + */ + private Date receiverTime; + /** + * 成交时间(用户确认收货 -> status = 已完成) + */ + private Date closingTime; + + /// + /// 其他 + + /** + * 是否退货 + * + * - 0、没有 + * - 1、换货 + * - 2、退货 + * - 3、换货 + 退货 + */ + private Integer hasReturnExchange; + /** + * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) + * + * - 0、待付款 + * - 1、待发货 + * - 2、待收获 + * - 3、已完成 + * - 4、已关闭 + */ + private Integer status; + /** + * 备注 + */ + private String remark; + + /// + /// 关联信息 + + /** + * orderItem + */ + private List orderItems; + /** + * 订单物流信息 + */ + private OrderRecipientBO orderRecipient; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java new file mode 100644 index 000000000..b20372e82 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderCreateBO.java @@ -0,0 +1,30 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 订单创建 BO + * + * @author Sin + * @time 2019-03-16 14:38 + */ +@Data +@Accessors(chain = true) +public class OrderCreateBO implements Serializable { + + /** + * 编号 + */ + private Integer id; + /** + * 订单编号 + */ + private String orderNo; + /** + * 订单金额 + */ + private Integer payAmount; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java new file mode 100644 index 000000000..bd59bb09c --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderInfoBO.java @@ -0,0 +1,233 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单 info + * + * @author Sin + * @time 2019-04-14 15:36 + */ +@Data +@Accessors(chain = true) +public class OrderInfoBO implements Serializable { + + /** + * id + */ + private Integer id; + /** + * 订单编号 + */ + private String orderNo; + /** + * 购买(商品)总金额,单位:分 + */ + private Integer buyPrice; + /** + * 优惠总金额,单位:分。 + */ + private Integer discountPrice; + /** + * 物流金额 (分) + */ + private Integer logisticsPrice; + /** + * 最终金额,单位:分 + * + * buyPrice + logisticsPrice - discountPrice = presentPrice + */ + private Integer presentPrice; + /** + * 实际已支付金额,单位:分 + * + * 初始时,金额为 0 。等到支付成功后,会进行更新。 + */ + private Integer payAmount; + + /** + * 付款时间(待发货) + */ + private Date paymentTime; + /** + * 发货时间(待收货) + */ + private Date deliveryTime; + /** + * 收货时间(已签收) + */ + private Date receiverTime; + /** + * 成交时间(用户确认收货 -> status = 已完成) + */ + private Date closingTime; + /** + * 是否退货 + * + * - 1、没有 + * - 2、换货 + * - 3、退货 + * - 4、换货 + 退货 + */ + private Integer hasReturnExchange; + /** + * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) + * + * - 1、待付款 + * - 2、待发货 + * - 3、待收获 + * - 4、已完成 + * - 5、已关闭 + */ + private Integer status; + /** + * 转换的字典值 + */ + private String statusText; + /** + * 备注 + */ + private String remark; + + /// + /// 其他信息 + + /** + * 手机人信息 + */ + private Recipient recipient; + /** + * 最新物流信息 + */ + private LogisticsDetail latestLogisticsDetail; + /** + * 订单 item + */ + private List orderItems; + + + /// + /// 其他字段 + + /** + * 是否退货 + */ + private Integer hasOrderReturn; + + @Data + @Accessors(chain = true) + public static class OrderItem { + + /** + * 商品编号 + */ + private Integer skuId; + /** + * 商品名称 + */ + private String skuName; + /** + * 商品图片 + */ + private String skuImage; + /** + * 数量 + */ + private Integer quantity; + /** + * 原始单价,单位:分。 + */ + 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 Recipient { + + /** + * 编号 + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 配送类型 + * + * - 1 快递 + */ + private Integer type; + /** + * 收件详细地址 + */ + private String address; + } + + @Data + @Accessors(chain = true) + public static class LogisticsDetail { + + /** + * id + */ + private Integer id; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 物流时间 + */ + private Date logisticsTime; + /** + * 物流信息 + */ + private String logisticsInformation; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java new file mode 100644 index 000000000..002dab929 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderItemBO.java @@ -0,0 +1,143 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 订单 item + * + * @author Sin + * @time 2019-03-28 21:11 + */ +@Data +@Accessors(chain = true) +public class OrderItemBO implements Serializable { + + /** + * 编号 + */ + private Integer id; + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单号 + */ + private String orderNo; + /** + * 商品编号 + */ + private Integer skuId; + /** + * 商品名称 + */ + private String skuName; + /** + * 商品图片 + */ + private String skuImage; + /** + * 数量 + */ + private Integer quantity; + /** + * 原始单价,单位:分。 + */ + 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; + + /// + /// 时间信息 + + /** + * 付款时间 + */ + private Date paymentTime; + /** + * 发货时间 + */ + private Date deliveryTime; + /** + * 收货时间 + */ + private Date receiverTime; + /** + * 成交时间 + */ + private Date closingTime; + + /// + /// 其他 + + /** + * 是否退货 + * + * - 1、没有 + * - 2、换货 + * - 3、退货 + * - 4、换货 + 退货 + */ + private Integer hasReturnExchange; + /** + * 发货方式 + * + * - 1 未选择 + * - 2 在线下单 + * - 3 自己联系快递 + * - 4 无物流 + */ + private Integer deliveryType; + /** + * 状态 + * + * - 1、待付款 + * - 2、待发货 + * - 3、已发货 + * - 4、已完成 + * - 5、已关闭 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 删除状态 + */ + private Integer deleted; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLastLogisticsInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLastLogisticsInfoBO.java new file mode 100644 index 000000000..daa9d26ae --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLastLogisticsInfoBO.java @@ -0,0 +1,85 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单物流 - 最后一个物流信息 + * + * @author Sin + * @time 2019-04-12 22:03 + */ +@Data +@Accessors(chain = true) +public class OrderLastLogisticsInfoBO implements Serializable { + + /** + * id + */ + private Integer id; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + /** + * 物流 (字典) + */ + private Integer logistics; + /** + * 物流 (字典) 转换后的值 + */ + private String logisticsText; + /** + * 物流编号 + */ + private String logisticsNo; + + /// + /// 物流信息 + + /** + * 最后一个物流信息 + */ + private LogisticsDetail lastLogisticsDetail; + + @Data + @Accessors(chain = true) + public static class LogisticsDetail { + /** + * id + */ + private Integer id; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 物流时间 + */ + private Date logisticsTime; + /** + * 物流时间 text + */ + private String logisticsTimeText; + /** + * 物流信息 + */ + private String logisticsInformation; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java new file mode 100644 index 000000000..080eef58c --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsBO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import cn.iocoder.common.framework.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单物流信息 + * + * @author Sin + * @time 2019-03-19 20:47 + */ +@Data +@Accessors(chain = true) +public class OrderLogisticsBO extends BaseDO { + + /** + * id + */ + private Integer id; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + /** + * 物流编号 + */ + private String logisticsNo; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoBO.java new file mode 100644 index 000000000..f87296dbb --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoBO.java @@ -0,0 +1,82 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单物流 - 详细信息 + * + * @author Sin + * @time 2019-04-12 22:03 + */ +@Data +@Accessors(chain = true) +public class OrderLogisticsInfoBO implements Serializable { + + /** + * id + */ + private Integer id; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + /** + * 物流 (字典) + */ + private Integer logistics; + /** + * 物流 (字典) 转换后的值 + */ + private String logisticsText; + /** + * 物流编号 + */ + private String logisticsNo; + + /// + /// 物流信息 + + private List details; + + @Data + @Accessors(chain = true) + public static class LogisticsDetail { + /** + * id + */ + private Integer id; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 物流时间 + */ + private Date logisticsTime; + /** + * 物流时间 text + */ + private String logisticsTimeText; + /** + * 物流信息 + */ + private String logisticsInformation; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoWithOrderBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoWithOrderBO.java new file mode 100644 index 000000000..d09578fd0 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderLogisticsInfoWithOrderBO.java @@ -0,0 +1,100 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单物流 - 详细信息 + * + * @author Sin + * @time 2019-04-12 22:03 + */ +@Data +@Accessors(chain = true) +public class OrderLogisticsInfoWithOrderBO implements Serializable { + + /** + * 订单id + */ + private Integer orderId; + /** + * 订单编号 + */ + private String orderNo; + /** + * 物流信息 + */ + private List logistics; + + @Data + @Accessors(chain = true) + public static class Logistics { + + /** + * id + */ + private Integer id; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + /** + * 物流 (字典) + */ + private Integer logistics; + /** + * 物流 (字典) 转换后的值 + */ + private String logisticsText; + /** + * 物流编号 + */ + private String logisticsNo; + + /// + /// 物流信息 + + private List details; + } + + @Data + @Accessors(chain = true) + public static class LogisticsDetail { + /** + * id + */ + private Integer id; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 物流时间 + */ + private Date logisticsTime; + /** + * 物流时间 text + */ + private String logisticsTimeText; + /** + * 物流信息 + */ + private String logisticsInformation; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java new file mode 100644 index 000000000..59a6636ea --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPageBO.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * 订单分页 + * + * @author Sin + * @time 2019-03-27 21:27 + */ +@Data +@Accessors(chain = true) +public class OrderPageBO implements Serializable { + + /** + * 总条数 + */ + private Integer total; + /** + * 订单列表 + */ + private List orders; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java new file mode 100644 index 000000000..853f860ae --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderPayBO.java @@ -0,0 +1,12 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import java.io.Serializable; + +/** + * 订单支付信息返回 + * + * @author Sin + * @time 2019-04-08 19:39 + */ +public class OrderPayBO implements Serializable { +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java new file mode 100644 index 000000000..e537e68bb --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderRecipientBO.java @@ -0,0 +1,45 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import cn.iocoder.common.framework.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单收件人信息 order_recipient + * + * @author Sin + * @time 2019-03-31 11:37 + */ +@Data +@Accessors(chain = true) +public class OrderRecipientBO extends BaseDO { // TODO FROM 芋艿 TO 小范,不要继承 BaseDO + + /** + * 编号 + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 手机方式 + */ + private Integer type; + /** + * 收件详细地址 + */ + private String address; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnInfoBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnInfoBO.java new file mode 100644 index 000000000..5ae3d3165 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnInfoBO.java @@ -0,0 +1,141 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单退货 info + * + * @author Sin + * @time 2019-04-27 10:19 + */ +@Data +@Accessors(chain = true) +public class OrderReturnInfoBO implements Serializable { + + /** + * 退货信息 + */ + private ReturnInfo returnInfo; + /** + * 订单 item + */ + private List orderItems; + /** + * 最后一个物流信息/最新物流信息 + */ + private OrderLastLogisticsInfoBO lastLogisticsInfo; + + @Data + @Accessors(chain = true) + public static class OrderItem { + + /** + * 商品编号 + */ + private Integer skuId; + /** + * 商品名称 + */ + private String skuName; + /** + * 商品图片 + */ + private String skuImage; + /** + * 数量 + */ + private Integer quantity; + /** + * 最终总金额,单位:分。 + */ + private Integer presentTotal; + } + + @Data + @Accessors(chain = true) + public static class ReturnInfo { + + /** + * 编号自动增长 + */ + private Integer id; + /** + * 服务号 + */ + private String serviceNumber; + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单号 (保存一个冗余) + */ + private String orderNo; + /** + * 物流id + */ + private Integer orderLogisticsId; + + /// + /// 退货原因 + + /** + * 退货金额 + */ + private Integer refundPrice; + /** + * 退货原因(字典值) + */ + private Integer reason; + /** + * 问题描述 + */ + private String describe; + + /// + /// 时间信息 + + /** + * 同意时间 + */ + private Date approvalTime; + /** + * 物流时间(填写物流单号时间) + */ + private Date logisticsTime; + /** + * 收货时间 + */ + private Date receiverTime; + /** + * 成交时间(确认时间) + */ + private Date closingTime; + /** + * 退款类型 + * + * - 1、退货退款 + * - 2、退款 + */ + private Integer serviceType; + /** + * 退款类型 转换值 + */ + private String serviceTypeText; + /** + * 状态 + * + * - 1、退货申请 + * - 2、申请成功 + * - 3、申请失败 + * - 4、退货中 + * - 5、退货成功 + */ + private Integer status; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnListBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnListBO.java new file mode 100644 index 000000000..608760da1 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/OrderReturnListBO.java @@ -0,0 +1,124 @@ +package cn.iocoder.mall.order.biz.bo.order; + +import cn.iocoder.common.framework.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 订单退货 list + * + * @author Sin + * @time 2019-05-06 21:54 + */ +@Data +@Accessors(chain = true) +public class OrderReturnListBO implements Serializable { + + /** + * 分页当前 index + */ + private Integer index; + /** + * pageSize + */ + private Integer pageSize; + /** + * totalCount + */ + private Integer totalCount; + /** + * data + */ + private List data; + + @Data + @Accessors(chain = true) + public static class OrderReturn { + + /** + * 编号自动增长 + */ + private Integer id; + /** + * 服务号 + */ + private String serviceNumber; + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单号 (保存一个冗余) + */ + private String orderNo; + /** + * 物流id + */ + private Integer orderLogisticsId; + + /// + /// 退货原因 + + /** + * 退货金额 + */ + private Integer refundPrice; + /** + * 退货原因(字典值) + */ + private Integer reason; + /** + * 问题描述 + */ + private String describe; + + /// + /// 时间信息 + + /** + * 同意时间 + */ + private Date approvalTime; + /** + * 物流时间(填写物流单号时间) + */ + private Date logisticsTime; + /** + * 收货时间 + */ + private Date receiverTime; + /** + * 成交时间(确认时间) + */ + private Date closingTime; + /** + * 服务类型 + * + * - 1、退货退款 + * - 2、退款 + */ + private Integer serviceType; + /** + * 状态 + * + * - 1、退货申请 + * - 2、申请成功 + * - 3、申请失败 + * - 4、退货中 + * - 5、退货成功 + */ + private Integer status; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java new file mode 100644 index 000000000..4fe42daee --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/bo/order/PostageDetailBO.java @@ -0,0 +1,14 @@ +package cn.iocoder.mall.order.biz.bo.order; + +public class PostageDetailBO { + +// "description": "有品甄选商品,即有品配送和第三方商家发货的商品,2018年1月1日起,单笔订单满99元免运费,不满99元收10元运费。", +// "leftTotal": "0.00", +// "merchantName": "有品配送", +// "postFee": "0.00", +// "postage": "10.00", +// "postageType": 0, +// "selCount": 14, +// "threshold": "99.00" + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/config/DatabaseConfiguration.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/config/DatabaseConfiguration.java new file mode 100644 index 000000000..c23aba7b7 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/config/DatabaseConfiguration.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.order.biz.config; + +import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; +import com.baomidou.mybatisplus.core.injector.ISqlInjector; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@MapperScan("cn.iocoder.mall.order.biz.dao") // 扫描对应的 Mapper 接口 +@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600 +public class DatabaseConfiguration { + + // 数据库连接池 Druid + + @Bean + public ISqlInjector sqlInjector() { + return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除 + } + + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); // MyBatis Plus 分页插件 + } + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java new file mode 100644 index 000000000..ed20bd083 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/CartConvert.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface CartConvert { + + CartConvert INSTANCE = Mappers.getMapper(CartConvert.class); + +// CalcOrderPriceBO.Item convert(ProductSkuDetailBO sku); +// +// List convert(List items); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java new file mode 100644 index 000000000..8f8ddb4e7 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java @@ -0,0 +1,44 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * 订单评论 convert + * + * @author wtz + * @time 2019-05-31 18:30 + */ +@Mapper +public interface OrderCommentConvert { + + OrderCommentConvert INSTANCE = Mappers.getMapper(OrderCommentConvert.class); + +// @Mappings({}) +// OrderCommentStateInfoPageBO.OrderCommentStateInfoItem convertOrderCommentStateInfoItem( +// OrderCommentDO orderCommentDO); +// +// @Mappings({}) +// List convertOrderCommentStateInfoItems( +// List orderCommentDOList); +// +// @Mappings({}) +// OrderCommentDO convertOrderCommentDO(OrderCommentCreateDTO orderCommentCreateDTO); +// +// @Mappings({}) +// OrderCommentCreateBO convertOrderCommentCreateBO(OrderCommentDO orderCommentDO); +// +// @Mappings({}) +// OrderCommentInfoBO convertOrderCommentInfoBO(OrderCommentDO orderCommentDO); +// +// @Mappings({}) +// OrderCommentTimeOutBO convertOrderCommentTimeOutBO(OrderCommentDO orderCommentDO); +// +// @Mappings({}) +// List convertOrderCommentTimeOutBOList( +// List orderCommentDOList); + + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java new file mode 100644 index 000000000..bfa344a2a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java @@ -0,0 +1,30 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + * 评论回复 convert + * + * @author wtz + * @time 2019-05-31 18:30 + */ +@Mapper +public interface OrderCommentReplyConvert { + + OrderCommentReplyConvert INSTANCE = Mappers.getMapper(OrderCommentReplyConvert.class); + +// @Mappings({}) +// OrderCommentReplyDO convert(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO); +// +// @Mappings({}) +// OrderCommentReplyCreateBO convert(OrderCommentReplyDO orderCommentReplyDO); +// +// @Mappings({}) +// List convert(List orderCommentReplyDOList); +// +// @Mappings({}) +// List convertOrderCommentReplayItem( +// List orderCommentReplyDOList); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java new file mode 100644 index 000000000..423f77843 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderConvert.java @@ -0,0 +1,22 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单 convert + * + * @author Sin + * @time 2019-03-17 10:14 + */ +@Mapper +public interface OrderConvert { + + OrderConvert INSTANCE = Mappers.getMapper(OrderConvert.class); + +// @Mappings({}) +// List convertPageBO(List orderDOList); +// +// @Mappings({}) +// OrderInfoBO convert(OrderDO orderDO); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java new file mode 100644 index 000000000..f22b3cb67 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderItemConvert.java @@ -0,0 +1,31 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单 item convert + * + * @author Sin + * @time 2019-03-23 14:34 + */ +@Mapper +public interface OrderItemConvert { + + OrderItemConvert INSTANCE = Mappers.getMapper(OrderItemConvert.class); + +// @Mappings({}) +// OrderItemDO convert(OrderItemUpdateDTO orderItemUpdateDTO); +// +// @Mappings({}) +// List convertOrderItemBO(List orderItemDOList); +// +// @Mappings({}) +// List convert(List orderCreateItemDTOList); +// +// @Mappings({}) +// List convertOrderItemDO(List orderItemDOList); +// +// @Mappings({}) +// List convertOrderInfoWithOrderItem(List orderItemDOList); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderLogisticsConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderLogisticsConvert.java new file mode 100644 index 000000000..17baca854 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderLogisticsConvert.java @@ -0,0 +1,48 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单物流 convert + * + * @author Sin + * @time 2019-03-23 14:39 + */ +@Mapper +public interface OrderLogisticsConvert { + + OrderLogisticsConvert INSTANCE = Mappers.getMapper(OrderLogisticsConvert.class); + +// @Mappings({}) +// OrderLogisticsDO convert(OrderDeliveryDTO orderDelivery); +// +// @Mappings({}) +// OrderLogisticsDO convert(OrderLogisticsUpdateDTO orderLogisticsDTO); +// +// @Mappings({}) +// OrderLogisticsDO convert(OrderRecipientDO orderRecipientDO); +// +// @Mappings({}) +// List convertLogistics( +// List orderLogisticsDOList); +// +// @Mappings({}) +// List convertLogisticsDetail( +// List orderLogisticsDOList); +// +// @Mappings({}) +// OrderLogisticsInfoBO convert(OrderLogisticsDO orderLogisticsDO); +// +// @Mappings({}) +// List convert( +// List orderLogisticsDetailDOList); +// +// @Mappings({}) +// @Named(value = "orderLastLogisticsInfoBO") +// OrderLastLogisticsInfoBO convertOrderLastLogisticsInfoBO(OrderLogisticsDO orderLogisticsDO); +// +// @Mappings({}) +// OrderLastLogisticsInfoBO.LogisticsDetail convertLastLogisticsDetail( +// OrderLogisticsDetailDO orderLogisticsDetailDO); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderLogisticsDetailConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderLogisticsDetailConvert.java new file mode 100644 index 000000000..8d52f7fa9 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderLogisticsDetailConvert.java @@ -0,0 +1,20 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单物流 convert + * + * @author Sin + * @time 2019-03-23 14:39 + */ +@Mapper +public interface OrderLogisticsDetailConvert { + + OrderLogisticsDetailConvert INSTANCE = Mappers.getMapper(OrderLogisticsDetailConvert.class); + +// @Mappings({}) +// OrderInfoBO.LogisticsDetail convertLogisticsDetail( +// OrderLogisticsDetailDO orderLogisticsDetailDO); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java new file mode 100644 index 000000000..08c46676a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java @@ -0,0 +1,31 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单收件人信息 + * + * @author Sin + * @time 2019-03-31 12:50 + */ +@Mapper +public interface OrderRecipientConvert { + + OrderRecipientConvert INSTANCE = Mappers.getMapper(OrderRecipientConvert.class); + +// @Mappings({}) +// OrderRecipientDO convert(OrderCreateDTO orderCreateDTO); +// +// @Mappings({}) +// OrderRecipientDO convert(UserAddressBO userAddressBO); +// +// @Mappings({}) +// OrderRecipientBO convert(OrderRecipientDO orderRecipientDO); +// +// @Mappings({}) +// List convert(List orderRecipientDOList); +// +// @Mappings({}) +// OrderInfoBO.Recipient convertOrderInfoRecipient(OrderRecipientDO orderRecipientDO); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderReturnConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderReturnConvert.java new file mode 100644 index 000000000..c79171571 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderReturnConvert.java @@ -0,0 +1,31 @@ +package cn.iocoder.mall.order.biz.convert; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单 return + * + * @author Sin + * @time 2019-03-30 15:46 + */ +@Mapper +public interface OrderReturnConvert { + + OrderReturnConvert INSTANCE = Mappers.getMapper(OrderReturnConvert.class); + +// @Mappings({}) +// OrderReturnDO convert(OrderReturnCreateDTO orderReturnCreate); +// +// @Mappings({}) +// OrderReturnDO convert(OrderReturnApplyDTO orderReturnApplyDTO); +// +// @Mappings({}) +// OrderReturnInfoBO.ReturnInfo convert(OrderReturnDO orderReturnDO); +// +// @Mappings({}) +// List convert(List orderItemDOList); +// +// @Mappings({}) +// List convertListBO(List orderReturnDOList); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java new file mode 100644 index 000000000..a2dd5c536 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/cart/CartMapper.java @@ -0,0 +1,46 @@ +package cn.iocoder.mall.order.biz.dao.cart; + +import cn.iocoder.mall.order.biz.dataobject.CartItemDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; + +@Repository +public interface CartMapper { +// +// CartItemDO selectById(@Param("id") Integer id); +// +// List selectByIds(@Param("ids") Collection ids); +// +// CartItemDO selectByUserIdAndSkuIdAndStatus(@Param("userId") Integer userId, +// @Param("skuId") Integer skuId, +// @Param("status") Integer status); +// +// Integer selectQuantitySumByUserIdAndStatus(@Param("userId") Integer userId, +// @Param("status") Integer status); +// +// List selectByUserIdAndStatusAndSelected(@Param("userId") Integer userId, +// @Param("status") Integer status, +// @Param("selected") Boolean selected); +//// +//// List selectListByTitleLike(@Param("title") String title, +//// @Param("offset") Integer offset, +//// @Param("limit") Integer limit); +// +//// Integer selectCountByTitleLike(@Param("title") String title); +// +// void insert(CartItemDO cartItemDO); +// +// int update(CartItemDO cartItemDO); +// +// int updateQuantity(@Param("id") Integer id, +// @Param("quantityIncr") Integer quantityIncr); +// +// int updateListByUserIdAndSkuId(@Param("userId") Integer userId, +// @Param("skuIds") Collection skuIds, +// @Param("selected") Boolean selected, +// @Param("status") Integer status); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/comment/OrderCommentMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/comment/OrderCommentMapper.java new file mode 100644 index 000000000..57a73649c --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/comment/OrderCommentMapper.java @@ -0,0 +1,84 @@ +package cn.iocoder.mall.order.biz.dao.comment; + +import org.springframework.stereotype.Repository; + +/** + * + * 订单评论 mapper + * + * @author wtz + * @time 2019-05-16 20:52 + */ +@Repository +public interface OrderCommentMapper{ + + +// /** +// * 插入订单评论 +// * @param orderCommentDO +// * @return +// */ +// void insert(OrderCommentDO orderCommentDO); +// +// +// /** +// * 根据 sku id 查询评论总条数 +// * @param productSkuId +// * @return +// */ +// int selectCommentTotalCountByProductSkuId(@Param("productSkuId") Integer productSkuId); +// +// +// /** +// * 分页获取评论 +// * @param orderCommentPageDTO +// * @return +// */ +// List selectCommentPage(OrderCommentPageDTO orderCommentPageDTO); +// +// +// /** +// * 根据评论 id 查询评论详情 +// * @param id +// * @return +// */ +// OrderCommentDO selectCommentInfoByCommentId(@Param("id") Integer id); +// +// +// /** +// * 订单评论状态信息详情 +// * @param orderCommentStateInfoPageDTO +// * @return +// */ +//// List selectOrderCommentStateInfoPage( +//// OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO); +// +// +// /** +// * 订单评论状态总数 +// * @param userId,commentState +// * @return +// */ +// int selectOrderCommentStateInfoTotal(@Param("userId") Integer userId, +// @Param("commentState") Integer commentState); +// +// +// /** +// * 订单评论超时分页 +// * @param orderCommentTimeOutPageDTO +// * @return +// */ +// List selectOrderCommentTimeOutPage( +// @Param("commentTimeOut") OrderCommentTimeOutPageDTO orderCommentTimeOutPageDTO); +// +// /** +// * 批量更新订单评论状态 +// * @param orderCommentTimeOutBOList +// * @param commentState +// */ +// void updateBatchOrderCommentState(@Param("commentState") Integer commentState, +// @Param("list") List orderCommentTimeOutBOList); + + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/comment/OrderCommentReplayMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/comment/OrderCommentReplayMapper.java new file mode 100644 index 000000000..d155c9206 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/comment/OrderCommentReplayMapper.java @@ -0,0 +1,58 @@ +package cn.iocoder.mall.order.biz.dao.comment; + +import org.springframework.stereotype.Repository; + +/** + * 订单评论回复 mapper + * + * @author wtz + * @time 2019-05-16 21:33 + */ +@Repository +public interface OrderCommentReplayMapper { + +// /** +// * 插入订单评论回复 +// * @param orderCommentReplyDO +// * @return +// */ +// void insert(OrderCommentReplyDO orderCommentReplyDO); +// +// /** +// * 根据评论 id 和用户类型获取商家回复 +// * @param commentId,userType +// * @return +// */ +// List selectCommentMerchantReplyByCommentIdAndUserType( +// @Param("commentId") Integer commentId, +// @Param("userType") Integer userType); +// +// +// /** +// * 分页获取评论回复 +// * @param orderCommentReplyPageDTO +// * @return +// */ +// List selectCommentReplyPage( +// OrderCommentReplyPageDTO orderCommentReplyPageDTO); +// +// +// /** +// * 根据评论 id 和用户类型获取评论回复总数 +// * @param commentId,userType +// * @return +// */ +// int selectCommentReplyTotalCountByCommentId(@Param("commentId") Integer commentId, +// @Param("userType") Integer userType); +// +// +// /** +// * 根据评论 id 查询最新的商家回复 +// * @param commentIds +// * @return +// */ +// List selectCommentNewMerchantReplyByCommentIds( +// @Param("commentIds") Collection commentIds, +// @Param("userType") Integer userType); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderCancelMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderCancelMapper.java new file mode 100644 index 000000000..59d402475 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderCancelMapper.java @@ -0,0 +1,17 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.biz.dataobject.OrderCancelDO; +import org.springframework.stereotype.Repository; + +/** + * 订单取消 mapper + * + * @author Sin + * @time 2019-03-30 16:27 + */ +@Repository +public interface OrderCancelMapper { + + int insert(OrderCancelDO orderCancelDO); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderItemMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderItemMapper.java new file mode 100644 index 000000000..5c5550ce6 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderItemMapper.java @@ -0,0 +1,84 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.biz.dataobject.OrderItemDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; + +/** + * 订单 item mapper + * + * @author Sin + * @time 2019-03-16 15:09 + */ +@Repository +public interface OrderItemMapper { + + /** + * 插入数据 + * + * @param orderItemDOList + */ + void insert(@Param("list") List orderItemDOList); + + /** + * 更新 - 根据Id + * + * @param orderItemDO + */ + void updateById(@Param("orderItemDO") OrderItemDO orderItemDO); + + /** + * 更新 - 根据 orderId + * @param orderId + * @param orderItemDO + */ + void updateByOrderId( + @Param("orderId") Integer orderId, + @Param("orderItemDO") OrderItemDO orderItemDO + ); + + /** + * 更新 - 根据Ids + * + * @param ids + * @param orderItemDO + */ + void updateByIds( + @Param("ids") List ids, + @Param("orderItemDO") OrderItemDO orderItemDO + ); + + /** + * 获取 - 根据 ids 查询 + * + * @param ids + * @return + */ + List selectByIds(@Param("ids") Collection ids); + + /** + * 查询 - 根据 orderIds 和 status + * + * @param orderIds + * @param deleted + * @return + */ + List selectByDeletedAndOrderIds( + @Param("orderIds") Collection orderIds, + @Param("deleted") Integer deleted + ); + + /** + * 查询 - 根据 orderId 下的 item + * + * @param orderId + * @return + */ + List selectByDeletedAndOrderId( + @Param("deleted") Integer deleted, + @Param("orderId") Integer orderId + ); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderLogisticsDetailMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderLogisticsDetailMapper.java new file mode 100644 index 000000000..dddc9c394 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderLogisticsDetailMapper.java @@ -0,0 +1,66 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDetailDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; + +/** + * 订单物流 - 物流详细信息 + * + * @author Sin + * @time 2019-04-12 21:35 + */ +@Repository +public interface OrderLogisticsDetailMapper { + + /** + * 插入 + * + * @param orderLogisticsDetailDO + * @return + */ + int insert(OrderLogisticsDetailDO orderLogisticsDetailDO); + + /** + * 查询 - 根据 物流id + * + * @param orderLogisticsId + * @return + */ + List selectByOrderLogisticsId( + @Param("orderLogisticsId") Integer orderLogisticsId + ); + + /** + * 查询 - 根据 物流ids + * + * @param orderLogisticsIds + * @return + */ + List selectByOrderLogisticsIds( + @Param("orderLogisticsIds") Collection orderLogisticsIds + ); + + /** + * 查询 - 获取最新的物流信息 + * + * @param orderLogisticsIds + * @return + */ + OrderLogisticsDetailDO selectLast( + @Param("orderLogisticsIds") Collection orderLogisticsIds + ); + + /** + * 查询 - 根据 last 根据物理id + * + * @param orderLogisticsId + * @return + */ + OrderLogisticsDetailDO selectLastByLogisticsId( + @Param("orderLogisticsId") Integer orderLogisticsId + ); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderLogisticsMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderLogisticsMapper.java new file mode 100644 index 000000000..9927933bc --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderLogisticsMapper.java @@ -0,0 +1,53 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; + +/** + * 订单 item mapper + * + * @author Sin + * @time 2019-03-16 15:09 + */ +@Repository +public interface OrderLogisticsMapper { + + /** + * 插入数据 + * + * @param orderLogisticsDO + */ + void insert(OrderLogisticsDO orderLogisticsDO); + + /** + * 更新 - 根据id + * + * @param orderLogisticsDO + */ + void updateById(OrderLogisticsDO orderLogisticsDO); + + /** + * 查询 - 根据 ids + * + * @param id + * @return + */ + OrderLogisticsDO selectById( + @Param("id") Integer id + ); + + /** + * 查询 - 根据 ids + * + * @param ids + * @return + */ + List selectByIds( + @Param("ids") Collection ids + ); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderMapper.java new file mode 100644 index 000000000..dac1f6847 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderMapper.java @@ -0,0 +1,53 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.biz.dataobject.OrderDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + * 订单 mapper + * + * @author Sin + * @time 2019-03-16 15:09 + */ +@Repository +public interface OrderMapper extends BaseMapper { + +// /** +// * 更新 - 根据 id 更新 +// * +// * @param orderDO +// * @return +// */ +// int updateById(OrderDO orderDO); +// +// int updateByIdAndStatus(@Param("id") Integer id, +// @Param("status") Integer status, +// @Param("updateObj") OrderDO updateObj); +// +// /** +// * 查询 - 根据id 查询 +// * +// * @param id +// * @return +// */ +// OrderDO selectById( +// @Param("id") Integer id +// ); +// +// /** +// * 查询 - 后台分页page +// * +// * @param orderQueryDTO +// * @return +// */ +// int selectPageCount(OrderQueryDTO orderQueryDTO); +// +// /** +// * 查询 - 后台分页page +// * +// * @param orderQueryDTO +// * @return +// */ +// List selectPage(OrderQueryDTO orderQueryDTO); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderRecipientMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderRecipientMapper.java new file mode 100644 index 000000000..eb6be60c1 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderRecipientMapper.java @@ -0,0 +1,47 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; + +/** + * 订单收件人 信息 + * + * @author Sin + * @time 2019-03-31 12:16 + */ +@Repository +public interface OrderRecipientMapper { + + /** + * 插入 - 订单收件人 + * + * @param orderRecipient + * @return + */ + int insert(OrderRecipientDO orderRecipient); + + /** + * 查询 - 根据 orderId + * + * @param orderId + * @return + */ + OrderRecipientDO selectByOrderId( + @Param("orderId") Integer orderId + ); + + /** + * 查询 - 根据 orderIds + * + * @param orderIds + * @return + */ + List selectByOrderIds( + @Param("orderIds") Collection orderIds + ); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderReturnMapper.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderReturnMapper.java new file mode 100644 index 000000000..f15bf7733 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dao/order/OrderReturnMapper.java @@ -0,0 +1,68 @@ +package cn.iocoder.mall.order.biz.dao.order; + +import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO; +import cn.iocoder.mall.order.biz.dataobject.OrderReturnDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 订单退货 mapper + * + * @author Sin + * @time 2019-03-30 15:36 + */ +@Repository +public interface OrderReturnMapper { + + /** + * 插入 - 退货信息 + * + * @param orderReturnDO + * @return + */ + int insert(OrderReturnDO orderReturnDO); + + /** + * 更新 - 根据 orderId + * + * @param orderReturnDO + * @return + */ + int updateById(OrderReturnDO orderReturnDO); + + /** + * 查询 - 根据 orderId + * + * @param orderId + * @return + */ + OrderReturnDO selectByOrderId( + @Param("orderId") Integer orderId + ); + + /** + * 列表查询 - queryDTO + * + * @param queryDTO + * @return + */ + int selectListCount(OrderReturnQueryDTO queryDTO); + + /** + * 列表查询 - queryDTO + * + * @param queryDTO + * @return + */ + List selectList(OrderReturnQueryDTO queryDTO); + + /** + * 查询 - 根据 id 查询 + * + * @param id + * @return + */ + OrderReturnDO selectById(Integer id); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java new file mode 100644 index 000000000..c92a6db1a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java @@ -0,0 +1,95 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import java.util.Date; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 购物车的商品信息 + */ +@Data +@Accessors(chain = true) +public class CartItemDO extends BaseDO { + + // ========= 基础字段 BEGIN ========= + + /** + * 编号,唯一自增。 + */ + private Integer id; + /** + * 状态 + * + * 1-正常 + * 2-主动删除 + * 3-下单删除 + */ + private Integer status; + /** + * 商品在购物车中的删除时间 + */ + private Date deleteTime; + /** + * 是否选中 + */ + private Boolean selected; + + // ========= 基础字段 END ========= + + // ========= 买家信息 BEGIN ========= + + /** + * 用户编号 + */ + private Integer userId; + + // ========= 买家信息 END ========= + + // ========= 商品信息 BEGIN ========= + + /** + * 商品 SPU 编号 + */ + private Integer spuId; + /** + * 商品 SKU 编号 + */ + private Integer skuId; + /** + * 商品购买数量 + */ + private Integer quantity; + + // TODO 冗余字段 + + + // ========= 商品信息 END ========= + + // ========= 交易信息 BEGIN ========= + + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单创建时间 + */ + private Date orderCreateTime; + + // ========= 交易信息 BEGIN ========= + + // ========= 优惠信息 BEGIN ========= + +// /** +// * 商品营销活动编号 +// */ +// private Integer activityId; +// /** +// * 商品营销活动类型 +// */ +// private Integer activityType; + + // ========= 优惠信息 END ========= + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java new file mode 100644 index 000000000..26afd1b98 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCancelDO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单关闭 + * + * - 注意:订单只有在用户为付款前取消。 + * + * - 取消订单,这里是取消整个订单,不能对订单 item 单独做取消 + * + * @author Sin + * @time 2019-03-30 16:20 + */ +@Data +@Accessors(chain = true) +public class OrderCancelDO extends BaseDO { + + /** + * id + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 订单编号 + */ + private String orderNo; + /** + * 关闭订单原因(字典) + */ + private Integer reason; + /** + * 原因(如果选择其他,原因保存在这) + */ + private String otherReason; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java new file mode 100644 index 000000000..916361748 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java @@ -0,0 +1,125 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单评论表 + * + * @author wtz + * @time 2019-05-14 20:48 + * + */ +@Data +@Accessors(chain = true) +@TableName(value = "order_comment") +public class OrderCommentDO extends BaseDO { + + /** + * 评论 id // TODO FROM 芋艿 TO wtz 中英文之间,要有空格 + */ + private Integer id; + + /** + * 订单 id + */ + private Integer orderId; + + /** + * 订单编号 + */ + private String orderNo; + + /** + * 商品 id + */ + private Integer productSpuId; + + /** + * 商品名称 + */ + private String productSpuName; + + /** + * 商品 sku id + */ + private Integer productSkuId; + + /** + * 商品 sku 属性 + */ + private String productSkuAttrs; + + /** + * 商品 sku 价格 + */ + private Integer productSkuPrice; + + /** + * 商品 sku url + */ + private String productSkuPicUrl; + + /** + * 用户id + */ + private Integer userId; + + /** + * 用户头像 + */ + private String userAvatar; + + /** + * 用户的真实姓名 + */ + private String userNickName; + + /** + * 评价星 + */ + private Integer star; + + /** + * 商品描述 + */ + private Integer productDescriptionStar; + + /** + * 物流评价 + */ + private Integer logisticsStar; + + /** + * 商家评价 + */ + private Integer merchantStar; + + /** + * 回复条数 + */ + private Integer replayCount; + + /** + * 点赞数 // TODO FROM 芋艿 TO wtz collect 是收藏的意思,最好换个单词噢。 + */ + private Integer likeCount; + + /** + * 评论的内容 + */ + private String commentContent; + + /** + * 评论的图片地址 + */ + private String commentPics; + + /** + * 订单评论状态 + */ + private Integer commentState; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java new file mode 100644 index 000000000..713e2550a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplyDO.java @@ -0,0 +1,87 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 商品评价回复表 + * + * // TODO FROM 芋艿 TO wtz 商品评价回复表 =》订单评论回复表 + * + * @author wtz + * @time 2019-05-14 21:00 + * + */ +@Data +@Accessors(chain = true) +@TableName(value = "order_comment_replay") +public class OrderCommentReplyDO extends BaseDO { + + /** + * 回复 id + */ + private Integer id; + + /** + * 评论 id + */ + private Integer commentId; + + /** + * 回复的类型 // TODO FROM 芋艿 TO wtz 记得加下枚举类 + */ + private Integer replyType; + + /** + * 父 id + */ + private Integer parentId; + + /** + * 回复目标用户 id + */ + private Integer parentUserId; + + /** + * 回复目标用户昵称 + */ + private String parentUserNickName; + + /** + * 回复目标用户头像 + */ + private String parentUserAvatar; + + /** + * 回复的内容 + */ + private String replyContent; + + /** + * 回复用户 id + */ + private Integer replyUserId; + + /** + * 回复用户昵称 + */ + private String replyUserNickName; + + /** + * 回复用户头像 + */ + private String replyUserAvatar; + + /** + * 回复用户身份 // TODO FROM 芋艿 TO wtz 【提示】userType 和 UserTypeEnum 记录保持一致。 + */ + private Integer userType; + + /** + * 回复点赞数 + */ + private Integer replyLikeCount; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java new file mode 100644 index 000000000..3632794bd --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderDO.java @@ -0,0 +1,104 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableName; +import java.util.Date; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单 + * + * @author Sin + * @time 2019-03-16 13:49 + */ +@Data +@Accessors(chain = true) +@TableName(value = "orders") +public class OrderDO extends DeletableDO { + + /** + * id + */ + private Integer id; + /** + * 用户编号 + */ + private Integer userId; + /** + * 订单编号 + */ + private String orderNo; + /** + * 购买(商品)总金额,单位:分 + */ + private Integer buyPrice; + /** + * 优惠总金额,单位:分。 + */ + private Integer discountPrice; + /** + * 物流金额 (分) + */ + private Integer logisticsPrice; + /** + * 最终金额,单位:分 + * + * buyPrice + logisticsPrice - discountPrice = presentPrice + */ + private Integer presentPrice; + /** + * 实际已支付金额,单位:分 + * + * 初始时,金额为 0 。等到支付成功后,会进行更新。 + */ + private Integer payAmount; + + /// + /// 时间信息 + + /** + * 付款时间(待发货) + */ + private Date paymentTime; + /** + * 发货时间(待收货) + */ + private Date deliveryTime; + /** + * 收货时间(已签收) + */ + private Date receiverTime; + /** + * 成交时间(用户确认收货 -> status = 已完成) + */ + private Date closingTime; + + /// + /// 其他 + + /** + * 是否退货 + * + * - 1、没有 + * - 2、换货 + * - 3、退货 + * - 4、换货 + 退货 + */ + private Integer hasReturnExchange; + /** + * 状态(如果有多个商品分开发货需要全部商品发完才会改变状态) + * + * - 1、待付款 + * - 2、待发货 + * - 3、待收获 + * - 4、已完成 + * - 5、已关闭 + */ + private Integer status; + /** + * 备注 + */ + private String remark; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java new file mode 100644 index 000000000..971ac0283 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderExchangeDO.java @@ -0,0 +1,113 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import java.util.Date; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 换货订单 + * + * @author Sin + * @time 2019-03-19 19:48 + */ +@Data +@Accessors(chain = true) +public class OrderExchangeDO extends DeletableDO { + + /** + * id + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 订单编号 + */ + private String orderNo; + /** + * 订单 item 编号 + */ + private Integer orderItemId; + /** + * 商品id(保存一个冗余,如果一个订单下存在多个商品,会有很大的作用) + */ + private String skuId; + /** + * 换货商品id + */ + private String exchangeSkuId; + /** + * 换货物流id + */ + private Integer exchangeOrderLogisticsId; + /** + * 收件物流id + */ + private Integer receiverOrderLogisticsId; + + /// + /// 原因 + + /** + * 原因 (关联字典) + * + * {@link cn.iocoder.mall.order.biz.constants.OrderExchangeReasonEnum} + */ + private Integer orderReasonId; + /** + * 原因(如果选择其他,原因保存在这) + * + * {@link cn.iocoder.mall.order.biz.constants.OrderExchangeReasonEnum#REASON_000} + */ + private String reason; + + /// + /// 时间信息 + + /** + * 创建时间 + * supper baseDO + */ +// private Date createTime; + /** + * 付款时间 + */ + private Date paymentTime; + /** + * 发货时间 + */ + private Date deliveryTime; + /** + * 收货时间 + */ + private Date receiverTime; + /** + * 成交时间 + */ + private Date closingTime; + + /// + /// 其他 + + /** + * 订单类型 + * + * - 0、为 Order 订单 (对整个订单退货) + * - 1、为 OrderItem 订单 (对订单某一个商品退货) + */ + private Integer orderType; + /** + * 状态 + * + * - 申请换货 + * - 申请成功 + * - 申请失败 + * - 换货中 + * - 换货成功 + */ + private Integer status; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java new file mode 100644 index 000000000..2196ea9c2 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderItemDO.java @@ -0,0 +1,143 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import java.util.Date; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单 item + * + * @author Sin + * @time 2019-03-16 14:03 + */ +@Data +@Accessors(chain = true) +public class OrderItemDO extends DeletableDO { + + /** + * 编号 + */ + private Integer id; + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单号 + */ + private String orderNo; + /** + * 商品编号 + */ + private Integer skuId; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 商品名称 + */ + private String skuName; + /** + * 商品图片 + */ + private String skuImage; + /** + * 数量 + */ + private Integer quantity; + /** + * 原始单价,单位:分。 + */ + 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; + // 如上字段,举个例子: + // 假设购买三个,即 quantity = 3 。 + // originPrice = 15 + // 使用限时折扣(单品优惠)8 折,buyPrice = 12 + // 开始算总的价格 + // buyTotal = buyPrice * quantity = 12 * 3 = 36 + // discountTotal ,假设有满减送(分组优惠)满 20 减 10 ,并且使用优惠劵满 1.01 减 1 ,则 discountTotal = 10 + 1 = 11 + // presentTotal = buyTotal - discountTotal = 24 - 11 = 13 + // 最终 presentPrice = presentTotal / quantity = 13 / 3 = 4.33 + + /// + /// 时间信息 + + /** + * 付款时间 + */ + private Date paymentTime; + /** + * 发货时间 + */ + private Date deliveryTime; + /** + * 收货时间 + */ + private Date receiverTime; + /** + * 成交时间 + */ + private Date closingTime; + + /// + /// 其他 + + /** + * 是否退货 + * + * - 1、没有 + * - 2、换货 + * - 3、退货 + * - 4、换货 + 退货 + */ + private Integer hasReturnExchange; + /** + * 发货方式 + * + * - 1 未选择 + * - 2 在线下单 + * - 3 自己联系快递 + * - 4 无物流 + */ + private Integer deliveryType; + /** + * 状态 + * + * - 1、待付款 + * - 2、待发货 + * - 3、已发货 + * - 4、已完成 + * - 5、已关闭 + */ + private Integer status; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java new file mode 100644 index 000000000..fb402f3ae --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDO.java @@ -0,0 +1,46 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单物流信息 + * + * @author Sin + * @time 2019-03-19 20:47 + */ +@Data +@Accessors(chain = true) +public class OrderLogisticsDO extends BaseDO { + + /** + * id + */ + private Integer id; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + /** + * 物流 (字典) + */ + private Integer logistics; + /** + * 物流编号 + */ + private String logisticsNo; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java new file mode 100644 index 000000000..0e67c0596 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderLogisticsDetailDO.java @@ -0,0 +1,37 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import java.util.Date; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单物流 - 详细信息 + * + * - 同步第三方物流信息 + * + * @author Sin + * @time 2019-03-19 20:48 + */ +@Data +@Accessors(chain = true) +public class OrderLogisticsDetailDO extends DeletableDO { + + /** + * id + */ + private Integer id; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 物流时间 + */ + private Date logisticsTime; + /** + * 物流信息 + */ + private String logisticsInformation; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderPreferentialDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderPreferentialDO.java new file mode 100644 index 000000000..b7b06cf42 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderPreferentialDO.java @@ -0,0 +1,46 @@ +package cn.iocoder.mall.order.biz.dataobject; + +/** + * 订单优惠明细 + */ +// TODO 芋艿 后续在完善 +public class OrderPreferentialDO { + + /** + * 编号 + */ + private Integer id; + /** + * 类型 + * + * 1 - 促销活动 + * 2 - 优惠劵 + */ + private Integer type; + // TODO 芋艿 优惠劵编号 or 促销活动编号 + /** + * 订单编号 + */ + private Integer orderId; + /** + * 商品 SPU 编号 + */ + private Integer spuId; + /** + * 商品 SKU 编号 + */ + private Integer skuId; + /** + * 商品数量 + */ + private Integer quantity; + /** + * 传入时的价格 + */ + private Integer originTotal; + /** + * 总优惠价格 + */ + private Integer discountTotal; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java new file mode 100644 index 000000000..537c05773 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java @@ -0,0 +1,48 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单收件人信息 order_recipient (配送信息) + * + * @author Sin + * @time 2019-03-31 11:37 + */ +@Data +@Accessors(chain = true) +public class OrderRecipientDO extends BaseDO { + + /** + * 编号 + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 配送类型 + * + * - 1 快递 + */ + private Integer type; + /** + * 收件详细地址 + */ + private String address; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java new file mode 100644 index 000000000..b9e9c93bf --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderReturnDO.java @@ -0,0 +1,102 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.mall.mybatis.dataobject.BaseDO; +import java.util.Date; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 退货订单 + * + * @author Sin + * @time 2019-03-19 19:48 + */ +@Data +@Accessors(chain = true) +public class OrderReturnDO extends BaseDO { + + // TODO FROM 芋艿 TO 小范,存储下支付中心的退款单号 + + /** + * 编号自动增长 + */ + private Integer id; + /** + * 服务号 + */ + // TODO FROM 芋艿 to 小范,换个名字,看着怪怪的 哈哈哈哈。 + private String serviceNumber; + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单号 (保存一个冗余) + */ + private String orderNo; + /** + * 物流id + */ + private Integer orderLogisticsId; + + /// + /// 退货原因 + + /** + * 退货金额 + */ + private Integer refundPrice; + /** + * 退货原因(字典值) + * + * {@link cn.iocoder.mall.order.biz.constants.OrderReturnReasonEnum} + */ + private Integer reason; + /** + * 问题描述 + */ + // TODO FROM 芋艿 to 小范,describe 是动词,换成名词 description + private String describe; + + /// + /// 时间信息 + + /** + * 同意时间 + */ + private Date approvalTime; + /** + * 拒绝时间 + */ + private Date refuseTime; + /** + * 物流时间(填写物流单号时间) + */ + private Date logisticsTime; + /** + * 收货时间 + */ + private Date receiverTime; + /** + * 成交时间(确认时间) + */ + private Date closingTime; + /** + * 服务类型 + * + * - 1、退货退款 + * - 2、退款 + */ + private Integer serviceType; + /** + * 状态 + * + * - 1、退货申请 + * - 2、申请成功 + * - 3、申请失败 + * - 4、退货中 + * - 5、已收货 + * - 6、退货成功 + */ + private Integer status; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md new file mode 100644 index 000000000..f42e41382 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md @@ -0,0 +1,21 @@ + +## 订单 + + +TODO + + +**退货** + +1. 商家未发货,退货原因 + + - 拍错/勿拍/多拍 + - 缺货 + +2. 商家已发货,退货原因 + + - 七天无理由 + - 质量问题 + - 不想要了 + - 其他 + \ No newline at end of file diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentCreateDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentCreateDTO.java new file mode 100644 index 000000000..5c788825c --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentCreateDTO.java @@ -0,0 +1,84 @@ +package cn.iocoder.mall.order.biz.dto.comment; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 订单评论创建 + * + * @author wtz + * @time 2019-05-15 20:42 + * + */ +@ApiModel("订单创建 DTO") +@Data +@Accessors(chain = true) +public class OrderCommentCreateDTO implements Serializable { + + + @ApiModelProperty(value = "订单 id", required = true) + @NotNull(message = "订单 id 不能为空") + private Integer orderId; + + @ApiModelProperty(value = "订单编号", required = true) + @NotEmpty(message = "订单编号不能为空") + private String orderNo; + + @ApiModelProperty(value = "商品 spu id", required = true) + @NotNull(message = "商品的 spu id 不能为空") + private Integer productSpuId; + + @ApiModelProperty(value = "商品 spu name", required = true) + @NotEmpty(message = "商品的 spu name 不能为空") + private String productSpuName; + + @ApiModelProperty(value = "商品 sku id", required = true) + @NotNull(message = "商品的 sku id 不能为空") + private Integer productSkuId; + + @ApiModelProperty(value = "商品 sku attrs", required = true) + @NotEmpty(message = "商品的 sku attrs 不能为空") + private String productSkuAttrs; + + @ApiModelProperty(value = "商品 sku price", required = true) + @NotNull(message = "商品的 sku price 不能为空") + private Integer productSkuPrice; + + @ApiModelProperty(value = "商品 sku url", required = true) + @NotEmpty(message = "商品的 sku url 不能为空") + private String productSkuPicUrl; + + @ApiModelProperty(value = "用户 id", required = true) + private Integer userId; + + @ApiModelProperty(value = "用户头像", required = true) + private String userAvatar; + + @ApiModelProperty(value = "用户昵称", required = true) + @NotEmpty(message = "用户昵称不能为空") + private String userNickName; + + @ApiModelProperty(value = "评价星级", required = true,example = "1-5") + private Integer star; + + @ApiModelProperty(value = "商品描述星级", required = true,example = "1-5") + private Integer productDescriptionStar; + + @ApiModelProperty(value = "物流评价星级", required = true,example = "1-5") + private Integer logisticsStar; + + @ApiModelProperty(value = "商家评价星级", required = true,example = "1-5") + private Integer merchantStar; + + @ApiModelProperty(value = "商家评价内容", required = true,example = "1-5") + private String commentContent; + + @ApiModelProperty(value = "评价图片", required = true) + private String commentPics; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentPageDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentPageDTO.java new file mode 100644 index 000000000..502ae9e0a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentPageDTO.java @@ -0,0 +1,32 @@ +package cn.iocoder.mall.order.biz.dto.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * 订单评论 query + * + */ +@Data +@Accessors(chain = true) +public class OrderCommentPageDTO implements Serializable { + + /** + * 商品 sku id + */ + private Integer productSkuId; + + /** + * 页码 + */ + private Integer pageNo; + + /** + * 每页条数 + */ + private Integer pageSize; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentReplyCreateDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentReplyCreateDTO.java new file mode 100644 index 000000000..e9c267ab8 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentReplyCreateDTO.java @@ -0,0 +1,70 @@ +package cn.iocoder.mall.order.biz.dto.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * 订单回复评论创建 + * + * @author wtz + * @time 2019-05-16 19:07 + * + */ +@Data +@Accessors(chain = true) +public class OrderCommentReplyCreateDTO implements Serializable { + + /** + * 评论 id + */ + private Integer commentId; + + /** + * 评论目标对象 id + */ + private Integer parentId; + + /** + * 评论目标用户 id + */ + private Integer parentUserId; + + /** + * 评论目标用户昵称 + */ + private String parentUserNickName; + + /** + * 评论目标用户头像 + */ + private String parentUserAvatar; + + /** + * 回复内容 + */ + private String replyContent; + + /** + * 回复用户 id + */ + private Integer replyUserId; + + /** + * 回复用户昵称 + */ + private String replyUserNickName; + + /** + * 回复用户头像 + */ + private String replyUserAvatar; + + /** + * 回复用户类型 + */ + private Integer userType; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentReplyPageDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentReplyPageDTO.java new file mode 100644 index 000000000..022f716c3 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentReplyPageDTO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.dto.comment; + + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * 订单评论信息详情 query + * + * @author wtz + * @time 2019-05-19 10:16 + */ +@Data +@Accessors(chain = true) +public class OrderCommentReplyPageDTO implements Serializable { + + /** + * 评论 id + */ + private Integer commentId; + + /** + * 用户类型 + */ + private Integer userType; + + /** + * 页码 + */ + private Integer pageNo; + + /** + * 每页条数 + */ + private Integer pageSize; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentStateInfoPageDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentStateInfoPageDTO.java new file mode 100644 index 000000000..4d42d7740 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentStateInfoPageDTO.java @@ -0,0 +1,38 @@ +package cn.iocoder.mall.order.biz.dto.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * 订单评论状态分页信息 query + * + * @author wtz + * @time 2019-06-07 10:45 + */ +@Data +@Accessors(chain = true) +public class OrderCommentStateInfoPageDTO implements Serializable { + + /** + * 用户 id + */ + private Integer userId; + + /** + * 评论状态 + */ + private Integer commentState; + + /** + * 页码 + */ + private Integer pageNo; + + /** + * 每页条数 + */ + private Integer pageSize; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentTimeOutPageDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentTimeOutPageDTO.java new file mode 100644 index 000000000..bb6b9bb0c --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentTimeOutPageDTO.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.order.biz.dto.comment; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 订单评论超时 + * + * @author wtz + * @time 2019-06-15 10:59 + */ +@Data +@Accessors(chain = true) +public class OrderCommentTimeOutPageDTO implements Serializable { + /** + * 超过的天数 + */ + private Integer overDay; + + /** + * 评论的状态 + */ + private Integer commentState; + + /** + * 页码 + */ + private Integer pageNo; + + /** + * 每页条数 + */ + private Integer pageSize; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/CalcOrderPriceDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/CalcOrderPriceDTO.java new file mode 100644 index 000000000..6f8409621 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/CalcOrderPriceDTO.java @@ -0,0 +1,56 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 计算订单价格 DTO + */ +@Data +@Accessors(chain = true) +public class CalcOrderPriceDTO { + + @NotNull(message = "用户编号不能为空") + private Integer userId; + + /** + * 优惠劵编号 + */ + private Integer couponCardId; + + @NotNull(message = "商品数组不能为空") + private List items; + + @Data + @Accessors(chain = true) + public static class Item { + + /** + * SKU 编号 + */ + private Integer skuId; + /** + * 数量 + */ + private Integer quantity; + /** + * 是否选中 + * + * 注意下,目前只有在购物车的时候,才可能出现该属性为 false 。其它情况下,都会为 true 为主。 + */ + private Boolean selected; + + public Item() { + } + + public Item(Integer skuId, Integer quantity, Boolean selected) { + this.skuId = skuId; + this.quantity = quantity; + this.selected = selected; + } + } + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderCreateDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderCreateDTO.java new file mode 100644 index 000000000..543b09f0f --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderCreateDTO.java @@ -0,0 +1,64 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Max; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * 订单创建 + * + * @author Sin + * @time 2019-03-16 14:42 + */ +@Data +@Accessors(chain = true) +public class OrderCreateDTO implements Serializable { + + /** + * 用户id + */ + private Integer userId; + /** + * 用户地址 + */ + private Integer userAddressId; + /** + * 优惠劵编号 + */ + private Integer couponCardId; + /** + * 备注 + */ + private String remark; + /** + * ip信息 + */ + private String ip; + + /// + /// order item + + private List orderItems; + + + @Data + @Accessors(chain = true) + public static class OrderItem { + + /** + * 商品编号 + */ + @NotNull + private Integer skuId; + /** + * 数量 + */ + @NotNull + @Max(value = 1000) + private Integer quantity; + } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderDeliveryDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderDeliveryDTO.java new file mode 100644 index 000000000..930cb03c9 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderDeliveryDTO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * 订单发货 + * + * @author Sin + * @time 2019-03-30 22:31 + */ +@Data +@Accessors(chain = true) +public class OrderDeliveryDTO implements Serializable { + + /** + * 订单id + */ + private Integer orderId; + // TODO 芋艿,物流方式。会存在无需物流的情况 + /** + * 物流公司 (字典) + */ + private Integer logistics; + /** + * 物流单编号 + */ + private String logisticsNo; + + /// + /// 物理信息是跟 orderItem 走 + + /** + * 订单 orderItemId + */ + private List orderItemIds; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderItemDeletedDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderItemDeletedDTO.java new file mode 100644 index 000000000..e5cabab3a --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderItemDeletedDTO.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * @author Sin + * @time 2019-03-23 10:22 + */ +@Data +@Accessors(chain = true) +public class OrderItemDeletedDTO implements Serializable { + + /** + * 订单id + */ + private Integer orderId; + /** + * 订单item id + */ + private List orderItemIds; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderItemUpdateDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderItemUpdateDTO.java new file mode 100644 index 000000000..ec97915b4 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderItemUpdateDTO.java @@ -0,0 +1,40 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 订单更新 + * + * @author Sin + * @time 2019-03-16 14:46 + */ +@Data +@Accessors(chain = true) +public class OrderItemUpdateDTO implements Serializable { + + /** + * 编号 + */ + @NotNull + private Integer id; + /** + * 商品编号 + */ + @NotNull + private Integer skuId; + /** + * 数量 + */ + @NotNull + private Integer quantity; + /** + * 金额(分) + */ + @NotNull + private Integer price; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderLogisticsUpdateDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderLogisticsUpdateDTO.java new file mode 100644 index 000000000..6024870f2 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderLogisticsUpdateDTO.java @@ -0,0 +1,51 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * 订单收件人信息 + * + * @author Sin + * @time 2019-03-17 20:22 + */ +@Data +@Accessors(chain = true) +public class OrderLogisticsUpdateDTO implements Serializable { + + /** + * 订单 id + */ + private Integer id; + /** + * 收件区域编号 + */ + @NotNull + private String areaNo; + /** + * 收件人名称 + */ + @NotNull + private String name; + /** + * 收件手机号 + */ + @NotNull + @Size(max = 11, min = 11) + // TODO: 2019-03-17 Sin 此处需要添加 手机号校验,需要添加新的注解 + private String mobile; + /** + * 收件详细地址 + */ + @NotNull + @Size(max = 250, min = 10, message = "收件地址应该在 10 ~ 250 个字符之间") + private String address; + /** + * 物流编号 + */ + private String logisticsNo; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderQueryDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderQueryDTO.java new file mode 100644 index 000000000..e4e366477 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderQueryDTO.java @@ -0,0 +1,59 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 订单 query + * + * @author Sin + * @time 2019-03-23 14:15 + */ +@Data +@Accessors(chain = true) +public class OrderQueryDTO implements Serializable { + + /** + * id + */ + private Integer id; + /** + * 订单号 + */ + private String orderNo; + /** + * 用户 id + */ + private Integer userId; + /** + * 物流id + */ + private Integer orderLogisticsId; + /** + * 是否退换货 + */ + private Integer hasReturnExchange; + /** + * 付款时间(待发货) + */ + private Date startPaymentTime; + private Date endPaymentTime; + /** + * 创建时间 + */ + private Date startCreateTime; + private Date endCreateTime; + /** + * 删除状态 + */ + private Integer deleted; + /** + * 状态 + */ + private Integer status; + private Integer pageNo; + private Integer pageSize; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnApplyDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnApplyDTO.java new file mode 100644 index 000000000..64118291e --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnApplyDTO.java @@ -0,0 +1,37 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Sin + * @time 2019-04-25 21:06 + */ +@Data +@Accessors(chain = true) +public class OrderReturnApplyDTO implements Serializable { + + /** + * 订单编号 + */ + private Integer orderId; + /** + * 退货原因(字典值) + */ + private Integer reason; + /** + * 问题描述 + */ + private String describe; + /** + * 退款类型 + * + * - 1、退货退款 + * - 2、退款 + */ + private Integer returnType; + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnCreateDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnCreateDTO.java new file mode 100644 index 000000000..8a2d19050 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnCreateDTO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 订单退货 - 创建 + * + * @author Sin + * @time 2019-03-30 15:34 + */ +@Data +@Accessors(chain = true) +public class OrderReturnCreateDTO implements Serializable { + + /** + * 订单编号 + */ + private Integer orderId; + /** + * 订单 item 编号 + */ + private Integer orderItemId; + /** + * 退货原因(字典值) + */ + private Integer orderReason; + /** + * 原因(如果选择其他,原因保存在这) + */ + private String otherReasons; + /** + * 订单类型 + * + * - 0、为 Order 订单 (对整个订单退货) + * - 1、为 OrderItem 订单 (对订单某一个商品退货) + */ + private Integer orderType; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnQueryDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnQueryDTO.java new file mode 100644 index 000000000..22f5f47bb --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderReturnQueryDTO.java @@ -0,0 +1,56 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 订单退货 查询 po + * + * @author Sin + * @time 2019-05-06 21:36 + */ +@Data +@Accessors(chain = true) +public class OrderReturnQueryDTO implements Serializable { + + /** + * + * 订单id + */ + private Integer orderId; + /** + * 订单编号 + */ + private Integer orderNo; + /** + * 服务号 + */ + private String serviceNumber; + /** + * 创建时间 - 开始 + */ + private Date startCreateTime; + /** + * 创建时间 - 结束 + */ + private Date endCreateTime; + /** + * 状态 + */ + private Integer status; + + /// + /// 分页信息 + + /** + * 分页 index + */ + private Integer index; + /** + * 分页大小 + */ + private Integer pageSize; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderUserPageDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderUserPageDTO.java new file mode 100644 index 000000000..146b5db30 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/order/OrderUserPageDTO.java @@ -0,0 +1,45 @@ +package cn.iocoder.mall.order.biz.dto.order; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 用户订单 page + * + * @author Sin + * @time 2019-04-08 17:50 + */ +@Data +@Accessors(chain = true) +public class OrderUserPageDTO implements Serializable { + + /** + * id + */ + private Integer id; + /** + * 订单号 + */ + private String orderNo; + /** + * 用户 id + */ + private Integer userId; + /** + * 付款时间(待发货) + */ + private Date startPaymentTime; + private Date endPaymentTime; + /** + * 创建时间 + */ + private Date startCreateTime; + private Date endCreateTime; + /** + * 状态 + */ + private Integer status; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java new file mode 100644 index 000000000..cfe0304c4 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/CartService.java @@ -0,0 +1,177 @@ +package cn.iocoder.mall.order.biz.service; + +public interface CartService { + +// // ========== 购物车 Item 的逻辑 ========== +// +// /** +// * 添加商品至购物车 +// * +// * @param userId 用户编号 +// * @param skuId 商品 SKU 编号 +// * @param quantity 数量 +// * @return 是否成功 +// */ +// Boolean add(Integer userId, Integer skuId, Integer quantity); +// +// /** +// * 购物车更新商品数量 +// * +// * @param userId 用户编号 +// * @param skuId 商品 SKU 编号 +// * @param quantity 数量 +// * @return 是否成功 +// */ +// Boolean updateQuantity(Integer userId, Integer skuId, Integer quantity); +// +// /** +// * 购物车更新商品是否选中 +// * +// * @param userId 用户编号 +// * @param skuIds 商品 SKU 编号数组 +// * @param selected 是否选中 +// * @return 是否成功 +// */ +// Boolean updateSelected(Integer userId, Collection skuIds, Boolean selected); +// +// /** +// * 购物车删除商品 +// * +// * @param userId 用户编号 +// * @param skuIds 商品 SKU 编号的数组 +// * +// * @return 是否成功 +// */ +// Boolean deleteList(Integer userId, List skuIds); +// +// /** +// * 清空购物车 +// * +// * @param userId 用户编号 +// * @return 是否成功 +// */ +// Boolean deleteAll(Integer userId); +// +// /** +// * 查询用户在购物车中的商品数量 +// * +// * @param userId 用户编号 +// * @return 商品数量 +// */ +// Integer count(Integer userId); +// +// /** +// * 显示买家购物车中的商品列表,并根据 selected 进行过滤。 +// * +// * @param userId 用户编号 +// * @param selected 是否选中。若为空,则不进行筛选 +// * @return 购物车中商品列表信息 +// */ +// List list(Integer userId, @Nullable Boolean selected); +// +// // ========== 购物车与订单相关的逻辑 ========== +// +// /** +// * 计算订单金额,返回计算结果 +// * +// * @param calcOrderPriceDTO 计算订单金额 DTO +// * @return 计算订单金额结果 +// */ +// CalcOrderPriceBO calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO); +// +// /** +// * 计算指定商品 SKU 的金额,并返回计算结果 +// * +// * TODO 芋艿,此处只会计算,限时折扣带来的价格变化。 +// * +// * @param skuId 商品 SKU 编号 +// * @return 计算订单金额结果 +// */ +// CalcSkuPriceBO calcSkuPrice(Integer skuId); // ========== 购物车 Item 的逻辑 ========== +// +// /** +// * 添加商品至购物车 +// * +// * @param userId 用户编号 +// * @param skuId 商品 SKU 编号 +// * @param quantity 数量 +// * @return 是否成功 +// */ +// Boolean add(Integer userId, Integer skuId, Integer quantity); +// +// /** +// * 购物车更新商品数量 +// * +// * @param userId 用户编号 +// * @param skuId 商品 SKU 编号 +// * @param quantity 数量 +// * @return 是否成功 +// */ +// Boolean updateQuantity(Integer userId, Integer skuId, Integer quantity); +// +// /** +// * 购物车更新商品是否选中 +// * +// * @param userId 用户编号 +// * @param skuIds 商品 SKU 编号数组 +// * @param selected 是否选中 +// * @return 是否成功 +// */ +// Boolean updateSelected(Integer userId, Collection skuIds, Boolean selected); +// +// /** +// * 购物车删除商品 +// * +// * @param userId 用户编号 +// * @param skuIds 商品 SKU 编号的数组 +// * +// * @return 是否成功 +// */ +// Boolean deleteList(Integer userId, List skuIds); +// +// /** +// * 清空购物车 +// * +// * @param userId 用户编号 +// * @return 是否成功 +// */ +// Boolean deleteAll(Integer userId); +// +// /** +// * 查询用户在购物车中的商品数量 +// * +// * @param userId 用户编号 +// * @return 商品数量 +// */ +// Integer count(Integer userId); +// +// /** +// * 显示买家购物车中的商品列表,并根据 selected 进行过滤。 +// * +// * @param userId 用户编号 +// * @param selected 是否选中。若为空,则不进行筛选 +// * @return 购物车中商品列表信息 +// */ +// List list(Integer userId, @Nullable Boolean selected); +// +// // ========== 购物车与订单相关的逻辑 ========== +// +// /** +// * 计算订单金额,返回计算结果 +// * +// * @param calcOrderPriceDTO 计算订单金额 DTO +// * @return 计算订单金额结果 +// */ +// CalcOrderPriceBO calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO); +// +// /** +// * 计算指定商品 SKU 的金额,并返回计算结果 +// * +// * TODO 芋艿,此处只会计算,限时折扣带来的价格变化。 +// * +// * @param skuId 商品 SKU 编号 +// * @return 计算订单金额结果 +// */ +// CalcSkuPriceBO calcSkuPrice(Integer skuId); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyService.java new file mode 100644 index 000000000..ade023546 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyService.java @@ -0,0 +1,40 @@ +package cn.iocoder.mall.order.biz.service; + +/** + * + * 订单评论回复模块 + * + * @author wtz + * @time 2019-05-29 14:30 + * + */ +public interface OrderCommentReplyService { + +// /** +// * 分页获取评论回复 +// * @param orderCommentReplyPageDTO +// * @return +// */ +// OrderCommentReplyPageBO getOrderCommentReplyPage( +// OrderCommentReplyPageDTO orderCommentReplyPageDTO); +// +// +// /** +// * 评论回复创建 +// * @param orderCommentReplyCreateDTO +// * @return +// */ +// OrderCommentReplyCreateBO createOrderCommentReply( +// OrderCommentReplyCreateDTO orderCommentReplyCreateDTO); +// +// +// /** +// * 获取商家评论回复 +// * @param commentId +// * @return +// */ +// List getOrderCommentMerchantReply(Integer commentId); + + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentService.java new file mode 100644 index 000000000..ae6a50063 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentService.java @@ -0,0 +1,61 @@ +package cn.iocoder.mall.order.biz.service; + +/** + * 订单评论模块 + * + * @author wtz + * @time 2019-05-14 22:10 + */ +public interface OrderCommentService { + +// /** +// * 评论创建 +// * @param orderCommentCreateDTO +// * @return +// */ +// OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO); +// +// +// +// /** +// * 获取评论列表的分页 +// * @param orderCommentPageDTO +// * @return +// */ +// OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO); +// +// +// /** +// * 获取评论详情 +// * @param commentId +// * @return +// */ +// OrderCommentInfoBO getOrderCommentInfo(Integer commentId); +// +// +// /** +// * 获取订单评论状态详情 +// * @param orderCommentStateInfoPageDTO +// * @return +// */ +// OrderCommentStateInfoPageBO getOrderCommentStateInfoPage( +// OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO); +// +// /** +// * 获取订单评论超时分页 +// * @param orderCommentTimeOutPageDTO +// * @return +// */ +// List getOrderCommentTimeOutPage( +// OrderCommentTimeOutPageDTO orderCommentTimeOutPageDTO); +// +// +// /** +// * 批量更新订单评论状态 +// * @param orderCommentTimeOutBOList +// */ +// void updateBatchOrderCommentState(List orderCommentTimeOutBOList); + + + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderLogisticsService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderLogisticsService.java new file mode 100644 index 000000000..84ec10139 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderLogisticsService.java @@ -0,0 +1,39 @@ +package cn.iocoder.mall.order.biz.service; + +/** + * 订单物流信息 + * + * @author Sin + * @time 2019-04-12 21:29 + */ +public interface OrderLogisticsService { + + +// /** +// * 获取物流信息 - 根据id +// * +// * @param id +// * @return +// */ +// CommonResult getLogisticsInfo(Integer id); +// +// +// /** +// * 获取 last 物流信息 - 根据id +// * +// * @param id +// * @return +// */ +// CommonResult getLastLogisticsInfo(Integer id); +// +// /** +// * 获取物流信息 - 根据 orderId +// * +// * @param userId +// * @param orderId +// * @return +// */ +// CommonResult getOrderLogisticsInfo(Integer userId, +// Integer orderId); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnService.java new file mode 100644 index 000000000..c569afb15 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnService.java @@ -0,0 +1,79 @@ +package cn.iocoder.mall.order.biz.service; + +/** + * 订单退货 + * + * @author Sin + * @time 2019-03-30 15:33 + */ +public interface OrderReturnService { + + +// /** +// * 订单 - 退货 +// * +// * @param orderReturnApplyDTO +// * @return +// */ +// CommonResult orderReturnApply(OrderReturnApplyDTO orderReturnApplyDTO); +// +// /** +// * 更新退款成功 +// * +// * 如果成功,则返回 success +// * 如果失败,则返回具体原因 +// * +// * @param orderId 订单编号 +// * @param refundPrice 退款金额 +// * @return 支付结果 +// */ +// String updateRefundSuccess(String orderId, Integer refundPrice); +// +// /** +// * 订单申请信息 +// * +// * @param orderId +// * @return +// */ +// CommonResult orderApplyInfo(Integer orderId); +// +// /** +// * 订单退货 - 列表 +// * +// * @param queryDTO +// * @return +// */ +// CommonResult orderReturnList(OrderReturnQueryDTO queryDTO); +// +// /** +// * 订单退货 - 接受 +// * +// * @param id +// * @return +// */ +// CommonResult orderReturnAgree(Integer id); +// +// /** +// * 订单退货 - 拒绝 +// * +// * @param id +// * @return +// */ +// CommonResult orderReturnRefuse(Integer id); +// +// /** +// * 订单退货 - 确认收货 +// * +// * @param id +// * @return +// */ +// CommonResult confirmReceipt(Integer id); +// +// /** +// * 订单退货 - 确认订单 +// * +// * @param id +// * @return +// */ +// CommonResult refund(Integer id, String ip); +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderService.java new file mode 100644 index 000000000..efce48107 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/OrderService.java @@ -0,0 +1,156 @@ +package cn.iocoder.mall.order.biz.service; + +/** + * 订单 service + * + * @author Sin + * @time 2019-03-16 13:15 + */ +public interface OrderService { + +// /** +// * 订单 page +// * +// * @param orderQueryDTO +// * @return +// */ +// CommonResult getOrderPage(OrderQueryDTO orderQueryDTO); +// +// /** +// * 获取订单items +// * +// * @param orderId +// * @return +// */ +// CommonResult> getOrderItems(Integer orderId); +// +// /** +// * 订单收件人信息 +// * +// * @param orderId +// * @return +// */ +// CommonResult getOrderRecipientBO(Integer orderId); +// +// /** +// * 订单info +// * +// * @param userId +// * @param orderId +// * @return +// */ +// CommonResult info(Integer userId, Integer orderId); +// +// /** +// * 订单 - 创建 +// * +// * @param orderCreateDTO +// * @return +// */ +// CommonResult createOrder(OrderCreateDTO orderCreateDTO); +// +// /** +// * 订单item - 更新 +// * +// * @param orderItemUpdateDTO +// * +// */ +// CommonResult updateOrderItem(OrderItemUpdateDTO orderItemUpdateDTO); +// +// /** +// * 更新订单item - payAmount(实付金额) +// * +// * @param orderId +// * @param orderItemId +// * @param payAmount +// * @return +// */ +// CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount); +// +// /** +// * 订单 - 取消订单 +// * +// * @param orderId +// * @return +// */ +// CommonResult cancelOrder(Integer orderId, Integer reasons, String otherReasons); +// +// /** +// * 订单发货 +// * +// * @param orderDelivery +// * @return +// */ +// CommonResult orderDelivery(OrderDeliveryDTO orderDelivery); +// +// /** +// * 更新订单 - 备注 +// * +// * @param orderId +// * @param remake +// * @return +// */ +// CommonResult updateOrderRemake(Integer orderId, String remake); +// +// /** +// * 删除订单item +// * +// * @param orderItemDeletedDTO +// * @return +// */ +// CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO); +// +// /** +// * 用户确认订单 +// * +// * @param userId +// * @param orderId +// * @return +// */ +// CommonResult confirmReceiving(Integer userId, Integer orderId); +// +// /** +// * 更新订单 - 收件这信息 +// * +// * 包含: +// * - 详细地址 +// * - 区域编号 +// * - 联系人电话 +// * - 联系人姓名 +// */ +// CommonResult updateLogistics(OrderLogisticsUpdateDTO orderLogisticsDTO); +// +// /** +// * 删除订单 // TODO FROM 芋艿 to 小范。删除订单,不要使用 deleted 字段,对于用户是删除,实际是隐藏。 +// * +// * @param id +// */ +// CommonResult deleteOrder(Integer id); +// +// /** +// * 更新订单支付成功 +// * +// * 如果成功,则返回 success +// * 如果失败,则返回具体原因 +// * +// * @param orderId 订单编号 +// * @param payAmount 支付的订单金额 +// * @return 支付结果 +// */ +// String updatePaySuccess(String orderId, Integer payAmount); +// +// /** +// * 监听确认收货 +// * +// * mq 更新 status +// */ +// CommonResult listenerConfirmGoods(); +// +// /** +// * 监听换货 +// * +// * mq 更新 status +// */ +// CommonResult listenerExchangeGoods(); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/CartServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/CartServiceImpl.java new file mode 100644 index 000000000..3013129c8 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/CartServiceImpl.java @@ -0,0 +1,488 @@ +package cn.iocoder.mall.order.biz.service.impl; + +import cn.iocoder.mall.order.biz.service.CartService; +import org.springframework.stereotype.Service; + +/** + * 购物车服务 Service 实现类 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.CartService.version}") +public class CartServiceImpl implements CartService { + +// @Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}") +// private ProductSpuService productSpuService; +// @Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}") +// private PromotionActivityService promotionActivityService; +// @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}") +// private CouponService couponService; +// +// @Autowired +// private CartMapper cartMapper; +// +// @Override +// @SuppressWarnings("Duplicates") +// public Boolean add(Integer userId, Integer skuId, Integer quantity) { +// // 查询 SKU 是否合法 +// ProductSkuBO sku = productSpuService.getProductSku(skuId); +// if (sku == null +// || CommonStatusEnum.DISABLE.getValue().equals(sku.getStatus())) { // sku 被禁用 +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode()); +// } +// // TODO 芋艿,后续基于商品是否上下架进一步完善。 +// // 查询 CartItemDO +// CartItemDO item = cartMapper.selectByUserIdAndSkuIdAndStatus(userId, skuId, CartItemStatusEnum.ENABLE.getValue()); +// // 存在,则进行数量更新 +// if (item != null) { +// return updateQuantity0(item, sku, quantity); +// } +// // 不存在,则进行插入 +// return add0(userId, sku, quantity); +// } +// +// private Boolean add0(Integer userId, ProductSkuBO sku, Integer quantity) { +// // 校验库存 +// if (quantity > sku.getQuantity()) { +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode()); +// } +// // 创建 CartItemDO 对象,并进行保存。 +// CartItemDO item = new CartItemDO() +// // 基础字段 +// .setStatus(CartItemStatusEnum.ENABLE.getValue()).setSelected(true) +// // 买家信息 +// .setUserId(userId) +// // 商品信息 +// .setSpuId(sku.getSpuId()).setSkuId(sku.getId()).setQuantity(quantity); +// item.setCreateTime(new Date()); +// cartMapper.insert(item); +// // 返回成功 +// return true; +// } +// +// @Override +// @SuppressWarnings("Duplicates") +// public Boolean updateQuantity(Integer userId, Integer skuId, Integer quantity) { +// // 查询 SKU 是否合法 +// ProductSkuBO sku = productSpuService.getProductSku(skuId); +// if (sku == null +// || CommonStatusEnum.DISABLE.getValue().equals(sku.getStatus())) { // sku 被禁用 +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode()); +// } +// // 查询 CartItemDO +// CartItemDO item = cartMapper.selectByUserIdAndSkuIdAndStatus(userId, skuId, CartItemStatusEnum.ENABLE.getValue()); +// if (item == null) { +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_NOT_FOUND.getCode()); +// } +// // TODO 芋艿,后续基于商品是否上下架进一步完善。 +// return updateQuantity0(item, sku, quantity); +// } +// +// private Boolean updateQuantity0(CartItemDO item, ProductSkuBO sku, Integer quantity) { +// // 校验库存 +// if (item.getQuantity() + quantity > sku.getQuantity()) { +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode()); +// } +// // 更新 CartItemDO +// cartMapper.updateQuantity(item.getId(), quantity); +// // 返回成功 +// return true; +// } +// +// @Override +// public Boolean updateSelected(Integer userId, Collection skuIds, Boolean selected) { +// // 更新 CartItemDO 们 +// cartMapper.updateListByUserIdAndSkuId(userId, skuIds, selected, null); +// // 返回成功 +// return true; +// } +// +// @Override +// public Boolean deleteList(Integer userId, List skuIds) { +// // 更新 CartItemDO 们 +// cartMapper.updateListByUserIdAndSkuId(userId, skuIds, null, CartItemStatusEnum.DELETE_BY_MANUAL.getValue()); +// // 返回成功 +// return true; +// } +// +// @Override +// public Boolean deleteAll(Integer userId) { +// return null; +// } +// +// @Override +// public Integer count(Integer userId) { +// return cartMapper.selectQuantitySumByUserIdAndStatus(userId, CartItemStatusEnum.ENABLE.getValue()); +// } +// +// @Override +// public List list(Integer userId, Boolean selected) { +// List items = cartMapper.selectByUserIdAndStatusAndSelected(userId, CartItemStatusEnum.ENABLE.getValue(), selected); +// return CartConvert.INSTANCE.convert(items); +// } +// +// @Override +// public CalcOrderPriceBO calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO) { +// // TODO 芋艿,补充一些表单校验。例如说,需要传入用户编号。 +// // 校验商品都存在 +// Map calcOrderItemMap = calcOrderPriceDTO.getItems().stream() +// .collect(Collectors.toMap(CalcOrderPriceDTO.Item::getSkuId, item -> item)); // KEY:skuId +// List skus = productSpuService.getProductSkuDetailList(calcOrderItemMap.keySet()); +// if (skus.size() != calcOrderPriceDTO.getItems().size()) { +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.ORDER_ITEM_SOME_NOT_EXISTS.getCode()); +// } +// // TODO 库存相关 +// // 查询促销活动 +// List activityList = promotionActivityService.getPromotionActivityListBySpuIds( +// skus.stream().map(sku -> sku.getSpu().getId()).collect(Collectors.toSet()), +// Collections.singletonList(PromotionActivityStatusEnum.RUN.getValue())); +// // 拼装结果(主要是计算价格) +// CalcOrderPriceBO calcOrderPriceBO = new CalcOrderPriceBO(); +// // 1. 创建初始的每一项的数组 +// List items = initCalcOrderPriceItems(skus, calcOrderItemMap); +// // 2. 计算【限时折扣】促销 +// modifyPriceByTimeLimitDiscount(items, activityList); +// // 3. 计算【满减送】促销 +// List itemGroups = groupByFullPrivilege(items, activityList); +// calcOrderPriceBO.setItemGroups(itemGroups); +// // 4. 计算优惠劵 +// if (calcOrderPriceDTO.getCouponCardId() != null) { +// Integer result = modifyPriceByCouponCard(calcOrderPriceDTO.getUserId(), calcOrderPriceDTO.getCouponCardId(), itemGroups); +// calcOrderPriceBO.setCouponCardDiscountTotal(result); +// } +// // 5. 计算最终的价格 +// int buyTotal = 0; +// int discountTotal = 0; +// int presentTotal = 0; +// for (CalcOrderPriceBO.ItemGroup itemGroup : calcOrderPriceBO.getItemGroups()) { +// buyTotal += itemGroup.getItems().stream().mapToInt(item -> item.getSelected() ? item.getBuyTotal() : 0).sum(); +// discountTotal += itemGroup.getItems().stream().mapToInt(item -> item.getSelected() ? item.getDiscountTotal() : 0).sum(); +// presentTotal += itemGroup.getItems().stream().mapToInt(item -> item.getSelected() ? item.getPresentTotal() : 0).sum(); +// } +// Assert.isTrue(buyTotal - discountTotal == presentTotal, +// String.format("价格合计( %d - %d == %d )不正确", buyTotal, discountTotal, presentTotal)); +// calcOrderPriceBO.setFee(new CalcOrderPriceBO.Fee(buyTotal, discountTotal, 0, presentTotal)); +// // 返回 +// return calcOrderPriceBO; +// } +// +// @Override +// @SuppressWarnings("Duplicates") +// public CalcSkuPriceBO calcSkuPrice(Integer skuId) { +// // 查询 SKU 是否合法 +// ProductSkuBO sku = productSpuService.getProductSku(skuId); +// if (sku == null +// || CommonStatusEnum.DISABLE.getValue().equals(sku.getStatus())) { // sku 被禁用 +// throw ServiceExceptionUtil.exception(OrderErrorCodeEnum.CARD_ITEM_SKU_NOT_FOUND.getCode()); +// } +// // 查询促销活动 +// List activityList = promotionActivityService.getPromotionActivityListBySpuId(sku.getSpuId(), +// Arrays.asList(PromotionActivityStatusEnum.WAIT.getValue(), PromotionActivityStatusEnum.RUN.getValue())); +// if (activityList.isEmpty()) { // 如果无促销活动,则直接返回默认结果即可 +// return new CalcSkuPriceBO().setOriginalPrice(sku.getPrice()).setBuyPrice(sku.getPrice()); +// } +// // 如果有促销活动,则开始做计算 TODO 芋艿,因为现在暂时只有限时折扣 + 满减送。所以写的比较简单先 +// PromotionActivityBO fullPrivilege = findPromotionActivityByType(activityList, PromotionActivityTypeEnum.FULL_PRIVILEGE); +// PromotionActivityBO timeLimitedDiscount = findPromotionActivityByType(activityList, PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT); +// Integer presentPrice = calcSkuPriceByTimeLimitDiscount(sku, timeLimitedDiscount); +// // 返回结果 +// return new CalcSkuPriceBO().setFullPrivilege(fullPrivilege).setTimeLimitedDiscount(timeLimitedDiscount) +// .setOriginalPrice(sku.getPrice()).setBuyPrice(presentPrice); +// } +// +// private List initCalcOrderPriceItems(List skus, +// Map calcOrderItemMap) { +// List items = new ArrayList<>(); +// for (ProductSkuDetailBO sku : skus) { +// CalcOrderPriceBO.Item item = CartConvert.INSTANCE.convert(sku); +// items.add(item); +// // 将是否选中,购物数量,复制到 item 中 +// CalcOrderPriceDTO.Item calcOrderItem = calcOrderItemMap.get(sku.getId()); +// item.setSelected(calcOrderItem.getSelected()); +// item.setBuyQuantity(calcOrderItem.getQuantity()); +// // 计算初始价格 +// item.setOriginPrice(sku.getPrice()); +// item.setBuyPrice(sku.getPrice()); +// item.setPresentPrice(sku.getPrice()); +// item.setBuyTotal(sku.getPrice() * calcOrderItem.getQuantity()); +// item.setDiscountTotal(0); +// item.setPresentTotal(item.getBuyTotal()); +// } +// return items; +// } +// +// private void modifyPriceByTimeLimitDiscount(List items, List activityList) { +// for (CalcOrderPriceBO.Item item : items) { +// // 获得符合条件的限时折扣 +// PromotionActivityBO timeLimitedDiscount = activityList.stream() +// .filter(activity -> PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT.getValue().equals(activity.getActivityType()) +// && activity.getTimeLimitedDiscount().getItems().stream().anyMatch(item0 -> item0.getSpuId().equals(item.getSpu().getId()))) +// .findFirst().orElse(null); +// if (timeLimitedDiscount == null) { +// continue; +// } +// // 计算价格 +// ProductSkuBO sku = new ProductSkuBO().setId(item.getId()).setSpuId(item.getSpu().getId()).setPrice(item.getPrice()); +// Integer newPrice = calcSkuPriceByTimeLimitDiscount(sku, timeLimitedDiscount); +// if (newPrice.equals(item.getPrice())) { +// continue; +// } +// // 设置优惠 +// item.setActivity(timeLimitedDiscount); +// // 设置价格 +// item.setBuyPrice(newPrice); +// item.setBuyTotal(newPrice * item.getBuyQuantity()); +// item.setPresentTotal(item.getBuyTotal() - item.getDiscountTotal()); +// item.setPresentPrice(item.getPresentTotal() / item.getBuyQuantity()); +// } +// } +// +// private List groupByFullPrivilege(List items, List activityList) { +// List itemGroups = new ArrayList<>(); +// // 获得所有满减送促销 +// List fullPrivileges = activityList.stream() +// .filter(activity -> PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType())) +// .collect(Collectors.toList()); +// // 基于满减送促销,进行分组 +// if (!fullPrivileges.isEmpty()) { +// items = new ArrayList<>(items); // 因为下面会修改数组,进行浅拷贝,避免影响传入的 items 。 +// for (PromotionActivityBO fullPrivilege : fullPrivileges) { +// // 创建 fullPrivilege 对应的分组 +// CalcOrderPriceBO.ItemGroup itemGroup = new CalcOrderPriceBO.ItemGroup() +// .setActivity(fullPrivilege) +// .setItems(new ArrayList<>()); +// // 筛选商品到分组中 +// for (Iterator iterator = items.iterator(); iterator.hasNext(); ) { +// CalcOrderPriceBO.Item item = iterator.next(); +// if (!isSpuMatchFullPrivilege(item.getSpu().getId(), fullPrivilege)) { +// continue; +// } +// itemGroup.getItems().add(item); +// iterator.remove(); +// } +// // 如果匹配到,则添加到 itemGroups 中 +// if (!itemGroup.getItems().isEmpty()) { +// itemGroups.add(itemGroup); +// } +// } +// } +// // 处理未参加活动的商品,形成一个分组 +// if (!items.isEmpty()) { +// itemGroups.add(new CalcOrderPriceBO.ItemGroup().setItems(items)); +// } +// // 计算每个分组的价格 +// for (CalcOrderPriceBO.ItemGroup itemGroup : itemGroups) { +// itemGroup.setActivityDiscountTotal(calcSkuPriceByFullPrivilege(itemGroup)); +// } +// // 返回结果 +// return itemGroups; +// } +// +// private Integer modifyPriceByCouponCard(Integer userId, Integer couponCardId, List itemGroups) { +// Assert.isTrue(couponCardId != null, "优惠劵编号不能为空"); +// // 查询优惠劵 +// CouponCardDetailBO couponCard = couponService.getCouponCardDetail(userId, couponCardId); +// // 获得匹配的商品 +// List items = new ArrayList<>(); +// if (RangeTypeEnum.ALL.getValue().equals(couponCard.getRangeType())) { +//// totalPrice = spus.stream().mapToInt(spu -> spu.getPrice() * spu.getQuantity()).sum(); +// itemGroups.forEach(itemGroup -> items.addAll(itemGroup.getItems())); +// } else if (RangeTypeEnum.PRODUCT_INCLUDE_PART.getValue().equals(couponCard.getRangeType())) { +// itemGroups.forEach(itemGroup -> items.forEach(item -> { +// if (couponCard.getRangeValues().contains(item.getSpu().getId())) { +// items.add(item); +// } +// })); +// } else if (RangeTypeEnum.PRODUCT_EXCLUDE_PART.getValue().equals(couponCard.getRangeType())) { +// itemGroups.forEach(itemGroup -> items.forEach(item -> { +// if (!couponCard.getRangeValues().contains(item.getSpu().getId())) { +// items.add(item); +// } +// })); +// } else if (RangeTypeEnum.CATEGORY_INCLUDE_PART.getValue().equals(couponCard.getRangeType())) { +// itemGroups.forEach(itemGroup -> items.forEach(item -> { +// if (couponCard.getRangeValues().contains(item.getSpu().getCid())) { +// items.add(item); +// } +// })); +// } else if (RangeTypeEnum.CATEGORY_EXCLUDE_PART.getValue().equals(couponCard.getRangeType())) { +// itemGroups.forEach(itemGroup -> items.forEach(item -> { +// if (!couponCard.getRangeValues().contains(item.getSpu().getCid())) { +// items.add(item); +// } +// })); +// } +// // 判断是否符合条件 +// int originalTotal = items.stream().mapToInt(CalcOrderPriceBO.Item::getPresentTotal).sum(); // 此处,指的是以优惠劵视角的原价 +// if (originalTotal == 0 || originalTotal < couponCard.getPriceAvailable()) { +// throw ServiceExceptionUtil.exception(PromotionErrorCodeEnum.COUPON_CARD_NOT_MATCH.getCode()); // TODO 芋艿,这种情况,会出现错误码的提示,无法格式化出来。另外,这块的最佳实践,找人讨论下。 +// } +// // 计算价格 +// // 获得到优惠信息,进行价格计算 +// int presentTotal; +// if (PreferentialTypeEnum.PRICE.getValue().equals(couponCard.getPreferentialType())) { // 减价 +// // 计算循环次数。这样,后续优惠的金额就是相乘了 +// presentTotal = originalTotal - couponCard.getPriceOff(); +// Assert.isTrue(presentTotal > 0, "计算后,价格为负数:" + presentTotal); +// } else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(couponCard.getPreferentialType())) { // 打折 +// presentTotal = originalTotal * couponCard.getPercentOff() / 100; +// if (couponCard.getDiscountPriceLimit() != null // 空,代表不限制优惠上限 +// && originalTotal - presentTotal > couponCard.getDiscountPriceLimit()) { +// presentTotal = originalTotal - couponCard.getDiscountPriceLimit(); +// } +// } else { +// throw new IllegalArgumentException(String.format("优惠劵(%s) 的优惠类型不正确", couponCard.toString())); +// } +// int discountTotal = originalTotal - presentTotal; +// Assert.isTrue(discountTotal > 0, "计算后,不产生优惠:" + discountTotal); +// // 按比例,拆分 presentTotal +// splitDiscountPriceToItems(items, discountTotal, presentTotal); +// // 返回优惠金额 +// return originalTotal - presentTotal; +// } +// +// /** +// * 计算指定 SKU 在限时折扣下的价格 +// * +// * @param sku SKU +// * @param timeLimitedDiscount 限时折扣促销。 +// * 传入的该活动,要保证该 SKU 在该促销下一定有优惠。 +// * @return 计算后的价格 +// */ +// private Integer calcSkuPriceByTimeLimitDiscount(ProductSkuBO sku, PromotionActivityBO timeLimitedDiscount) { +// if (timeLimitedDiscount == null) { +// return sku.getPrice(); +// } +// // 获得对应的优惠项 +// PromotionActivityBO.TimeLimitedDiscount.Item item = timeLimitedDiscount.getTimeLimitedDiscount().getItems().stream() +// .filter(item0 -> item0.getSpuId().equals(sku.getSpuId())) +// .findFirst().orElse(null); +// if (item == null) { +// throw new IllegalArgumentException(String.format("折扣活动(%s) 不存在商品(%s) 的优惠配置", +// timeLimitedDiscount.toString(), sku.toString())); +// } +// // 计算价格 +// if (PreferentialTypeEnum.PRICE.getValue().equals(item.getPreferentialType())) { // 减价 +// int presentPrice = sku.getPrice() - item.getPreferentialValue(); +// return presentPrice >= 0 ? presentPrice : sku.getPrice(); // 如果计算优惠价格小于 0 ,则说明无法使用优惠。 +// } +// if (PreferentialTypeEnum.DISCOUNT.getValue().equals(item.getPreferentialType())) { // 打折 +// return sku.getPrice() * item.getPreferentialValue() / 100; +// } +// throw new IllegalArgumentException(String.format("折扣活动(%s) 的优惠类型不正确", timeLimitedDiscount.toString())); +// } +// +// private Integer calcSkuPriceByFullPrivilege(CalcOrderPriceBO.ItemGroup itemGroup) { +// if (itemGroup.getActivity() == null) { +// return null; +// } +// PromotionActivityBO activity = itemGroup.getActivity(); +// Assert.isTrue(PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType()), +// "传入的必须的满减送活动必须是满减送"); +// // 获得优惠信息 +// List items = itemGroup.getItems().stream().filter(CalcOrderPriceBO.Item::getSelected) +// .collect(Collectors.toList()); +// Integer itemCnt = items.stream().mapToInt(CalcOrderPriceBO.Item::getBuyQuantity).sum(); +// Integer originalTotal = items.stream().mapToInt(CalcOrderPriceBO.Item::getPresentTotal).sum(); +// List privileges = activity.getFullPrivilege().getPrivileges().stream() +// .filter(privilege -> { +// if (MeetTypeEnum.PRICE.getValue().equals(privilege.getMeetType())) { +// return originalTotal >= privilege.getMeetValue(); +// } +// if (MeetTypeEnum.QUANTITY.getValue().equals(privilege.getMeetType())) { +// return itemCnt >= privilege.getMeetValue(); +// } +// throw new IllegalArgumentException(String.format("满减送活动(%s) 的匹配(%s)不正确", itemGroup.getActivity().toString(), privilege.toString())); +// }).collect(Collectors.toList()); +// // 获得不到优惠信息,返回原始价格 +// if (privileges.isEmpty()) { +// return null; +// } +// // 获得到优惠信息,进行价格计算 +// PromotionActivityBO.FullPrivilege.Privilege privilege = privileges.get(privileges.size() - 1); +// Integer presentTotal; +// if (PreferentialTypeEnum.PRICE.getValue().equals(privilege.getPreferentialType())) { // 减价 +// // 计算循环次数。这样,后续优惠的金额就是相乘了 +// Integer cycleCount = 1; +// if (activity.getFullPrivilege().getCycled()) { +// if (MeetTypeEnum.PRICE.getValue().equals(privilege.getMeetType())) { +// cycleCount = originalTotal / privilege.getMeetValue(); +// } else if (MeetTypeEnum.QUANTITY.getValue().equals(privilege.getMeetType())) { +// cycleCount = itemCnt / privilege.getMeetValue(); +// } +// } +// presentTotal = originalTotal - cycleCount * privilege.getMeetValue(); +// if (presentTotal < 0) { // 如果计算优惠价格小于 0 ,则说明无法使用优惠。 +// presentTotal = originalTotal; +// } +// } else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(privilege.getPreferentialType())) { // 打折 +// presentTotal = originalTotal * privilege.getPreferentialValue() / 100; +// } else { +// throw new IllegalArgumentException(String.format("满减送促销(%s) 的优惠类型不正确", activity.toString())); +// } +// int discountTotal = originalTotal - presentTotal; +// if (discountTotal == 0) { +// return null; +// } +// // 按比例,拆分 presentTotal +//// for (int i = 0; i < items.size(); i++) { +//// CalcOrderPriceBO.Item item = items.get(i); +//// Integer discountPart; +//// if (i < items.size() - 1) { // 减一的原因,是因为拆分时,如果按照比例,可能会出现.所以最后一个,使用反减 +//// discountPart = (int) (discountTotal * (1.0D * item.getPresentTotal() / presentTotal)); +//// discountTotal -= discountPart; +//// } else { +//// discountPart = discountTotal; +//// } +//// Assert.isTrue(discountPart > 0, "优惠金额必须大于 0"); +//// item.setDiscountTotal(item.getDiscountTotal() + discountPart); +//// item.setPresentTotal(item.getBuyTotal() - item.getDiscountTotal()); +//// item.setPresentPrice(item.getPresentTotal() / item.getBuyQuantity()); +//// } +// splitDiscountPriceToItems(items, discountTotal, presentTotal); +// // 返回优惠金额 +// return originalTotal - presentTotal; +// } +// +// private void splitDiscountPriceToItems(List items, Integer discountTotal, Integer presentTotal) { +// for (int i = 0; i < items.size(); i++) { +// CalcOrderPriceBO.Item item = items.get(i); +// Integer discountPart; +// if (i < items.size() - 1) { // 减一的原因,是因为拆分时,如果按照比例,可能会出现.所以最后一个,使用反减 +// discountPart = (int) (discountTotal * (1.0D * item.getPresentTotal() / presentTotal)); +// discountTotal -= discountPart; +// } else { +// discountPart = discountTotal; +// } +// Assert.isTrue(discountPart > 0, "优惠金额必须大于 0"); +// item.setDiscountTotal(item.getDiscountTotal() + discountPart); +// item.setPresentTotal(item.getBuyTotal() - item.getDiscountTotal()); +// item.setPresentPrice(item.getPresentTotal() / item.getBuyQuantity()); +// } +// } +// +// private PromotionActivityBO findPromotionActivityByType(List activityList, PromotionActivityTypeEnum type) { +// return activityList.stream() +// .filter(activity -> type.getValue().equals(activity.getActivityType())) +// .findFirst().orElse(null); +// } +// +// private List findPromotionActivityListByType(List activityList, PromotionActivityTypeEnum type) { +// return activityList.stream() +// .filter(activity -> type.getValue().equals(activity.getActivityType())) +// .collect(Collectors.toList()); +// } +// +// private boolean isSpuMatchFullPrivilege(Integer spuId, PromotionActivityBO activity) { +// Assert.isTrue(PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType()), +// "传入的必须的促销活动必须是满减送"); +// PromotionActivityBO.FullPrivilege fullPrivilege = activity.getFullPrivilege(); +// if (RangeTypeEnum.ALL.getValue().equals(fullPrivilege.getRangeType())) { +// return true; +// } else if (RangeTypeEnum.PRODUCT_INCLUDE_PART.getValue().equals(fullPrivilege.getRangeType())) { +// return fullPrivilege.getRangeValues().contains(spuId); +// } else { +// throw new IllegalArgumentException(String.format("促销活动(%s) 可用范围的类型是不正确", activity.toString())); +// } +// } + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderCommentReplyServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderCommentReplyServiceImpl.java new file mode 100644 index 000000000..bb31fb549 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderCommentReplyServiceImpl.java @@ -0,0 +1,72 @@ +package cn.iocoder.mall.order.biz.service.impl; + +import cn.iocoder.mall.order.biz.dao.comment.OrderCommentReplayMapper; +import cn.iocoder.mall.order.biz.service.OrderCommentReplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + * 订单评论回复 service impl + * + * @author wtz + * @time 2019-05-31 18:30 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true",version = "${dubbo.provider.OrderCommentReplyService.version}") +public class OrderCommentReplyServiceImpl implements OrderCommentReplyService { + + @Autowired + private OrderCommentReplayMapper orderCommentReplayMapper; + +// /** +// * 分页获取评论回复 +// * @param orderCommentReplyPageDTO +// * @return +// */ +// @Override +// public OrderCommentReplyPageBO getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO) { +// OrderCommentReplyPageBO orderCommentReplyPageBO=new OrderCommentReplyPageBO(); +// //评论回复总数 +// Integer totalCount=orderCommentReplayMapper.selectCommentReplyTotalCountByCommentId(orderCommentReplyPageDTO.getCommentId(), +// orderCommentReplyPageDTO.getUserType()); +// //分页获取评论回复 +// List orderCommentReplyDOList=orderCommentReplayMapper.selectCommentReplyPage(orderCommentReplyPageDTO); +// orderCommentReplyPageBO.setTotal(totalCount); +// orderCommentReplyPageBO.setOrderCommentReplayItems(OrderCommentReplyConvert.INSTANCE.convertOrderCommentReplayItem(orderCommentReplyDOList)); +// return orderCommentReplyPageBO; +// } +// +// +// /** +// * 创建评论回复 +// * @param orderCommentReplyCreateDTO +// * @return +// */ +// @Override +// public OrderCommentReplyCreateBO createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO) { +// OrderCommentReplyDO orderCommentReplyDO=OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyCreateDTO); +// orderCommentReplyDO.setCreateTime(new Date()); +// +// Integer replyType=orderCommentReplyCreateDTO.getCommentId()==orderCommentReplyCreateDTO.getParentId()? +// OrderCommentRelpyTypeEnum.COMMENT_REPLY.getValue():OrderCommentRelpyTypeEnum.REPLY_REPLY.getValue(); +// +// orderCommentReplyDO.setReplyType(replyType); +// +// orderCommentReplayMapper.insert(orderCommentReplyDO); +// +// return OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyDO); +// } +// +// /** +// * 获取商家评论回复 +// * @param commentId +// * @return +// */ +// @Override +// public List getOrderCommentMerchantReply(Integer commentId) { +// List orderCommentReplyDOList=orderCommentReplayMapper.selectCommentMerchantReplyByCommentIdAndUserType(commentId, +// OrderReplyUserTypeEnum.MERCHANT.getValue()); +// return OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyDOList); +// } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderCommentServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderCommentServiceImpl.java new file mode 100644 index 000000000..5f963c327 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderCommentServiceImpl.java @@ -0,0 +1,93 @@ +package cn.iocoder.mall.order.biz.service.impl; + +import cn.iocoder.mall.order.biz.dao.comment.OrderCommentMapper; +import cn.iocoder.mall.order.biz.dao.comment.OrderCommentReplayMapper; +import cn.iocoder.mall.order.biz.service.OrderCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + * 订单评论 service impl + * + * @author wtz + * @time 2019 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderCommentService.version}") +public class OrderCommentServiceImpl implements OrderCommentService { + + @Autowired + private OrderCommentMapper orderCommentMapper; + + @Autowired + private OrderCommentReplayMapper orderCommentReplayMapper; + + +// @Override +// public OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO) { +// OrderCommentDO orderCommentDO=OrderCommentConvert.INSTANCE.convertOrderCommentDO(orderCommentCreateDTO); +// orderCommentDO.setCreateTime(new Date()); +// orderCommentMapper.insert(orderCommentDO); +// return OrderCommentConvert.INSTANCE.convertOrderCommentCreateBO(orderCommentDO); +// } +// +// @Override +// public OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO) { +// OrderCommentPageBO orderCommentPageBO=new OrderCommentPageBO(); +// //分页内容 +// List orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO); +// //分页评论的 id +// List commentIds=orderCommentDOList.stream().map(x->x.getId()).collect(Collectors.toList()); +// //获取商家最新的评论回复 +// List orderCommentReplyDOList=orderCommentReplayMapper.selectCommentNewMerchantReplyByCommentIds(commentIds, +// OrderReplyUserTypeEnum.MERCHANT.getValue()); +// //评论组装 +// List orderCommentItemList=orderCommentDOList.stream() +// .flatMap(x->orderCommentReplyDOList.stream() +// .filter(y->x.getId()==y.getCommentId()) +// .map(y->new OrderCommentPageBO.OrderCommentItem(x.getId(),x.getUserAvatar(),x.getUserNickName(),x.getStar(), +// x.getCommentContent(),x.getCommentPics(),x.getReplayCount(),x.getLikeCount(),x.getCreateTime(),y.getReplyContent())) +// ).collect(Collectors.toList()); +// //总数 +// int totalCount=orderCommentMapper.selectCommentTotalCountByProductSkuId(orderCommentPageDTO.getProductSkuId()); +// orderCommentPageBO.setOrderCommentItems(orderCommentItemList); +// orderCommentPageBO.setTotal(totalCount); +// return orderCommentPageBO; +// } +// +// +// @Override +// public OrderCommentInfoBO getOrderCommentInfo(Integer commentId) { +// //查询评论详情 +// OrderCommentDO orderCommentDO=orderCommentMapper.selectCommentInfoByCommentId(commentId); +// return OrderCommentConvert.INSTANCE.convertOrderCommentInfoBO(orderCommentDO); +// } +// +// @Override +// public OrderCommentStateInfoPageBO getOrderCommentStateInfoPage(OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO) { +// OrderCommentStateInfoPageBO orderCommentStateInfoPageBO=new OrderCommentStateInfoPageBO(); +// //总数 +// int total=orderCommentMapper.selectOrderCommentStateInfoTotal(orderCommentStateInfoPageDTO.getUserId(), +// orderCommentStateInfoPageDTO.getCommentState()); +// //查询评论状态详情 +// List orderCommentDOList=orderCommentMapper.selectOrderCommentStateInfoPage(orderCommentStateInfoPageDTO); +// //转化评论状态详情 +// List orderCommentStateInfoItemList= +// OrderCommentConvert.INSTANCE.convertOrderCommentStateInfoItems(orderCommentDOList); +// orderCommentStateInfoPageBO.setTotal(total); +// orderCommentStateInfoPageBO.setOrderCommentStateInfoItems(orderCommentStateInfoItemList); +// return orderCommentStateInfoPageBO; +// } +// +// @Override +// public List getOrderCommentTimeOutPage(OrderCommentTimeOutPageDTO orderCommentTimeOutPageDTO) { +// List orderCommentDOList=orderCommentMapper.selectOrderCommentTimeOutPage(orderCommentTimeOutPageDTO); +// return OrderCommentConvert.INSTANCE.convertOrderCommentTimeOutBOList(orderCommentDOList); +// } +// +// @Override +// public void updateBatchOrderCommentState(List orderCommentTimeOutBOList) { +// orderCommentMapper.updateBatchOrderCommentState(OrderCommentStatusEnum.SUCCESS_COMMENT.getValue(),orderCommentTimeOutBOList); +// } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderLogisticsServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderLogisticsServiceImpl.java new file mode 100644 index 000000000..5f4b744c2 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderLogisticsServiceImpl.java @@ -0,0 +1,131 @@ +package cn.iocoder.mall.order.biz.service.impl; + +import cn.iocoder.mall.order.biz.service.OrderLogisticsService; +import org.springframework.stereotype.Service; + +/** + * 订单物流 + * + * @author Sin + * @time 2019-04-12 21:32 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderLogisticsService.version}") +public class OrderLogisticsServiceImpl implements OrderLogisticsService { + +// @Autowired +// private OrderMapper orderMapper; +// @Autowired +// private OrderItemMapper orderItemMapper; +// @Autowired +// private OrderLogisticsMapper orderLogisticsMapper; +// @Autowired +// private OrderLogisticsDetailMapper orderLogisticsDetailMapper; +// +// @Override +// public CommonResult getLogisticsInfo(Integer id) { +// OrderLogisticsDO orderLogisticsDO = orderLogisticsMapper.selectById(id); +// if (orderLogisticsDO == null) { +// return CommonResult.success(null); +// } +// +// List orderLogisticsDetailDOList = orderLogisticsDetailMapper +// .selectByOrderLogisticsId(orderLogisticsDO.getId()); +// +// // 转换数据结构 +// List logisticsDetails +// = OrderLogisticsConvert.INSTANCE.convert(orderLogisticsDetailDOList); +// +// OrderLogisticsInfoBO orderLogisticsInfo2BO = OrderLogisticsConvert.INSTANCE.convert(orderLogisticsDO); +// orderLogisticsInfo2BO.setDetails(logisticsDetails); +// return CommonResult.success(orderLogisticsInfo2BO); +// } +// +// @Override +// public CommonResult getLastLogisticsInfo(Integer id) { +// OrderLogisticsDO orderLogisticsDO = orderLogisticsMapper.selectById(id); +// if (orderLogisticsDO == null) { +// return CommonResult.success(null); +// } +// +// OrderLogisticsDetailDO orderLastLogisticsDetailDO = orderLogisticsDetailMapper.selectLastByLogisticsId(id); +// +// // 转换数据结构 +// OrderLastLogisticsInfoBO.LogisticsDetail lastLogisticsDetail +// = OrderLogisticsConvert.INSTANCE.convertLastLogisticsDetail(orderLastLogisticsDetailDO); +// +// OrderLastLogisticsInfoBO lastLogisticsInfoBO = OrderLogisticsConvert +// .INSTANCE.convertOrderLastLogisticsInfoBO(orderLogisticsDO); +// +// lastLogisticsInfoBO.setLastLogisticsDetail(lastLogisticsDetail); +// return CommonResult.success(lastLogisticsInfoBO); +// } +// +// @Override +// public CommonResult getOrderLogisticsInfo(Integer userId, Integer orderId) { +// OrderDO orderDO = orderMapper.selectById(orderId); +// +// if (orderDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// if (!userId.equals(orderDO.getUserId())) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_USER_ORDER.getCode()); +// } +// +// // 获取订单所发货的订单 id +// List orderItemDOList = orderItemMapper.selectByDeletedAndOrderId( +// DeletedStatusEnum.DELETED_NO.getValue(), orderId); +// +// // 获取物流 信息 +// Set orderLogisticsIds = orderItemDOList.stream() +// .filter(o -> o.getOrderLogisticsId() != null) +// .map(o -> o.getOrderLogisticsId()) +// .collect(Collectors.toSet()); +// +// List orderLogisticsDOList = Collections.emptyList(); +// List orderLogisticsDetailDOList = Collections.emptyList(); +// if (!CollectionUtils.isEmpty(orderLogisticsIds)) { +// orderLogisticsDOList = orderLogisticsMapper.selectByIds(orderLogisticsIds); +// orderLogisticsDetailDOList = orderLogisticsDetailMapper.selectByOrderLogisticsIds(orderLogisticsIds); +// } +// +// // 转换 return 的数据 +// List logistics +// = OrderLogisticsConvert.INSTANCE.convertLogistics(orderLogisticsDOList); +// +// List logisticsDetails +// = OrderLogisticsConvert.INSTANCE.convertLogisticsDetail(orderLogisticsDetailDOList); +// +// logisticsDetails.stream().map(o -> { +// o.setLogisticsTimeText(DateUtil.format(o.getLogisticsTime(), "yyyy-MM-dd HH:mm")); +// return o; +// }).collect(Collectors.toList()); +// +// Map> logisticsDetailMultimap +// = logisticsDetails.stream().collect( +// Collectors.toMap( +// o -> o.getOrderLogisticsId(), +// item -> Lists.newArrayList(item), +// (oldVal, newVal) -> { +// oldVal.addAll(newVal); +// return oldVal; +// } +// ) +// ); +// +// logistics.stream().map(o -> { +// if (logisticsDetailMultimap.containsKey(o.getId())) { +// o.setDetails(logisticsDetailMultimap.get(o.getId())); +// } +// return o; +// }).collect(Collectors.toList()); +// +// return CommonResult.success( +// new OrderLogisticsInfoWithOrderBO() +// .setOrderId(orderId) +// .setOrderNo(orderDO.getOrderNo()) +// .setLogistics(logistics) +// ); +// } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderReturnServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderReturnServiceImpl.java new file mode 100644 index 000000000..7c8ab357f --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderReturnServiceImpl.java @@ -0,0 +1,235 @@ +package cn.iocoder.mall.order.biz.service.impl; + +import cn.iocoder.mall.order.biz.service.OrderReturnService; +import org.springframework.stereotype.Service; + +/** + * 订单退货 service + * + * @author Sin + * @time 2019-03-30 15:35 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderReturnService.version}") +public class OrderReturnServiceImpl implements OrderReturnService { + +// @Autowired +// private OrderMapper orderMapper; +// @Autowired +// private OrderItemMapper orderItemMapper; +// @Autowired +// private OrderReturnMapper orderReturnMapper; +// @Autowired +// private OrderLogisticsService orderLogisticsService; +// +// @Reference(validation = "true", version = "${dubbo.consumer.PayRefundService.version}") +// private PayRefundService payRefundService; +// @Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}") +// private DataDictService dataDictService; +// +// +// @Override +// public CommonResult orderReturnApply(OrderReturnApplyDTO orderReturnDTO) { +// OrderDO checkOrder = orderMapper.selectById(orderReturnDTO.getOrderId()); +// +// // 检查订单是否 存在 +// if (checkOrder == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// // 转换 DO +// OrderReturnDO orderReturnDO = OrderReturnConvert.INSTANCE.convert(orderReturnDTO); +// orderReturnDO +// .setOrderId(checkOrder.getId()) +// // TODO: 2019-04-27 Sin 服务号生成规则 +// .setServiceNumber(UUID.randomUUID().toString().replaceAll("-", "").substring(0, 16)) +// .setOrderNo(checkOrder.getOrderNo()) +// .setStatus(OrderReturnStatusEnum.RETURN_APPLICATION.getValue()) +// .setCreateTime(new Date()); +// +// // 保存申请信息 +// orderReturnMapper.insert(orderReturnDO); +// return CommonResult.success(null); +// } +// +// @Override +// public String updateRefundSuccess(String orderId, Integer refundPrice) { +// return "success"; +// } +// +// @Override +// public CommonResult orderApplyInfo(Integer orderId) { +// +// // 检查订单是否退货 +// OrderReturnDO orderReturnDO = orderReturnMapper.selectByOrderId(orderId); +// if (orderReturnDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NO_RETURN_APPLY.getCode()); +// } +// +// List orderItemDOList = orderItemMapper +// .selectByDeletedAndOrderId(DeletedStatusEnum.DELETED_NO.getValue(), orderId); +// +// // 订单不存在 +// if (CollectionUtils.isEmpty(orderItemDOList)) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// // 转换 returnInfo +// OrderReturnInfoBO.ReturnInfo returnInfo = OrderReturnConvert.INSTANCE.convert(orderReturnDO); +// List itemList = OrderReturnConvert.INSTANCE.convert(orderItemDOList); +// +// // 物流信息 +// CommonResult lastLogisticsCommonResult = orderLogisticsService +// .getLastLogisticsInfo(orderReturnDO.getOrderLogisticsId()); +// +// if (lastLogisticsCommonResult.isError()) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_LOGISTICS_INVOKING_FAIL.getCode()); +// } +// +// OrderLastLogisticsInfoBO lastLogisticsInfoBO = lastLogisticsCommonResult.getData(); +// OrderReturnInfoBO orderReturnInfoBO = new OrderReturnInfoBO() +// .setOrderItems(itemList) +// .setReturnInfo(returnInfo) +// .setLastLogisticsInfo(lastLogisticsInfoBO); +// +// return CommonResult.success(orderReturnInfoBO); +// } +// +// @Override +// public CommonResult orderReturnList(OrderReturnQueryDTO queryDTO) { +// int totalCount = orderReturnMapper.selectListCount(queryDTO); +// if (totalCount <= 0) { +// return CommonResult.success( +// new OrderReturnListBO() +// .setData(Collections.EMPTY_LIST) +// .setIndex(queryDTO.getIndex()) +// .setPageSize(queryDTO.getPageSize()) +// .setTotalCount(0) +// ); +// } +// List orderReturnDOList = orderReturnMapper.selectList(queryDTO); +// List orderReturnListBOList +// = OrderReturnConvert.INSTANCE.convertListBO(orderReturnDOList); +// +// return CommonResult.success( +// new OrderReturnListBO() +// .setData(orderReturnListBOList) +// .setIndex(queryDTO.getIndex()) +// .setPageSize(queryDTO.getPageSize()) +// .setTotalCount(totalCount) +// ); +// } +// +// @Override +// public CommonResult orderReturnAgree(Integer id) { +// OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); +// if (orderReturnDO == null) { +// return ServiceExceptionUtil +// .error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode()); +// } +// +// orderReturnMapper.updateById( +// new OrderReturnDO() +// .setId(id) +// .setApprovalTime(new Date()) +// .setStatus(OrderReturnStatusEnum.APPLICATION_SUCCESSFUL.getValue()) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// public CommonResult orderReturnRefuse(Integer id) { +// OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); +// if (orderReturnDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode()); +// } +// +// orderReturnMapper.updateById( +// new OrderReturnDO() +// .setId(id) +// .setRefuseTime(new Date()) +// .setStatus(OrderReturnStatusEnum.APPLICATION_FAIL.getValue()) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// public CommonResult confirmReceipt(Integer id) { +// OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); +// if (orderReturnDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode()); +// } +// +// orderReturnMapper.updateById( +// new OrderReturnDO() +// .setId(id) +// .setReceiverTime(new Date()) +// .setStatus(OrderReturnStatusEnum.ORDER_RECEIPT.getValue()) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// @Transactional +// public CommonResult refund(Integer id, String ip) { +// OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id); +// if (orderReturnDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode()); +// } +// +// // TODO: 2019/5/8 sin, 发送 MQ 消息,申请退货成功! +// // TODO: 2019/5/8 sin 退款:支付系统退款 +// // TODO: 2019/5/8 sin 退货+退款:退回商品签收后,支付系统退款 +// // TODO: 2019/5/8 sin 事务一致性 [重要] +// +// +// CommonResult dataDictResult = dataDictService +// .getDataDict(DictKeyConstants.ORDER_RETURN_REASON, orderReturnDO.getReason()); +// +// if (dataDictResult.isError()) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.DICT_SERVER_INVOKING_FAIL.getCode()); +// } +// +// // 支付退款 +// String orderDescription = dataDictResult.getData() +// .getDisplayName() + "(" + orderReturnDO.getDescribe() + ")"; +// +// CommonResult payResult = payRefundService.submitRefund( +// new PayRefundSubmitDTO() +// .setAppId(PayAppId.APP_ID_SHOP_ORDER) +// .setOrderId(String.valueOf(orderReturnDO.getOrderId())) +// .setPrice(orderReturnDO.getRefundPrice()) +// .setOrderDescription(orderDescription) +// .setCreateIp(ip) +// ); +// +// if (!payResult.isSuccess()) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_REFUND_FAILED.getCode()); +// } +// +// // 更新 订单退货 信息 +// orderReturnMapper.updateById( +// new OrderReturnDO() +// .setId(id) +// .setClosingTime(new Date()) +// .setStatus(OrderReturnStatusEnum.RETURN_SUCCESS.getValue()) +// ); +// +// // 更新订单 +// orderMapper.updateById( +// new OrderDO() +// .setId(orderReturnDO.getOrderId()) +// .setClosingTime(new Date()) +// .setStatus(OrderStatusEnum.COMPLETED.getValue()) +// ); +// +// // 更新订单 +// orderItemMapper.updateByOrderId( +// orderReturnDO.getOrderId(), +// new OrderItemDO() +// .setClosingTime(new Date()) +// .setStatus(OrderStatusEnum.COMPLETED.getValue()) +// ); +// return CommonResult.success(null); +// } +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderServiceImpl.java new file mode 100644 index 000000000..ecbfe290d --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/impl/OrderServiceImpl.java @@ -0,0 +1,604 @@ +package cn.iocoder.mall.order.biz.service.impl; + +import cn.iocoder.mall.order.biz.service.OrderService; +import org.springframework.stereotype.Service; + +/** + * 订单 service impl + * + * @author Sin + * @time 2019-03-16 15:08 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderService.version}") +public class OrderServiceImpl implements OrderService { + +// /** +// * 支付过期时间 120 分钟 +// */ +// public static final int PAY_EXPIRE_TIME = 120; +// +// @Autowired +// private OrderMapper orderMapper; +// @Autowired +// private OrderItemMapper orderItemMapper; +// @Autowired +// private OrderLogisticsMapper orderLogisticsMapper; +// @Autowired +// private OrderLogisticsDetailMapper orderLogisticsDetailMapper; +// @Autowired +// private OrderRecipientMapper orderRecipientMapper; +// @Autowired +// private OrderCancelMapper orderCancelMapper; +// @Autowired +// private OrderReturnMapper orderReturnMapper; +// +// @Autowired +// private CartServiceImpl cartService; +// +// @Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}") +// private ProductSpuService productSpuService; +// @Reference(validation = "true", version = "${dubbo.consumer.UserAddressService.version}") +// private UserAddressService userAddressService; +// @Reference(validation = "true", version = "${dubbo.consumer.PayTransactionService.version}") +// private PayTransactionService payTransactionService; +// @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}") +// private CouponService couponService; +// +// @Override +// public CommonResult getOrderPage(OrderQueryDTO orderQueryDTO) { +// +// int totalCount = orderMapper.selectPageCount(orderQueryDTO); +// if (totalCount == 0) { // TODO FROM 芋艿 TO 小范 Collections.EMPTY_LIST 改成 Collections.emptyList() +// return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(0)); +// } +// +// // 获取订单数据 +// List orderDOList = orderMapper.selectPage(orderQueryDTO); +// +// if (CollectionUtils.isEmpty(orderDOList)) { +// return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(totalCount)); +// } +// +// // 获取订单 id +// Set orderIds = orderDOList.stream() +// .map(orderDO -> orderDO.getId()) // TODO FROM 芋艿 to 小范,记得用 Lambda +// .collect(Collectors.toSet()); +// +// // 获取配送信息 +// List orderRecipientDOList = orderRecipientMapper.selectByOrderIds(orderIds); +// List orderRecipientBOList = OrderRecipientConvert.INSTANCE.convert(orderRecipientDOList); +// Map orderRecipientBOMap +// = orderRecipientBOList.stream().collect(Collectors.toMap(OrderRecipientBO::getOrderId, obj -> obj)); +// +// // 获取 订单的 items +// List orderItemDOList = orderItemMapper +// .selectByDeletedAndOrderIds(orderIds, DeletedStatusEnum.DELETED_NO.getValue()); +// +// List orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemDO(orderItemDOList); +// Map> orderItemBOMultimap = orderItemBOList.stream().collect( +// Collectors.toMap( +// OrderItemBO::getOrderId, +// item -> Lists.newArrayList(item), +// (oldVal, newVal) -> { +// oldVal.addAll(newVal); +// return oldVal; +// } +// ) +// ); +// +// // 转换 orderDO 为 OrderBO,并设置 item +// List orderPageBOList = OrderConvert.INSTANCE.convertPageBO(orderDOList); +// List result = orderPageBOList.stream().map(orderBO -> { +// if (orderItemBOMultimap.containsKey(orderBO.getId())) { +// orderBO.setOrderItems(orderItemBOMultimap.get(orderBO.getId())); +// } +// if (orderRecipientBOMap.containsKey(orderBO.getId())) { +// orderBO.setOrderRecipient(orderRecipientBOMap.get(orderBO.getId())); +// } +// return orderBO; +// }).collect(Collectors.toList()); +// return CommonResult.success( +// new OrderPageBO() +// .setTotal(totalCount) +// .setOrders(result) +// ); +// } +// +// @Override +// public CommonResult> getOrderItems(Integer orderId) { +// if (orderMapper.selectById(orderId) == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// List orderItemDOList = orderItemMapper +// .selectByDeletedAndOrderId(DeletedStatusEnum.DELETED_NO.getValue(), orderId); +// +// List orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemBO(orderItemDOList); +// return CommonResult.success(orderItemBOList); +// } +// +// @Override +// public CommonResult getOrderRecipientBO(Integer orderId) { +// if (orderMapper.selectById(orderId) == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// OrderRecipientDO orderRecipientDO = orderRecipientMapper.selectByOrderId(orderId); +// OrderRecipientBO orderRecipientBO = OrderRecipientConvert.INSTANCE.convert(orderRecipientDO); +// return CommonResult.success(orderRecipientBO); +// } +// +// @Override +// public CommonResult info(Integer userId, Integer orderId) { +// OrderDO orderDO = orderMapper.selectById(orderId); +// if (orderDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// List itemDOList = orderItemMapper +// .selectByDeletedAndOrderId(DeletedStatusEnum.DELETED_NO.getValue(), orderId); +// +// List orderItems +// = OrderItemConvert.INSTANCE.convertOrderInfoWithOrderItem(itemDOList); +// +// Set orderLogisticsIds = itemDOList.stream() +// .filter(o -> o.getOrderLogisticsId() != null) +// .map(o -> o.getOrderLogisticsId()) +// .collect(Collectors.toSet()); +// +// +// +// // 收件人信息 +// OrderRecipientDO orderRecipientDO = orderRecipientMapper.selectByOrderId(orderId); +// +// // 订单物流信息 +// OrderLogisticsDetailDO orderLogisticsDetailDO = null; +// if (!CollectionUtils.isEmpty(orderLogisticsIds)) { +// orderLogisticsDetailDO = orderLogisticsDetailMapper.selectLast(orderLogisticsIds); +// } +// +// // 检查是否申请退货 +// OrderReturnDO orderReturnDO = orderReturnMapper.selectByOrderId(orderId); +// +// // convert 信息 +// OrderInfoBO.LogisticsDetail logisticsDetail +// = OrderLogisticsDetailConvert.INSTANCE.convertLogisticsDetail(orderLogisticsDetailDO); +// +// OrderInfoBO.Recipient recipient = OrderRecipientConvert.INSTANCE.convertOrderInfoRecipient(orderRecipientDO); +// OrderInfoBO orderInfoBO = OrderConvert.INSTANCE.convert(orderDO); +// orderInfoBO.setRecipient(recipient); +// orderInfoBO.setOrderItems(orderItems); +// orderInfoBO.setLatestLogisticsDetail(logisticsDetail); +// +// // 是否退货 +// if (orderReturnDO != null) { +// orderInfoBO.setHasOrderReturn(orderReturnDO.getStatus()); +// } else { +// orderInfoBO.setHasOrderReturn(-1); +// } +// return CommonResult.success(orderInfoBO); +// } +// +// @Override +// @GlobalTransactional +//// @Transactional // 使用 Seata 分布事务后,无需在使用 @Transactional 注解。 +// public CommonResult createOrder(OrderCreateDTO orderCreateDTO) { +// Integer userId = orderCreateDTO.getUserId(); +// List orderItemDTOList = orderCreateDTO.getOrderItems(); +// List orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList); +// +// // 获取商品信息 +// Set skuIds = orderItemDOList.stream().map(OrderItemDO::getSkuId).collect(Collectors.toSet()); +// List productList = productSpuService.getProductSkuDetailList(skuIds); +// if (orderItemDTOList.size() != productList.size()) { // 校验获得的数量,是否匹配 +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_GOODS_INFO_INCORRECT.getCode()); +// } +// +// // 价格计算 +// CalcOrderPriceBO calcOrderPrice = calcOrderPrice(productList, orderCreateDTO); +// +// // 设置 orderItem +// Map productSpuBOMap = productList +// .stream().collect(Collectors.toMap(ProductSkuDetailBO::getId, o -> o)); // 商品 SKU 信息的集合 +// Map priceItemMap = new HashMap<>(); // 商品 SKU 价格的映射 +// calcOrderPrice.getItemGroups().forEach(itemGroup -> +// itemGroup.getItems().forEach(item -> priceItemMap.put(item.getId(), item))); +// // 遍历 orderItemDOList 数组,将商品信息、商品价格,设置到其中 +// for (OrderItemDO orderItemDO : orderItemDOList) { +// ProductSkuDetailBO productSkuDetailBO = productSpuBOMap.get(orderItemDO.getSkuId()); +// if (productSkuDetailBO.getQuantity() <= 0) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_INSUFFICIENT_INVENTORY.getCode()); +// } +// if (productSkuDetailBO.getPrice() <= 0) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GOODS_AMOUNT_INCORRECT.getCode()); +// } +// // 设置 SKU 信息 +// orderItemDO.setSkuImage(Optional.ofNullable(productSkuDetailBO.getSpu().getPicUrls().get(0)).get()); +// orderItemDO.setSkuName(productSkuDetailBO.getSpu().getName()); +// // 设置价格信息 +// CalcOrderPriceBO.Item priceItem = priceItemMap.get(orderItemDO.getSkuId()); +// Assert.notNull(priceItem, "商品计算价格为空"); +// orderItemDO.setOriginPrice(priceItem.getOriginPrice()) +// .setBuyPrice(priceItem.getBuyPrice()) +// .setPresentPrice(priceItem.getPresentPrice()) +// .setBuyTotal(priceItem.getBuyTotal()) +// .setDiscountTotal(priceItem.getDiscountTotal()) +// .setPresentTotal(priceItem.getPresentTotal()); +// } +// +// // 标记优惠劵已使用 +// if (orderCreateDTO.getCouponCardId() != null) { +// couponService.useCouponCard(userId, orderCreateDTO.getCouponCardId()); +// } +// +// // TODO 芋艿,扣除库存 +// +// // order +// +// // TODO: 2019-04-11 Sin 订单号需要生成规则 +// // TODO FROM 芋艿 to 小范:可以考虑抽象成一个方法,下面几个也是。 +// String orderNo = UUID.randomUUID().toString().replace("-", "").substring(0, 16); +//// Integer totalAmount = orderCommon.calculatedAmount(orderItemDOList); +//// Integer totalPrice = orderCommon.calculatedPrice(orderItemDOList); +//// Integer totalLogisticsPrice = orderCommon.calculatedLogisticsPrice(orderItemDOList); +// OrderDO orderDO = new OrderDO() +// .setUserId(userId) +// .setOrderNo(orderNo) +// .setBuyPrice(calcOrderPrice.getFee().getBuyTotal()) +// .setDiscountPrice(calcOrderPrice.getFee().getDiscountTotal()) +// .setLogisticsPrice(calcOrderPrice.getFee().getPostageTotal()) +// .setPresentPrice(calcOrderPrice.getFee().getPresentTotal()) +// .setPayAmount(0) +// .setClosingTime(null) +// .setDeliveryTime(null) +// .setPaymentTime(null) +// .setStatus(OrderStatusEnum.WAITING_PAYMENT.getValue()) +// .setHasReturnExchange(OrderHasReturnExchangeEnum.NO.getValue()) +// .setRemark(Optional.ofNullable(orderCreateDTO.getRemark()).orElse("")); +// orderDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue()); +//// orderDO.setCreateTime(new Date()); +//// orderDO.setUpdateTime(null); +// orderMapper.insert(orderDO); +// +// // 收件人信息 +// CommonResult userAddressResult = userAddressService.getAddress(userId, orderCreateDTO.getUserAddressId()); +// if (userAddressResult.isError()) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_USER_ADDRESS_FAIL.getCode()); +// } +// UserAddressBO userAddressBO = userAddressResult.getData(); +// OrderRecipientDO orderRecipientDO = OrderRecipientConvert.INSTANCE.convert(userAddressBO); +// orderRecipientDO +// .setOrderId(orderDO.getId()) +// .setType(OrderRecipientTypeEnum.EXPRESS.getValue()) +// .setCreateTime(new Date()) +// .setUpdateTime(null); +// orderRecipientMapper.insert(orderRecipientDO); +// +// // order item +// orderItemDOList.forEach(orderItemDO -> { +// orderItemDO +// .setOrderId(orderDO.getId()) +// .setOrderNo(orderDO.getOrderNo()) +// .setPaymentTime(null) +// .setDeliveryTime(null) +// .setReceiverTime(null) +// .setClosingTime(null) +// .setHasReturnExchange(OrderStatusEnum.WAITING_PAYMENT.getValue()) +// .setDeliveryType(OrderDeliveryTypeEnum.NONE.getValue()) +// .setStatus(OrderStatusEnum.WAITING_PAYMENT.getValue()) +// .setDeleted(DeletedStatusEnum.DELETED_NO.getValue()) +// .setCreateTime(new Date()) +// .setUpdateTime(null); +// }); +// // 一次性插入 +// orderItemMapper.insert(orderItemDOList); +// +// // 创建预订单 +// createPayTransaction(orderDO, orderItemDOList, orderCreateDTO.getIp()); +// +//// if (commonResult.isError()) { +//// //手动开启事务回滚 +//// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); +//// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_PAY_FAIL.getValue()); +//// } +// +// // TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息,业务扩展和统计 +// return CommonResult.success( +// new OrderCreateBO() +// .setId(orderDO.getId()) +// .setOrderNo(orderDO.getOrderNo()) +// .setPayAmount(orderDO.getPayAmount()) +// ); +// } +// +// private CalcOrderPriceBO calcOrderPrice(List skus, OrderCreateDTO orderCreateDTO) { +// // 创建计算的 DTO +// CalcOrderPriceDTO calcOrderPriceDTO = new CalcOrderPriceDTO() +// .setUserId(orderCreateDTO.getUserId()) +// .setItems(new ArrayList<>(skus.size())) +// .setCouponCardId(orderCreateDTO.getCouponCardId()); +// for (OrderCreateDTO.OrderItem item : orderCreateDTO.getOrderItems()) { +// calcOrderPriceDTO.getItems().add(new CalcOrderPriceDTO.Item(item.getSkuId(), item.getQuantity(), true)); +// } +// // 执行计算 +// return cartService.calcOrderPrice(calcOrderPriceDTO); +// } +// +// private PayTransactionBO createPayTransaction(OrderDO order, List orderItems, String ip) { +// // TODO sin 支付订单 orderSubject 暂时取第一个子订单商品信息 +// String orderSubject = orderItems.get(0).getSkuName(); +// Date expireTime = DateUtil.addDate(Calendar.MINUTE, PAY_EXPIRE_TIME); +// return payTransactionService.createTransaction( +// new PayTransactionCreateDTO() +// .setCreateIp(ip) +// .setAppId(PayAppId.APP_ID_SHOP_ORDER) +// .setOrderId(order.getId().toString()) +// .setExpireTime(expireTime) +// .setPrice(order.getPresentPrice()) +// .setOrderSubject(orderSubject) +// .setOrderMemo("测试备注") // TODO 芋艿,后面补充 +// .setOrderDescription("测试描述") // TODO 芋艿,后面补充 +// ); +// } +// +// @Override // TODO 芋艿,需要确认下这个方法的用途。因为涉及修改价格和数量。 +// public CommonResult updateOrderItem(OrderItemUpdateDTO orderUpdateDTO) { +// OrderItemDO orderItemDO = OrderItemConvert.INSTANCE.convert(orderUpdateDTO); +// orderItemMapper.updateById(orderItemDO); +// +// // TODO: 2019-03-24 sin 需要重新计算金额 +// // TODO: 2019-03-24 sin 需要记录日志 +// return CommonResult.success(null); +// } +// +// @Override +// @Transactional +// public CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount) { +// OrderDO orderDO = orderMapper.selectById(orderId); +// if (orderDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// if (payAmount < 0) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_PAY_AMOUNT_NOT_NEGATIVE.getCode()); +// } +// +// // 先更新金额 +// orderItemMapper.updateById(new OrderItemDO().setId(orderItemId) +//// .setPayAmount(payAmount) TODO 芋艿,这里要修改 +// ); +// +// // 再重新计算订单金额 +// List orderItemDOList = orderItemMapper +// .selectByDeletedAndOrderId(DeletedStatusEnum.DELETED_NO.getValue(), orderId); +//// Integer price = orderCommon.calculatedPrice(orderItemDOList); +//// Integer amount = orderCommon.calculatedAmount(orderItemDOList); +// Integer price = -1; // TODO 芋艿,这里要修改,价格 +// Integer amount = -1; +// orderMapper.updateById( +// new OrderDO() +// .setId(orderId) +//// .setPrice(price) TODO 芋艿,这里要修改 +// .setPayAmount(amount) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// @Transactional // TODO 芋艿,要校验下 userId 。不然可以取消任何用户的订单列。 +// public CommonResult cancelOrder(Integer orderId, Integer reason, String otherReason) { +// // 关闭订单,在用户还未付款的时候可操作 +// OrderDO orderDO = orderMapper.selectById(orderId); +// if (orderDO == null) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()); +// } +// +// // 检查专题,只有待付款状态才能操作 +// if (!orderDO.getStatus().equals(OrderStatusEnum.WAITING_PAYMENT.getValue())) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_STATUS_NOT_CANCEL.getCode()); +// } +// +// OrderCancelDO orderCancelDO +// = (OrderCancelDO) new OrderCancelDO() +// .setOrderId(orderDO.getId()) +// .setOrderNo(orderDO.getOrderNo()) +// .setReason(reason) +// .setOtherReason(otherReason) +// .setCreateTime(new Date()) +// .setUpdateTime(null); +// +// // 关闭订单,修改状态 item +// // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题 +// orderItemMapper.updateByOrderId( +// orderId, +// new OrderItemDO().setStatus(OrderStatusEnum.CLOSED.getValue()) +// ); +// +// // 关闭订单,修改状态 order +// orderMapper.updateById(new OrderDO().setId(orderId).setStatus(OrderStatusEnum.CLOSED.getValue())); +// // 保存取消订单原因 +// orderCancelMapper.insert(orderCancelDO); +// return CommonResult.success(null); +// } +// +// @Override +// @Transactional // TODO FROM 芋艿 TO 小范:泛型,一定要明确哈。 +// public CommonResult orderDelivery(OrderDeliveryDTO orderDelivery) { +// List orderItemIds = orderDelivery.getOrderItemIds(); +// +// // 获取所有订单 items // TODO FROM 芋艿 TO 小范,deleted 是默认条件,所以 by 里面可以不带哈 +// List allOrderItems = orderItemMapper.selectByDeletedAndOrderId(orderDelivery.getOrderId(), DeletedStatusEnum.DELETED_NO.getValue()); +// +// // 当前需要发货订单,检查 id 和 status +// List needDeliveryOrderItems = allOrderItems.stream() +// .filter(orderItemDO -> orderItemIds.contains(orderItemDO.getId()) +// && OrderStatusEnum.WAIT_SHIPMENT.getValue() == orderItemDO.getStatus()) +// .collect(Collectors.toList()); // TODO 芋艿,如果这里只是比对数字,可以用 Lambda 求和,不需要弄成一个集合的 +// // 发货订单,检查 +// if (needDeliveryOrderItems.size() != orderItemIds.size()) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_DELIVERY_INCORRECT_DATA.getCode()); +// } +// +// OrderRecipientDO orderRecipientDO = orderRecipientMapper.selectByOrderId(orderDelivery.getOrderId()); +// OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderRecipientDO); +// // 保存物流信息 +// orderLogisticsDO +// .setLogisticsNo(orderDelivery.getLogisticsNo()) +// .setLogistics(orderDelivery.getLogistics()) +// .setCreateTime(new Date()) +// .setUpdateTime(null); +// orderLogisticsMapper.insert(orderLogisticsDO); +// +// // 关联订单item 和 物流信息 +// // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题,然后判断下更新数量,不对,就抛出异常。 +// orderItemMapper.updateByIds( +// orderItemIds, +// new OrderItemDO() +// .setOrderLogisticsId(orderLogisticsDO.getId()) +// .setStatus(OrderStatusEnum.ALREADY_SHIPMENT.getValue()) +// ); +// +// // 子订单是否全部发货,如果发完,就更新 order +// List unShippedOrderItems = allOrderItems.stream() +// .filter(orderItemDO -> OrderStatusEnum.WAIT_SHIPMENT.getValue() == orderItemDO.getStatus() +// && !orderItemIds.contains(orderItemDO.getId())) +// .collect(Collectors.toList()); +// if (unShippedOrderItems.size() <= 0) { +// // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题 +// orderMapper.updateById( +// new OrderDO() +// .setId(orderDelivery.getOrderId()) +// .setStatus(OrderStatusEnum.ALREADY_SHIPMENT.getValue()) +// ); +// } +// // 返回成功 +// return CommonResult.success(null); +// } +// +// @Override +// public CommonResult updateOrderRemake(Integer orderId, String remake) { +// // 此处不做订单校验,直接设置备注即可 +// orderMapper.updateById(new OrderDO().setId(orderId).setRemark(remake)); +// return CommonResult.success(null); +// } +// +// @Override +// @Transactional // TODO FROM 芋艿 to 小范,先不做这个功能,电商一班不存在这个功能哈。 +// public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) { +// Integer orderId = orderItemDeletedDTO.getOrderId(); +// List orderItemIds = orderItemDeletedDTO.getOrderItemIds(); +// +// // 获取当前有效的订单 item +// List orderItemDOList = orderItemMapper +// .selectByDeletedAndOrderId(DeletedStatusEnum.DELETED_NO.getValue(), orderId); +// +// List effectiveOrderItems = orderItemDOList.stream() +// .filter(orderItemDO -> !orderItemIds.contains(orderItemDO.getId())) +// .collect(Collectors.toList()); +// +// // 检查订单 item,必须要有一个 item +// if (CollectionUtils.isEmpty(effectiveOrderItems)) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_ITEM_ONLY_ONE.getCode()); +// } +// +// // 更新订单 item +// orderItemMapper.updateByIds( +// orderItemIds, +// (OrderItemDO) new OrderItemDO() +// .setDeleted(DeletedStatusEnum.DELETED_YES.getValue()) +// ); +// +// // 更新订单 amount +//// Integer totalAmount = orderCommon.calculatedAmount(effectiveOrderItems); +// Integer totalAmount = -1; // TODO 芋艿,需要修改下,价格相关 +// orderMapper.updateById( +// new OrderDO() +// .setId(orderId) +// .setPayAmount(totalAmount) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// public CommonResult confirmReceiving(Integer userId, Integer orderId) { +// OrderDO orderDO = orderMapper.selectById(orderId); +// +// // 是否该用户的订单 +// if (!userId.equals(orderDO.getUserId())) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_USER_ORDER.getCode()); +// } +// +// if (OrderStatusEnum.ALREADY_SHIPMENT.getValue() != orderDO.getStatus()) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_UNABLE_CONFIRM_ORDER.getCode()); +// } +// +// // TODO FROM 芋艿 TO 小范,更新的时候,where 里面带下 status 避免并发的问题 +// orderMapper.updateById( +// new OrderDO() +// .setId(orderId) +// .setReceiverTime(new Date()) +// .setStatus(OrderStatusEnum.COMPLETED.getValue()) +// +// ); +// +// orderItemMapper.updateByOrderId( +// orderId, +// new OrderItemDO() +// .setStatus(OrderStatusEnum.COMPLETED.getValue()) +// .setReceiverTime(new Date()) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// public CommonResult updateLogistics(OrderLogisticsUpdateDTO orderLogisticsDTO) { +// OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderLogisticsDTO); +// orderLogisticsMapper.updateById(orderLogisticsDO); +// return CommonResult.success(null); +// } +// +// @Override +// public CommonResult deleteOrder(Integer id) { +// // 删除订单操作,一般用于 用户端删除,是否存在检查可以过掉 +// orderMapper.updateById((OrderDO) new OrderDO() +// .setId(id) +// .setDeleted(DeletedStatusEnum.DELETED_YES.getValue()) +// ); +// return CommonResult.success(null); +// } +// +// @Override +// public String updatePaySuccess(String orderId, Integer payAmount) { +// OrderDO order = orderMapper.selectById(Integer.valueOf(orderId)); +// if (order == null) { // 订单不存在 +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_NOT_EXISTENT.getCode()).getMessage(); +// } +// if (!order.getStatus().equals(OrderStatusEnum.WAITING_PAYMENT.getValue())) { // 状态不处于等待支付 +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_STATUS_NOT_WAITING_PAYMENT.getCode()).getMessage(); +// } +// if (!order.getPresentPrice().equals(payAmount)) { // 支付金额不正确 +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_PAY_AMOUNT_ERROR.getCode()).getMessage(); +// } +// // 更新 OrderDO 状态为已支付,等待发货 +// OrderDO updateOrderObj = new OrderDO() +// .setStatus(OrderStatusEnum.WAIT_SHIPMENT.getValue()) +// .setPayAmount(payAmount) +// .setPaymentTime(new Date()); +// int updateCount = orderMapper.updateByIdAndStatus(order.getId(), order.getStatus(), updateOrderObj); +// if (updateCount <= 0) { +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_STATUS_NOT_WAITING_PAYMENT.getCode()).getMessage(); +// } +// // TODO FROM 芋艿 to 小范,把更新 OrderItem 给补全。 +// return "success"; +// } +// +// @Override +// public CommonResult listenerConfirmGoods() { +// return null; +// } +// +// @Override +// public CommonResult listenerExchangeGoods() { +// return null; +// } +} diff --git a/order/order-biz/src/main/resources/biz.yaml b/order/order-biz/src/main/resources/biz.yaml index ba156c62e..fb1c302dd 100644 --- a/order/order-biz/src/main/resources/biz.yaml +++ b/order/order-biz/src/main/resources/biz.yaml @@ -1,7 +1,7 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://s1.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8 + url: jdbc:mysql://s1.iocoder.cn:3306/mall_order?useSSL=false&useUnicode=true&characterEncoding=UTF-8 driver-class-name: com.mysql.jdbc.Driver username: root password: 3WLiVUBEwTbvAfsh @@ -16,4 +16,4 @@ mybatis-plus: logic-delete-value: 1 # 逻辑已删除值(默认为 1) logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) mapper-locations: classpath*:mapper/*.xml - type-aliases-package: cn.iocoder.mall.system.biz.dataobject + type-aliases-package: cn.iocoder.mall.order.biz.dataobject diff --git a/order/order-biz/src/main/resources/mapper/CartMapper.xml b/order/order-biz/src/main/resources/mapper/CartMapper.xml new file mode 100644 index 000000000..b5ca5f4c4 --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/CartMapper.xml @@ -0,0 +1,129 @@ + + + + + + id, status, delete_time, selected, user_id, + spu_id, sku_id, quantity, order_id, order_create_time, + create_time + + + + + + + + + + + + + + INSERT INTO cart_item ( + status, delete_time, selected, user_id, + spu_id, sku_id, quantity, order_id, order_create_time, + create_time + ) VALUES ( + #{status}, #{deleteTime}, #{selected}, #{userId}, + #{spuId}, #{skuId}, #{quantity}, #{orderId}, #{orderCreateTime}, + #{createTime} + ) + + + + UPDATE cart_item + + + status = #{status}, + + + delete_time = #{deleteTime}, + + + selected = #{selected}, + + + quantity = #{quantity}, + + + order_id = #{orderId}, + + + order_create_time = #{orderCreateTime}, + + + price = #{price}, + + + quantity = #{quantity}, + + + WHERE id = #{id} + + + + UPDATE cart_item + SET quantity = quantity + #{quantityIncr} + WHERE id = #{id} + + + + UPDATE cart_item + + + selected = #{selected}, + + + status = #{status}, + + + WHERE user_id = #{userId} + AND sku_id IN + + #{skuId} + + -- AND deleted = 0 + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderCancelMapper.xml b/order/order-biz/src/main/resources/mapper/OrderCancelMapper.xml new file mode 100644 index 000000000..1f36e4891 --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderCancelMapper.xml @@ -0,0 +1,22 @@ + + + + + + id, order_id, order_no, reason, other_reason, + create_time, update_time + + + + + INSERT INTO `order_cancel` ( + order_id, order_no, reason, other_reason, + create_time, update_time + ) VALUES ( + #{orderId}, #{orderNo}, #{reason}, #{otherReason}, + #{createTime}, #{updateTime} + ) + + diff --git a/order/order-biz/src/main/resources/mapper/OrderCommentMapper.xml b/order/order-biz/src/main/resources/mapper/OrderCommentMapper.xml new file mode 100644 index 000000000..e5f96e209 --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderCommentMapper.xml @@ -0,0 +1,104 @@ + + + + + + id,order_id,order_no,product_spu_id,product_spu_name,product_sku_id,product_sku_attrs,product_sku_price,product_sku_pic_url, + user_id,user_avatar,user_nick_name,star,product_description_star,logistics_star,merchant_star,replay_count,like_count,comment_content, + comment_pics,comment_state,create_time,update_time + + + + + INSERT INTO order_comment(order_id,order_no,product_spu_id,product_spu_name,product_sku_id, + product_sku_attrs,product_sku_price,product_sku_pic_url,user_id,user_avatar,user_nick_name,star, + product_description_star,logistics_star,merchant_star,comment_content,comment_pics,comment_state,create_time,update_time) + VALUES (#{orderId},#{orderNo},#{productSpuId},#{productSpuName},#{productSkuId},#{productSkuAttrs}, + #{productSkuPrice},#{productSkuPicUrl},#{userId},#{userAvatar},#{userNickName},#{star}, + #{productDescriptionStar},#{logisticsStar},#{merchantStar},#{commentContent},#{commentPics},#{commentState},#{createTime}, #{updateTime}); + + + + + + + + + + + + + + + + + + + + + + + + UPDATE order_comment + SET + comment_state = #{commentState} + WHERE + id + IN + + + #{item.id} + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderCommentReplayMapper.xml b/order/order-biz/src/main/resources/mapper/OrderCommentReplayMapper.xml new file mode 100644 index 000000000..ada6257d4 --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderCommentReplayMapper.xml @@ -0,0 +1,81 @@ + + + + + + id,comment_id,reply_type,parent_id,parent_user_id,parent_user_nick_name,parent_user_avatar,reply_content, + reply_user_id,reply_user_nick_name,reply_user_avatar,user_type,reply_like_count,create_time,update_time + + + + + INSERT INTO order_comment_replay(comment_id,reply_type,parent_id,parent_user_id,parent_user_nick_name,parent_user_avatar,reply_content,reply_user_id, + reply_user_nick_name,reply_user_avatar,user_type,create_time,update_time) + VALUES (#{commentId},#{replyType},#{parentId},#{parentUserId},#{parentUserNickName},#{parentUserAvatar},#{replyContent},#{replyUserId}, + #{replyUserNickName},#{replyUserAvatar},#{userType},#{createTime},#{updateTime}) + + + + + + + + + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderItemMapper.xml b/order/order-biz/src/main/resources/mapper/OrderItemMapper.xml new file mode 100644 index 000000000..f4bdf2c3c --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderItemMapper.xml @@ -0,0 +1,172 @@ + + + + + + id, order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id, + quantity, origin_price, buy_price, present_price, buy_total, discount_total, present_total, + payment_time, delivery_time, receiver_time, closing_time, + has_return_exchange, delivery_type, status, + create_time, update_time, deleted + + + + + INSERT INTO `order_item` ( + order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id, + quantity, origin_price, buy_price, present_price, buy_total, discount_total, present_total, + payment_time, delivery_time, receiver_time, closing_time, + has_return_exchange, delivery_type, status, + create_time, update_time, deleted + ) VALUES + + (#{item.orderId}, #{item.orderNo}, #{item.skuId}, #{item.skuName}, #{item.skuImage}, #{item.orderLogisticsId}, + #{item.quantity}, #{item.originPrice}, #{item.buyPrice}, #{item.presentPrice}, #{item.buyTotal}, #{item.discountTotal}, #{item.presentTotal}, + #{item.paymentTime}, #{item.deliveryTime}, #{item.receiverTime}, #{item.closingTime}, + #{item.hasReturnExchange}, #{item.deliveryType}, #{item.status}, + #{item.createTime}, #{item.updateTime}, #{item.deleted}) + + + + + + + + , order_id = #{orderItemDO.orderId} + + + , order_no = #{orderItemDO.orderNo} + + + , order_logistics_id = #{orderItemDO.orderLogisticsId} + + + , sku_id = #{orderItemDO.skuId} + + + , sku_name = #{orderItemDO.skuName} + + + , sku_image = #{orderItemDO.skuImage} + + + , quantity = #{orderItemDO.quantity} + + + + + + + + + + + , payment_time = #{orderItemDO.paymentTime} + + + , delivery_time = #{orderItemDO.deliveryTime} + + + , receiver_time = #{orderItemDO.receiverTime} + + + , closing_time = #{orderItemDO.closingTime} + + + + , has_return_exchange = #{orderItemDO.hasReturnExchange} + + + , status = #{orderItemDO.status} + + + , delivery_type = #{orderItemDO.deliveryType} + + + , `deleted` = #{orderItemDO.deleted} + + + , create_time = #{orderItemDO.createTime} + + + , update_time = #{orderItemDO.updateTime} + + + + + + + UPDATE `order_item` + + WHERE id = #{orderItemDO.id} + + + + + UPDATE `order_item` + + WHERE id IN + + #{id} + + + + + + UPDATE `order_item` + + WHERE order_id = #{orderId} + + + + + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderLogisticsDetailMapper.xml b/order/order-biz/src/main/resources/mapper/OrderLogisticsDetailMapper.xml new file mode 100644 index 000000000..4f2745035 --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderLogisticsDetailMapper.xml @@ -0,0 +1,76 @@ + + + + + + id, + order_logistics_id, + logistics_time, + logistics_information, + create_time, + update_time + + + + + INSERT INTO cart_item (order_logistics_id, logistics_time, logistics_information, + create_time, update_time) + VALUES (#{orderLogisticsId}, #{logisticsTime}, #{logisticsInformation}, + #{createTime}, #{updateTime}) + + + + + + + + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderLogisticsMapper.xml b/order/order-biz/src/main/resources/mapper/OrderLogisticsMapper.xml new file mode 100644 index 000000000..663dff66e --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderLogisticsMapper.xml @@ -0,0 +1,80 @@ + + + + + + id, area_no, `name`, mobile, address, logistics, logistics_no, create_time, update_time + + + + + INSERT INTO `order_logistics` ( + area_no, `name`, mobile, address, logistics, logistics_no, create_time, update_time + ) VALUES ( + #{areaNo}, #{name}, #{mobile}, #{address}, + #{logistics}, #{logisticsNo}, #{createTime}, #{updateTime} + ) + + + + + + + , area_no = #{areaNo} + + + , `name` = #{name} + + + , mobile = #{mobile} + + + , address = #{address} + + + , logistics = #{logistics} + + + , logistics_no = #{logisticsNo} + + + + + + + UPDATE `order_logistics` + + WHERE id = #{id} + + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderMapper.xml b/order/order-biz/src/main/resources/mapper/OrderMapper.xml new file mode 100644 index 000000000..2f03b33f3 --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderMapper.xml @@ -0,0 +1,141 @@ + + + + + + id, user_id, order_no, buy_price, discount_price, logistics_price, present_price, pay_amount, + payment_time, delivery_time, receiver_time, closing_time, + has_return_exchange, + status, remark, create_time, update_time, `deleted` + + + + + + , order_no = #{orderNo} + + + , buy_price = #{buyPrice} + + + , discount_price = #{discountPrice} + + + , logistics_price = #{logisticsPrice} + + + , logistics_price = #{logisticsPrice} + + + , present_price = #{presentPrice} + + + , pay_amount = #{payAmount} + + + , delivery_time = #{deliveryTime} + + + , payment_time = #{paymentTime} + + + , receiver_time = #{receiverTime} + + + , closing_time = #{closingTime} + + + , has_return_exchange = #{hasReturnExchange} + + + + , status = #{status} + + + , remark = #{remark} + + + , `deleted` = #{deleted} + + + , create_time = #{createTime} + + + , update_time = #{updateTime} + + + + + + UPDATE `orders` + + WHERE id = #{id} + + + + UPDATE `orders` + + + , pay_amount = #{updateObj.payAmount} + + + , payment_time = #{updateObj.paymentTime} + + + , status = #{updateObj.status} + + + WHERE id = #{id} + AND status = #{status} + + + + + + + AND `status` = #{status} + + + AND `user_id` = #{userId} + + + AND `id` = #{id} + + + AND `order_no` = #{orderNo} + + + AND `has_return_exchange` = #{hasReturnExchange} + + + AND `create_time` >= #{startCreateTime} + AND `create_time` <= #{endCreateTime} + + + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderRecipientMapper.xml b/order/order-biz/src/main/resources/mapper/OrderRecipientMapper.xml new file mode 100644 index 000000000..ca08c48bf --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderRecipientMapper.xml @@ -0,0 +1,46 @@ + + + + + + id, order_id, `area_no`, `name`, mobile, address, `type`, + create_time, update_time + + + + + INSERT INTO `order_recipient` ( + order_id, `area_no`, `name`, mobile, address, + `type`, create_time, update_time + ) VALUES ( + #{orderId}, #{areaNo}, #{name}, #{mobile}, #{address}, + #{type}, #{createTime,jdbcType=TIMESTAMP} , #{updateTime} + ) + + + + + + + + + diff --git a/order/order-biz/src/main/resources/mapper/OrderReturnMapper.xml b/order/order-biz/src/main/resources/mapper/OrderReturnMapper.xml new file mode 100644 index 000000000..6748a6b8c --- /dev/null +++ b/order/order-biz/src/main/resources/mapper/OrderReturnMapper.xml @@ -0,0 +1,165 @@ + + + + + + id, + service_number, + order_id, + order_no, + order_logistics_id, + refund_price, + reason, + `describe`, + approval_time, + refuse_time, + logistics_time, + receiver_time, + closing_time, + service_type, + status, + create_time, + update_time + + + + + INSERT INTO `order_return` ( + service_number, order_id, order_no, order_logistics_id, + refund_price, reason, `describe`, + approval_time, refuse_time, logistics_time, receiver_time, closing_time, + service_type, status, + create_time, update_time) + VALUES ( + #{serviceNumber}, #{orderId}, #{orderNo}, #{orderLogisticsId}, + ${refundPrice}, #{reason}, #{describe}, + #{approvalTime}, #{refuse_time}, #{logisticsTime}, #{receiverTime}, #{closingTime}, + #{serviceType}, #{status}, #{createTime}, #{updateTime}) + + + + + + + , order_logistics_id = #{orderLogisticsId} + + + , refund_price = #{refundPrice} + + + , reason = #{reason} + + + , `describe` = #{describe} + + + , approval_time = #{approvalTime} + + + , refuse_time = #{refuseTime} + + + , logistics_time = #{logisticsTime} + + + , receiver_time = #{receiverTime} + + + , closing_time = #{closingTime} + + + , service_type = #{serviceType} + + + , status = #{status} + + + , create_time = #{createTime} + + + , update_time = #{updateTime} + + + + + + + UPDATE `order_return` + + WHERE id = #{id} + + + + + + + + + AND status = #{status} + + + AND service_number = #{serviceNumber} + + + AND order_id = #{orderId} + + + AND order_no = #{orderNo} + + + AND create_time >= #{startCreateTime} + AND create_time <= #{endCreateTime} + + + + + + + + + + + + + diff --git a/order/order-service-impl/src/main/resources/mapper/CartMapper.xml b/order/order-service-impl/src/main/resources/mapper/CartMapper.xml index 7d9a28f38..b5ca5f4c4 100644 --- a/order/order-service-impl/src/main/resources/mapper/CartMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/CartMapper.xml @@ -1,6 +1,6 @@ - + id, status, delete_time, selected, user_id, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCancelMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCancelMapper.xml index cb7faca20..1f36e4891 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCancelMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCancelMapper.xml @@ -1,6 +1,6 @@ - + id, order_id, order_no, reason, other_reason, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml index d0694320b..e5f96e209 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml @@ -1,6 +1,6 @@ - + id,order_id,order_no,product_spu_id,product_spu_name,product_sku_id,product_sku_attrs,product_sku_price,product_sku_pic_url, @@ -101,4 +101,4 @@ - \ No newline at end of file + diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml index 8b6731865..ada6257d4 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml @@ -1,6 +1,6 @@ - + id,comment_id,reply_type,parent_id,parent_user_id,parent_user_nick_name,parent_user_avatar,reply_content, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml index 593332489..f4bdf2c3c 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml @@ -1,6 +1,6 @@ - + id, order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderLogisticsDetailMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderLogisticsDetailMapper.xml index 34db79843..4f2745035 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderLogisticsDetailMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderLogisticsDetailMapper.xml @@ -1,6 +1,6 @@ - + id, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderLogisticsMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderLogisticsMapper.xml index 84de53114..663dff66e 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderLogisticsMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderLogisticsMapper.xml @@ -1,6 +1,6 @@ - + id, area_no, `name`, mobile, address, logistics, logistics_no, create_time, update_time @@ -77,4 +77,4 @@ WHERE `id` = #{id} LIMIT 1 - \ No newline at end of file + diff --git a/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml index 5bc328e25..2f03b33f3 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml @@ -1,6 +1,6 @@ - + id, user_id, order_no, buy_price, discount_price, logistics_price, present_price, pay_amount, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml index 77c893b0b..ca08c48bf 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml @@ -1,6 +1,6 @@ - + id, order_id, `area_no`, `name`, mobile, address, `type`, diff --git a/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml index a397240f5..6748a6b8c 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderReturnMapper.xml @@ -1,6 +1,6 @@ - + id,