trade:增加用户 App 的订单分页和详情接口
parent
b7d78a24a4
commit
7f131a3853
|
@ -26,8 +26,12 @@ tenant-id: {{appTenentId}}
|
|||
]
|
||||
}
|
||||
|
||||
### /trade-order/page 获得订单交易分页
|
||||
GET {{shop-api-base-url}}/trade-order/page?status=1&pageNo=1&pageSize=10
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
### 获得订单交易的分页
|
||||
GET {{appApi}}/trade/order/page?pageNo=1&pageSize=10
|
||||
Authorization: Bearer {{appToken}}
|
||||
tenant-id: {{appTenentId}}
|
||||
|
||||
###
|
||||
### 获得订单交易的详细
|
||||
GET {{appApi}}/trade/order/get-detail?id=21
|
||||
Authorization: Bearer {{appToken}}
|
||||
tenant-id: {{appTenentId}}
|
||||
|
|
|
@ -4,12 +4,13 @@ import cn.hutool.extra.servlet.ServletUtil;
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderGetCreateInfoRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderRespVO;
|
||||
import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi;
|
||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
@ -20,8 +21,11 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Api(tags = "用户 App - 交易订单")
|
||||
@RestController
|
||||
|
@ -33,6 +37,9 @@ public class AppTradeOrderController {
|
|||
@Resource
|
||||
private TradeOrderService tradeOrderService;
|
||||
|
||||
@Resource
|
||||
private ProductPropertyValueApi productPropertyValueApi;
|
||||
|
||||
@GetMapping("/get-create-info")
|
||||
@ApiOperation("基于商品,确认创建订单")
|
||||
@PreAuthenticated
|
||||
|
@ -47,7 +54,7 @@ public class AppTradeOrderController {
|
|||
public CommonResult<Long> createOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO,
|
||||
HttpServletRequest servletRequest) {
|
||||
// 获取登录用户、用户 IP 地址
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
Long loginUserId = getLoginUserId();
|
||||
String clientIp = ServletUtil.getClientIP(servletRequest);
|
||||
// 创建交易订单,预支付记录
|
||||
Long orderId = tradeOrderService.createOrder(loginUserId, clientIp, createReqVO);
|
||||
|
@ -62,19 +69,34 @@ public class AppTradeOrderController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@GetMapping("/get-detail")
|
||||
@ApiOperation("获得交易订单")
|
||||
@ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true, dataTypeClass = Long.class)
|
||||
public CommonResult<AppTradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
|
||||
// return success(tradeOrderService.getTradeOrder(tradeOrderId));
|
||||
return null;
|
||||
@ApiImplicitParam(name = "id", value = "交易订单编号", required = true, dataTypeClass = Long.class)
|
||||
public CommonResult<AppTradeOrderDetailRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
// 查询订单
|
||||
TradeOrderDO order = tradeOrderService.getOrder(getLoginUserId(), id);
|
||||
// 查询订单项
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderService.getOrderItemListByOrderId(order.getId());
|
||||
// 查询商品属性
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails = productPropertyValueApi
|
||||
.getPropertyValueDetailList(TradeOrderConvert.INSTANCE.convertPropertyValueIds(orderItems));
|
||||
// 最终组合
|
||||
return success(TradeOrderConvert.INSTANCE.convert02(order, orderItems, propertyValueDetails));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得订单交易分页")
|
||||
public CommonResult<PageResult<AppTradeOrderRespVO>> pageTradeOrder(AppTradeOrderPageReqVO pageVO) {
|
||||
// return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO));
|
||||
return null;
|
||||
public CommonResult<PageResult<AppTradeOrderPageItemRespVO>> getOrderPage(AppTradeOrderPageReqVO reqVO) {
|
||||
// 查询订单
|
||||
PageResult<TradeOrderDO> pageResult = tradeOrderService.getOrderPage(getLoginUserId(), reqVO);
|
||||
// 查询订单项
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderService.getOrderItemListByOrderId(
|
||||
convertSet(pageResult.getList(), TradeOrderDO::getId));
|
||||
// 查询商品属性
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails = productPropertyValueApi
|
||||
.getPropertyValueDetailList(TradeOrderConvert.INSTANCE.convertPropertyValueIds(orderItems));
|
||||
// 最终组合
|
||||
return success(TradeOrderConvert.INSTANCE.convertPage02(pageResult, orderItems, propertyValueDetails));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("用户 App - 订单交易的明细 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderDetailRespVO {
|
||||
|
||||
// ========== 订单基本信息 ==========
|
||||
|
||||
@ApiModelProperty(value = "订单编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "订单流水号", required = true, example = "1146347329394184195")
|
||||
private String no;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, notes = "下单时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "用户备注", required = true, example = "你猜")
|
||||
private String userRemark;
|
||||
|
||||
@ApiModelProperty(value = "订单状态", required = true, example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "购买的商品数量", required = true, example = "10")
|
||||
private Integer productCount;
|
||||
|
||||
@ApiModelProperty(value = "订单完成时间")
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
@ApiModelProperty(value = "订单取消时间")
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@ApiModelProperty(value = "支付订单编号", required = true, example = "1024")
|
||||
private Long payOrderId;
|
||||
|
||||
@ApiModelProperty(value = "付款时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@ApiModelProperty(value = "商品原价(总)", required = true, example = "1000", notes = "单位:分")
|
||||
private Integer originalPrice;
|
||||
|
||||
@ApiModelProperty(value = "订单原价(总)", required = true, example = "1000", notes = "单位:分")
|
||||
private Integer orderPrice;
|
||||
|
||||
@ApiModelProperty(value = "订单优惠(总)", required = true, example = "100", notes = "单位:分")
|
||||
private Integer discountPrice;
|
||||
|
||||
@ApiModelProperty(value = "运费金额", required = true, example = "100", notes = "单位:分")
|
||||
private Integer deliveryPrice;
|
||||
|
||||
@ApiModelProperty(value = "订单调价(总)", required = true, example = "100", notes = "单位:分")
|
||||
private Integer adjustPrice;
|
||||
|
||||
@ApiModelProperty(value = "应付金额(总)", required = true, example = "1000", notes = "单位:分")
|
||||
private Integer payPrice;
|
||||
|
||||
// ========== 收件 + 物流基本信息 ==========
|
||||
|
||||
@ApiModelProperty(value = "发货物流单号", example = "1024")
|
||||
private String logisticsNo;
|
||||
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private LocalDateTime deliveryTime;
|
||||
|
||||
@ApiModelProperty(value = "收货时间")
|
||||
private LocalDateTime receiveTime;
|
||||
|
||||
@ApiModelProperty(value = "收件人名称", required = true, example = "张三")
|
||||
private String receiverName;
|
||||
|
||||
@ApiModelProperty(value = "收件人手机", required = true, example = "13800138000")
|
||||
private String receiverMobile;
|
||||
|
||||
@ApiModelProperty(value = "收件人地区编号", required = true, example = "110000")
|
||||
private Integer receiverAreaId;
|
||||
|
||||
@ApiModelProperty(value = "收件人地区名字", required = true, example = "上海 上海市 普陀区")
|
||||
private String receiverAreaName;
|
||||
|
||||
@ApiModelProperty(value = "收件人邮编", required = true, example = "100000")
|
||||
private Integer receiverPostCode;
|
||||
|
||||
@ApiModelProperty(value = "收件人详细地址", required = true, example = "中关村大街 1 号")
|
||||
private String receiverDetailAddress;
|
||||
|
||||
// ========== 售后基本信息 ==========
|
||||
|
||||
// ========== 营销基本信息 ==========
|
||||
|
||||
@ApiModelProperty(value = "优惠劵编号", example = "1024")
|
||||
private Long couponId;
|
||||
|
||||
@ApiModelProperty(value = "优惠劵减免金额", required = true, example = "100", notes = "单位:分")
|
||||
private Integer couponPrice;
|
||||
|
||||
@ApiModelProperty(value = "积分抵扣的金额", required = true, example = "100", notes = "单位:分")
|
||||
private Integer pointPrice;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*/
|
||||
private List<Item> items;
|
||||
|
||||
@ApiModel("用户 App - 交易订单的分页项的订单项目")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 名称", required = true, example = "芋道源码")
|
||||
private String spuName;
|
||||
|
||||
@ApiModelProperty(value = "商品 SKU 编号", required = true, example = "1")
|
||||
private Long skuId;
|
||||
|
||||
@ApiModelProperty(value = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@ApiModelProperty(value = "购买数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty(value = "商品原价(总)", required = true, example = "100", notes = "单位:分")
|
||||
private Integer originalPrice;
|
||||
|
||||
@ApiModelProperty(value = "商品原价(单)", required = true, example = "100", notes = "单位:分")
|
||||
private Integer originalUnitPrice;
|
||||
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
// TODO 芋艿:字段优化
|
||||
@ApiModel("交易订单项 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "id自增长", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "订单编号", required = true)
|
||||
private Integer orderId;
|
||||
@ApiModelProperty(value = "订单项状态", required = true)
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "商品 SKU 编号", required = true)
|
||||
private Integer skuId;
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true)
|
||||
private Integer spuId;
|
||||
@ApiModelProperty(value = "商品名字", required = true)
|
||||
private String skuName;
|
||||
@ApiModelProperty(value = "图片名字", required = true)
|
||||
private String skuImage;
|
||||
@ApiModelProperty(value = "商品数量", required = true)
|
||||
private Integer quantity;
|
||||
@ApiModelProperty(value = "原始单价,单位:分", required = true)
|
||||
private Integer originPrice;
|
||||
@ApiModelProperty(value = "购买单价,单位:分", required = true)
|
||||
private Integer buyPrice;
|
||||
@ApiModelProperty(value = "最终价格,单位:分", required = true)
|
||||
private Integer presentPrice;
|
||||
@ApiModelProperty(value = "购买总金额,单位:分", required = true)
|
||||
private Integer buyTotal;
|
||||
@ApiModelProperty(value = "优惠总金额,单位:分", required = true)
|
||||
private Integer discountTotal;
|
||||
@ApiModelProperty(value = "最终总金额,单位:分", required = true)
|
||||
private Integer presentTotal;
|
||||
@ApiModelProperty(value = "退款总金额,单位:分", required = true)
|
||||
private Integer refundTotal;
|
||||
@ApiModelProperty(value = "物流id")
|
||||
private Integer logisticsId;
|
||||
@ApiModelProperty(value = "售后状态", required = true)
|
||||
private Integer afterSaleStatus;
|
||||
@ApiModelProperty(value = "售后订单编号")
|
||||
private Integer afterSaleOrderId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("用户 App - 订单交易的分页项 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderPageItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "订单编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "订单流水号", required = true, example = "1146347329394184195")
|
||||
private String no;
|
||||
|
||||
@ApiModelProperty(value = "订单状态", required = true, example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "购买的商品数量", required = true, example = "10")
|
||||
private Integer productCount;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*/
|
||||
private List<Item> items;
|
||||
|
||||
@ApiModel("用户 App - 交易订单的明细的订单项目")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 名称", required = true, example = "芋道源码")
|
||||
private String spuName;
|
||||
|
||||
@ApiModelProperty(value = "商品 SKU 编号", required = true, example = "1")
|
||||
private Long skuId;
|
||||
|
||||
@ApiModelProperty(value = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@ApiModelProperty(value = "购买数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty(value = "商品原价(总)", required = true, example = "100", notes = "单位:分")
|
||||
private Integer originalPrice;
|
||||
|
||||
@ApiModelProperty(value = "商品原价(单)", required = true, example = "100", notes = "单位:分")
|
||||
private Integer originalUnitPrice;
|
||||
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +1,19 @@
|
|||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
// TODO 芋艿:字段优化
|
||||
@ApiModel("交易订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppTradeOrderPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
|
||||
private Integer orderStatus;
|
||||
@InEnum(value = TradeOrderStatusEnum.class, message = "订单状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
// TODO 芋艿:字段优化
|
||||
@ApiModel("订单交易 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderRespVO {
|
||||
|
||||
@ApiModelProperty(value = "订单编号", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "用户编号", required = true)
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "订单单号", required = true)
|
||||
private String orderNo;
|
||||
@ApiModelProperty(value = "订单状态", required = true)
|
||||
private Integer orderStatus;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "订单结束时间")
|
||||
private LocalDateTime endTime;
|
||||
@ApiModelProperty(value = "订单金额(总金额),单位:分", required = true)
|
||||
private Integer buyPrice;
|
||||
@ApiModelProperty(value = "优惠总金额,单位:分", required = true)
|
||||
private Integer discountPrice;
|
||||
@ApiModelProperty(value = "物流金额,单位:分", required = true)
|
||||
private Integer logisticsPrice;
|
||||
@ApiModelProperty(value = "最终金额,单位:分", required = true)
|
||||
private Integer presentPrice;
|
||||
@ApiModelProperty(value = "支付金额,单位:分", required = true)
|
||||
private Integer payPrice;
|
||||
@ApiModelProperty(value = "退款金额,单位:分", required = true)
|
||||
private Integer refundPrice;
|
||||
@ApiModelProperty(value = "付款时间")
|
||||
private LocalDateTime payTime;
|
||||
@ApiModelProperty(value = "支付订单编号")
|
||||
private Integer payTransactionId;
|
||||
@ApiModelProperty(value = "支付渠道")
|
||||
private Integer payChannel;
|
||||
@ApiModelProperty(value = "配送类型", required = true)
|
||||
private Integer deliveryType;
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private LocalDateTime deliveryTime;
|
||||
@ApiModelProperty(value = "收货时间")
|
||||
private LocalDateTime receiveTime;
|
||||
@ApiModelProperty(value = "收件人名称", required = true)
|
||||
private String receiverName;
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String receiverMobile;
|
||||
@ApiModelProperty(value = "地区编码", required = true)
|
||||
private Integer receiverAreaCode;
|
||||
@ApiModelProperty(value = "收件详细地址", required = true)
|
||||
private String receiverDetailAddress;
|
||||
@ApiModelProperty(value = "售后状态", required = true)
|
||||
private Integer afterSaleStatus;
|
||||
@ApiModelProperty(value = "优惠劵编号")
|
||||
private Integer couponCardId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*
|
||||
* // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto
|
||||
*/
|
||||
private List<AppTradeOrderItemRespVO> orderItems;
|
||||
|
||||
|
||||
}
|
|
@ -17,7 +17,10 @@ import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUse
|
|||
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
|
||||
|
@ -174,4 +177,65 @@ public interface TradeOrderConvert {
|
|||
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
MemberUserRespVO convert(MemberUserRespDTO bean);
|
||||
|
||||
default PageResult<AppTradeOrderPageItemRespVO> convertPage02(PageResult<TradeOrderDO> pageResult, List<TradeOrderItemDO> orderItems,
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails) {
|
||||
Map<Long, List<TradeOrderItemDO>> orderItemMap = convertMultiMap(orderItems, TradeOrderItemDO::getOrderId);
|
||||
Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId);
|
||||
// 转化 List
|
||||
List<AppTradeOrderPageItemRespVO> orderVOs = CollectionUtils.convertList(pageResult.getList(), order -> {
|
||||
List<TradeOrderItemDO> xOrderItems = orderItemMap.get(order.getId());
|
||||
AppTradeOrderPageItemRespVO orderVO = convert02(order, xOrderItems);
|
||||
if (CollUtil.isNotEmpty(xOrderItems)) {
|
||||
// 处理商品属性
|
||||
for (int i = 0; i < xOrderItems.size(); i++) {
|
||||
List<TradeOrderItemDO.Property> properties = xOrderItems.get(i).getProperties();
|
||||
if (CollUtil.isEmpty(properties)) {
|
||||
continue;
|
||||
}
|
||||
AppTradeOrderPageItemRespVO.Item item = orderVO.getItems().get(i);
|
||||
item.setProperties(new ArrayList<>(properties.size()));
|
||||
// 遍历每个 properties,设置到 TradeOrderPageItemRespVO.Item 中
|
||||
properties.forEach(property -> {
|
||||
ProductPropertyValueDetailRespDTO propertyValueDetail = propertyValueDetailMap.get(property.getValueId());
|
||||
if (propertyValueDetail == null) {
|
||||
return;
|
||||
}
|
||||
item.getProperties().add(convert02(propertyValueDetail));
|
||||
});
|
||||
}
|
||||
}
|
||||
return orderVO;
|
||||
});
|
||||
return new PageResult<>(orderVOs, pageResult.getTotal());
|
||||
}
|
||||
AppTradeOrderPageItemRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
|
||||
|
||||
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails) {
|
||||
AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems);
|
||||
// 处理商品属性
|
||||
Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId);
|
||||
for (int i = 0; i < orderItems.size(); i++) {
|
||||
List<TradeOrderItemDO.Property> properties = orderItems.get(i).getProperties();
|
||||
if (CollUtil.isEmpty(properties)) {
|
||||
continue;
|
||||
}
|
||||
AppTradeOrderDetailRespVO.Item item = orderVO.getItems().get(i);
|
||||
item.setProperties(new ArrayList<>(properties.size()));
|
||||
// 遍历每个 properties,设置到 TradeOrderPageItemRespVO.Item 中
|
||||
properties.forEach(property -> {
|
||||
ProductPropertyValueDetailRespDTO propertyValueDetail = propertyValueDetailMap.get(property.getValueId());
|
||||
if (propertyValueDetail == null) {
|
||||
return;
|
||||
}
|
||||
item.getProperties().add(convert02(propertyValueDetail));
|
||||
});
|
||||
}
|
||||
// 处理收货地址
|
||||
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
||||
return orderVO;
|
||||
}
|
||||
AppTradeOrderDetailRespVO convert3(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
@ -35,4 +36,11 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
|||
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
|
||||
}
|
||||
|
||||
default PageResult<TradeOrderDO> selectPage(AppTradeOrderPageReqVO reqVO, Long userId) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
||||
.eq(TradeOrderDO::getUserId, userId)
|
||||
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(TradeOrderDO::getId)); // TODO 芋艿:未来不同的 status,不同的排序
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
|
||||
|
@ -74,13 +75,22 @@ public interface TradeOrderService {
|
|||
TradeOrderDO getOrder(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 获得交易订单分页
|
||||
* 【管理员】获得交易订单分页
|
||||
*
|
||||
* @param reqVO 分页请求
|
||||
* @return 交易订单
|
||||
*/
|
||||
PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 【会员】获得交易订单分页
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param reqVO 分页请求
|
||||
* @return 交易订单
|
||||
*/
|
||||
PageResult<TradeOrderDO> getOrderPage(Long userId, AppTradeOrderPageReqVO reqVO);
|
||||
|
||||
// =================== Order Item ===================
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliver
|
|||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO.Item;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
|
@ -450,6 +451,11 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
|||
return tradeOrderMapper.selectPage(reqVO, userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TradeOrderDO> getOrderPage(Long userId, AppTradeOrderPageReqVO reqVO) {
|
||||
return tradeOrderMapper.selectPage(reqVO, userId);
|
||||
}
|
||||
|
||||
// =================== Order Item ===================
|
||||
|
||||
@Override
|
||||
|
|
|
@ -113,7 +113,7 @@ public class SmsSendServiceImpl implements SmsSendService {
|
|||
SmsChannelDO channelDO = smsChannelService.getSmsChannel(channelId);
|
||||
// 短信模板不存在
|
||||
if (channelDO == null) {
|
||||
throw exception(SMS_SEND_TEMPLATE_NOT_EXISTS);
|
||||
throw exception(SMS_CHANNEL_NOT_EXISTS);
|
||||
}
|
||||
return channelDO;
|
||||
}
|
||||
|
|
|
@ -198,20 +198,12 @@ export const constantRoutes = [
|
|||
]
|
||||
},
|
||||
{
|
||||
path: '/order',
|
||||
path: '/trade/order',
|
||||
component: Layout,
|
||||
name: '订单管理',
|
||||
meta: { title: '订单管理' },
|
||||
alwaysShow: true,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '/mall/trade/order',
|
||||
name: '商品订单',
|
||||
meta: { title: '商品订单' },
|
||||
component: (resolve) => require(['@/views/mall/trade/order'], resolve)
|
||||
},
|
||||
{
|
||||
path: '/mall/trade/order/detail',
|
||||
path: 'detail',
|
||||
name: '订单详情',
|
||||
hidden: true,
|
||||
meta: { title: '订单详情' },
|
||||
|
|
|
@ -229,7 +229,7 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
goToDetail (row) {
|
||||
this.$router.push({ path: '/mall/trade/order/detail', query: { id: row.id }})
|
||||
this.$router.push({ path: '/trade/order/detail', query: { id: row.id }})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { http } = uni.$u
|
||||
|
||||
//获得订单交易分页
|
||||
export const getOrderPageData = params => http.get('/trade/order/page', { params })
|
||||
// 获得订单交易分页
|
||||
export const getOrderPage = params => http.get('/trade/order/page', { params })
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getOrderPageData } from '../../api/order'
|
||||
import { getOrderPage } from '../../api/order'
|
||||
|
||||
export default {
|
||||
name: 'order',
|
||||
|
@ -32,23 +32,19 @@ export default {
|
|||
status: '0'
|
||||
},
|
||||
{
|
||||
name: '已付款',
|
||||
name: '待发货',
|
||||
status: '10'
|
||||
},
|
||||
{
|
||||
name: '待发货',
|
||||
name: '待收货',
|
||||
status: '20'
|
||||
},
|
||||
{
|
||||
name: '待收货',
|
||||
name: '已完成',
|
||||
status: '30'
|
||||
},
|
||||
{
|
||||
name: '已完成',
|
||||
status: '40'
|
||||
},
|
||||
{
|
||||
name: '已取消',
|
||||
name: '已取消', // TODO @辰尘:已取消不展示
|
||||
status: '50'
|
||||
}
|
||||
],
|
||||
|
@ -76,7 +72,7 @@ export default {
|
|||
if (status >= 0) {
|
||||
params.orderStatus = status
|
||||
}
|
||||
getOrderPageData(params)
|
||||
getOrderPage(params)
|
||||
.then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue