parent
c5f8abd6de
commit
f4c7f65cb8
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.mall.order.dao;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.order.dataobject.OrderDO;
|
||||||
|
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单 item mapper
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-03-16 15:09
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface OrderLogisticsMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入数据
|
||||||
|
*
|
||||||
|
* @param orderLogisticsDO
|
||||||
|
*/
|
||||||
|
void insert(OrderLogisticsDO orderLogisticsDO);
|
||||||
|
}
|
|
@ -2,7 +2,6 @@ package cn.iocoder.mall.order.dataobject;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.dataobject.BaseDO;
|
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,19 +33,19 @@ public class OrderDO extends BaseDO {
|
||||||
/// 时间信息
|
/// 时间信息
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 付款时间
|
* 付款时间(待发货)
|
||||||
*/
|
*/
|
||||||
private Date paymentTime;
|
private Date paymentTime;
|
||||||
/**
|
/**
|
||||||
* 发货时间
|
* 发货时间(待收货)
|
||||||
*/
|
*/
|
||||||
private Date deliveryTime;
|
private Date deliveryTime;
|
||||||
/**
|
/**
|
||||||
* 收货时间
|
* 收货时间(已签收)
|
||||||
*/
|
*/
|
||||||
private Date receiverTime;
|
private Date receiverTime;
|
||||||
/**
|
/**
|
||||||
* 成交时间
|
* 成交时间(用户确认收货 -> status = 已完成)
|
||||||
*/
|
*/
|
||||||
private Date closingTime;
|
private Date closingTime;
|
||||||
|
|
||||||
|
@ -72,13 +71,6 @@ public class OrderDO extends BaseDO {
|
||||||
* - 4、已关闭
|
* - 4、已关闭
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
/**
|
|
||||||
* 删除状态
|
|
||||||
*
|
|
||||||
* - 0 未删除
|
|
||||||
* - 1 已删除
|
|
||||||
*/
|
|
||||||
private Integer deleteStatus;
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +89,6 @@ public class OrderDO extends BaseDO {
|
||||||
", closingTime=" + closingTime +
|
", closingTime=" + closingTime +
|
||||||
", hasReturnExchange=" + hasReturnExchange +
|
", hasReturnExchange=" + hasReturnExchange +
|
||||||
", status=" + status +
|
", status=" + status +
|
||||||
", deleteStatus=" + deleteStatus +
|
|
||||||
", remark='" + remark + '\'' +
|
", remark='" + remark + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
@ -192,15 +183,6 @@ public class OrderDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getDeleteStatus() {
|
|
||||||
return deleteStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderDO setDeleteStatus(Integer deleteStatus) {
|
|
||||||
this.deleteStatus = deleteStatus;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
public String getRemark() {
|
||||||
return remark;
|
return remark;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
* 订单编号
|
* 订单编号
|
||||||
*/
|
*/
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 订单 item 编号
|
||||||
|
*/
|
||||||
|
private Integer orderItemId;
|
||||||
/**
|
/**
|
||||||
* 商品id(保存一个冗余,如果一个订单下存在多个商品,会有很大的作用)
|
* 商品id(保存一个冗余,如果一个订单下存在多个商品,会有很大的作用)
|
||||||
*/
|
*/
|
||||||
|
@ -62,8 +66,9 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
|
* supper baseDO
|
||||||
*/
|
*/
|
||||||
private Date createTime;
|
// private Date createTime;
|
||||||
/**
|
/**
|
||||||
* 付款时间
|
* 付款时间
|
||||||
*/
|
*/
|
||||||
|
@ -84,6 +89,13 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
///
|
///
|
||||||
/// 其他
|
/// 其他
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单类型
|
||||||
|
*
|
||||||
|
* - 0、为 Order 订单 (对整个订单退货)
|
||||||
|
* - 1、为 OrderItem 订单 (对订单某一个商品退货)
|
||||||
|
*/
|
||||||
|
private Integer orderType;
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*
|
*
|
||||||
|
@ -101,17 +113,18 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", orderId=" + orderId +
|
", orderId=" + orderId +
|
||||||
", orderNo='" + orderNo + '\'' +
|
", orderNo='" + orderNo + '\'' +
|
||||||
|
", orderItemId=" + orderItemId +
|
||||||
", skuId='" + skuId + '\'' +
|
", skuId='" + skuId + '\'' +
|
||||||
", exchangeSkuId='" + exchangeSkuId + '\'' +
|
", exchangeSkuId='" + exchangeSkuId + '\'' +
|
||||||
", exchangeOrderLogisticsId=" + exchangeOrderLogisticsId +
|
", exchangeOrderLogisticsId=" + exchangeOrderLogisticsId +
|
||||||
", receiverOrderLogisticsId=" + receiverOrderLogisticsId +
|
", receiverOrderLogisticsId=" + receiverOrderLogisticsId +
|
||||||
", orderReasonId=" + orderReasonId +
|
", orderReasonId=" + orderReasonId +
|
||||||
", reason='" + reason + '\'' +
|
", reason='" + reason + '\'' +
|
||||||
", createTime=" + createTime +
|
|
||||||
", paymentTime=" + paymentTime +
|
", paymentTime=" + paymentTime +
|
||||||
", deliveryTime=" + deliveryTime +
|
", deliveryTime=" + deliveryTime +
|
||||||
", receiverTime=" + receiverTime +
|
", receiverTime=" + receiverTime +
|
||||||
", closingTime=" + closingTime +
|
", closingTime=" + closingTime +
|
||||||
|
", orderType=" + orderType +
|
||||||
", status=" + status +
|
", status=" + status +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
@ -143,6 +156,15 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getOrderItemId() {
|
||||||
|
return orderItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderExchangeDO setOrderItemId(Integer orderItemId) {
|
||||||
|
this.orderItemId = orderItemId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSkuId() {
|
public String getSkuId() {
|
||||||
return skuId;
|
return skuId;
|
||||||
}
|
}
|
||||||
|
@ -197,17 +219,6 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OrderExchangeDO setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getPaymentTime() {
|
public Date getPaymentTime() {
|
||||||
return paymentTime;
|
return paymentTime;
|
||||||
}
|
}
|
||||||
|
@ -244,6 +255,15 @@ public class OrderExchangeDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getOrderType() {
|
||||||
|
return orderType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderExchangeDO setOrderType(Integer orderType) {
|
||||||
|
this.orderType = orderType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getStatus() {
|
public Integer getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,6 @@ public class OrderItemDO extends BaseDO {
|
||||||
///
|
///
|
||||||
/// 时间信息
|
/// 时间信息
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
/**
|
/**
|
||||||
* 付款时间
|
* 付款时间
|
||||||
*/
|
*/
|
||||||
|
@ -67,25 +63,20 @@ public class OrderItemDO extends BaseDO {
|
||||||
/**
|
/**
|
||||||
* 是否退货
|
* 是否退货
|
||||||
*
|
*
|
||||||
* - 0、no
|
* - 1、没有
|
||||||
* - 1、yes
|
* - 2、换货
|
||||||
|
* - 3、退货
|
||||||
|
* - 4、换货 + 退货
|
||||||
*/
|
*/
|
||||||
private Integer hasReturn;
|
private Integer hasReturnExchange;
|
||||||
/**
|
|
||||||
* 是否换货
|
|
||||||
*
|
|
||||||
* - 0、no
|
|
||||||
* - 1、yes
|
|
||||||
*/
|
|
||||||
private Integer hasExchange;
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*
|
*
|
||||||
* - 0、待付款
|
* - 1、待付款
|
||||||
* - 1、待发货
|
* - 2、待发货
|
||||||
* - 2、待收获
|
* - 3、已发货
|
||||||
* - 3、已完成
|
* - 4、已完成
|
||||||
* - 4、已关闭
|
* - 5、已关闭
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@ -98,13 +89,11 @@ public class OrderItemDO extends BaseDO {
|
||||||
", skuId='" + skuId + '\'' +
|
", skuId='" + skuId + '\'' +
|
||||||
", quantity=" + quantity +
|
", quantity=" + quantity +
|
||||||
", price=" + price +
|
", price=" + price +
|
||||||
", createTime=" + createTime +
|
|
||||||
", paymentTime=" + paymentTime +
|
", paymentTime=" + paymentTime +
|
||||||
", deliveryTime=" + deliveryTime +
|
", deliveryTime=" + deliveryTime +
|
||||||
", receiverTime=" + receiverTime +
|
", receiverTime=" + receiverTime +
|
||||||
", closingTime=" + closingTime +
|
", closingTime=" + closingTime +
|
||||||
", hasReturn=" + hasReturn +
|
", hasReturnExchange=" + hasReturnExchange +
|
||||||
", hasExchange=" + hasExchange +
|
|
||||||
", status=" + status +
|
", status=" + status +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
@ -163,17 +152,6 @@ public class OrderItemDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OrderItemDO setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getPaymentTime() {
|
public Date getPaymentTime() {
|
||||||
return paymentTime;
|
return paymentTime;
|
||||||
}
|
}
|
||||||
|
@ -210,21 +188,12 @@ public class OrderItemDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getHasReturn() {
|
public Integer getHasReturnExchange() {
|
||||||
return hasReturn;
|
return hasReturnExchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderItemDO setHasReturn(Integer hasReturn) {
|
public OrderItemDO setHasReturnExchange(Integer hasReturnExchange) {
|
||||||
this.hasReturn = hasReturn;
|
this.hasReturnExchange = hasReturnExchange;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHasExchange() {
|
|
||||||
return hasExchange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderItemDO setHasExchange(Integer hasExchange) {
|
|
||||||
this.hasExchange = hasExchange;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,6 @@ public class OrderLogisticsDetailDO extends BaseDO {
|
||||||
* 物流信息
|
* 物流信息
|
||||||
*/
|
*/
|
||||||
private String logisticsInformation;
|
private String logisticsInformation;
|
||||||
/**
|
|
||||||
* 创建时间(同步时间)
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -42,7 +38,6 @@ public class OrderLogisticsDetailDO extends BaseDO {
|
||||||
", orderLogisticsId=" + orderLogisticsId +
|
", orderLogisticsId=" + orderLogisticsId +
|
||||||
", logisticsTime=" + logisticsTime +
|
", logisticsTime=" + logisticsTime +
|
||||||
", logisticsInformation='" + logisticsInformation + '\'' +
|
", logisticsInformation='" + logisticsInformation + '\'' +
|
||||||
", createTime=" + createTime +
|
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,13 +76,4 @@ public class OrderLogisticsDetailDO extends BaseDO {
|
||||||
this.logisticsInformation = logisticsInformation;
|
this.logisticsInformation = logisticsInformation;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderLogisticsDetailDO setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,10 @@ public class OrderReturnDO extends BaseDO {
|
||||||
* 商品编号(保存一个冗余,如果一个订单下存在多个商品,会有很大的作用)
|
* 商品编号(保存一个冗余,如果一个订单下存在多个商品,会有很大的作用)
|
||||||
*/
|
*/
|
||||||
private String skuId;
|
private String skuId;
|
||||||
|
/**
|
||||||
|
* 物流id
|
||||||
|
*/
|
||||||
|
private Integer orderLogisticsId;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// 退货原因
|
/// 退货原因
|
||||||
|
@ -102,6 +106,7 @@ public class OrderReturnDO extends BaseDO {
|
||||||
", orderNo='" + orderNo + '\'' +
|
", orderNo='" + orderNo + '\'' +
|
||||||
", orderItemId=" + orderItemId +
|
", orderItemId=" + orderItemId +
|
||||||
", skuId='" + skuId + '\'' +
|
", skuId='" + skuId + '\'' +
|
||||||
|
", orderLogisticsId=" + orderLogisticsId +
|
||||||
", orderReasonId=" + orderReasonId +
|
", orderReasonId=" + orderReasonId +
|
||||||
", reason='" + reason + '\'' +
|
", reason='" + reason + '\'' +
|
||||||
", createTime=" + createTime +
|
", createTime=" + createTime +
|
||||||
|
@ -159,6 +164,15 @@ public class OrderReturnDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getOrderLogisticsId() {
|
||||||
|
return orderLogisticsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderReturnDO setOrderLogisticsId(Integer orderLogisticsId) {
|
||||||
|
this.orderLogisticsId = orderLogisticsId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getOrderReasonId() {
|
public Integer getOrderReasonId() {
|
||||||
return orderReasonId;
|
return orderReasonId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
package cn.iocoder.mall.order.service;
|
package cn.iocoder.mall.order.service;
|
||||||
|
|
||||||
|
import cn.iocoder.common.framework.constant.DeleteStatusEnum;
|
||||||
import cn.iocoder.mall.order.api.OrderService;
|
import cn.iocoder.mall.order.api.OrderService;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderBO;
|
import cn.iocoder.mall.order.api.bo.OrderBO;
|
||||||
import cn.iocoder.mall.order.api.constants.OrderDeleteStatusEnum;
|
import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum;
|
||||||
import cn.iocoder.mall.order.api.constants.OrderPayStatusEnum;
|
import cn.iocoder.mall.order.api.constant.OrderStatusEnum;
|
||||||
import cn.iocoder.mall.order.api.constants.OrderStatusEnum;
|
|
||||||
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
|
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderReceiverInformationDTO;
|
import cn.iocoder.mall.order.api.dto.OrderReceiverInformationDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderUpdateDTO;
|
||||||
import cn.iocoder.mall.order.convert.OrderConvert;
|
import cn.iocoder.mall.order.convert.OrderConvert;
|
||||||
import cn.iocoder.mall.order.dao.OrderItemMapper;
|
import cn.iocoder.mall.order.dao.OrderItemMapper;
|
||||||
|
import cn.iocoder.mall.order.dao.OrderLogisticsMapper;
|
||||||
import cn.iocoder.mall.order.dao.OrderMapper;
|
import cn.iocoder.mall.order.dao.OrderMapper;
|
||||||
import cn.iocoder.mall.order.dataobject.OrderDO;
|
import cn.iocoder.mall.order.dataobject.OrderDO;
|
||||||
import cn.iocoder.mall.order.dataobject.OrderItemDO;
|
import cn.iocoder.mall.order.dataobject.OrderItemDO;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 service impl
|
* 订单 service impl
|
||||||
|
@ -37,39 +40,67 @@ public class OrderServiceImpl implements OrderService {
|
||||||
private OrderMapper orderMapper;
|
private OrderMapper orderMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderItemMapper orderItemMapper;
|
private OrderItemMapper orderItemMapper;
|
||||||
|
@Autowired
|
||||||
|
private OrderLogisticsMapper orderLogisticsMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public OrderBO createOrder(OrderCreateDTO orderCreateDTO) {
|
public OrderBO createOrder(OrderCreateDTO orderCreateDTO) {
|
||||||
List<OrderCreateItemDTO> orderItemDTOList = orderCreateDTO.getOrderItems();
|
List<OrderCreateItemDTO> orderItemDTOList = orderCreateDTO.getOrderItems();
|
||||||
OrderDO orderDO = OrderConvert.INSTANCE.convert(orderCreateDTO);
|
OrderLogisticsDO orderLogisticsDO = OrderConvert.INSTANCE.convert(orderCreateDTO);
|
||||||
List<OrderItemDO> orderItemDOList = OrderConvert.INSTANCE.convert(orderItemDTOList);
|
List<OrderItemDO> orderItemDOList = OrderConvert.INSTANCE.convert(orderItemDTOList);
|
||||||
|
|
||||||
|
// 物流信息
|
||||||
|
orderLogisticsDO.setLogisticsNo("");
|
||||||
|
orderLogisticsMapper.insert(orderLogisticsDO);
|
||||||
|
|
||||||
// order
|
// order
|
||||||
|
OrderDO orderDO = new OrderDO();
|
||||||
|
orderDO.setOrderLogisticsId(orderLogisticsDO.getId());
|
||||||
orderDO.setOrderNo(UUID.randomUUID().toString().replace("-", ""));
|
orderDO.setOrderNo(UUID.randomUUID().toString().replace("-", ""));
|
||||||
orderDO.setPrice(1000);
|
orderDO.setPrice(-1); // 先设置一个默认值,金额在下面计算
|
||||||
orderDO.setCreateTime(new Date());
|
orderDO.setCreateTime(new Date());
|
||||||
|
orderDO.setUpdateTime(null);
|
||||||
|
orderDO.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||||
|
|
||||||
orderDO.setClosingTime(null);
|
orderDO.setClosingTime(null);
|
||||||
orderDO.setDeliveryTime(null);
|
orderDO.setDeliveryTime(null);
|
||||||
orderDO.setPaymentTime(null);
|
orderDO.setPaymentTime(null);
|
||||||
orderDO.setStatus(OrderStatusEnum.WAIT_SHIPMENT.getValue());
|
orderDO.setStatus(OrderStatusEnum.WAIT_SHIPMENT.getValue());
|
||||||
orderDO.setPayStatus(OrderPayStatusEnum.WAITING_PAYMENT.getValue());
|
orderDO.setHasReturnExchange(OrderHasReturnExchangeEnum.NO.getValue());
|
||||||
orderDO.setDeleteStatus(OrderDeleteStatusEnum.DELETE_NO.getValue());
|
orderDO.setRemark(Optional.ofNullable(orderCreateDTO.getRemark()).orElse(""));
|
||||||
orderMapper.insert(orderDO);
|
orderMapper.insert(orderDO);
|
||||||
|
|
||||||
// order item
|
// order item
|
||||||
int goodsPrice = 1000;
|
AtomicInteger totalPrice = new AtomicInteger();
|
||||||
orderItemDOList.forEach(orderItemDO -> {
|
orderItemDOList.forEach(orderItemDO -> {
|
||||||
|
int goodsPrice = 1000; // 商品单价
|
||||||
int price = orderItemDO.getQuantity() * goodsPrice;
|
int price = orderItemDO.getQuantity() * goodsPrice;
|
||||||
|
totalPrice.addAndGet(price);
|
||||||
orderItemDO
|
orderItemDO
|
||||||
.setStatus(OrderStatusEnum.WAIT_SHIPMENT.getValue())
|
|
||||||
.setOrderId(orderDO.getId())
|
.setOrderId(orderDO.getId())
|
||||||
.setPrice(price)
|
.setOrderNo(orderDO.getOrderNo())
|
||||||
.setDeliveryTime(null);
|
.setPrice(goodsPrice)
|
||||||
|
.setPaymentTime(null)
|
||||||
|
.setDeliveryTime(null)
|
||||||
|
.setReceiverTime(null)
|
||||||
|
.setClosingTime(null)
|
||||||
|
.setHasReturnExchange(OrderStatusEnum.WAITING_PAYMENT.getValue())
|
||||||
|
.setStatus(OrderStatusEnum.WAITING_PAYMENT.getValue())
|
||||||
|
.setCreateTime(new Date())
|
||||||
|
.setUpdateTime(new Date())
|
||||||
|
.setDeleted(DeleteStatusEnum.DELETE_NO.getValue());
|
||||||
|
|
||||||
orderItemMapper.insert(orderItemDO);
|
orderItemMapper.insert(orderItemDO);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 更新订单金额
|
||||||
|
orderMapper.updateById(
|
||||||
|
new OrderDO()
|
||||||
|
.setId(orderDO.getId())
|
||||||
|
.setPrice(totalPrice.get())
|
||||||
|
);
|
||||||
|
|
||||||
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息
|
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息
|
||||||
|
|
||||||
return new OrderBO()
|
return new OrderBO()
|
||||||
|
@ -93,9 +124,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
@Override
|
@Override
|
||||||
public void deleteOrder(Integer id) {
|
public void deleteOrder(Integer id) {
|
||||||
// 删除订单操作,一般用于 用户端删除,是否存在检查可以过掉
|
// 删除订单操作,一般用于 用户端删除,是否存在检查可以过掉
|
||||||
orderMapper.updateById(new OrderDO()
|
orderMapper.updateById((OrderDO) new OrderDO()
|
||||||
.setId(id)
|
.setId(id)
|
||||||
.setDeleteStatus(OrderDeleteStatusEnum.DELETE_YES.getValue())
|
.setDeleted(DeleteStatusEnum.DELETE_YES.getValue())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.mall.order.dao.OrderLogisticsMapper">
|
||||||
|
|
||||||
|
<sql id="FIELDS">
|
||||||
|
id, area_no, `name`, mobile, address, logistics_no
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
插入数据
|
||||||
|
-->
|
||||||
|
<insert id="insert" parameterType="OrderLogisticsDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
|
INSERT INTO `order_logistics` (
|
||||||
|
area_no, `name`, mobile, address, logistics_no
|
||||||
|
) VALUES (
|
||||||
|
#{areaNo}, #{name}, #{mobile}, #{address},
|
||||||
|
#{logisticsNo}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -3,9 +3,9 @@
|
||||||
<mapper namespace="cn.iocoder.mall.order.dao.OrderMapper">
|
<mapper namespace="cn.iocoder.mall.order.dao.OrderMapper">
|
||||||
|
|
||||||
<sql id="FIELDS">
|
<sql id="FIELDS">
|
||||||
order_no, price, receiver_area_no, receiver_mobile,
|
id, order_logistics_id, order_no, price, payment_time,
|
||||||
receiver_address, `status`, pay_status, create_time,
|
delivery_time, receiver_time, closing_time, has_return_exchange,
|
||||||
payment_time, delivery_time, closing_time, remark
|
status, remark
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -13,13 +13,13 @@
|
||||||
-->
|
-->
|
||||||
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order` (
|
INSERT INTO `order` (
|
||||||
order_no, price, receiver_area_no, receiver_mobile,
|
order_logistics_id, order_no, price, payment_time,
|
||||||
receiver_address, `status`, pay_status, create_time,
|
delivery_time, receiver_time, closing_time,
|
||||||
payment_time, delivery_time, closing_time, remark
|
has_return_exchange, status, remark
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{orderNo}, ${price}, #{receiverAreaNo}, #{receiverMobile},
|
#{orderLogisticsId}, ${orderNo}, #{price}, #{paymentTime},
|
||||||
#{receiverAddress}, #{status}, #{payStatus}, #{createTime},
|
#{deliveryTime}, #{receiverTime}, #{closingTime},
|
||||||
#{paymentTime}, #{deliveryTime}, #{closingTime}, #{remark}
|
#{hasReturnExchange}, #{status}, #{remark}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -28,42 +28,44 @@
|
||||||
-->
|
-->
|
||||||
<sql id="updateSql" >
|
<sql id="updateSql" >
|
||||||
<set>
|
<set>
|
||||||
|
<if test="orderLogisticsId != null">
|
||||||
|
, order_logistics_id = #{orderLogisticsId}
|
||||||
|
</if>
|
||||||
<if test="orderNo != null">
|
<if test="orderNo != null">
|
||||||
, order_no = #{orderNo}
|
, order_no = #{orderNo}
|
||||||
</if>
|
</if>
|
||||||
<if test="price != null">
|
<if test="price != null">
|
||||||
, price = #{price}
|
, price = #{price}
|
||||||
</if>
|
</if>
|
||||||
<if test="receiverAreaNo != null">
|
-- time
|
||||||
, receiver_area_no = #{receiverAreaNo}
|
|
||||||
</if>
|
|
||||||
<if test="receiverMobile != null">
|
|
||||||
, receiver_mobile = #{receiverMobile}
|
|
||||||
</if>
|
|
||||||
<if test="receiverAddress != null">
|
|
||||||
, receiver_address = #{receiverAddress}
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
, status = #{status}
|
|
||||||
</if>
|
|
||||||
<if test="payStatus != null">
|
|
||||||
, pay_status = #{payStatus}
|
|
||||||
</if>
|
|
||||||
<if test="deleteStatus != null">
|
|
||||||
, delete_status = #{deleteStatus}
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
, create_time = #{createTime}
|
|
||||||
</if>
|
|
||||||
<if test="paymentTime != null">
|
<if test="paymentTime != null">
|
||||||
, payment_time = #{paymentTime}
|
, payment_time = #{paymentTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="deliveryTime != null">
|
<if test="deliveryTime != null">
|
||||||
, delivery_time = #{deliveryTime}
|
, delivery_time = #{deliveryTime}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="receiverTime != null">
|
||||||
|
, receiver_time = #{receiverTime}
|
||||||
|
</if>
|
||||||
<if test="closingTime != null">
|
<if test="closingTime != null">
|
||||||
, closing_time = #{closingTime}
|
, closing_time = #{closingTime}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="hasReturnExchange != null">
|
||||||
|
, has_return_exchange = #{hasReturnExchange}
|
||||||
|
</if>
|
||||||
|
-- other
|
||||||
|
<if test="status != null">
|
||||||
|
, status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="delete != null">
|
||||||
|
, `delete` = #{delete}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
, create_time = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
, update_time = #{updateTime}
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
, remark = #{remark}
|
, remark = #{remark}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
DROP TABLE `order`;
|
||||||
|
DROP TABLE `order_item`;
|
||||||
|
DROP TABLE `order_exchange`;
|
||||||
|
DROP TABLE `order_return`;
|
||||||
|
DROP TABLE `order_logistics`;
|
||||||
|
DROP TABLE `order_logistics_detail`;
|
||||||
|
|
||||||
|
CREATE TABLE `order` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT 'Id,自增长',
|
||||||
|
`order_logistics_id` int NOT NULL COMMENT '物流id',
|
||||||
|
`order_no` varchar(50) NOT NULL COMMENT '订单单号',
|
||||||
|
`price` int(10) NULL COMMENT '金额(分)',
|
||||||
|
`payment_time` datetime NULL COMMENT '付款时间',
|
||||||
|
`delivery_time` datetime NULL COMMENT '发货时间',
|
||||||
|
`receiver_time` datetime NULL COMMENT '收货时间',
|
||||||
|
`closing_time` datetime NULL COMMENT '成交时间',
|
||||||
|
`has_return_exchange` smallint NULL COMMENT '是否退换货',
|
||||||
|
`remark` varchar(255) NULL COMMENT '备注',
|
||||||
|
`status` smallint(2) NULL COMMENT '状态(如果有多个商品分开发货需要全部商品发完才会改变状态) 0、待付款 1、待发货 2、待收货 3、已完成 4、已关闭',
|
||||||
|
`create_time` datetime NULL COMMENT '订单创建时间',
|
||||||
|
`update_time` datetime NULL COMMENT '更新时间',
|
||||||
|
`deleted` smallint NULL COMMENT '删除状态',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
CREATE TABLE `order_item` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id自增长',
|
||||||
|
`order_id` int NOT NULL COMMENT '订单编号',
|
||||||
|
`order_no` varchar(50) NOT NULL COMMENT '订单号',
|
||||||
|
`sku_id` int NOT NULL COMMENT '商品编号',
|
||||||
|
`quantity` int(3) NOT NULL COMMENT '商品数量',
|
||||||
|
`price` int(255) NOT NULL COMMENT '金额',
|
||||||
|
`payment_time` datetime NULL COMMENT '付款时间',
|
||||||
|
`delivery_time` datetime NULL COMMENT '发货时间',
|
||||||
|
`receiver_time` datetime NULL COMMENT '收货时间',
|
||||||
|
`closing_time` datetime NULL,
|
||||||
|
`has_return_exchange` int NULL COMMENT '是否退换货',
|
||||||
|
`create_time` datetime NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NULL COMMENT '更新时间',
|
||||||
|
`status` smallint(2) NOT NULL COMMENT '状态:0、代发货 1、已发货 2、已收货 20、换货中 21、换货成功 40、退货中 41、已退货',
|
||||||
|
`delete` smallint(2) NOT NULL COMMENT '删除状态',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `order_exchange` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`order_id` int(11) NOT NULL,
|
||||||
|
`order_no` varchar(50) NOT NULL,
|
||||||
|
`sku_id` int(11) NOT NULL,
|
||||||
|
`exchange_sku_id` int(11) NOT NULL COMMENT '换货商品id',
|
||||||
|
`exchange_order_logistics_id` int(11) NOT NULL COMMENT '换货物流id',
|
||||||
|
`receiver_order_logistics_id` int(11) NOT NULL COMMENT '收件地址',
|
||||||
|
`order_reason_id` int(11) NULL COMMENT '换货原因',
|
||||||
|
`reason` varchar(255) NULL COMMENT '换货原因 (其他的时候)',
|
||||||
|
`payment_time` datetime NULL COMMENT '付款时间',
|
||||||
|
`delivery_time` datetime NULL COMMENT '发货时间',
|
||||||
|
`receiver_time` datetime NULL COMMENT '收货时间',
|
||||||
|
`closing_time` datetime NULL COMMENT '成交时间',
|
||||||
|
`create_time` datetime NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NULL COMMENT '更新时间',
|
||||||
|
`delete` smallint(2) NULL COMMENT '删除状态',
|
||||||
|
`order_type` int(2) NULL COMMENT '订单类型 0、为 Order 订单 1、为 OrderItem 订单',
|
||||||
|
`status` int(2) NULL COMMENT '状态 申请换货、申请成功、申请失败、换货中、换货成功',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `order_return` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id自增长',
|
||||||
|
`order_id` int NOT NULL COMMENT '订单编号',
|
||||||
|
`order_no` varchar(50) NOT NULL COMMENT '订单号',
|
||||||
|
`sku_id` int NOT NULL COMMENT '商品编号',
|
||||||
|
`order_item_id` int(11) NOT NULL COMMENT '订单item id',
|
||||||
|
`order_logistics_id` int(11) NOT NULL COMMENT '物流 id',
|
||||||
|
|
||||||
|
`order_reason_id` int(11) NULL COMMENT '退货原因',
|
||||||
|
`reason` varchar(255) NULL COMMENT '换货原因 (其他的时候)',
|
||||||
|
`create_time` datetime NULL COMMENT '创建时间',
|
||||||
|
`approval_time` datetime NULL COMMENT '同意时间',
|
||||||
|
`logistics_time` datetime NULL COMMENT '物流时间(填写物流单号时间)',
|
||||||
|
`receiver_time` datetime NULL COMMENT '收货时间',
|
||||||
|
`closing_time` datetime NULL COMMENT '成交时间',
|
||||||
|
`order_type` int(2) NULL COMMENT '订单类型 0、为 Order 订单 1、为 OrderItem 订单',
|
||||||
|
|
||||||
|
`update_time` datetime NULL COMMENT '更新时间',
|
||||||
|
`delete` smallint(2) NULL COMMENT '删除状态',
|
||||||
|
`status` int(2) NULL COMMENT '状态 申请换货、申请成功、申请失败、退货中、退货成功',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `order_logistics` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id自增长',
|
||||||
|
`area_no` int NOT NULL COMMENT '订单编号',
|
||||||
|
`name` VARCHAR(20) NOT NULL COMMENT '名称',
|
||||||
|
`mobile` VARCHAR(20) NOT NULL COMMENT '手机号',
|
||||||
|
`address` VARCHAR(255) NOT NULL COMMENT '详细地址',
|
||||||
|
`logistics_no` VARCHAR(20) NOT NULL COMMENT '物流单号',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `order_logistics_detail` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id自增长',
|
||||||
|
`order_logistics_id` int NOT NULL COMMENT '物流编号',
|
||||||
|
`logistics_time` datetime NOT NULL COMMENT '物流时间',
|
||||||
|
`logistics_information` VARCHAR(20) NOT NULL COMMENT '物流信息',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue