diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtil.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtil.java index 76883dee3..f1af58317 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtil.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/util/CollectionUtil.java @@ -1,9 +1,9 @@ package cn.iocoder.common.framework.util; -import org.springframework.util.ReflectionUtils; - -import java.lang.reflect.Field; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; public class CollectionUtil { @@ -14,54 +14,4 @@ public class CollectionUtil { public static Set asSet(T... objs) { return new HashSet<>(Arrays.asList(objs)); } - - - /** - * 创建指定属性为KEY, objs的每个元素为值的Multimap的Map集合。 - * - * @param objs 数组 - * @param keyClazz 值类型,即{@code property}的类型 - * @param valClazz 值类型 - * @param property 属性名 - * @param 泛型 - * @param 泛型 - * @return 指定属性的Map集合 - */ - @SuppressWarnings("unchecked") - public static Map> buildMultimap(List objs, Class keyClazz, Class valClazz, - String property) { - if (objs.isEmpty()) { - return Collections.EMPTY_MAP; - } - Map> results = new HashMap<>(objs.size()); - try { - Field field = getField(objs, property); - for (V obj : objs) { - K key = (K) field.get(obj); - List 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; - } } \ No newline at end of file diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java index 9be39da5d..7bc204904 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java @@ -2,20 +2,19 @@ package cn.iocoder.mall.order.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; 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.application.convert.OrderConvertAPP; import cn.iocoder.mall.order.application.vo.OrderItemUpdateVO; import cn.iocoder.mall.order.application.vo.OrderLogisticsVO; 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.ApiOperation; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.List; - /** * 订单API(admins) * @@ -37,15 +36,23 @@ public class AdminsOrderController { 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") - @ApiOperation("订单item更新") + @ApiOperation("更新-订单item") public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdateVO orderItemUpdateVO) { OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderItemUpdateVO); return orderService.updateOrderItem(dto); } @PutMapping("logistics/update") - @ApiOperation("订单物流更新") + @ApiOperation("更新-订单物流") public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsVO orderLogisticsVO) { OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderLogisticsVO); return orderService.updateLogistics(dto); diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageVO.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageVO.java index 800a86ad7..f289a3178 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageVO.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageVO.java @@ -1,6 +1,6 @@ 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.ApiModelProperty; diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java index ff03cec07..601bd313d 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java @@ -1,10 +1,10 @@ package cn.iocoder.mall.order.api; 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 java.util.List; - /** * 订单 service * @@ -28,7 +28,7 @@ public interface OrderService { * @param orderCreateDTO * @return */ - CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO); + CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO); /** * 订单item - 更新 @@ -38,6 +38,16 @@ public interface OrderService { */ CommonResult updateOrderItem(OrderItemUpdateDTO orderItemUpdateDTO); + /** + * 订单item - 更新 payAmount(实付金额) + * + * @param orderId + * @param orderItemId + * @param payAmount + * @return + */ + CommonResult updateOrderItemPayAmount(Integer orderId, Integer orderItemId, Integer payAmount); + /** * 订单item - 删除 * diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java index 15a2d6a2f..4b2d3a8d6 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java @@ -1,34 +1,114 @@ package cn.iocoder.mall.order.api.bo; import java.io.Serializable; +import java.util.Date; +import java.util.List; /** - * 订单创建 BO + * 订单 page * * @author Sin - * @time 2019-03-16 14:38 + * @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 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 orderItems; + /** + * 订单物流信息 + */ + private OrderLogisticsBO orderLogistics; @Override public String toString() { return "OrderBO{" + "id=" + id + + ", userId=" + userId + + ", orderLogisticsId=" + orderLogisticsId + ", 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; } + 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; } @@ -50,12 +148,93 @@ public class OrderBO implements Serializable { return this; } - public Integer getMoney() { - return money; + public Integer getPayAmount() { + return payAmount; } - public OrderBO setMoney(Integer money) { - this.money = money; + public OrderBO setPayAmount(Integer payAmount) { + 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 getOrderItems() { + return orderItems; + } + + public OrderBO setOrderItems(List orderItems) { + this.orderItems = orderItems; + return this; + } + + public OrderLogisticsBO getOrderLogistics() { + return orderLogistics; + } + + public OrderBO setOrderLogistics(OrderLogisticsBO orderLogistics) { + this.orderLogistics = orderLogistics; return this; } } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java new file mode 100644 index 000000000..8c97b4f42 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCreateBO.java @@ -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; + } +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java similarity index 67% rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemBO.java rename to order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java index 3852716d8..6341f79bb 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderItemBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderItemBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.order.api.dto; +package cn.iocoder.mall.order.api.bo; import java.io.Serializable; import java.util.Date; @@ -27,14 +27,26 @@ public class OrderItemBO implements Serializable { * 商品编号 */ private Integer skuId; + /** + * 商品名称 + */ + private String skuName; + /** + * 商品图片 + */ + private String skuImage; /** * 数量 */ private Integer quantity; /** - * 金额(分) + * 价格(分) */ private Integer price; + /** + * 支付金额(实付金额) + */ + private Integer payAmount; /// /// 时间信息 @@ -79,21 +91,40 @@ public class OrderItemBO implements Serializable { */ private Integer status; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 删除状态 + */ + private Integer deleted; + @Override public String toString() { - return "OrderItemDO{" + + return "OrderItemBO{" + "id=" + id + ", orderId=" + orderId + ", orderNo='" + orderNo + '\'' + - ", skuId='" + skuId + '\'' + + ", skuId=" + skuId + + ", skuName='" + skuName + '\'' + + ", skuImage='" + skuImage + '\'' + ", quantity=" + quantity + ", price=" + price + + ", payAmount=" + payAmount + ", paymentTime=" + paymentTime + ", deliveryTime=" + deliveryTime + ", receiverTime=" + receiverTime + ", closingTime=" + closingTime + ", hasReturnExchange=" + hasReturnExchange + ", status=" + status + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + ", deleted=" + deleted + '}'; } @@ -133,6 +164,24 @@ public class OrderItemBO implements Serializable { 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() { return quantity; } @@ -151,6 +200,15 @@ public class OrderItemBO implements Serializable { return this; } + public Integer getPayAmount() { + return payAmount; + } + + public OrderItemBO setPayAmount(Integer payAmount) { + this.payAmount = payAmount; + return this; + } + public Date getPaymentTime() { return paymentTime; } @@ -204,4 +262,31 @@ public class OrderItemBO implements Serializable { this.status = status; 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; + } } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java new file mode 100644 index 000000000..5786e324a --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderLogisticsBO.java @@ -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; + } +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderPageBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java similarity index 95% rename from order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderPageBO.java rename to order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java index 9d3b10c41..7bfe8b917 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderPageBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderPageBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.order.api.dto; +package cn.iocoder.mall.order.api.bo; import java.io.Serializable; import java.util.List; diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java index af10c9a4a..4d9f13a8d 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java @@ -13,6 +13,7 @@ public enum OrderErrorCodeEnum { ORDER_ITEM_ONLY_ONE(1000001000, "订单Item只有一个!"), ORDER_GET_SKU_FAIL(1000001001, "获取商品失败!"), ORDER_GET_SKU_NOT_EXISTENT(1000001002, "获取的商品不存在!"), + ORDER_PAY_AMOUNT_NOT_NEGATIVE(1000001002, "支付金额不能为负数!"), ; private final int code; diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderBO.java deleted file mode 100644 index eef0fa82e..000000000 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderBO.java +++ /dev/null @@ -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 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 getOrderItems() { - return orderItems; - } - - public OrderBO setOrderItems(List orderItems) { - this.orderItems = orderItems; - return this; - } -} diff --git a/order/order-service-impl/pom.xml b/order/order-service-impl/pom.xml index ed05a2a72..4f94a08a8 100644 --- a/order/order-service-impl/pom.xml +++ b/order/order-service-impl/pom.xml @@ -32,6 +32,11 @@ dubbo compile + + com.google.guava + guava + 27.0.1-jre + mysql diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/config/DatabaseConfiguration.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/config/DatabaseConfiguration.java similarity index 100% rename from order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/config/DatabaseConfiguration.java rename to order/order-service-impl/src/main/java/cn/iocoder/mall/order/config/DatabaseConfiguration.java diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/config/ServiceExceptionConfiguration.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/config/ServiceExceptionConfiguration.java similarity index 100% rename from order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/config/ServiceExceptionConfiguration.java rename to order/order-service-impl/src/main/java/cn/iocoder/mall/order/config/ServiceExceptionConfiguration.java diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderConvert.java similarity index 81% rename from order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvert.java rename to order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderConvert.java index 8c74c98e2..1d7efb04f 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvert.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderConvert.java @@ -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 org.mapstruct.Mapper; import org.mapstruct.Mappings; diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderItemConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderItemConvert.java similarity index 88% rename from order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderItemConvert.java rename to order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderItemConvert.java index f3a01e0cf..f90368435 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderItemConvert.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderItemConvert.java @@ -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.OrderItemBO; +import cn.iocoder.mall.order.api.bo.OrderItemBO; import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO; import cn.iocoder.mall.order.dataobject.OrderItemDO; import org.mapstruct.Mapper; diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderLogisticsConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderLogisticsConvert.java similarity index 73% rename from order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderLogisticsConvert.java rename to order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderLogisticsConvert.java index a61e61b03..1eecb7f53 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/application/convert/OrderLogisticsConvert.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/convert/OrderLogisticsConvert.java @@ -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.OrderLogisticsUpdateDTO; import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; @@ -7,6 +8,8 @@ import org.mapstruct.Mapper; import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; +import java.util.List; + /** * 订单物流 convert * @@ -23,4 +26,7 @@ public interface OrderLogisticsConvert { @Mappings({}) OrderLogisticsDO convert(OrderLogisticsUpdateDTO orderLogisticsDTO); + + @Mappings({}) + List convertOrderLogisticsBO(List orderLogisticsDOList); } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderItemMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderItemMapper.java index 016f8f1a9..6441accd6 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderItemMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderItemMapper.java @@ -46,12 +46,12 @@ public interface OrderItemMapper { * 查询 - 根据 orderIds 和 status * * @param orderIds - * @param status + * @param deleted * @return */ - List selectByOrderIdsAndStatus( + List selectByOrderIdsAndDeleted( @Param("orderIds") Collection orderIds, - @Param("status") Integer status + @Param("deleted") Integer deleted ); /** diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java index 12237e161..67cd0cb94 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dao/OrderLogisticsMapper.java @@ -1,8 +1,12 @@ package cn.iocoder.mall.order.dao; import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import java.util.Collection; +import java.util.List; + /** * 订单 item mapper * @@ -25,4 +29,14 @@ public interface OrderLogisticsMapper { * @param orderLogisticsDO */ void updateById(OrderLogisticsDO orderLogisticsDO); + + /** + * 查询 - 根据 orderId + * + * @param ids + * @return + */ + List selectByIds( + @Param("ids") Collection ids + ); } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java index 41eb4ca87..6fe641834 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderDO.java @@ -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 + ", orderLogisticsId=" + orderLogisticsId + ", orderNo='" + orderNo + '\'' + - ", price=" + price + + ", payAmount=" + payAmount + ", paymentTime=" + paymentTime + ", deliveryTime=" + deliveryTime + ", receiverTime=" + receiverTime + @@ -134,12 +134,12 @@ public class OrderDO extends DeletableDO { return this; } - public Integer getPrice() { - return price; + public Integer getPayAmount() { + return payAmount; } - public OrderDO setPrice(Integer price) { - this.price = price; + public OrderDO setPayAmount(Integer payAmount) { + this.payAmount = payAmount; return this; } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java index 38a5e374f..20132cdd2 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderItemDO.java @@ -28,14 +28,26 @@ public class OrderItemDO extends DeletableDO { * 商品编号 */ private Integer skuId; + /** + * 商品名称 + */ + private String skuName; + /** + * 商品图片 + */ + private String skuImage; /** * 数量 */ private Integer quantity; /** - * 金额(分) + * 价格(分) */ private Integer price; + /** + * 支付金额(实付金额) + */ + private Integer payAmount; /// /// 时间信息 @@ -86,9 +98,12 @@ public class OrderItemDO extends DeletableDO { "id=" + id + ", orderId=" + orderId + ", orderNo='" + orderNo + '\'' + - ", skuId='" + skuId + '\'' + + ", skuId=" + skuId + + ", skuName=" + skuName + + ", skuImage=" + skuImage + ", quantity=" + quantity + ", price=" + price + + ", payAmount=" + payAmount + ", paymentTime=" + paymentTime + ", deliveryTime=" + deliveryTime + ", receiverTime=" + receiverTime + @@ -134,6 +149,24 @@ public class OrderItemDO extends DeletableDO { 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() { return quantity; } @@ -152,6 +185,15 @@ public class OrderItemDO extends DeletableDO { return this; } + public Integer getPayAmount() { + return payAmount; + } + + public OrderItemDO setPayAmount(Integer payAmount) { + this.payAmount = payAmount; + return this; + } + public Date getPaymentTime() { return paymentTime; } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java index 4fcc7d564..c15c22f8b 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/dataobject/OrderLogisticsDO.java @@ -15,6 +15,10 @@ public class OrderLogisticsDO extends BaseDO { * id */ private Integer id; + /** + * 订单编号 + */ + private Integer orderId; /** * 收件区域编号 */ @@ -40,6 +44,7 @@ public class OrderLogisticsDO extends BaseDO { public String toString() { return "OrderLogisticsDO{" + "id=" + id + + ", orderId=" + orderId + ", areaNo='" + areaNo + '\'' + ", name='" + name + '\'' + ", mobile='" + mobile + '\'' + @@ -57,6 +62,15 @@ public class OrderLogisticsDO extends BaseDO { return this; } + public Integer getOrderId() { + return orderId; + } + + public OrderLogisticsDO setOrderId(Integer orderId) { + this.orderId = orderId; + return this; + } + public String getAreaNo() { return areaNo; } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java index f7cfac001..cee0b5221 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/service/OrderServiceImpl.java @@ -1,24 +1,25 @@ package cn.iocoder.mall.order.service; 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.vo.CommonResult; import cn.iocoder.mall.order.OrderCommon; 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.OrderHasReturnExchangeEnum; import cn.iocoder.mall.order.api.constant.OrderStatusEnum; import cn.iocoder.mall.order.api.dto.*; -import cn.iocoder.mall.order.application.convert.OrderConvert; -import cn.iocoder.mall.order.application.convert.OrderItemConvert; -import cn.iocoder.mall.order.application.convert.OrderLogisticsConvert; +import cn.iocoder.mall.order.convert.OrderConvert; +import cn.iocoder.mall.order.convert.OrderItemConvert; +import cn.iocoder.mall.order.convert.OrderLogisticsConvert; 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.dataobject.OrderDO; import cn.iocoder.mall.order.dataobject.OrderItemDO; import cn.iocoder.mall.order.dataobject.OrderLogisticsDO; +import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -58,15 +59,36 @@ public class OrderServiceImpl implements OrderService { List orderDOList = orderMapper.selectPage(orderQueryDTO); // 获取订单 id - Set orderIds = orderDOList.stream().map(orderDO -> orderDO.getId()).collect(Collectors.toSet()); + Set orderIds = orderDOList.stream() + .map(orderDO -> orderDO.getId()) + .collect(Collectors.toSet()); + + Set orderLogisticsIds = orderDOList.stream() + .map(orderDO -> orderDO.getOrderLogisticsId()) + .collect(Collectors.toSet()); + + // 获取物流信息 + List orderLogisticsDOList = orderLogisticsMapper.selectByIds(orderLogisticsIds); + List orderLogisticsBOList + = OrderLogisticsConvert.INSTANCE.convertOrderLogisticsBO(orderLogisticsDOList); + Map orderLogisticsDOMap + = orderLogisticsBOList.stream().collect(Collectors.toMap(OrderLogisticsBO::getId, obj -> obj)); // 获取 订单的 items List orderItemDOList = orderItemMapper - .selectByOrderIdsAndStatus(orderIds, DeletedStatusEnum.DELETED_NO.getValue()); + .selectByOrderIdsAndDeleted(orderIds, DeletedStatusEnum.DELETED_NO.getValue()); List orderItemBOList = OrderItemConvert.INSTANCE.convertOrderItemDO(orderItemDOList); - Map> orderItemBOMultimap = CollectionUtil - .buildMultimap(orderItemBOList, Integer.class, OrderItemBO.class, "orderId"); + 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); @@ -74,6 +96,9 @@ public class OrderServiceImpl implements OrderService { if (orderItemBOMultimap.containsKey(orderBO.getId())) { orderBO.setOrderItems(orderItemBOMultimap.get(orderBO.getId())); } + if (orderLogisticsDOMap.containsKey(orderBO.getOrderLogisticsId())) { + orderBO.setOrderLogistics(orderLogisticsDOMap.get(orderBO.getOrderLogisticsId())); + } return orderBO; }).collect(Collectors.toList()); @@ -86,7 +111,7 @@ public class OrderServiceImpl implements OrderService { @Override @Transactional - public CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO) { + public CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO) { List orderItemDTOList = orderCreateDTO.getOrderItems(); OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderCreateDTO); List orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList); @@ -120,7 +145,7 @@ public class OrderServiceImpl implements OrderService { .setUserId(userId) .setOrderLogisticsId(orderLogisticsDO.getId()) .setOrderNo(UUID.randomUUID().toString().replace("-", "")) - .setPrice(-1) // 先设置一个默认值,金额在下面计算 + .setPayAmount(-1) // 先设置一个默认值,金额在下面计算 .setClosingTime(null) .setDeliveryTime(null) .setPaymentTime(null) @@ -140,6 +165,9 @@ public class OrderServiceImpl implements OrderService { .setOrderId(orderDO.getId()) .setOrderNo(orderDO.getOrderNo()) .setPrice(goodsPrice) + .setPayAmount(orderItemDO.getQuantity() * orderItemDO.getPrice()) + .setSkuName("夏季衣服-默认数据") + .setSkuImage("//img.alicdn.com/tps/i4/TB1TiGwKXXXXXXRXFXXqVMCNVXX-400-400.jpg_350x350q90.jpg_.webp") .setPaymentTime(null) .setDeliveryTime(null) .setReceiverTime(null) @@ -158,16 +186,16 @@ public class OrderServiceImpl implements OrderService { orderMapper.updateById( new OrderDO() .setId(orderDO.getId()) - .setPrice(totalAmount) + .setPayAmount(totalAmount) ); // TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息 return CommonResult.success( - new cn.iocoder.mall.order.api.bo.OrderBO() + new OrderCreateBO() .setId(orderDO.getId()) .setOrderNo(orderDO.getOrderNo()) - .setMoney(orderDO.getPrice()) + .setPayAmount(orderDO.getPayAmount()) ); } @@ -181,6 +209,19 @@ public class OrderServiceImpl implements OrderService { 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 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 public CommonResult deleteOrderItem(OrderItemDeletedDTO orderItemDeletedDTO) { Integer orderId = orderItemDeletedDTO.getOrderId(); @@ -211,7 +252,7 @@ public class OrderServiceImpl implements OrderService { orderMapper.updateById( new OrderDO() .setId(orderId) - .setPrice(totalAmount) + .setPayAmount(totalAmount) ); return CommonResult.success(null); } 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 aebee0fb1..8d88c3fc0 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderItemMapper.xml @@ -3,7 +3,7 @@ - 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, has_return_exchange, status, create_time, update_time, deleted @@ -13,7 +13,7 @@ --> 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, has_return_exchange, status, create_time, update_time, deleted ) VALUES ( @@ -38,13 +38,22 @@ , sku_id = #{skuId} + + , sku_name = #{skuName} + + + , sku_image = #{skuImage} + , quantity = #{quantity} , price = #{price} - -- time + + , pay_amount = #{payAmount} + + , payment_time = #{paymentTime} @@ -57,7 +66,7 @@ , closing_time = #{closingTime} - -- other + , has_return_exchange = #{hasReturnExchange} @@ -114,12 +123,14 @@ - + SELECT + + FROM `order_item` + WHERE `deleted` = #{deleted} AND `order_id` IN - + #{orderId} 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 97f758b4c..a91040075 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderLogisticsMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderLogisticsMapper.xml @@ -3,7 +3,7 @@ - id, area_no, `name`, mobile, address, logistics_no + id, area_no, `name`, mobile, address, logistics_no, create_time, update_time + \ 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 1ba0d39c7..dcdef4d5f 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderMapper.xml @@ -3,7 +3,7 @@ - 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, status, remark, create_time, update_time, `deleted` @@ -36,8 +36,8 @@ , order_no = #{orderNo} - - , price = #{price} + + , pay_amount = #{payAmount} -- time diff --git a/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java b/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java index 09db66885..f1bb5a291 100644 --- a/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java +++ b/order/order-service-impl/src/test/java/cn/iocoder/mall/order/service/OrderServiceImplTest.java @@ -3,12 +3,11 @@ package cn.iocoder.mall.order.service; import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.order.OrderApplicationTest; 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.OrderCreateItemDTO; import cn.iocoder.mall.order.dao.OrderMapper; import cn.iocoder.mall.order.dataobject.OrderDO; -import org.checkerframework.checker.units.qual.A; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -44,7 +43,7 @@ public class OrderServiceImplTest { .setSkuId(1) .setQuantity(1); - CommonResult result = orderService.createOrder( + CommonResult result = orderService.createOrder( userId, new OrderCreateDTO() .setRemark("")