trade:定义管理后台的订单分页接口

pull/2/head
YunaiV 2022-12-08 00:07:14 +08:00
parent 0b9ddddd18
commit 7fc9689f07
19 changed files with 340 additions and 61 deletions

View File

@ -15,10 +15,9 @@ import java.util.Arrays;
@Getter
public enum TerminalEnum implements IntArrayValuable {
//TODO terminal 重复,请参考 '订单来源终端:[1:小程序 2:H5 3:iOS 4:安卓]'
MINI_PROGRAM(1, "小程序"),
H5(2, "H5"),
IOS(3, "iOS"),
IOS(3, "苹果"),
ANDROID(3, "安卓"),;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TerminalEnum::getTerminal).toArray();

View File

@ -17,12 +17,11 @@ import java.util.Arrays;
@Getter
public enum TradeOrderStatusEnum implements IntArrayValuable {
UNPAID(0, "未付款"),
PAID(10, "已付款"), // 例如说,拼团订单,支付后,需要拼团成功后,才会处于待发货
UNDELIVERED(20, "待发货"),
DELIVERED(30, "已发货"),
COMPLETED(40, "已完成"),
CANCELED(50, "已取消");
UNPAID(0, "待支付"),
UNDELIVERED(10, "待发货"),
DELIVERED(20, "已发货"),
COMPLETED(30, "已完成"),
CANCELED(40, "已取消");
// TODO 芋艿: TAKE("待核验"):虚拟订单需要核验商品
@ -55,16 +54,6 @@ public enum TradeOrderStatusEnum implements IntArrayValuable {
return ObjectUtil.equal(UNPAID.getStatus(), status);
}
/**
*
*
* @param status
* @return
*/
public static boolean isPaid(Integer status) {
return ObjectUtil.equal(PAID.getStatus(), status);
}
/**
*
*
@ -112,7 +101,7 @@ public enum TradeOrderStatusEnum implements IntArrayValuable {
* @return
*/
public static boolean havePaid(Integer status) {
return ObjectUtils.equalsAny(status, PAID.getStatus(), UNDELIVERED.getStatus(),
return ObjectUtils.equalsAny(status, UNDELIVERED.getStatus(),
DELIVERED.getStatus(), COMPLETED.getStatus());
}

View File

@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -73,7 +73,7 @@ public class TradeAfterSaleBaseVO {
private Long skuId;
@ApiModelProperty(value = "规格值数组")
private List<ProductPropertyRespVO> properties;
private List<ProductPropertyValueDetailRespVO> properties;
@ApiModelProperty(value = "商品图片", example = "https://www.iocoder.cn/2.png")
private String picUrl;

View File

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.trade.controller.admin.base.product.property;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("管理后台 - 商品规格 Response VO")
@Data
public class ProductPropertyRespVO {
@ApiModelProperty(value = "属性编号", required = true, example = "1")
private Long propertyId;
@ApiModelProperty(value = "属性值编号", required = true, example = "2")
private Long valueId;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.trade.controller.admin.base.product.property;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("管理后台 - 商品规格 + 规格值的明细 Response VO")
@Data
public class ProductPropertyValueDetailRespVO {
@ApiModelProperty(value = "属性的编号", required = true, example = "1")
private Long propertyId;
@ApiModelProperty(value = "属性的名称", required = true, example = "颜色")
private String propertyName;
@ApiModelProperty(value = "属性值的编号", required = true, example = "1024")
private Long valueId;
@ApiModelProperty(value = "属性值的名称", required = true, example = "红色")
private String valueName;
}

View File

@ -1,18 +1,18 @@
package cn.iocoder.yudao.module.trade.controller.admin.order;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
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.TradeOrderPageItemRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -29,6 +29,14 @@ public class TradeOrderController {
@Resource
private TradeOrderService tradeOrderService;
@GetMapping("/page")
@ApiOperation("获得交易订单分页")
@PreAuthorize("@ss.hasPermission('trade:order:query')")
public CommonResult<PageResult<TradeOrderPageItemRespVO>> getOrderPage(TradeOrderPageReqVO reqVO) {
PageResult<TradeOrderDO> pageResult = tradeOrderService.getOrderPage(reqVO);
return success(null);
}
@PostMapping("/delivery")
@ApiOperation("发货订单")
@PreAuthorize("@ss.hasPermission('trade:order:delivery')")

View File

@ -0,0 +1,142 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class TradeOrderBaseVO {
// ========== 订单基本信息 ==========
@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 = "1", notes = "参见 TerminalEnum 枚举")
private Integer terminal;
@ApiModelProperty(value = "用户编号", required = true, example = "2048")
private Long userId;
@ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1")
private String userIp;
@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 = "取消类型", example = "10", notes = "参见 TradeOrderCancelTypeEnum 枚举")
private Integer cancelType;
@ApiModelProperty(value = "商家备注", example = "你猜一下")
private String remark;
// ========== 价格 + 支付基本信息 ==========
@ApiModelProperty(value = "支付订单编号", required = true, example = "1024")
private Long payOrderId;
@ApiModelProperty(value = "是否已支付", required = true, example = "true")
private Boolean payed;
@ApiModelProperty(value = "付款时间")
private LocalDateTime payTime;
@ApiModelProperty(value = "支付渠道", required = true, example = "wx_lite", notes = "参见 PayChannelEnum 枚举")
private String payChannelCode;
@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 Long deliveryTemplateId;
@ApiModelProperty(value = "发货物流公司编号", example = "1024")
private Long logisticsId;
@ApiModelProperty(value = "发货物流单号", example = "1024")
private String logisticsNo;
@ApiModelProperty(value = "发货状态", required = true, example = "1", notes = "参见 TradeOrderDeliveryStatusEnum 枚举")
private Integer deliveryStatus;
@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 = "100000")
private Integer receiverPostCode;
@ApiModelProperty(value = "收件人详细地址", required = true, example = "中关村大街 1 号")
private String receiverDetailAddress;
// ========== 售后基本信息 ==========
@ApiModelProperty(value = "售后状态", example = "1", notes = "参见 TradeOrderAfterSaleStatusEnum 枚举")
private Integer afterSaleStatus;
@ApiModelProperty(value = "退款金额", required = true, example = "100", notes = "单位:分")
private Integer refundPrice;
// ========== 营销基本信息 ==========
@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;
}

View File

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class TradeOrderItemBaseVO {
// ========== 订单项基本信息 ==========
@ApiModelProperty(value = "编号", required = true, example = "1")
private Long id;
@ApiModelProperty(value = "用户编号", required = true, example = "1")
private Long userId;
@ApiModelProperty(value = "订单编号", required = true, example = "1")
private Long orderId;
// ========== 商品基本信息 ==========
@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;
@ApiModelProperty(value = "商品优惠(总)", required = true, example = "100", notes = "单位:分")
private Integer discountPrice;
@ApiModelProperty(value = "商品实付金额(总)", required = true, example = "100", notes = "单位:分")
private Integer payPrice;
@ApiModelProperty(value = "子订单分摊金额(总)", required = true, example = "100", notes = "单位:分")
private Integer orderPartPrice;
@ApiModelProperty(value = "分摊后子订单实付金额(总)", required = true, example = "100", notes = "单位:分")
private Integer orderDividePrice;
// ========== 营销基本信息 ==========
// TODO 芋艿:在捉摸一下
// ========== 售后基本信息 ==========
@ApiModelProperty(value = "售后状态", required = true, example = "1", notes = "参见 TradeOrderItemAfterSaleStatusEnum 枚举类")
private Integer afterSaleStatus;
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
@ApiModel("管理后台 - 交易订单的分页项 Response VO")
@Data
public class TradeOrderPageItemRespVO {
/**
*
*/
private List<Item> items;
@ApiModel("管理后台 - 交易订单的分页项的订单项目")
@Data
public static class Item extends TradeOrderItemBaseVO {
/**
*
*/
private List<ProductPropertyValueDetailRespVO> properties;
}
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
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;
@ApiModel("管理后台 - 交易订单的分页 Request VO")
@Data
public class TradeOrderPageReqVO {
@ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
@InEnum(value = TradeOrderStatusEnum.class, message = "订单状态必须是 {value}")
private Integer status;
}

View File

@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("用户 App - 规格 + 规格值 Response VO")
@ApiModel("用户 App - 商品规格 + 规格值的明细 Response VO")
@Data
public class AppProductPropertyValueDetailRespVO {

View File

@ -8,8 +8,8 @@ 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.TradeOrderPageReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderRespVO;
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.trade.service.order.TradeOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -65,14 +65,14 @@ public class AppTradeOrderController {
@GetMapping("/get")
@ApiOperation("获得交易订单")
@ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true, dataTypeClass = Long.class)
public CommonResult<TradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
public CommonResult<AppTradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
// return success(tradeOrderService.getTradeOrder(tradeOrderId));
return null;
}
@GetMapping("/page")
@ApiOperation("获得订单交易分页")
public CommonResult<PageResult<TradeOrderRespVO>> pageTradeOrder(TradeOrderPageReqVO pageVO) {
public CommonResult<PageResult<AppTradeOrderRespVO>> pageTradeOrder(AppTradeOrderPageReqVO pageVO) {
// return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO));
return null;
}

View File

@ -6,9 +6,10 @@ import lombok.Data;
import java.time.LocalDateTime;
// TODO 芋艿:字段优化
@ApiModel("交易订单项 Response VO")
@Data
public class TradeOrderItemRespVO {
public class AppTradeOrderItemRespVO {
@ApiModelProperty(value = "id自增长", required = true)
private Integer id;

View File

@ -6,10 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
// TODO 芋艿:字段优化
@ApiModel("交易订单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class TradeOrderPageReqVO extends PageParam {
public class AppTradeOrderPageReqVO extends PageParam {
@ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
private Integer orderStatus;

View File

@ -6,9 +6,10 @@ import io.swagger.annotations.*;
import java.time.LocalDateTime;
import java.util.*;
// TODO 芋艿:字段优化
@ApiModel("订单交易 Response VO")
@Data
public class TradeOrderRespVO {
public class AppTradeOrderRespVO {
@ApiModelProperty(value = "订单编号", required = true)
private Integer id;
@ -66,7 +67,7 @@ public class TradeOrderRespVO {
*
* // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto
*/
private List<TradeOrderItemRespVO> orderItems;
private List<AppTradeOrderItemRespVO> orderItems;
}

View File

@ -47,7 +47,7 @@ public class TradeOrderDO extends BaseDO {
*/
private Integer type; // TODO order_promotion_type
/**
*
*
*
* {@link TerminalEnum}
*/
@ -97,6 +97,10 @@ public class TradeOrderDO extends BaseDO {
// ========== 价格 + 支付基本信息 ==========
// 价格文档 - 淘宝https://open.taobao.com/docV3.htm?docId=108471&docType=1
// 价格文档 - 京东到家https://openo2o.jddj.com/api/getApiDetail/182/4d1494c5e7ac4679bfdaaed950c5bc7f.htm
// 价格文档 - 有赞https://doc.youzanyun.com/detail/API/0/906
/**
*
*
@ -115,17 +119,12 @@ public class TradeOrderDO extends BaseDO {
*/
private LocalDateTime payTime;
/**
*
*
*
* PayChannelEnum
*/
private String payChannelCode;
// ========== 价格 + 支付基本信息 ==========
// 价格文档 - 淘宝https://open.taobao.com/docV3.htm?docId=108471&docType=1
// 价格文档 - 京东到家https://openo2o.jddj.com/api/getApiDetail/182/4d1494c5e7ac4679bfdaaed950c5bc7f.htm
// 价格文档 - 有赞https://doc.youzanyun.com/detail/API/0/906
/**
*
*
@ -222,7 +221,7 @@ public class TradeOrderDO extends BaseDO {
*/
private String receiverDetailAddress;
// ========== 退款基本信息 ==========
// ========== 售后基本信息 ==========
/**
*
*

View File

@ -140,7 +140,7 @@ public class TradeOrderItemDO extends BaseDO {
// TODO 芋艿:在捉摸一下
// ========== 退款基本信息 ==========
// ========== 售后基本信息 ==========
/**
*
*

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.trade.service.order;
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.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
@ -58,6 +60,14 @@ public interface TradeOrderService {
*/
TradeOrderDO getOrder(Long userId, Long id);
/**
*
*
* @param reqVO
* @return
*/
PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO);
// =================== Order Item ===================
/**

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.member.api.address.AddressApi;
@ -25,6 +26,7 @@ import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
import cn.iocoder.yudao.module.promotion.api.price.PriceApi;
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO;
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.AppTradeOrderCreateReqVO.Item;
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
@ -419,6 +421,11 @@ public class TradeOrderServiceImpl implements TradeOrderService {
return order;
}
@Override
public PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO) {
return null;
}
// =================== Order Item ===================
@Override