订单详情接口调整
This commit is contained in:
@@ -17,17 +17,15 @@ import java.util.Arrays;
|
||||
@Getter
|
||||
public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
UNPAID(0, "待支付"),
|
||||
UNDELIVERED(10, "待发货"),
|
||||
DELIVERED(20, "已发货"),
|
||||
COMPLETED(30, "已完成"),
|
||||
CANCELED(40, "已取消"),
|
||||
|
||||
WAITPAID(100, "等待付款"),
|
||||
WAITCONFIRM(110, "等待确定"),
|
||||
WAITSERVE(120, "等待服务"),
|
||||
WAITACCEPT(130, "等待验收"),
|
||||
SERVECANCELED(140, "取消服务");
|
||||
WAITPAID(10, "等待付款"),
|
||||
WAITCONFIRM(20, "等待确定"),
|
||||
WAITSERVE(30, "等待服务"),
|
||||
WAITACCEPT(40, "等待验收"),
|
||||
COMPLETED(50, "已完成"),
|
||||
CANCELED(60, "已取消"),
|
||||
DELIVERED(70, "已退款"),
|
||||
WAITDELIVERED(80, "待发货"),
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(TradeOrderStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
@@ -55,7 +53,7 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isUnpaid(Integer status) {
|
||||
return ObjectUtil.equal(UNPAID.getStatus(), status);
|
||||
return ObjectUtil.equal(WAITPAID.getStatus(), status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +63,7 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isUndelivered(Integer status) {
|
||||
return ObjectUtil.equal(UNDELIVERED.getStatus(), status);
|
||||
return ObjectUtil.equal(WAITDELIVERED.getStatus(), status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +103,7 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean havePaid(Integer status) {
|
||||
return ObjectUtils.equalsAny(status, UNDELIVERED.getStatus(),
|
||||
return ObjectUtils.equalsAny(status, WAITCONFIRM.getStatus(),
|
||||
DELIVERED.getStatus(), COMPLETED.getStatus());
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +196,15 @@ public class LocalDateTimeUtils {
|
||||
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取day 天后的日期
|
||||
*
|
||||
* @return 昨天
|
||||
*/
|
||||
public static LocalDateTime getPlusDay(Integer day) {
|
||||
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().plusDays(day));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本月的开始时间
|
||||
*
|
||||
|
||||
@@ -29,14 +29,13 @@ import static com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils.wri
|
||||
@RequestMapping("/infra/file")
|
||||
@Validated
|
||||
@Slf4j
|
||||
@PermitAll
|
||||
public class FileController {
|
||||
|
||||
@Resource private FileService fileService;
|
||||
|
||||
/** 上传文件", description = "模式一:后端上传文件 */
|
||||
@PostMapping("/upload")
|
||||
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception {
|
||||
public CommonResult<String> uploadFile(@Valid FileUploadReqVO uploadReqVO) throws Exception {
|
||||
MultipartFile file = uploadReqVO.getFile();
|
||||
String path = uploadReqVO.getPath();
|
||||
return success(
|
||||
|
||||
@@ -7,10 +7,10 @@ spring:
|
||||
username: nacos # Nacos 账号
|
||||
password: nacos # Nacos 密码
|
||||
discovery: # 【配置中心】配置项
|
||||
namespace: 16bd40df-7cc7-4c2c-82c2-6186ade7bb08 # 命名空间。这里使用 dev 开发环境
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
config: # 【注册中心】配置项
|
||||
namespace: 16bd40df-7cc7-4c2c-82c2-6186ade7bb08 # 命名空间。这里使用 dev 开发环境
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
|
||||
@@ -2,6 +2,12 @@ package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||
|
||||
// 移除Swagger相关导入
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.tashow.cloud.common.enums.TerminalEnum;
|
||||
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||
import com.tashow.cloud.common.validation.InEnum;
|
||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderStatusEnum;
|
||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -15,17 +21,27 @@ public class TradeOrderBaseVO {
|
||||
// 订单编号
|
||||
private Long id;
|
||||
|
||||
// 订单流水号
|
||||
// 订单编号
|
||||
private String orderNum;
|
||||
|
||||
// 下单时间
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 订单类型
|
||||
* {@link TradeOrderTypeEnum#getType()}
|
||||
*/
|
||||
private Integer orderType;
|
||||
|
||||
// 订单类目
|
||||
private String orderCategoryName;
|
||||
|
||||
// 订单来源
|
||||
/**
|
||||
* 订单来源
|
||||
* {@link TerminalEnum#getTerminal()}
|
||||
*/
|
||||
@InEnum(TerminalEnum.class)
|
||||
private Integer orderTerminal;
|
||||
/**
|
||||
* 订单状态
|
||||
* {@link TradeOrderStatusEnum#getStatus()}
|
||||
*/
|
||||
@InEnum(TradeOrderStatusEnum.class)
|
||||
private Integer orderStatus;
|
||||
|
||||
// 用户编号
|
||||
private Long userId;
|
||||
@@ -37,35 +53,14 @@ public class TradeOrderBaseVO {
|
||||
private String userAvatar;
|
||||
//用户手机号
|
||||
private String userMobile;
|
||||
// 订单状态
|
||||
private Integer orderStatus;
|
||||
|
||||
//商品图片
|
||||
private String picUrl;
|
||||
//商品名称
|
||||
private String spuName;
|
||||
//商品规格
|
||||
private String skuName;
|
||||
// 购买的商品数量
|
||||
private Integer count;
|
||||
// 单价
|
||||
private Integer price;
|
||||
//到手价
|
||||
private Integer handedPrice;
|
||||
//实付金额
|
||||
private Integer payPrice;
|
||||
// 单位
|
||||
private String unit;
|
||||
|
||||
//预约时间
|
||||
private String subTime;
|
||||
//服务地址
|
||||
private String serveAddress;
|
||||
// 用户备注 - 必填,示例:你猜
|
||||
private String userRemark;
|
||||
//支付方式
|
||||
private String payType;
|
||||
//财务状态
|
||||
private String financeStatus;
|
||||
|
||||
// 下单时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
// 订单完成时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,336 +2,116 @@ package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||
|
||||
// 移除Swagger相关导入
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// 管理后台 - 交易订单的详情 Response VO
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeOrderDetailRespVO {
|
||||
public class TradeOrderDetailRespVO {
|
||||
|
||||
//基本信息
|
||||
private TradeOrderBaseInfo tradeOrderInfoBase;
|
||||
//商品信息
|
||||
private TradeProductInfo tradeProductInfo;
|
||||
//服务信息
|
||||
private TradeServeInfo tradeServeInfo;
|
||||
//扩展服务信息
|
||||
private TradeExtendServeInfo tradeExtendServeInfo;
|
||||
//附加费信息
|
||||
private TradeExtendCostInfo tradeExtendCostInfo;
|
||||
//订单类目id
|
||||
private Long orderCategoryId;
|
||||
//订单类目名称
|
||||
private String orderCategoryName;
|
||||
|
||||
//取消原因
|
||||
private String cancelReason;
|
||||
//商家备注
|
||||
private String merchantRemark;
|
||||
//退款时间
|
||||
private LocalDateTime refundTime;
|
||||
//保障时间
|
||||
private LocalDateTime propertyTime;
|
||||
//保障状态
|
||||
private Integer propertyStatus;
|
||||
//优惠金额
|
||||
private Integer discountPrice;
|
||||
//退款金额
|
||||
private Integer refundPrice;
|
||||
//实收金额
|
||||
private Integer livePrice;
|
||||
//支付渠道 (线上线下)
|
||||
private String payChannelCode;
|
||||
//交易流水号
|
||||
private String payOrderId;
|
||||
//支付时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime payTime;
|
||||
//取消时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime cancelTime;
|
||||
//订单状态流转记录
|
||||
List<TradeOrderStatusRespVo> statusList;
|
||||
//商品列表
|
||||
private List<Item> items;
|
||||
|
||||
//服务信息(order_serve_info配置)
|
||||
private JSONArray tradeServeInfo;
|
||||
//扩展服务信息(order_serve_info配置)
|
||||
private JSONArray tradeExtendServeInfo;
|
||||
//附加费信息(order_serve_info配置)
|
||||
private JSONArray tradeExtendCostInfo;
|
||||
|
||||
/**
|
||||
* 订单基本信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class TradeOrderBaseInfo{
|
||||
//订单id
|
||||
private String id;
|
||||
//订单编号
|
||||
private String orderNo;
|
||||
//订单状态
|
||||
private String orderStatus;
|
||||
//订单类型
|
||||
private String orderType;
|
||||
//订单类目
|
||||
private String orderCategoryNameAndId;
|
||||
//订单来源
|
||||
private String orderTerminal;
|
||||
//用户信息
|
||||
private String userInfo;
|
||||
//用户头像
|
||||
private String userAvatar;
|
||||
public static class Item {
|
||||
|
||||
//取消时间
|
||||
private String cancelTime;
|
||||
//取消原因
|
||||
private String cancelReason;
|
||||
//商家备注
|
||||
private String merchantRemark;
|
||||
|
||||
//退款时间
|
||||
private String refundTime;
|
||||
|
||||
//保障时间
|
||||
private String propertyTime;
|
||||
//保障状态
|
||||
private String propertyStatus;
|
||||
|
||||
//订单总价
|
||||
private Integer price;
|
||||
//优惠金额
|
||||
private Integer discountPrice;
|
||||
//实付金额
|
||||
private Integer payPrice;
|
||||
//退款金额
|
||||
private Integer refundPrice;
|
||||
//实收金额
|
||||
private Integer livePrice;
|
||||
|
||||
//支付方式(支付宝微信)
|
||||
private String payType;
|
||||
//支付渠道 (线上线下)
|
||||
private String payChannelCode;
|
||||
//交易流水号
|
||||
private String payOrderId;
|
||||
//支付时间
|
||||
private LocalDateTime payTime;
|
||||
|
||||
//创建时间
|
||||
private LocalDateTime createTime;
|
||||
//完成时间
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
}
|
||||
/**
|
||||
* 商品信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeProductInfo{
|
||||
|
||||
//店铺log
|
||||
private String shopLogoUrl;
|
||||
//店铺名称
|
||||
private Long id;
|
||||
//店铺名称
|
||||
private String shopName;
|
||||
//店铺logo
|
||||
private String shopLogo;
|
||||
|
||||
//商品id
|
||||
private Long spuId;
|
||||
//skuid
|
||||
//skuId
|
||||
private Long skuId;
|
||||
//商品图片
|
||||
private String picUrl;
|
||||
|
||||
//商品规格图
|
||||
private String skuPicUrl;
|
||||
//商品名称
|
||||
private String spuName;
|
||||
//商品规格
|
||||
private String skuName;
|
||||
//购买数量
|
||||
private Integer count;
|
||||
//商品单价
|
||||
private Integer price;
|
||||
//商品单位
|
||||
private String unit;
|
||||
//到手价(单价 - 优惠)
|
||||
private Integer handedPrice;
|
||||
//成本价
|
||||
private Integer expensePrice;
|
||||
//保障
|
||||
private List<String> properties;
|
||||
//服务内容
|
||||
private String serveContent;
|
||||
//订单类目id
|
||||
private Long orderCategoryId;
|
||||
//订单类目名称
|
||||
private String orderCategoryName;
|
||||
|
||||
|
||||
// 购买的商品数量
|
||||
private Integer count;
|
||||
// 订单总价
|
||||
private Integer price;
|
||||
// 单位
|
||||
private String unit;
|
||||
//商品总价
|
||||
private Integer totalPrice;
|
||||
//优惠金额
|
||||
private Integer discountPrice;
|
||||
//实付金额
|
||||
private Integer payPrice;
|
||||
|
||||
//累计退款金额
|
||||
private Integer refundPrice;
|
||||
//累计退款数量
|
||||
private Integer refundCount;
|
||||
//到手价
|
||||
private Integer handedPrice;
|
||||
//成本价
|
||||
private Integer expensePrice;
|
||||
|
||||
}
|
||||
//服务保障列表
|
||||
private String properties;
|
||||
//服务内容
|
||||
private String serveContent;
|
||||
|
||||
|
||||
/**
|
||||
* 服务信息(殡葬专属字段)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeServeInfo{
|
||||
// 内部存储动态属性的 Map,键为属性名称,值为属性值
|
||||
private Map<String, Object> properties;
|
||||
/**
|
||||
* 构造方法:初始化动态属性 Map
|
||||
*/
|
||||
public TradeServeInfo() {
|
||||
properties = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* setProperty 方法:添加或更新指定属性
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @param value 属性值
|
||||
*/
|
||||
public void setProperty(String key, Object value) {
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("属性名称不能为 null");
|
||||
}
|
||||
properties.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getProperty 方法:获取指定属性的值
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @return 属性值;若不存在则返回 null
|
||||
*/
|
||||
public Object getProperty(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* removeProperty 方法:删除指定属性
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @return 删除的属性值;若属性不存在则返回 null
|
||||
*/
|
||||
public Object removeProperty(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* getProperties 方法:返回所有动态属性的 Map
|
||||
*
|
||||
* @return 内部存储属性的 Map
|
||||
*/
|
||||
public Map<String, Object> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务信息(殡葬专属字段)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeExtendServeInfo{
|
||||
// 内部存储动态属性的 Map,键为属性名称,值为属性值
|
||||
private Map<String, Object> properties;
|
||||
/**
|
||||
* 构造方法:初始化动态属性 Map
|
||||
*/
|
||||
public TradeExtendServeInfo() {
|
||||
properties = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* setProperty 方法:添加或更新指定属性
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @param value 属性值
|
||||
*/
|
||||
public void setProperty(String key, Object value) {
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("属性名称不能为 null");
|
||||
}
|
||||
properties.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getProperty 方法:获取指定属性的值
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @return 属性值;若不存在则返回 null
|
||||
*/
|
||||
public Object getProperty(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* removeProperty 方法:删除指定属性
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @return 删除的属性值;若属性不存在则返回 null
|
||||
*/
|
||||
public Object removeProperty(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* getProperties 方法:返回所有动态属性的 Map
|
||||
*
|
||||
* @return 内部存储属性的 Map
|
||||
*/
|
||||
public Map<String, Object> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 服务信息(殡葬专属字段)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TradeExtendCostInfo{
|
||||
// 内部存储动态属性的 Map,键为属性名称,值为属性值
|
||||
private Map<String, Object> properties;
|
||||
/**
|
||||
* 构造方法:初始化动态属性 Map
|
||||
*/
|
||||
public TradeExtendCostInfo() {
|
||||
properties = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* setProperty 方法:添加或更新指定属性
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @param value 属性值
|
||||
*/
|
||||
public void setProperty(String key, Object value) {
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("属性名称不能为 null");
|
||||
}
|
||||
properties.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* getProperty 方法:获取指定属性的值
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @return 属性值;若不存在则返回 null
|
||||
*/
|
||||
public Object getProperty(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* removeProperty 方法:删除指定属性
|
||||
*
|
||||
* @param key 属性名称
|
||||
* @return 删除的属性值;若属性不存在则返回 null
|
||||
*/
|
||||
public Object removeProperty(String key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return properties.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* getProperties 方法:返回所有动态属性的 Map
|
||||
*
|
||||
* @return 内部存储属性的 Map
|
||||
*/
|
||||
public Map<String, Object> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||
|
||||
// 移除Swagger相关导入
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,60 +9,7 @@ import lombok.Data;
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class TradeOrderItemBaseVO {
|
||||
public class TradeOrderItemBaseVO extends TradeOrderBaseVO{
|
||||
|
||||
// ========== 订单项基本信息 ==========
|
||||
|
||||
// 编号 - 必填,示例:1
|
||||
private Long id;
|
||||
|
||||
// 用户编号 - 必填,示例:1
|
||||
private Long userId;
|
||||
|
||||
// 订单编号 - 必填,示例:1
|
||||
private Long orderId;
|
||||
|
||||
// ========== 商品基本信息 ==========
|
||||
|
||||
// 商品 SPU 编号 - 必填,示例:1
|
||||
private Long spuId;
|
||||
|
||||
// 商品 SPU 名称 - 必填,示例:芋道源码
|
||||
private String spuName;
|
||||
|
||||
// 商品 SKU 编号 - 必填,示例:1
|
||||
private Long skuId;
|
||||
|
||||
// 商品图片 - 必填,示例:https://www.iocoder.cn/1.png
|
||||
private String picUrl;
|
||||
|
||||
// 购买数量 - 必填,示例:1
|
||||
private Integer count;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
// 商品原价(单) - 必填,示例:100
|
||||
private Integer price;
|
||||
|
||||
// 商品优惠(总) - 必填,示例:100
|
||||
private Integer discountPrice;
|
||||
|
||||
// 商品实付金额(总) - 必填,示例:100
|
||||
private Integer payPrice;
|
||||
|
||||
// 子订单分摊金额(总) - 必填,示例:100
|
||||
private Integer orderPartPrice;
|
||||
|
||||
// 分摊后子订单实付金额(总) - 必填,示例:100
|
||||
private Integer orderDividePrice;
|
||||
|
||||
// ========== 营销基本信息 ==========
|
||||
|
||||
// TODO 芋艿:在捉摸一下
|
||||
|
||||
// ========== 售后基本信息 ==========
|
||||
|
||||
// 售后状态 - 必填,示例:1
|
||||
private Integer afterSaleStatus;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,52 @@
|
||||
package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
// 管理后台 - 交易订单的分页项 Response VO
|
||||
@Data
|
||||
public class TradeOrderPageRespVO extends TradeOrderBaseVO {
|
||||
|
||||
//订单项列表
|
||||
private List<Item> items;
|
||||
//店铺名称
|
||||
private String shopName;
|
||||
//店铺log
|
||||
private String shopLogo;
|
||||
//支付剩余时间
|
||||
private String payLastTime;
|
||||
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
//商品图片
|
||||
private String picUrl;
|
||||
//商品名称
|
||||
private String spuName;
|
||||
//商品规格
|
||||
private String skuName;
|
||||
// 购买的商品数量
|
||||
private Integer count;
|
||||
// 订单总价
|
||||
private Integer price;
|
||||
// 订单总价
|
||||
private Integer discountPrice;
|
||||
//到手价
|
||||
private Integer handedPrice;
|
||||
//实付金额
|
||||
private Integer payPrice;
|
||||
// 单位
|
||||
private String unit;
|
||||
//预约时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime subTime;
|
||||
//服务地址
|
||||
private String serveAddress;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||
|
||||
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderOperateTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TradeOrderStatusRespVo {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 订单号
|
||||
*
|
||||
* 关联 {@link TradeOrderDO#getId()}
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 操作前状态
|
||||
*/
|
||||
private Integer beforeStatus;
|
||||
/**
|
||||
* 操作后状态
|
||||
*/
|
||||
private Integer afterStatus;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
*
|
||||
* {@link TradeOrderOperateTypeEnum}
|
||||
*/
|
||||
private Integer operateType;
|
||||
/**
|
||||
* 订单日志信息
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 订单日志信息
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -137,12 +137,12 @@ public class AppTradeOrderController {
|
||||
Map<String, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(5);
|
||||
// 全部
|
||||
orderCount.put("allCount", tradeOrderQueryService.getOrderCount(getLoginUserId(), null, null));
|
||||
// 待付款(未支付)
|
||||
orderCount.put("unpaidCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||
TradeOrderStatusEnum.UNPAID.getStatus(), null));
|
||||
// 待发货
|
||||
orderCount.put("undeliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||
TradeOrderStatusEnum.UNDELIVERED.getStatus(), null));
|
||||
// // 待付款(未支付)
|
||||
// orderCount.put("unpaidCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||
// TradeOrderStatusEnum.UNPAID.getStatus(), null));
|
||||
// // 待发货
|
||||
// orderCount.put("undeliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||
// TradeOrderStatusEnum.UNDELIVERED.getStatus(), null));
|
||||
// 待收货
|
||||
orderCount.put("deliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||
TradeOrderStatusEnum.DELIVERED.getStatus(), null));
|
||||
|
||||
@@ -30,6 +30,7 @@ public interface AfterSaleConvert {
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "id", ignore = true),
|
||||
@Mapping(target = "refundPrice", ignore = true),
|
||||
@Mapping(target = "createTime", ignore = true),
|
||||
@Mapping(target = "updateTime", ignore = true),
|
||||
@Mapping(target = "creator", ignore = true),
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.tashow.cloud.trade.convert.order;
|
||||
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.util.collection.CollectionUtils;
|
||||
import com.tashow.cloud.common.util.date.LocalDateTimeUtils;
|
||||
import com.tashow.cloud.common.util.ip.AreaUtils;
|
||||
import com.tashow.cloud.common.util.string.StrUtils;
|
||||
import com.tashow.cloud.excel.dict.core.DictFrameworkUtils;
|
||||
@@ -25,19 +28,23 @@ import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderLogDO;
|
||||
import com.tashow.cloud.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
|
||||
import com.tashow.cloud.trade.framework.order.config.TradeOrderProperties;
|
||||
import com.tashow.cloud.trade.framework.order.core.utils.TransOrderByTempUtils;
|
||||
import com.tashow.cloud.trade.service.brokerage.bo.BrokerageAddReqBO;
|
||||
import com.tashow.cloud.trade.service.price.bo.TradePriceCalculateReqBO;
|
||||
import com.tashow.cloud.trade.service.price.bo.TradePriceCalculateRespBO;
|
||||
import com.tashow.cloud.tradeapi.api.order.dto.TradeOrderRespDTO;
|
||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderStatusEnum;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.tashow.cloud.common.util.collection.CollectionUtils.convertMap;
|
||||
import static com.tashow.cloud.common.util.collection.CollectionUtils.convertMultiMap;
|
||||
@@ -50,15 +57,16 @@ public interface TradeOrderConvert {
|
||||
TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class);
|
||||
|
||||
//region 分页结果
|
||||
|
||||
default PageResult<TradeOrderPageRespVO> convertPage(PageResult<TradeOrderDO> pageResult, List<TradeOrderItemDO> orderItems) {
|
||||
Map<Long, TradeOrderItemDO> orderItemMap = convertMap(orderItems, TradeOrderItemDO::getOrderId);
|
||||
Map<Long, List<TradeOrderItemDO>> orderItemMap = convertMultiMap(orderItems, TradeOrderItemDO::getOrderId);
|
||||
// 转化 List
|
||||
List<TradeOrderPageRespVO> orderVOs = CollectionUtils.convertList(pageResult.getList(), order -> {
|
||||
TradeOrderItemDO itemDO = orderItemMap.get(order.getId());
|
||||
TradeOrderPageRespVO orderVO = convert(order, itemDO);
|
||||
orderVO.setHandedPrice(itemDO.getPrice()-itemDO.getDiscountPrice());
|
||||
return orderVO;
|
||||
List<TradeOrderItemDO> itemDO = orderItemMap.get(order.getId());
|
||||
TradeOrderPageRespVO orderPageRespVO = convert(order, itemDO);
|
||||
orderPageRespVO.getItems().stream().forEach(item -> {
|
||||
item.setHandedPrice(item.getPrice() - item.getDiscountPrice());
|
||||
});
|
||||
return orderPageRespVO;
|
||||
});
|
||||
return new PageResult<>(orderVOs, pageResult.getTotal());
|
||||
}
|
||||
@@ -66,29 +74,66 @@ public interface TradeOrderConvert {
|
||||
@Mappings({
|
||||
@Mapping(source = "order.id", target = "id"),
|
||||
@Mapping(source = "order.userId", target = "userId"),
|
||||
@Mapping(source = "items.createTime", target = "createTime"),
|
||||
@Mapping(source = "items.price", target = "price"),
|
||||
@Mapping(source = "items.payPrice", target = "payPrice"),
|
||||
})
|
||||
TradeOrderPageRespVO convert(TradeOrderDO order, TradeOrderItemDO items);
|
||||
TradeOrderPageRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
//endregion
|
||||
|
||||
//region 订单详情
|
||||
default TradeOrderDetailRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, List<TradeOrderLogDO> orderLogs) {
|
||||
//订单基本信息
|
||||
TradeOrderDetailRespVO orderVO = convert2(order, orderItems, orderLogs);
|
||||
//计算商品到手价
|
||||
|
||||
default TradeOrderDetailRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,List<TradeOrderLogDO> orderLogs) {
|
||||
//
|
||||
TradeOrderDetailRespVO orderVO = convert2(order, orderItems);
|
||||
orderVO.getItems().stream().forEach(item -> {
|
||||
item.setHandedPrice(item.getPrice() - item.getDiscountPrice());
|
||||
item.setTotalPrice(item.getPrice() * item.getCount() - item.getDiscountPrice());
|
||||
|
||||
//产品类目在订单详情里
|
||||
orderVO.setOrderCategoryId(item.getOrderCategoryId());
|
||||
orderVO.setOrderCategoryName(item.getOrderCategoryName());
|
||||
|
||||
//todo 服务保障列表 properties 服务内容 serveContent
|
||||
|
||||
//转换
|
||||
});
|
||||
//转换服务信息
|
||||
orderItems.stream().filter(a -> StrUtil.isNotBlank(a.getServeInfo()))
|
||||
.findAny()
|
||||
.ifPresent(orderItem -> {
|
||||
JSONObject transResult = TransOrderByTempUtils.trans(orderItem);
|
||||
//服务信息(order_serve_info配置)
|
||||
orderVO.setTradeServeInfo(transResult.getJSONArray("serveInfo"));
|
||||
//可选服务 //扩展服务信息(order_serve_info配置)
|
||||
orderVO.setTradeExtendServeInfo(transResult.getJSONArray("selectedServeInfo"));
|
||||
//服务附加费 //附加费信息(order_serve_info配置)
|
||||
orderVO.setTradeExtendCostInfo(transResult.getJSONArray("priceExtInfo"));
|
||||
});
|
||||
|
||||
//保障时间 保障状态 如果状态是已完成 则
|
||||
if (Objects.equals(order.getOrderStatus(), TradeOrderStatusEnum.COMPLETED.getStatus())) {
|
||||
LocalDateTime finishTime = order.getFinishTime();
|
||||
Long between = LocalDateTimeUtils.between(finishTime);
|
||||
|
||||
orderVO.setPropertyStatus(between >= 7 ? 0 : 1);
|
||||
orderVO.setPropertyTime(LocalDateTimeUtils.getPlusDay(7));
|
||||
}
|
||||
return orderVO;
|
||||
}
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "order", target = "tradeOrderInfoBase"),
|
||||
})
|
||||
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
@Mappings({
|
||||
@Mapping(source = "items", target = "tradeOrderInfoBase"),
|
||||
})
|
||||
TradeOrderDetailRespVO convert3(TradeOrderItemDO items);
|
||||
// @Mappings(
|
||||
// @Mapping(target ="items.tradeServeInfo", source = "tradeServeInfo",qualifiedByName = "jsonToMap")
|
||||
// )
|
||||
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items, List<TradeOrderLogDO> statusList);
|
||||
|
||||
@Named("jsonToMap")
|
||||
default Map<String, Object> jsonToMap(String json) {
|
||||
try {
|
||||
return new ObjectMapper().readValue(json, Map.class);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("json转换map出错", e);
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
@Mappings({
|
||||
@@ -141,15 +186,6 @@ public interface TradeOrderConvert {
|
||||
return createReqDTO;
|
||||
}
|
||||
|
||||
|
||||
// ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
|
||||
|
||||
|
||||
|
||||
List<TradeOrderDetailRespVO> convertList03(List<TradeOrderLogDO> orderLogs);
|
||||
|
||||
|
||||
|
||||
MemberUserRespVO convert(MemberUserRespDTO bean);
|
||||
|
||||
default PageResult<AppTradeOrderPageItemRespVO> convertPage02(PageResult<TradeOrderDO> pageResult,
|
||||
@@ -165,8 +201,6 @@ public interface TradeOrderConvert {
|
||||
|
||||
AppTradeOrderPageItemRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
|
||||
// AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
|
||||
|
||||
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||
TradeOrderProperties tradeOrderProperties,
|
||||
DeliveryExpressDO express) {
|
||||
@@ -198,10 +232,6 @@ public interface TradeOrderConvert {
|
||||
@Mapping(target = "anonymous", source = "createReqVO.anonymous"),
|
||||
@Mapping(target = "userId", source = "tradeOrderItemDO.userId")
|
||||
})
|
||||
// ProductCommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO, TradeOrderItemDO tradeOrderItemDO);
|
||||
//
|
||||
// TradePriceCalculateReqBO convert(AppTradeOrderSettlementReqVO settlementReqVO);
|
||||
//
|
||||
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
|
||||
List<CartDO> cartList) {
|
||||
TradePriceCalculateReqBO reqBO = new TradePriceCalculateReqBO().setUserId(userId)
|
||||
@@ -268,7 +298,4 @@ public interface TradeOrderConvert {
|
||||
return bo;
|
||||
}
|
||||
|
||||
@Named("convertList04")
|
||||
List<TradeOrderRespDTO> convertList04(List<TradeOrderDO> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -32,14 +32,7 @@ public class TradeOrderDO extends BaseDO {
|
||||
* 订单流水号
|
||||
*/
|
||||
private String orderNum;
|
||||
/**
|
||||
* 订单类目id
|
||||
*/
|
||||
private Long orderCategoryId;
|
||||
/**
|
||||
* 订单类目名称
|
||||
*/
|
||||
private String orderCategoryName;
|
||||
|
||||
/**
|
||||
* 订单类型 (枚举 TradeOrderTypeEnum)
|
||||
*/
|
||||
@@ -112,14 +105,7 @@ public class TradeOrderDO extends BaseDO {
|
||||
* 实收金额(总),单位:分
|
||||
*/
|
||||
private Integer livePrice;
|
||||
/**
|
||||
* 预约类型(1预约 2 加急)
|
||||
*/
|
||||
private Boolean subType;
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private LocalDateTime subTime;
|
||||
|
||||
/**
|
||||
* 支付订单编号
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,22 @@ public class TradeOrderItemDO extends BaseDO {
|
||||
* 商品 SKU 名称
|
||||
*/
|
||||
private String skuName;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
private String shopName;
|
||||
/**
|
||||
* 订单类目id
|
||||
*/
|
||||
private Long orderCategoryId;
|
||||
/**
|
||||
* 订单类目名称
|
||||
*/
|
||||
private String orderCategoryName;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
@@ -100,11 +116,36 @@ public class TradeOrderItemDO extends BaseDO {
|
||||
* 实收金额(总),单位:分
|
||||
*/
|
||||
private Integer livePrice;
|
||||
/**
|
||||
* 退款金额(总),单位:分
|
||||
*/
|
||||
private Integer refundPrice;
|
||||
/**
|
||||
* 退款状态
|
||||
*/
|
||||
private Integer refundStatus;
|
||||
/**
|
||||
* 退款时间
|
||||
*/
|
||||
private LocalDateTime refundTime;
|
||||
/**
|
||||
* 预约类型(1预约 2 加急)
|
||||
*/
|
||||
private Boolean subType;
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private LocalDateTime subTime;
|
||||
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
private LocalDateTime serveAddress;
|
||||
private String serveAddress;
|
||||
|
||||
/**
|
||||
* 服务内容
|
||||
*/
|
||||
private String serveContent;
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
|
||||
@@ -32,12 +32,9 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
||||
.likeIfPresent(TradeOrderDO::getMerchantName, reqVO.getMerchantName())
|
||||
.eqIfPresent(TradeOrderDO::getOrderCategoryId, reqVO.getOrderCategoryId())
|
||||
.eqIfPresent(TradeOrderDO::getOrderTerminal, reqVO.getOrderTerminal())
|
||||
.eqIfPresent(TradeOrderDO::getFinanceStatus, reqVO.getFinanceStatus())
|
||||
.eqIfPresent(TradeOrderDO::getAfterSaleStatus, reqVO.getAfterSaleStatus())
|
||||
.eqIfPresent(TradeOrderDO::getSubType, reqVO.getSubType())
|
||||
.betweenIfPresent(TradeOrderDO::getSubTime, reqVO.getSubTime())
|
||||
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||
.and(StrUtil.isNotBlank(reqVO.getProdSearch()),
|
||||
qw->qw.like(TradeOrderDO::getOrderNum, reqVO.getProdSearch())
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.tashow.cloud.trade.framework.order.core.utils;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tashow.cloud.common.util.json.JsonUtils;
|
||||
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TransOrderByTempUtils {
|
||||
|
||||
private final static String tempUrl = "temp/order_serve_info.json";
|
||||
|
||||
|
||||
public static JSONObject trans(TradeOrderItemDO item) {
|
||||
JSONObject result = new JSONObject();
|
||||
String json = ResourceUtil.readUtf8Str(tempUrl);
|
||||
//解析json
|
||||
JSONObject orderInfo = JSON.parseObject(json);
|
||||
JSONArray serveInfoTempObj = orderInfo.getJSONArray("serveInfo");
|
||||
JSONArray serveExtInfoTempObj = orderInfo.getJSONArray("selectedServeInfo");
|
||||
JSONArray priceExtInfoTempObj = orderInfo.getJSONArray("priceExtInfo");
|
||||
//获取服务信息
|
||||
result.put("serveInfo", getServeInfo(serveInfoTempObj, item.getServeInfo()));
|
||||
//可选服务
|
||||
result.put("selectedServeInfo", getServeInfo(serveExtInfoTempObj, item.getServeExtInfo()));
|
||||
//服务附加费
|
||||
result.put("priceExtInfo", getServeInfo(priceExtInfoTempObj, item.getPriceExtInfo()));
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<List<JSONObject>> getServeInfo(JSONArray tempObj, String valueInfo) {
|
||||
List<List<JSONObject>> result = new ArrayList<>();
|
||||
//数据json [{},{}]
|
||||
JSONArray valueInfoObj = JSON.parseArray(valueInfo);
|
||||
for (Object val : valueInfoObj) {
|
||||
List<JSONObject> valResult = new ArrayList<>();
|
||||
Map valMap = JsonUtils.parseObject(val.toString(), Map.class);
|
||||
if (valMap == null) {
|
||||
continue;
|
||||
}
|
||||
//模版json
|
||||
for (Object tem : tempObj) {
|
||||
JSONObject resultMap = new JSONObject();
|
||||
Map<String, Object> tempMap = JsonUtils.parseObject(tem.toString(), Map.class);
|
||||
resultMap.put("key", MapUtil.getStr(tempMap, "key"));
|
||||
resultMap.put("name", MapUtil.getStr(tempMap, "name"));
|
||||
resultMap.put("value", valMap.get(MapUtil.getStr(tempMap, "key")));
|
||||
resultMap.put("sort", MapUtil.getStr(tempMap, "sort"));
|
||||
valResult.add(resultMap);
|
||||
}
|
||||
result.add(valResult);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TradeOrderItemDO itemDO = new TradeOrderItemDO();
|
||||
JSONArray tempObj = new JSONArray();
|
||||
JSONObject orderInfo = new JSONObject();
|
||||
orderInfo.put("petName", "aaa");
|
||||
orderInfo.put("petType", "aaa");
|
||||
orderInfo.put("weight", "aaa");
|
||||
orderInfo.put("diedTime", "aaa");
|
||||
orderInfo.put("diedReason", "aaa");
|
||||
orderInfo.put("remainsPhoneUrl", "aaa");
|
||||
orderInfo.put("subType", "aaa");
|
||||
orderInfo.put("changeRule", "aaa");
|
||||
orderInfo.put("subOrder", "aaa");
|
||||
orderInfo.put("userRemark", "aaa");
|
||||
orderInfo.put("merchantRemark", "aaa");
|
||||
orderInfo.put("pickUpAddress", "aaa");
|
||||
orderInfo.put("sendAddress", "aaa");
|
||||
tempObj.add(orderInfo);
|
||||
orderInfo = new JSONObject();
|
||||
orderInfo.put("petName", "bbb");
|
||||
orderInfo.put("petType", "bbb");
|
||||
orderInfo.put("weight", "bbb");
|
||||
orderInfo.put("diedTime", "bbb");
|
||||
orderInfo.put("diedReason", "bbb");
|
||||
orderInfo.put("remainsPhoneUrl", "bbb");
|
||||
orderInfo.put("subType", "bbb");
|
||||
orderInfo.put("changeRule", "bbb");
|
||||
orderInfo.put("subOrder", "bbb");
|
||||
orderInfo.put("userRemark", "bbb");
|
||||
orderInfo.put("merchantRemark", "bbb");
|
||||
orderInfo.put("pickUpAddress", "bbb");
|
||||
orderInfo.put("sendAddress", "bbb");
|
||||
tempObj.add(orderInfo);
|
||||
String jsonString = JSON.toJSONString(tempObj);
|
||||
System.out.println("serveInfo:" + jsonString);
|
||||
itemDO.setServeInfo(jsonString);
|
||||
JSONArray tempObj1 = new JSONArray();
|
||||
JSONObject extraInfo = new JSONObject();
|
||||
extraInfo.put("serveUrl", "aaa");
|
||||
extraInfo.put("serveName", "aaa");
|
||||
extraInfo.put("serveDesc", "aaa");
|
||||
extraInfo.put("prodType", "aaa");
|
||||
extraInfo.put("parentActive", "aaa");
|
||||
extraInfo.put("count", "aaa");
|
||||
extraInfo.put("price", "aaa");
|
||||
extraInfo.put("handPrice", "aaa");
|
||||
extraInfo.put("totalPrice", "aaa");
|
||||
extraInfo.put("discountPrice", "aaa");
|
||||
extraInfo.put("payPrice", "aaa");
|
||||
extraInfo.put("refundMoney", "aaa");
|
||||
extraInfo.put("refundCount", "aaa");
|
||||
extraInfo.put("deliveryType", "aaa");
|
||||
extraInfo.put("receiptUser", "aaa");
|
||||
extraInfo.put("userMobile", "aaa");
|
||||
extraInfo.put("receiveAddress", "aaa");
|
||||
tempObj1.add(extraInfo);
|
||||
extraInfo = new JSONObject();
|
||||
extraInfo.put("serveUrl", "bbb");
|
||||
extraInfo.put("serveName", "bbb");
|
||||
extraInfo.put("serveDesc", "bbb");
|
||||
extraInfo.put("prodType", "bbb");
|
||||
extraInfo.put("parentActive", "bbb");
|
||||
extraInfo.put("count", "bbb");
|
||||
extraInfo.put("price", "bbb");
|
||||
extraInfo.put("handPrice", "bbb");
|
||||
extraInfo.put("totalPrice", "bbb");
|
||||
extraInfo.put("discountPrice", "bbb");
|
||||
extraInfo.put("payPrice", "bbb");
|
||||
extraInfo.put("refundMoney", "bbb");
|
||||
extraInfo.put("refundCount", "bbb");
|
||||
extraInfo.put("deliveryType", "bbb");
|
||||
extraInfo.put("receiptUser", "bbb");
|
||||
extraInfo.put("userMobile", "bbb");
|
||||
extraInfo.put("receiveAddress", "bbb");
|
||||
tempObj1.add(extraInfo);
|
||||
String jsonString1 = JSON.toJSONString(tempObj1);
|
||||
System.out.println("selected:" + jsonString1);
|
||||
itemDO.setServeExtInfo(jsonString1);
|
||||
JSONArray priceExtObj = new JSONArray();
|
||||
JSONObject priceExtInfo = new JSONObject();
|
||||
priceExtInfo.put("costName", "aaa");
|
||||
priceExtInfo.put("serveArea", "aaa");
|
||||
priceExtInfo.put("targetArea", "aaa");
|
||||
priceExtInfo.put("chargeType", "aaa");
|
||||
priceExtInfo.put("respMode", "aaa");
|
||||
priceExtInfo.put("respTime", "aaa");
|
||||
priceExtInfo.put("weight", "aaa");
|
||||
priceExtInfo.put("chargeTime", "aaa");
|
||||
priceExtInfo.put("totalPrice", "aaa");
|
||||
priceExtInfo.put("discountPrice", "aaa");
|
||||
priceExtInfo.put("payPrice", "aaa");
|
||||
priceExtInfo.put("refundPrice", "aaa");
|
||||
priceExtObj.add(priceExtInfo);
|
||||
priceExtInfo = new JSONObject();
|
||||
priceExtInfo.put("costName", "bbb");
|
||||
priceExtInfo.put("serveArea", "bbb");
|
||||
priceExtInfo.put("targetArea", "bbb");
|
||||
priceExtInfo.put("chargeType", "bbb");
|
||||
priceExtInfo.put("respMode", "bbb");
|
||||
priceExtInfo.put("respTime", "bbb");
|
||||
priceExtInfo.put("weight", "bbb");
|
||||
priceExtInfo.put("chargeTime", "bbb");
|
||||
priceExtInfo.put("totalPrice", "bbb");
|
||||
priceExtInfo.put("discountPrice", "bbb");
|
||||
priceExtInfo.put("payPrice", "bbb");
|
||||
priceExtInfo.put("refundPrice", "bbb");
|
||||
priceExtObj.add(priceExtInfo);
|
||||
String jsonString2 = JSON.toJSONString(priceExtObj);
|
||||
System.out.println("price:" + jsonString2);
|
||||
itemDO.setPriceExtInfo(jsonString2);
|
||||
Map<String, Object> trans = trans(itemDO);
|
||||
System.out.println(JSON.toJSONString(trans));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -268,19 +268,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
PayOrderRespDTO payOrder = validatePayOrderPaid(order, payOrderId);
|
||||
|
||||
// 3. 更新 TradeOrderDO 状态为已支付,等待发货
|
||||
int updateCount = tradeOrderMapper.updateByIdAndStatus(id, order.getOrderStatus(),
|
||||
new TradeOrderDO().setOrderStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayStatus(true)
|
||||
.setPayTime(LocalDateTime.now()).setPayChannelCode(1));
|
||||
if (updateCount == 0) {
|
||||
throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
|
||||
}
|
||||
// int updateCount = tradeOrderMapper.updateByIdAndStatus(id, order.getOrderStatus(),
|
||||
// new TradeOrderDO().setOrderStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayStatus(true)
|
||||
// .setPayTime(LocalDateTime.now()).setPayChannelCode(1));
|
||||
// if (updateCount == 0) {
|
||||
// throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
|
||||
// }
|
||||
|
||||
// 4. 执行 TradeOrderHandler 的后置处理
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderItemMapper.selectListByOrderId(id);
|
||||
tradeOrderHandlers.forEach(handler -> handler.afterPayOrder(order, orderItems));
|
||||
|
||||
// 5. 记录订单日志
|
||||
TradeOrderLogUtils.setOrderInfo(order.getId(), order.getOrderStatus(), TradeOrderStatusEnum.UNDELIVERED.getStatus());
|
||||
// TradeOrderLogUtils.setOrderInfo(order.getId(), order.getOrderStatus(), TradeOrderStatusEnum.UNDELIVERED.getStatus());
|
||||
TradeOrderLogUtils.setUserInfo(order.getUserId(), UserTypeEnum.MEMBER.getValue());
|
||||
}
|
||||
|
||||
@@ -516,9 +516,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
throw exception(ORDER_NOT_FOUND);
|
||||
}
|
||||
// 1.2 校验状态
|
||||
if (ObjectUtil.notEqual(order.getOrderStatus(), TradeOrderStatusEnum.UNPAID.getStatus())) {
|
||||
throw exception(ORDER_CANCEL_FAIL_STATUS_NOT_UNPAID);
|
||||
}
|
||||
// if (ObjectUtil.notEqual(order.getOrderStatus(), TradeOrderStatusEnum.UNPAID.getStatus())) {
|
||||
// throw exception(ORDER_CANCEL_FAIL_STATUS_NOT_UNPAID);
|
||||
// }
|
||||
|
||||
// 2. 取消订单
|
||||
cancelOrder0(order, TradeOrderCancelTypeEnum.MEMBER_CANCEL);
|
||||
@@ -529,7 +529,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
// 1. 查询过期的待支付订单
|
||||
LocalDateTime expireTime = minusTime(tradeOrderProperties.getPayExpireTime());
|
||||
List<TradeOrderDO> orders = tradeOrderMapper.selectListByStatusAndCreateTimeLt(
|
||||
TradeOrderStatusEnum.UNPAID.getStatus(), expireTime);
|
||||
TradeOrderStatusEnum.WAITPAID.getStatus(), expireTime);
|
||||
if (CollUtil.isEmpty(orders)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
{
|
||||
"serveInfo": [
|
||||
{
|
||||
"key": "petName",
|
||||
"name": "宠物名字",
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"key": "petType",
|
||||
"name": "宠物品种",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "weight",
|
||||
"name": "体型/体重",
|
||||
"sort": 3
|
||||
},
|
||||
{
|
||||
"key": "diedTime",
|
||||
"name": "离世时间",
|
||||
"sort": 4
|
||||
},
|
||||
{
|
||||
"key": "diedReason",
|
||||
"name": "离世原因",
|
||||
"sort": 5
|
||||
},
|
||||
{
|
||||
"key": "remainsPhoneUrl",
|
||||
"name": "遗体照片",
|
||||
"sort": 6
|
||||
},
|
||||
{
|
||||
"key": "subType",
|
||||
"name": "预约类型",
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"key": "changeRule",
|
||||
"name": "更改规则",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "subOrder",
|
||||
"name": "预约时间",
|
||||
"sort": 3
|
||||
},
|
||||
{
|
||||
"key": "userRemark",
|
||||
"name": "用户备注",
|
||||
"sort": 4
|
||||
},
|
||||
{
|
||||
"key": "merchantRemark",
|
||||
"name": "客服备注",
|
||||
"sort": 5
|
||||
},
|
||||
{
|
||||
"key": "pickUpAddress",
|
||||
"name": "取货地址",
|
||||
"sort": 6
|
||||
},
|
||||
{
|
||||
"key": "sendAddress",
|
||||
"name": "送货地址",
|
||||
"sort": 7
|
||||
}
|
||||
],
|
||||
"selectedServeInfo": [
|
||||
{
|
||||
"key": "serveUrl",
|
||||
"name": "服务主图",
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"key": "prodUrl",
|
||||
"name": "纪念品主图",
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"key": "serveName",
|
||||
"name": "服务名称",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "prodName",
|
||||
"name": "商品名称",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "serveDesc",
|
||||
"name": "服务描述",
|
||||
"sort": 3
|
||||
},
|
||||
{
|
||||
"key": "prodDesc",
|
||||
"name": "商品描述",
|
||||
"sort": 3
|
||||
},
|
||||
{
|
||||
"key": "prodType",
|
||||
"name": "商品类型",
|
||||
"sort": 4
|
||||
},
|
||||
{
|
||||
"key": "parentActive",
|
||||
"name": "父工作流",
|
||||
"sort": 5
|
||||
},
|
||||
{
|
||||
"key": "count",
|
||||
"name": "数量",
|
||||
"sort": 4
|
||||
},
|
||||
|
||||
{
|
||||
"key": "price",
|
||||
"name": "单价",
|
||||
"sort": 5
|
||||
},
|
||||
{
|
||||
"key": "handPrice",
|
||||
"name": "到手价",
|
||||
"sort": 6
|
||||
},
|
||||
{
|
||||
"key": "totalPrice",
|
||||
"name": "商品总价",
|
||||
"sort": 7
|
||||
},
|
||||
{
|
||||
"key": "discountPrice",
|
||||
"name": "优惠金额",
|
||||
"sort": 8
|
||||
},
|
||||
{
|
||||
"key": "payPrice",
|
||||
"name": "实付金额",
|
||||
"sort": 9
|
||||
},
|
||||
{
|
||||
"key": "refundMoney",
|
||||
"name": "累计退款金额",
|
||||
"sort": 10
|
||||
},
|
||||
{
|
||||
"key": "refundCount",
|
||||
"name": "累计退款次数",
|
||||
"sort": 11
|
||||
},
|
||||
{
|
||||
"key": "deliveryType",
|
||||
"name": "配送方式",
|
||||
"sort": 12
|
||||
},
|
||||
{
|
||||
"key": "receiptUser",
|
||||
"name": "收货人",
|
||||
"sort": 13
|
||||
},
|
||||
{
|
||||
"key": "pickUpUser",
|
||||
"name": "提货人",
|
||||
"sort": 13
|
||||
},
|
||||
{
|
||||
"key": "userMobile",
|
||||
"name": "手机号码",
|
||||
"sort": 14
|
||||
},
|
||||
{
|
||||
"key": "receiveAddress",
|
||||
"name": "收货地址",
|
||||
"sort": 15
|
||||
},
|
||||
{
|
||||
"key": "pickUpAddress",
|
||||
"name": "自提地址",
|
||||
"sort": 15
|
||||
}
|
||||
],
|
||||
"priceExtInfo": [
|
||||
{
|
||||
"key": "costName",
|
||||
"name": "费用名称",
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"key": "serveArea",
|
||||
"name": "可服务区域",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "targetArea",
|
||||
"name": "目标区域",
|
||||
"sort": 3
|
||||
},
|
||||
{
|
||||
"key": "chargeType",
|
||||
"name": "收费方式",
|
||||
"sort": 4
|
||||
},
|
||||
{
|
||||
"key": "respMode",
|
||||
"name": "响应模式",
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"key": "respTime",
|
||||
"name": "响应时间",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "weight",
|
||||
"name": "体型/体重",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "chargeTime",
|
||||
"name": "收费时段",
|
||||
"sort": 2
|
||||
},
|
||||
{
|
||||
"key": "totalPrice",
|
||||
"name": "服务总价",
|
||||
"sort": 5
|
||||
},
|
||||
{
|
||||
"key": "discountPrice",
|
||||
"name": "优惠金额",
|
||||
"sort": 6
|
||||
},
|
||||
{
|
||||
"key": "payPrice",
|
||||
"name": "实付金额",
|
||||
"sort": 7
|
||||
},
|
||||
{
|
||||
"key": "refundPrice",
|
||||
"name": "累计退款金额",
|
||||
"sort": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user