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 e86b25275..9be39da5d 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,14 +2,12 @@ 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.dto.OrderItemUpdateDTO; -import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO; -import cn.iocoder.mall.order.api.dto.OrderPageBO; -import cn.iocoder.mall.order.api.dto.OrderQueryDTO; +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.springframework.beans.factory.annotation.Autowired; @@ -34,10 +32,9 @@ public class AdminsOrderController { @GetMapping("page") @ApiOperation("订单列表") - public CommonResult> getOrderPage(@Validated OrderPageQueryVO orderPageQueryVO) { + public CommonResult getOrderPage(@Validated OrderPageQueryVO orderPageQueryVO) { OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convertPageBO(orderPageQueryVO); - CommonResult> result = orderService.getOrderPage(orderQueryDTO); - return result; + return orderService.getOrderPage(orderQueryDTO); } @PutMapping("order_item/update") diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageQueryVO.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageQueryVO.java index 1e40f89d2..f6fd3c312 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageQueryVO.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageQueryVO.java @@ -2,6 +2,7 @@ package cn.iocoder.mall.order.application.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -34,16 +35,27 @@ public class OrderPageQueryVO implements Serializable { * 付款时间(待发货) */ @ApiModelProperty("start付款时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startPaymentTime; @ApiModelProperty("end付款时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endPaymentTime; /** * 创建时间 */ @ApiModelProperty("start订单创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startCreateTime; @ApiModelProperty("end订单创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endCreateTime; + /** + * 结束时间 + */ + @ApiModelProperty("start成交时间") + private Date startClosingTime; + @ApiModelProperty("end成交时间") + private Date endClosingTime; /** * 删除状态 */ @@ -64,6 +76,8 @@ public class OrderPageQueryVO implements Serializable { ", endPaymentTime=" + endPaymentTime + ", startCreateTime=" + startCreateTime + ", endCreateTime=" + endCreateTime + + ", startClosingTime=" + startClosingTime + + ", endClosingTime=" + endClosingTime + ", deleted=" + deleted + ", pageNo=" + pageNo + ", pageSize=" + pageSize + @@ -133,6 +147,24 @@ public class OrderPageQueryVO implements Serializable { return this; } + public Date getStartClosingTime() { + return startClosingTime; + } + + public OrderPageQueryVO setStartClosingTime(Date startClosingTime) { + this.startClosingTime = startClosingTime; + return this; + } + + public Date getEndClosingTime() { + return endClosingTime; + } + + public OrderPageQueryVO setEndClosingTime(Date endClosingTime) { + this.endClosingTime = endClosingTime; + return this; + } + public Integer getDeleted() { return deleted; } 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 new file mode 100644 index 000000000..800a86ad7 --- /dev/null +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/OrderPageVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.mall.order.application.vo; + +import cn.iocoder.mall.order.api.dto.OrderBO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.List; + +/** + * 订单分页 vo + * + * @author Sin + * @time 2019-03-27 21:23 + */ +@ApiModel("订单VO") +public class OrderPageVO implements Serializable { + + /** + * 分页 + */ + @ApiModelProperty("分页下表当前") + private Integer pageNo; + /** + * 总条数 + */ + @ApiModelProperty("总条数") + private Integer total; + /** + * 订单 list + */ + @ApiModelProperty("订单信息") + private List orders; + + @Override + public String toString() { + return "OrderPageVO{" + + "pageNo=" + pageNo + + ", total=" + total + + ", orders=" + orders + + '}'; + } + + public Integer getPageNo() { + return pageNo; + } + + public OrderPageVO setPageNo(Integer pageNo) { + this.pageNo = pageNo; + return this; + } + + public Integer getTotal() { + return total; + } + + public OrderPageVO setTotal(Integer total) { + this.total = total; + return this; + } + + public List getOrders() { + return orders; + } + + public OrderPageVO setOrders(List orders) { + this.orders = orders; + return this; + } +} 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 9882c6dd6..ff03cec07 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,7 +1,6 @@ package cn.iocoder.mall.order.api; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.bo.OrderBO; import cn.iocoder.mall.order.api.dto.*; import java.util.List; @@ -20,7 +19,7 @@ public interface OrderService { * @param orderQueryDTO * @return */ - CommonResult> getOrderPage(OrderQueryDTO orderQueryDTO); + CommonResult getOrderPage(OrderQueryDTO orderQueryDTO); /** * 订单 - 创建 @@ -29,7 +28,7 @@ public interface OrderService { * @param orderCreateDTO * @return */ - CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO); + CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO); /** * 订单item - 更新 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 new file mode 100644 index 000000000..dfc2666b4 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderBO.java @@ -0,0 +1,207 @@ +package cn.iocoder.mall.order.api.dto; + +import java.io.Serializable; +import java.util.Date; + +/** + * 订单 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; + + @Override + public String toString() { + return "OrderPageBO{" + + "id=" + id + + ", userId=" + userId + + ", orderLogisticsId=" + orderLogisticsId + + ", orderNo='" + orderNo + '\'' + + ", price=" + price + + ", paymentTime=" + paymentTime + + ", deliveryTime=" + deliveryTime + + ", receiverTime=" + receiverTime + + ", closingTime=" + closingTime + + ", hasReturnExchange=" + hasReturnExchange + + ", status=" + status + + ", remark='" + remark + '\'' + + '}'; + } + + 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; + } +} 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/dto/OrderPageBO.java index d29a87052..9d3b10c41 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/dto/OrderPageBO.java @@ -1,207 +1,48 @@ 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 + * @time 2019-03-27 21:27 */ public class OrderPageBO implements Serializable { /** - * id + * 总条数 */ - private Integer id; + private Integer total; /** - * 用户编号 + * 订单列表 */ - 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; + private List orders; @Override public String toString() { return "OrderPageBO{" + - "id=" + id + - ", userId=" + userId + - ", orderLogisticsId=" + orderLogisticsId + - ", orderNo='" + orderNo + '\'' + - ", price=" + price + - ", paymentTime=" + paymentTime + - ", deliveryTime=" + deliveryTime + - ", receiverTime=" + receiverTime + - ", closingTime=" + closingTime + - ", hasReturnExchange=" + hasReturnExchange + - ", status=" + status + - ", remark='" + remark + '\'' + + "total=" + total + + ", orders=" + orders + '}'; } - public Integer getId() { - return id; + public Integer getTotal() { + return total; } - public OrderPageBO setId(Integer id) { - this.id = id; + public OrderPageBO setTotal(Integer total) { + this.total = total; return this; } - public Integer getUserId() { - return userId; + public List getOrders() { + return orders; } - public OrderPageBO setUserId(Integer userId) { - this.userId = userId; - return this; - } - - public Integer getOrderLogisticsId() { - return orderLogisticsId; - } - - public OrderPageBO setOrderLogisticsId(Integer orderLogisticsId) { - this.orderLogisticsId = orderLogisticsId; - return this; - } - - public String getOrderNo() { - return orderNo; - } - - public OrderPageBO setOrderNo(String orderNo) { - this.orderNo = orderNo; - return this; - } - - public Integer getPrice() { - return price; - } - - public OrderPageBO setPrice(Integer price) { - this.price = price; - return this; - } - - public Date getPaymentTime() { - return paymentTime; - } - - public OrderPageBO setPaymentTime(Date paymentTime) { - this.paymentTime = paymentTime; - return this; - } - - public Date getDeliveryTime() { - return deliveryTime; - } - - public OrderPageBO setDeliveryTime(Date deliveryTime) { - this.deliveryTime = deliveryTime; - return this; - } - - public Date getReceiverTime() { - return receiverTime; - } - - public OrderPageBO setReceiverTime(Date receiverTime) { - this.receiverTime = receiverTime; - return this; - } - - public Date getClosingTime() { - return closingTime; - } - - public OrderPageBO setClosingTime(Date closingTime) { - this.closingTime = closingTime; - return this; - } - - public Integer getHasReturnExchange() { - return hasReturnExchange; - } - - public OrderPageBO setHasReturnExchange(Integer hasReturnExchange) { - this.hasReturnExchange = hasReturnExchange; - return this; - } - - public Integer getStatus() { - return status; - } - - public OrderPageBO setStatus(Integer status) { - this.status = status; - return this; - } - - public String getRemark() { - return remark; - } - - public OrderPageBO setRemark(String remark) { - this.remark = remark; + public OrderPageBO setOrders(List orders) { + this.orders = orders; return this; } } 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/application/convert/OrderConvert.java index 14b63abce..8c74c98e2 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/application/convert/OrderConvert.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.order.application.convert; -import cn.iocoder.mall.order.api.dto.OrderPageBO; +import cn.iocoder.mall.order.api.dto.OrderBO; import cn.iocoder.mall.order.dataobject.OrderDO; import org.mapstruct.Mapper; import org.mapstruct.Mappings; @@ -20,5 +20,5 @@ public interface OrderConvert { OrderConvert INSTANCE = Mappers.getMapper(OrderConvert.class); @Mappings({}) - List convertPageBO(List orderDOList); + List convertPageBO(List orderDOList); } 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 bec0a32d5..fac3de9f2 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 @@ -5,7 +5,6 @@ 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.OrderBO; import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum; import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum; import cn.iocoder.mall.order.api.constant.OrderStatusEnum; @@ -47,21 +46,26 @@ public class OrderServiceImpl implements OrderService { private OrderCommon orderCommon; @Override - public CommonResult> getOrderPage(OrderQueryDTO orderQueryDTO) { + public CommonResult getOrderPage(OrderQueryDTO orderQueryDTO) { int totalCount = orderMapper.selectPageCount(orderQueryDTO); if (totalCount == 0) { - return CommonResult.success(Collections.EMPTY_LIST); + return CommonResult.success(new OrderPageBO().setTotal(0)); } List orderDOList = orderMapper.selectPage(orderQueryDTO); - List orderPageBOList = OrderConvert.INSTANCE.convertPageBO(orderDOList); - return CommonResult.success(orderPageBOList); + List orderPageBOList = OrderConvert.INSTANCE.convertPageBO(orderDOList); + + return CommonResult.success( + new OrderPageBO() + .setTotal(totalCount) + .setOrders(orderPageBOList) + ); } @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); @@ -139,7 +143,7 @@ public class OrderServiceImpl implements OrderService { // TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息 return CommonResult.success( - new OrderBO() + new cn.iocoder.mall.order.api.bo.OrderBO() .setId(orderDO.getId()) .setOrderNo(orderDO.getOrderNo()) .setMoney(orderDO.getPrice())