parent
3cbe0ba3b6
commit
0d14138ef2
|
@ -1,9 +1,9 @@
|
||||||
package cn.iocoder.common.framework.util;
|
package cn.iocoder.common.framework.util;
|
||||||
|
|
||||||
import org.springframework.util.ReflectionUtils;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.lang.reflect.Field;
|
import java.util.HashSet;
|
||||||
import java.util.*;
|
import java.util.Set;
|
||||||
|
|
||||||
public class CollectionUtil {
|
public class CollectionUtil {
|
||||||
|
|
||||||
|
@ -14,54 +14,4 @@ public class CollectionUtil {
|
||||||
public static <T> Set<T> asSet(T... objs) {
|
public static <T> Set<T> asSet(T... objs) {
|
||||||
return new HashSet<>(Arrays.asList(objs));
|
return new HashSet<>(Arrays.asList(objs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建指定属性为KEY, objs的每个元素为值的Multimap的Map集合。
|
|
||||||
*
|
|
||||||
* @param objs 数组
|
|
||||||
* @param keyClazz 值类型,即{@code property}的类型
|
|
||||||
* @param valClazz 值类型
|
|
||||||
* @param property 属性名
|
|
||||||
* @param <K> 泛型
|
|
||||||
* @param <V> 泛型
|
|
||||||
* @return 指定属性的Map集合
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <K, V> Map<K, List<V>> buildMultimap(List<V> objs, Class<K> keyClazz, Class<V> valClazz,
|
|
||||||
String property) {
|
|
||||||
if (objs.isEmpty()) {
|
|
||||||
return Collections.EMPTY_MAP;
|
|
||||||
}
|
|
||||||
Map<K, List<V>> results = new HashMap<>(objs.size());
|
|
||||||
try {
|
|
||||||
Field field = getField(objs, property);
|
|
||||||
for (V obj : objs) {
|
|
||||||
K key = (K) field.get(obj);
|
|
||||||
List<V> value = results.get(key);
|
|
||||||
if (value == null) {
|
|
||||||
results.put(key, value = new ArrayList<>());
|
|
||||||
}
|
|
||||||
value.add(obj);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 object 属性 field
|
|
||||||
*
|
|
||||||
* @param objs 对象数组
|
|
||||||
* @param property 属性
|
|
||||||
* @return 对象元素里的指定属性Field, 并设置该field可以被访问
|
|
||||||
*/
|
|
||||||
public static Field getField(List<?> objs, String property) {
|
|
||||||
Field field = ReflectionUtils.findField(objs.get(0).getClass(), property);
|
|
||||||
if (!field.isAccessible()) {
|
|
||||||
field.setAccessible(true);
|
|
||||||
}
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -2,20 +2,19 @@ package cn.iocoder.mall.order.application.controller.admins;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.order.api.OrderService;
|
import cn.iocoder.mall.order.api.OrderService;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderPageBO;
|
||||||
import cn.iocoder.mall.order.api.dto.*;
|
import cn.iocoder.mall.order.api.dto.*;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderItemUpdateVO;
|
import cn.iocoder.mall.order.application.vo.OrderItemUpdateVO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderLogisticsVO;
|
import cn.iocoder.mall.order.application.vo.OrderLogisticsVO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderPageQueryVO;
|
import cn.iocoder.mall.order.application.vo.OrderPageQueryVO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderPageVO;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单API(admins)
|
* 订单API(admins)
|
||||||
*
|
*
|
||||||
|
@ -37,15 +36,23 @@ public class AdminsOrderController {
|
||||||
return orderService.getOrderPage(orderQueryDTO);
|
return orderService.getOrderPage(orderQueryDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("order_item/update_pay_amount")
|
||||||
|
@ApiOperation("更新-订单item实付金额")
|
||||||
|
public CommonResult updateOrderItemPayAmount(@RequestParam("orderId") Integer orderId,
|
||||||
|
@RequestParam("orderItemId") Integer orderItemId,
|
||||||
|
@RequestParam("payAmount") Integer payAmount) {
|
||||||
|
return orderService.updateOrderItemPayAmount(orderId, orderItemId, payAmount);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("order_item/update")
|
@PutMapping("order_item/update")
|
||||||
@ApiOperation("订单item更新")
|
@ApiOperation("更新-订单item")
|
||||||
public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdateVO orderItemUpdateVO) {
|
public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdateVO orderItemUpdateVO) {
|
||||||
OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderItemUpdateVO);
|
OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderItemUpdateVO);
|
||||||
return orderService.updateOrderItem(dto);
|
return orderService.updateOrderItem(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("logistics/update")
|
@PutMapping("logistics/update")
|
||||||
@ApiOperation("订单物流更新")
|
@ApiOperation("更新-订单物流")
|
||||||
public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsVO orderLogisticsVO) {
|
public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsVO orderLogisticsVO) {
|
||||||
OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderLogisticsVO);
|
OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderLogisticsVO);
|
||||||
return orderService.updateLogistics(dto);
|
return orderService.updateLogistics(dto);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package cn.iocoder.mall.order.application.vo;
|
package cn.iocoder.mall.order.application.vo;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.dto.OrderBO;
|
import cn.iocoder.mall.order.api.bo.OrderBO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package cn.iocoder.mall.order.api;
|
package cn.iocoder.mall.order.api;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderCreateBO;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderPageBO;
|
||||||
import cn.iocoder.mall.order.api.dto.*;
|
import cn.iocoder.mall.order.api.dto.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 service
|
* 订单 service
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,7 @@ public interface OrderService {
|
||||||
* @param orderCreateDTO
|
* @param orderCreateDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CommonResult<cn.iocoder.mall.order.api.bo.OrderBO> createOrder(Integer userId, OrderCreateDTO orderCreateDTO);
|
CommonResult<OrderCreateBO> createOrder(Integer userId, OrderCreateDTO orderCreateDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单item - 更新
|
* 订单item - 更新
|
||||||
|
@ -38,6 +38,16 @@ public interface OrderService {
|
||||||
*/
|
*/
|
||||||
CommonResult updateOrderItem(OrderItemUpdateDTO orderItemUpdateDTO);
|
CommonResult updateOrderItem(OrderItemUpdateDTO orderItemUpdateDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单item - 更新 payAmount(实付金额)
|
||||||
|
*
|
||||||
|
* @param orderId
|
||||||
|
* @param orderItemId
|
||||||
|
* @param payAmount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单item - 删除
|
* 订单item - 删除
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,34 +1,114 @@
|
||||||
package cn.iocoder.mall.order.api.bo;
|
package cn.iocoder.mall.order.api.bo;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单创建 BO
|
* 订单 page
|
||||||
*
|
*
|
||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-16 14:38
|
* @time 2019-03-23 14:30
|
||||||
*/
|
*/
|
||||||
public class OrderBO implements Serializable {
|
public class OrderBO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编号
|
* id
|
||||||
*/
|
*/
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
/**
|
||||||
|
* 物流id
|
||||||
|
*/
|
||||||
|
private Integer orderLogisticsId;
|
||||||
/**
|
/**
|
||||||
* 订单编号
|
* 订单编号
|
||||||
*/
|
*/
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
/**
|
/**
|
||||||
* 订单金额
|
* 交易金额
|
||||||
*/
|
*/
|
||||||
private Integer money;
|
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<OrderItemBO> orderItems;
|
||||||
|
/**
|
||||||
|
* 订单物流信息
|
||||||
|
*/
|
||||||
|
private OrderLogisticsBO orderLogistics;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OrderBO{" +
|
return "OrderBO{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
|
", userId=" + userId +
|
||||||
|
", orderLogisticsId=" + orderLogisticsId +
|
||||||
", orderNo='" + orderNo + '\'' +
|
", orderNo='" + orderNo + '\'' +
|
||||||
", money=" + money +
|
", payAmount=" + payAmount +
|
||||||
|
", paymentTime=" + paymentTime +
|
||||||
|
", deliveryTime=" + deliveryTime +
|
||||||
|
", receiverTime=" + receiverTime +
|
||||||
|
", closingTime=" + closingTime +
|
||||||
|
", hasReturnExchange=" + hasReturnExchange +
|
||||||
|
", status=" + status +
|
||||||
|
", remark='" + remark + '\'' +
|
||||||
|
", orderItems=" + orderItems +
|
||||||
|
", orderLogistics=" + orderLogistics +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +121,24 @@ public class OrderBO implements Serializable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrderLogisticsId() {
|
||||||
|
return orderLogisticsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setOrderLogisticsId(Integer orderLogisticsId) {
|
||||||
|
this.orderLogisticsId = orderLogisticsId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOrderNo() {
|
public String getOrderNo() {
|
||||||
return orderNo;
|
return orderNo;
|
||||||
}
|
}
|
||||||
|
@ -50,12 +148,93 @@ public class OrderBO implements Serializable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMoney() {
|
public Integer getPayAmount() {
|
||||||
return money;
|
return payAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderBO setMoney(Integer money) {
|
public OrderBO setPayAmount(Integer payAmount) {
|
||||||
this.money = money;
|
this.payAmount = payAmount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getPaymentTime() {
|
||||||
|
return paymentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setPaymentTime(Date paymentTime) {
|
||||||
|
this.paymentTime = paymentTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDeliveryTime() {
|
||||||
|
return deliveryTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setDeliveryTime(Date deliveryTime) {
|
||||||
|
this.deliveryTime = deliveryTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getReceiverTime() {
|
||||||
|
return receiverTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setReceiverTime(Date receiverTime) {
|
||||||
|
this.receiverTime = receiverTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getClosingTime() {
|
||||||
|
return closingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setClosingTime(Date closingTime) {
|
||||||
|
this.closingTime = closingTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getHasReturnExchange() {
|
||||||
|
return hasReturnExchange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setHasReturnExchange(Integer hasReturnExchange) {
|
||||||
|
this.hasReturnExchange = hasReturnExchange;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OrderItemBO> getOrderItems() {
|
||||||
|
return orderItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setOrderItems(List<OrderItemBO> orderItems) {
|
||||||
|
this.orderItems = orderItems;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO getOrderLogistics() {
|
||||||
|
return orderLogistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderBO setOrderLogistics(OrderLogisticsBO orderLogistics) {
|
||||||
|
this.orderLogistics = orderLogistics;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package cn.iocoder.mall.order.api.bo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建 BO
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-03-16 14:38
|
||||||
|
*/
|
||||||
|
public class OrderCreateBO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private Integer payAmount;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "OrderCreateBO{" +
|
||||||
|
"id=" + id +
|
||||||
|
", orderNo='" + orderNo + '\'' +
|
||||||
|
", payAmount=" + payAmount +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderCreateBO setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderNo() {
|
||||||
|
return orderNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderCreateBO setOrderNo(String orderNo) {
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPayAmount() {
|
||||||
|
return payAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderCreateBO setPayAmount(Integer payAmount) {
|
||||||
|
this.payAmount = payAmount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.bo;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -27,14 +27,26 @@ public class OrderItemBO implements Serializable {
|
||||||
* 商品编号
|
* 商品编号
|
||||||
*/
|
*/
|
||||||
private Integer skuId;
|
private Integer skuId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String skuName;
|
||||||
|
/**
|
||||||
|
* 商品图片
|
||||||
|
*/
|
||||||
|
private String skuImage;
|
||||||
/**
|
/**
|
||||||
* 数量
|
* 数量
|
||||||
*/
|
*/
|
||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
/**
|
/**
|
||||||
* 金额(分)
|
* 价格(分)
|
||||||
*/
|
*/
|
||||||
private Integer price;
|
private Integer price;
|
||||||
|
/**
|
||||||
|
* 支付金额(实付金额)
|
||||||
|
*/
|
||||||
|
private Integer payAmount;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// 时间信息
|
/// 时间信息
|
||||||
|
@ -79,21 +91,40 @@ public class OrderItemBO implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 删除状态
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OrderItemDO{" +
|
return "OrderItemBO{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", orderId=" + orderId +
|
", orderId=" + orderId +
|
||||||
", orderNo='" + orderNo + '\'' +
|
", orderNo='" + orderNo + '\'' +
|
||||||
", skuId='" + skuId + '\'' +
|
", skuId=" + skuId +
|
||||||
|
", skuName='" + skuName + '\'' +
|
||||||
|
", skuImage='" + skuImage + '\'' +
|
||||||
", quantity=" + quantity +
|
", quantity=" + quantity +
|
||||||
", price=" + price +
|
", price=" + price +
|
||||||
|
", payAmount=" + payAmount +
|
||||||
", paymentTime=" + paymentTime +
|
", paymentTime=" + paymentTime +
|
||||||
", deliveryTime=" + deliveryTime +
|
", deliveryTime=" + deliveryTime +
|
||||||
", receiverTime=" + receiverTime +
|
", receiverTime=" + receiverTime +
|
||||||
", closingTime=" + closingTime +
|
", closingTime=" + closingTime +
|
||||||
", hasReturnExchange=" + hasReturnExchange +
|
", hasReturnExchange=" + hasReturnExchange +
|
||||||
", status=" + status +
|
", status=" + status +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
", deleted=" + deleted +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +164,24 @@ public class OrderItemBO implements Serializable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSkuName() {
|
||||||
|
return skuName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemBO setSkuName(String skuName) {
|
||||||
|
this.skuName = skuName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkuImage() {
|
||||||
|
return skuImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemBO setSkuImage(String skuImage) {
|
||||||
|
this.skuImage = skuImage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getQuantity() {
|
public Integer getQuantity() {
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +200,15 @@ public class OrderItemBO implements Serializable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getPayAmount() {
|
||||||
|
return payAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemBO setPayAmount(Integer payAmount) {
|
||||||
|
this.payAmount = payAmount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getPaymentTime() {
|
public Date getPaymentTime() {
|
||||||
return paymentTime;
|
return paymentTime;
|
||||||
}
|
}
|
||||||
|
@ -204,4 +262,31 @@ public class OrderItemBO implements Serializable {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemBO setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemBO setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDeleted() {
|
||||||
|
return deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemBO setDeleted(Integer deleted) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
package cn.iocoder.mall.order.api.bo;
|
||||||
|
|
||||||
|
import cn.iocoder.common.framework.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单物流信息
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-03-19 20:47
|
||||||
|
*/
|
||||||
|
public class OrderLogisticsBO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 收件区域编号
|
||||||
|
*/
|
||||||
|
private String areaNo;
|
||||||
|
/**
|
||||||
|
* 收件人名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 收件手机号
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 收件详细地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 物流编号
|
||||||
|
*/
|
||||||
|
private String logisticsNo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "OrderLogisticsDO{" +
|
||||||
|
"id=" + id +
|
||||||
|
", areaNo='" + areaNo + '\'' +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", mobile='" + mobile + '\'' +
|
||||||
|
", address='" + address + '\'' +
|
||||||
|
", logisticsNo='" + logisticsNo + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAreaNo() {
|
||||||
|
return areaNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO setAreaNo(String areaNo) {
|
||||||
|
this.areaNo = areaNo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMobile() {
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO setMobile(String mobile) {
|
||||||
|
this.mobile = mobile;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogisticsNo() {
|
||||||
|
return logisticsNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsBO setLogisticsNo(String logisticsNo) {
|
||||||
|
this.logisticsNo = logisticsNo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.bo;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -13,6 +13,7 @@ public enum OrderErrorCodeEnum {
|
||||||
ORDER_ITEM_ONLY_ONE(1000001000, "订单Item只有一个!"),
|
ORDER_ITEM_ONLY_ONE(1000001000, "订单Item只有一个!"),
|
||||||
ORDER_GET_SKU_FAIL(1000001001, "获取商品失败!"),
|
ORDER_GET_SKU_FAIL(1000001001, "获取商品失败!"),
|
||||||
ORDER_GET_SKU_NOT_EXISTENT(1000001002, "获取的商品不存在!"),
|
ORDER_GET_SKU_NOT_EXISTENT(1000001002, "获取的商品不存在!"),
|
||||||
|
ORDER_PAY_AMOUNT_NOT_NEGATIVE(1000001002, "支付金额不能为负数!"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
|
|
@ -1,226 +0,0 @@
|
||||||
package cn.iocoder.mall.order.api.dto;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单 page
|
|
||||||
*
|
|
||||||
* @author Sin
|
|
||||||
* @time 2019-03-23 14:30
|
|
||||||
*/
|
|
||||||
public class OrderBO implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 用户编号
|
|
||||||
*/
|
|
||||||
private Integer userId;
|
|
||||||
/**
|
|
||||||
* 物流id
|
|
||||||
*/
|
|
||||||
private Integer orderLogisticsId;
|
|
||||||
/**
|
|
||||||
* 订单编号
|
|
||||||
*/
|
|
||||||
private String orderNo;
|
|
||||||
/**
|
|
||||||
* 交易金额
|
|
||||||
*/
|
|
||||||
private Integer price;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// 时间信息
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 付款时间(待发货)
|
|
||||||
*/
|
|
||||||
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<OrderItemBO> orderItems;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "OrderBO{" +
|
|
||||||
"id=" + id +
|
|
||||||
", userId=" + userId +
|
|
||||||
", orderLogisticsId=" + orderLogisticsId +
|
|
||||||
", orderNo='" + orderNo + '\'' +
|
|
||||||
", price=" + price +
|
|
||||||
", paymentTime=" + paymentTime +
|
|
||||||
", deliveryTime=" + deliveryTime +
|
|
||||||
", receiverTime=" + receiverTime +
|
|
||||||
", closingTime=" + closingTime +
|
|
||||||
", hasReturnExchange=" + hasReturnExchange +
|
|
||||||
", status=" + status +
|
|
||||||
", remark='" + remark + '\'' +
|
|
||||||
", orderItems=" + orderItems +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setUserId(Integer userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrderLogisticsId() {
|
|
||||||
return orderLogisticsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setOrderLogisticsId(Integer orderLogisticsId) {
|
|
||||||
this.orderLogisticsId = orderLogisticsId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrderNo() {
|
|
||||||
return orderNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setOrderNo(String orderNo) {
|
|
||||||
this.orderNo = orderNo;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setPrice(Integer price) {
|
|
||||||
this.price = price;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getPaymentTime() {
|
|
||||||
return paymentTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setPaymentTime(Date paymentTime) {
|
|
||||||
this.paymentTime = paymentTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDeliveryTime() {
|
|
||||||
return deliveryTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setDeliveryTime(Date deliveryTime) {
|
|
||||||
this.deliveryTime = deliveryTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getReceiverTime() {
|
|
||||||
return receiverTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setReceiverTime(Date receiverTime) {
|
|
||||||
this.receiverTime = receiverTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getClosingTime() {
|
|
||||||
return closingTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setClosingTime(Date closingTime) {
|
|
||||||
this.closingTime = closingTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHasReturnExchange() {
|
|
||||||
return hasReturnExchange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setHasReturnExchange(Integer hasReturnExchange) {
|
|
||||||
this.hasReturnExchange = hasReturnExchange;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<OrderItemBO> getOrderItems() {
|
|
||||||
return orderItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderBO setOrderItems(List<OrderItemBO> orderItems) {
|
|
||||||
this.orderItems = orderItems;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,6 +32,11 @@
|
||||||
<artifactId>dubbo</artifactId>
|
<artifactId>dubbo</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>27.0.1-jre</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package cn.iocoder.mall.order.application.convert;
|
package cn.iocoder.mall.order.convert;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.dto.OrderBO;
|
import cn.iocoder.mall.order.api.bo.OrderBO;
|
||||||
import cn.iocoder.mall.order.dataobject.OrderDO;
|
import cn.iocoder.mall.order.dataobject.OrderDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.iocoder.mall.order.application.convert;
|
package cn.iocoder.mall.order.convert;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
|
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderItemBO;
|
import cn.iocoder.mall.order.api.bo.OrderItemBO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
|
||||||
import cn.iocoder.mall.order.dataobject.OrderItemDO;
|
import cn.iocoder.mall.order.dataobject.OrderItemDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.iocoder.mall.order.application.convert;
|
package cn.iocoder.mall.order.convert;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderLogisticsBO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
||||||
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
||||||
|
@ -7,6 +8,8 @@ import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单物流 convert
|
* 订单物流 convert
|
||||||
*
|
*
|
||||||
|
@ -23,4 +26,7 @@ public interface OrderLogisticsConvert {
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderLogisticsDO convert(OrderLogisticsUpdateDTO orderLogisticsDTO);
|
OrderLogisticsDO convert(OrderLogisticsUpdateDTO orderLogisticsDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<OrderLogisticsBO> convertOrderLogisticsBO(List<OrderLogisticsDO> orderLogisticsDOList);
|
||||||
}
|
}
|
|
@ -46,12 +46,12 @@ public interface OrderItemMapper {
|
||||||
* 查询 - 根据 orderIds 和 status
|
* 查询 - 根据 orderIds 和 status
|
||||||
*
|
*
|
||||||
* @param orderIds
|
* @param orderIds
|
||||||
* @param status
|
* @param deleted
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderItemDO> selectByOrderIdsAndStatus(
|
List<OrderItemDO> selectByOrderIdsAndDeleted(
|
||||||
@Param("orderIds") Collection<Integer> orderIds,
|
@Param("orderIds") Collection<Integer> orderIds,
|
||||||
@Param("status") Integer status
|
@Param("deleted") Integer deleted
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package cn.iocoder.mall.order.dao;
|
package cn.iocoder.mall.order.dao;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 item mapper
|
* 订单 item mapper
|
||||||
*
|
*
|
||||||
|
@ -25,4 +29,14 @@ public interface OrderLogisticsMapper {
|
||||||
* @param orderLogisticsDO
|
* @param orderLogisticsDO
|
||||||
*/
|
*/
|
||||||
void updateById(OrderLogisticsDO orderLogisticsDO);
|
void updateById(OrderLogisticsDO orderLogisticsDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 - 根据 orderId
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OrderLogisticsDO> selectByIds(
|
||||||
|
@Param("ids") Collection<Integer> ids
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class OrderDO extends DeletableDO {
|
||||||
/**
|
/**
|
||||||
* 交易金额
|
* 交易金额
|
||||||
*/
|
*/
|
||||||
private Integer price;
|
private Integer payAmount;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// 时间信息
|
/// 时间信息
|
||||||
|
@ -87,7 +87,7 @@ public class OrderDO extends DeletableDO {
|
||||||
", userId=" + userId +
|
", userId=" + userId +
|
||||||
", orderLogisticsId=" + orderLogisticsId +
|
", orderLogisticsId=" + orderLogisticsId +
|
||||||
", orderNo='" + orderNo + '\'' +
|
", orderNo='" + orderNo + '\'' +
|
||||||
", price=" + price +
|
", payAmount=" + payAmount +
|
||||||
", paymentTime=" + paymentTime +
|
", paymentTime=" + paymentTime +
|
||||||
", deliveryTime=" + deliveryTime +
|
", deliveryTime=" + deliveryTime +
|
||||||
", receiverTime=" + receiverTime +
|
", receiverTime=" + receiverTime +
|
||||||
|
@ -134,12 +134,12 @@ public class OrderDO extends DeletableDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPrice() {
|
public Integer getPayAmount() {
|
||||||
return price;
|
return payAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderDO setPrice(Integer price) {
|
public OrderDO setPayAmount(Integer payAmount) {
|
||||||
this.price = price;
|
this.payAmount = payAmount;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,26 @@ public class OrderItemDO extends DeletableDO {
|
||||||
* 商品编号
|
* 商品编号
|
||||||
*/
|
*/
|
||||||
private Integer skuId;
|
private Integer skuId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String skuName;
|
||||||
|
/**
|
||||||
|
* 商品图片
|
||||||
|
*/
|
||||||
|
private String skuImage;
|
||||||
/**
|
/**
|
||||||
* 数量
|
* 数量
|
||||||
*/
|
*/
|
||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
/**
|
/**
|
||||||
* 金额(分)
|
* 价格(分)
|
||||||
*/
|
*/
|
||||||
private Integer price;
|
private Integer price;
|
||||||
|
/**
|
||||||
|
* 支付金额(实付金额)
|
||||||
|
*/
|
||||||
|
private Integer payAmount;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// 时间信息
|
/// 时间信息
|
||||||
|
@ -86,9 +98,12 @@ public class OrderItemDO extends DeletableDO {
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", orderId=" + orderId +
|
", orderId=" + orderId +
|
||||||
", orderNo='" + orderNo + '\'' +
|
", orderNo='" + orderNo + '\'' +
|
||||||
", skuId='" + skuId + '\'' +
|
", skuId=" + skuId +
|
||||||
|
", skuName=" + skuName +
|
||||||
|
", skuImage=" + skuImage +
|
||||||
", quantity=" + quantity +
|
", quantity=" + quantity +
|
||||||
", price=" + price +
|
", price=" + price +
|
||||||
|
", payAmount=" + payAmount +
|
||||||
", paymentTime=" + paymentTime +
|
", paymentTime=" + paymentTime +
|
||||||
", deliveryTime=" + deliveryTime +
|
", deliveryTime=" + deliveryTime +
|
||||||
", receiverTime=" + receiverTime +
|
", receiverTime=" + receiverTime +
|
||||||
|
@ -134,6 +149,24 @@ public class OrderItemDO extends DeletableDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSkuName() {
|
||||||
|
return skuName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemDO setSkuName(String skuName) {
|
||||||
|
this.skuName = skuName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkuImage() {
|
||||||
|
return skuImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemDO setSkuImage(String skuImage) {
|
||||||
|
this.skuImage = skuImage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getQuantity() {
|
public Integer getQuantity() {
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +185,15 @@ public class OrderItemDO extends DeletableDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getPayAmount() {
|
||||||
|
return payAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderItemDO setPayAmount(Integer payAmount) {
|
||||||
|
this.payAmount = payAmount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getPaymentTime() {
|
public Date getPaymentTime() {
|
||||||
return paymentTime;
|
return paymentTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ public class OrderLogisticsDO extends BaseDO {
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private Integer orderId;
|
||||||
/**
|
/**
|
||||||
* 收件区域编号
|
* 收件区域编号
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +44,7 @@ public class OrderLogisticsDO extends BaseDO {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OrderLogisticsDO{" +
|
return "OrderLogisticsDO{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
|
", orderId=" + orderId +
|
||||||
", areaNo='" + areaNo + '\'' +
|
", areaNo='" + areaNo + '\'' +
|
||||||
", name='" + name + '\'' +
|
", name='" + name + '\'' +
|
||||||
", mobile='" + mobile + '\'' +
|
", mobile='" + mobile + '\'' +
|
||||||
|
@ -57,6 +62,15 @@ public class OrderLogisticsDO extends BaseDO {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getOrderId() {
|
||||||
|
return orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderLogisticsDO setOrderId(Integer orderId) {
|
||||||
|
this.orderId = orderId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAreaNo() {
|
public String getAreaNo() {
|
||||||
return areaNo;
|
return areaNo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
package cn.iocoder.mall.order.service;
|
package cn.iocoder.mall.order.service;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
||||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
|
||||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.order.OrderCommon;
|
import cn.iocoder.mall.order.OrderCommon;
|
||||||
import cn.iocoder.mall.order.api.OrderService;
|
import cn.iocoder.mall.order.api.OrderService;
|
||||||
|
import cn.iocoder.mall.order.api.bo.*;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderStatusEnum;
|
import cn.iocoder.mall.order.api.constant.OrderStatusEnum;
|
||||||
import cn.iocoder.mall.order.api.dto.*;
|
import cn.iocoder.mall.order.api.dto.*;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderConvert;
|
import cn.iocoder.mall.order.convert.OrderConvert;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderItemConvert;
|
import cn.iocoder.mall.order.convert.OrderItemConvert;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderLogisticsConvert;
|
import cn.iocoder.mall.order.convert.OrderLogisticsConvert;
|
||||||
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.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 cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
import cn.iocoder.mall.order.dataobject.OrderLogisticsDO;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
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;
|
||||||
|
@ -58,15 +59,36 @@ public class OrderServiceImpl implements OrderService {
|
||||||
List<OrderDO> orderDOList = orderMapper.selectPage(orderQueryDTO);
|
List<OrderDO> orderDOList = orderMapper.selectPage(orderQueryDTO);
|
||||||
|
|
||||||
// 获取订单 id
|
// 获取订单 id
|
||||||
Set<Integer> orderIds = orderDOList.stream().map(orderDO -> orderDO.getId()).collect(Collectors.toSet());
|
Set<Integer> orderIds = orderDOList.stream()
|
||||||
|
.map(orderDO -> orderDO.getId())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
Set<Integer> orderLogisticsIds = orderDOList.stream()
|
||||||
|
.map(orderDO -> orderDO.getOrderLogisticsId())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 获取物流信息
|
||||||
|
List<OrderLogisticsDO> orderLogisticsDOList = orderLogisticsMapper.selectByIds(orderLogisticsIds);
|
||||||
|
List<OrderLogisticsBO> orderLogisticsBOList
|
||||||
|
= OrderLogisticsConvert.INSTANCE.convertOrderLogisticsBO(orderLogisticsDOList);
|
||||||
|
Map<Integer, OrderLogisticsBO> orderLogisticsDOMap
|
||||||
|
= orderLogisticsBOList.stream().collect(Collectors.toMap(OrderLogisticsBO::getId, obj -> obj));
|
||||||
|
|
||||||
// 获取 订单的 items
|
// 获取 订单的 items
|
||||||
List<OrderItemDO> orderItemDOList = orderItemMapper
|
List<OrderItemDO> orderItemDOList = orderItemMapper
|
||||||
.selectByOrderIdsAndStatus(orderIds, DeletedStatusEnum.DELETED_NO.getValue());
|
.selectByOrderIdsAndDeleted(orderIds, DeletedStatusEnum.DELETED_NO.getValue());
|
||||||
|
|
||||||
List<OrderItemBO> orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemDO(orderItemDOList);
|
List<OrderItemBO> orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemDO(orderItemDOList);
|
||||||
Map<Integer, List<OrderItemBO>> orderItemBOMultimap = CollectionUtil
|
Map<Integer, List<OrderItemBO>> orderItemBOMultimap = orderItemBOList.stream().collect(
|
||||||
.buildMultimap(orderItemBOList, Integer.class, OrderItemBO.class, "orderId");
|
Collectors.toMap(
|
||||||
|
OrderItemBO::getOrderId,
|
||||||
|
item -> Lists.newArrayList(item),
|
||||||
|
(oldVal, newVal) -> {
|
||||||
|
oldVal.addAll(newVal);
|
||||||
|
return oldVal;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// 转换 orderDO 为 OrderBO,并设置 item
|
// 转换 orderDO 为 OrderBO,并设置 item
|
||||||
List<OrderBO> orderPageBOList = OrderConvert.INSTANCE.convertPageBO(orderDOList);
|
List<OrderBO> orderPageBOList = OrderConvert.INSTANCE.convertPageBO(orderDOList);
|
||||||
|
@ -74,6 +96,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
if (orderItemBOMultimap.containsKey(orderBO.getId())) {
|
if (orderItemBOMultimap.containsKey(orderBO.getId())) {
|
||||||
orderBO.setOrderItems(orderItemBOMultimap.get(orderBO.getId()));
|
orderBO.setOrderItems(orderItemBOMultimap.get(orderBO.getId()));
|
||||||
}
|
}
|
||||||
|
if (orderLogisticsDOMap.containsKey(orderBO.getOrderLogisticsId())) {
|
||||||
|
orderBO.setOrderLogistics(orderLogisticsDOMap.get(orderBO.getOrderLogisticsId()));
|
||||||
|
}
|
||||||
return orderBO;
|
return orderBO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
@ -86,7 +111,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public CommonResult<cn.iocoder.mall.order.api.bo.OrderBO> createOrder(Integer userId, OrderCreateDTO orderCreateDTO) {
|
public CommonResult<OrderCreateBO> createOrder(Integer userId, OrderCreateDTO orderCreateDTO) {
|
||||||
List<OrderCreateItemDTO> orderItemDTOList = orderCreateDTO.getOrderItems();
|
List<OrderCreateItemDTO> orderItemDTOList = orderCreateDTO.getOrderItems();
|
||||||
OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderCreateDTO);
|
OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderCreateDTO);
|
||||||
List<OrderItemDO> orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList);
|
List<OrderItemDO> orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList);
|
||||||
|
@ -120,7 +145,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
.setUserId(userId)
|
.setUserId(userId)
|
||||||
.setOrderLogisticsId(orderLogisticsDO.getId())
|
.setOrderLogisticsId(orderLogisticsDO.getId())
|
||||||
.setOrderNo(UUID.randomUUID().toString().replace("-", ""))
|
.setOrderNo(UUID.randomUUID().toString().replace("-", ""))
|
||||||
.setPrice(-1) // 先设置一个默认值,金额在下面计算
|
.setPayAmount(-1) // 先设置一个默认值,金额在下面计算
|
||||||
.setClosingTime(null)
|
.setClosingTime(null)
|
||||||
.setDeliveryTime(null)
|
.setDeliveryTime(null)
|
||||||
.setPaymentTime(null)
|
.setPaymentTime(null)
|
||||||
|
@ -140,6 +165,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
.setOrderId(orderDO.getId())
|
.setOrderId(orderDO.getId())
|
||||||
.setOrderNo(orderDO.getOrderNo())
|
.setOrderNo(orderDO.getOrderNo())
|
||||||
.setPrice(goodsPrice)
|
.setPrice(goodsPrice)
|
||||||
|
.setPayAmount(orderItemDO.getQuantity() * orderItemDO.getPrice())
|
||||||
|
.setSkuName("夏季衣服-默认数据")
|
||||||
|
.setSkuImage("//img.alicdn.com/tps/i4/TB1TiGwKXXXXXXRXFXXqVMCNVXX-400-400.jpg_350x350q90.jpg_.webp")
|
||||||
.setPaymentTime(null)
|
.setPaymentTime(null)
|
||||||
.setDeliveryTime(null)
|
.setDeliveryTime(null)
|
||||||
.setReceiverTime(null)
|
.setReceiverTime(null)
|
||||||
|
@ -158,16 +186,16 @@ public class OrderServiceImpl implements OrderService {
|
||||||
orderMapper.updateById(
|
orderMapper.updateById(
|
||||||
new OrderDO()
|
new OrderDO()
|
||||||
.setId(orderDO.getId())
|
.setId(orderDO.getId())
|
||||||
.setPrice(totalAmount)
|
.setPayAmount(totalAmount)
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息
|
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息
|
||||||
|
|
||||||
return CommonResult.success(
|
return CommonResult.success(
|
||||||
new cn.iocoder.mall.order.api.bo.OrderBO()
|
new OrderCreateBO()
|
||||||
.setId(orderDO.getId())
|
.setId(orderDO.getId())
|
||||||
.setOrderNo(orderDO.getOrderNo())
|
.setOrderNo(orderDO.getOrderNo())
|
||||||
.setMoney(orderDO.getPrice())
|
.setPayAmount(orderDO.getPayAmount())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +209,19 @@ public class OrderServiceImpl implements OrderService {
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount) {
|
||||||
|
if (payAmount < 0) {
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_PAY_AMOUNT_NOT_NEGATIVE.getCode());
|
||||||
|
}
|
||||||
|
orderItemMapper.updateById(new OrderItemDO().setId(orderItemId).setPayAmount(payAmount));
|
||||||
|
List<OrderItemDO> orderItemDOList = orderItemMapper.selectByOrderIdAndDeleted(orderId, DeletedStatusEnum.DELETED_NO.getValue());
|
||||||
|
Integer orderPayAmount = orderCommon.calculatedAmount(orderItemDOList);
|
||||||
|
orderMapper.updateById(new OrderDO().setId(orderId).setPayAmount(orderPayAmount));
|
||||||
|
return CommonResult.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) {
|
public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) {
|
||||||
Integer orderId = orderItemDeletedDTO.getOrderId();
|
Integer orderId = orderItemDeletedDTO.getOrderId();
|
||||||
|
@ -211,7 +252,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
orderMapper.updateById(
|
orderMapper.updateById(
|
||||||
new OrderDO()
|
new OrderDO()
|
||||||
.setId(orderId)
|
.setId(orderId)
|
||||||
.setPrice(totalAmount)
|
.setPayAmount(totalAmount)
|
||||||
);
|
);
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<mapper namespace="cn.iocoder.mall.order.dao.OrderItemMapper">
|
<mapper namespace="cn.iocoder.mall.order.dao.OrderItemMapper">
|
||||||
|
|
||||||
<sql id="FIELDS">
|
<sql id="FIELDS">
|
||||||
id, order_id, order_no, sku_id, quantity, price,
|
id, order_id, order_no, sku_id, sku_name, sku_image, quantity, price, pay_amount,
|
||||||
payment_time, delivery_time, receiver_time, closing_time,
|
payment_time, delivery_time, receiver_time, closing_time,
|
||||||
has_return_exchange, status, create_time, update_time, deleted
|
has_return_exchange, status, create_time, update_time, deleted
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
-->
|
-->
|
||||||
<insert id="insert" parameterType="OrderItemDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderItemDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order_item` (
|
INSERT INTO `order_item` (
|
||||||
order_id, order_no, sku_id, quantity, price,
|
order_id, order_no, sku_id, sku_name, sku_image, quantity, price, pay_amount,
|
||||||
payment_time, delivery_time, receiver_time, closing_time,
|
payment_time, delivery_time, receiver_time, closing_time,
|
||||||
has_return_exchange, status, create_time, update_time, deleted
|
has_return_exchange, status, create_time, update_time, deleted
|
||||||
) VALUES (
|
) VALUES (
|
||||||
|
@ -38,13 +38,22 @@
|
||||||
<if test="skuId != null">
|
<if test="skuId != null">
|
||||||
, sku_id = #{skuId}
|
, sku_id = #{skuId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="skuName != null">
|
||||||
|
, sku_name = #{skuName}
|
||||||
|
</if>
|
||||||
|
<if test="skuImage != null">
|
||||||
|
, sku_image = #{skuImage}
|
||||||
|
</if>
|
||||||
<if test="quantity != null">
|
<if test="quantity != null">
|
||||||
, quantity = #{quantity}
|
, quantity = #{quantity}
|
||||||
</if>
|
</if>
|
||||||
<if test="price != null">
|
<if test="price != null">
|
||||||
, price = #{price}
|
, price = #{price}
|
||||||
</if>
|
</if>
|
||||||
-- time
|
<if test="payAmount != null">
|
||||||
|
, pay_amount = #{payAmount}
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="paymentTime != null">
|
<if test="paymentTime != null">
|
||||||
, payment_time = #{paymentTime}
|
, payment_time = #{paymentTime}
|
||||||
</if>
|
</if>
|
||||||
|
@ -57,7 +66,7 @@
|
||||||
<if test="closingTime != null">
|
<if test="closingTime != null">
|
||||||
, closing_time = #{closingTime}
|
, closing_time = #{closingTime}
|
||||||
</if>
|
</if>
|
||||||
-- other
|
|
||||||
<if test="hasReturnExchange != null">
|
<if test="hasReturnExchange != null">
|
||||||
, has_return_exchange = #{hasReturnExchange}
|
, has_return_exchange = #{hasReturnExchange}
|
||||||
</if>
|
</if>
|
||||||
|
@ -114,12 +123,14 @@
|
||||||
<!--
|
<!--
|
||||||
查询 - 根据 orderIds 和 status
|
查询 - 根据 orderIds 和 status
|
||||||
-->
|
-->
|
||||||
<select id="selectByOrderIdsAndStatus" resultType="cn.iocoder.mall.order.dataobject.OrderItemDO">
|
<select id="selectByOrderIdsAndDeleted" resultType="cn.iocoder.mall.order.dataobject.OrderItemDO">
|
||||||
SELECT * FROM `order_item`
|
SELECT
|
||||||
WHERE `status` = #{status}
|
<include refid="FIELDS" />
|
||||||
|
FROM `order_item`
|
||||||
|
WHERE `deleted` = #{deleted}
|
||||||
AND `order_id`
|
AND `order_id`
|
||||||
IN
|
IN
|
||||||
<foreach collection="orderIds" index="orderId" open="(" close=")" separator=",">
|
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
|
||||||
#{orderId}
|
#{orderId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<mapper namespace="cn.iocoder.mall.order.dao.OrderLogisticsMapper">
|
<mapper namespace="cn.iocoder.mall.order.dao.OrderLogisticsMapper">
|
||||||
|
|
||||||
<sql id="FIELDS">
|
<sql id="FIELDS">
|
||||||
id, area_no, `name`, mobile, address, logistics_no
|
id, area_no, `name`, mobile, address, logistics_no, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -49,4 +49,18 @@
|
||||||
<include refid="updateFieldSql" />
|
<include refid="updateFieldSql" />
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
查询 - 根据 orderId
|
||||||
|
-->
|
||||||
|
<select id="selectByIds" resultType="cn.iocoder.mall.order.dataobject.OrderLogisticsDO">
|
||||||
|
SELECT
|
||||||
|
<include refid="FIELDS" />
|
||||||
|
FROM `order_logistics`
|
||||||
|
WHERE `id`
|
||||||
|
IN
|
||||||
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -3,7 +3,7 @@
|
||||||
<mapper namespace="cn.iocoder.mall.order.dao.OrderMapper">
|
<mapper namespace="cn.iocoder.mall.order.dao.OrderMapper">
|
||||||
|
|
||||||
<sql id="FIELDS">
|
<sql id="FIELDS">
|
||||||
id, user_id, order_logistics_id, order_no, price, payment_time,
|
id, user_id, order_logistics_id, order_no, pay_amount, payment_time,
|
||||||
delivery_time, receiver_time, closing_time, has_return_exchange,
|
delivery_time, receiver_time, closing_time, has_return_exchange,
|
||||||
status, remark, create_time, update_time, `deleted`
|
status, remark, create_time, update_time, `deleted`
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -36,8 +36,8 @@
|
||||||
<if test="orderNo != null">
|
<if test="orderNo != null">
|
||||||
, order_no = #{orderNo}
|
, order_no = #{orderNo}
|
||||||
</if>
|
</if>
|
||||||
<if test="price != null">
|
<if test="payAmount != null">
|
||||||
, price = #{price}
|
, pay_amount = #{payAmount}
|
||||||
</if>
|
</if>
|
||||||
-- time
|
-- time
|
||||||
<if test="paymentTime != null">
|
<if test="paymentTime != null">
|
||||||
|
|
|
@ -3,12 +3,11 @@ package cn.iocoder.mall.order.service;
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.order.OrderApplicationTest;
|
import cn.iocoder.mall.order.OrderApplicationTest;
|
||||||
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.OrderCreateBO;
|
||||||
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.dao.OrderMapper;
|
import cn.iocoder.mall.order.dao.OrderMapper;
|
||||||
import cn.iocoder.mall.order.dataobject.OrderDO;
|
import cn.iocoder.mall.order.dataobject.OrderDO;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -44,7 +43,7 @@ public class OrderServiceImplTest {
|
||||||
.setSkuId(1)
|
.setSkuId(1)
|
||||||
.setQuantity(1);
|
.setQuantity(1);
|
||||||
|
|
||||||
CommonResult<OrderBO> result = orderService.createOrder(
|
CommonResult<OrderCreateBO> result = orderService.createOrder(
|
||||||
userId,
|
userId,
|
||||||
new OrderCreateDTO()
|
new OrderCreateDTO()
|
||||||
.setRemark("")
|
.setRemark("")
|
||||||
|
|
Loading…
Reference in New Issue