Merge remote-tracking branch 'origin/feature/order' into feature/order
This commit is contained in:
@@ -17,17 +17,15 @@ import java.util.Arrays;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
||||||
|
|
||||||
UNPAID(0, "待支付"),
|
WAITPAID(10, "等待付款"),
|
||||||
UNDELIVERED(10, "待发货"),
|
WAITCONFIRM(20, "等待确定"),
|
||||||
DELIVERED(20, "已发货"),
|
WAITSERVE(30, "等待服务"),
|
||||||
COMPLETED(30, "已完成"),
|
WAITACCEPT(40, "等待验收"),
|
||||||
CANCELED(40, "已取消"),
|
COMPLETED(50, "已完成"),
|
||||||
|
CANCELED(60, "已取消"),
|
||||||
WAITPAID(100, "等待付款"),
|
DELIVERED(70, "已退款"),
|
||||||
WAITCONFIRM(110, "等待确定"),
|
WAITDELIVERED(80, "待发货"),
|
||||||
WAITSERVE(120, "等待服务"),
|
;
|
||||||
WAITACCEPT(130, "等待验收"),
|
|
||||||
SERVECANCELED(140, "取消服务");
|
|
||||||
|
|
||||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(TradeOrderStatusEnum::getStatus).toArray(Integer[]::new);
|
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 是否
|
* @return 是否
|
||||||
*/
|
*/
|
||||||
public static boolean isUnpaid(Integer status) {
|
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 是否
|
* @return 是否
|
||||||
*/
|
*/
|
||||||
public static boolean isUndelivered(Integer status) {
|
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 是否
|
* @return 是否
|
||||||
*/
|
*/
|
||||||
public static boolean havePaid(Integer status) {
|
public static boolean havePaid(Integer status) {
|
||||||
return ObjectUtils.equalsAny(status, UNDELIVERED.getStatus(),
|
return ObjectUtils.equalsAny(status, WAITCONFIRM.getStatus(),
|
||||||
DELIVERED.getStatus(), COMPLETED.getStatus());
|
DELIVERED.getStatus(), COMPLETED.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,15 @@ public class LocalDateTimeUtils {
|
|||||||
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1));
|
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")
|
@RequestMapping("/infra/file")
|
||||||
@Validated
|
@Validated
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@PermitAll
|
|
||||||
public class FileController {
|
public class FileController {
|
||||||
|
|
||||||
@Resource private FileService fileService;
|
@Resource private FileService fileService;
|
||||||
|
|
||||||
/** 上传文件", description = "模式一:后端上传文件 */
|
/** 上传文件", description = "模式一:后端上传文件 */
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
public CommonResult<String> uploadFile(FileUploadReqVO uploadReqVO) throws Exception {
|
public CommonResult<String> uploadFile(@Valid FileUploadReqVO uploadReqVO) throws Exception {
|
||||||
MultipartFile file = uploadReqVO.getFile();
|
MultipartFile file = uploadReqVO.getFile();
|
||||||
String path = uploadReqVO.getPath();
|
String path = uploadReqVO.getPath();
|
||||||
return success(
|
return success(
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ spring:
|
|||||||
username: nacos # Nacos 账号
|
username: nacos # Nacos 账号
|
||||||
password: nacos # Nacos 密码
|
password: nacos # Nacos 密码
|
||||||
discovery: # 【配置中心】配置项
|
discovery: # 【配置中心】配置项
|
||||||
namespace: 16bd40df-7cc7-4c2c-82c2-6186ade7bb08 # 命名空间。这里使用 dev 开发环境
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
metadata:
|
metadata:
|
||||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||||
config: # 【注册中心】配置项
|
config: # 【注册中心】配置项
|
||||||
namespace: 16bd40df-7cc7-4c2c-82c2-6186ade7bb08 # 命名空间。这里使用 dev 开发环境
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import com.tashow.cloud.common.pojo.CommonResult;
|
|||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import com.tashow.cloud.memberapi.api.user.MemberUserApi;
|
import com.tashow.cloud.memberapi.api.user.MemberUserApi;
|
||||||
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
||||||
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderPageRespVO;
|
|
||||||
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
|
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderPageRespVO;
|
||||||
|
import com.tashow.cloud.trade.controller.admin.order.vo.TradeOrderSummaryRespVO;
|
||||||
import com.tashow.cloud.trade.convert.order.TradeOrderConvert;
|
import com.tashow.cloud.trade.convert.order.TradeOrderConvert;
|
||||||
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderDO;
|
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderItemDO;
|
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
@@ -91,12 +92,18 @@ public class TradeOrderController {
|
|||||||
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, orderLogs));
|
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, orderLogs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 获得交易订单统计
|
//
|
||||||
// @GetMapping("/summary")
|
|
||||||
|
/**
|
||||||
|
* 获得交易订单统计
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/summary")
|
||||||
|
@PermitAll
|
||||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||||
// public CommonResult<TradeOrderSummaryRespVO> getOrderSummary(TradeOrderPageReqVO reqVO) {
|
public CommonResult<TradeOrderSummaryRespVO> getOrderSummary() {
|
||||||
// return success(tradeOrderQueryService.getOrderSummary(reqVO));
|
return success(tradeOrderQueryService.getOrderSummary());
|
||||||
// }
|
}
|
||||||
//
|
//
|
||||||
// // 获得交易订单的物流轨迹
|
// // 获得交易订单的物流轨迹
|
||||||
// // id: 交易订单编号
|
// // id: 交易订单编号
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ package com.tashow.cloud.trade.controller.admin.order.vo;
|
|||||||
|
|
||||||
// 移除Swagger相关导入
|
// 移除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 lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -15,17 +21,27 @@ public class TradeOrderBaseVO {
|
|||||||
// 订单编号
|
// 订单编号
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// 订单流水号
|
// 订单编号
|
||||||
private String orderNum;
|
private String orderNum;
|
||||||
|
|
||||||
// 下单时间
|
/**
|
||||||
private LocalDateTime createTime;
|
* 订单类型
|
||||||
|
* {@link TradeOrderTypeEnum#getType()}
|
||||||
|
*/
|
||||||
|
private Integer orderType;
|
||||||
|
|
||||||
// 订单类目
|
/**
|
||||||
private String orderCategoryName;
|
* 订单来源
|
||||||
|
* {@link TerminalEnum#getTerminal()}
|
||||||
// 订单来源
|
*/
|
||||||
|
@InEnum(TerminalEnum.class)
|
||||||
private Integer orderTerminal;
|
private Integer orderTerminal;
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
* {@link TradeOrderStatusEnum#getStatus()}
|
||||||
|
*/
|
||||||
|
@InEnum(TradeOrderStatusEnum.class)
|
||||||
|
private Integer orderStatus;
|
||||||
|
|
||||||
// 用户编号
|
// 用户编号
|
||||||
private Long userId;
|
private Long userId;
|
||||||
@@ -37,35 +53,14 @@ public class TradeOrderBaseVO {
|
|||||||
private String userAvatar;
|
private String userAvatar;
|
||||||
//用户手机号
|
//用户手机号
|
||||||
private String userMobile;
|
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 userRemark;
|
||||||
//支付方式
|
|
||||||
private String payType;
|
// 下单时间
|
||||||
//财务状态
|
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||||
private String financeStatus;
|
private LocalDateTime createTime;
|
||||||
|
// 订单完成时间
|
||||||
|
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,336 +2,125 @@ package com.tashow.cloud.trade.controller.admin.order.vo;
|
|||||||
|
|
||||||
// 移除Swagger相关导入
|
// 移除Swagger相关导入
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
// 管理后台 - 交易订单的详情 Response VO
|
// 管理后台 - 交易订单的详情 Response VO
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class TradeOrderDetailRespVO {
|
public class TradeOrderDetailRespVO extends TradeOrderBaseVO{
|
||||||
|
|
||||||
//基本信息
|
//订单类目id
|
||||||
private TradeOrderBaseInfo tradeOrderInfoBase;
|
private Long orderCategoryId;
|
||||||
//商品信息
|
//订单类目名称
|
||||||
private TradeProductInfo tradeProductInfo;
|
private String orderCategoryName;
|
||||||
//服务信息
|
|
||||||
private TradeServeInfo tradeServeInfo;
|
|
||||||
//扩展服务信息
|
|
||||||
private TradeExtendServeInfo tradeExtendServeInfo;
|
|
||||||
//附加费信息
|
|
||||||
private TradeExtendCostInfo tradeExtendCostInfo;
|
|
||||||
|
|
||||||
|
//取消原因
|
||||||
|
private String cancelReason;
|
||||||
|
//商家备注
|
||||||
|
private String merchantRemark;
|
||||||
|
//退款时间
|
||||||
|
private LocalDateTime refundTime;
|
||||||
|
//保障时间
|
||||||
|
private LocalDateTime propertyTime;
|
||||||
|
//保障状态
|
||||||
|
private Integer propertyStatus;
|
||||||
|
//订单金额
|
||||||
|
private Integer price;
|
||||||
|
//实付金额
|
||||||
|
private Integer payPrice;
|
||||||
|
//优惠金额
|
||||||
|
private Integer discountPrice;
|
||||||
|
//退款金额
|
||||||
|
private Integer refundPrice;
|
||||||
|
//实收金额
|
||||||
|
private Integer livePrice;
|
||||||
|
//支付方式
|
||||||
|
private Integer payType;
|
||||||
|
//支付渠道 (线上线下)
|
||||||
|
private Integer payChannelCode;
|
||||||
|
//倒计时()
|
||||||
|
private String payLastTime;
|
||||||
|
//财务状态
|
||||||
|
private Integer financeStatus;
|
||||||
|
//交易流水号
|
||||||
|
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 JSONObject tradeServeInfo;
|
||||||
|
//扩展服务信息(order_serve_info配置)
|
||||||
|
private JSONArray tradeExtendServeInfo;
|
||||||
|
//附加费信息(order_serve_info配置)
|
||||||
|
private JSONArray tradeExtendCostInfo;
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单基本信息
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
public static class Item {
|
||||||
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;
|
|
||||||
|
|
||||||
//取消时间
|
//店铺名称
|
||||||
private String cancelTime;
|
private Long id;
|
||||||
//取消原因
|
|
||||||
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 String shopName;
|
private String shopName;
|
||||||
|
//店铺logo
|
||||||
|
private String shopLogo;
|
||||||
|
|
||||||
//商品id
|
//商品id
|
||||||
private Long spuId;
|
private Long spuId;
|
||||||
//skuid
|
//skuId
|
||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
//商品图片
|
||||||
|
private String picUrl;
|
||||||
|
|
||||||
//商品规格图
|
|
||||||
private String skuPicUrl;
|
|
||||||
//商品名称
|
//商品名称
|
||||||
private String spuName;
|
private String spuName;
|
||||||
//商品规格
|
//商品规格
|
||||||
private String skuName;
|
private String skuName;
|
||||||
//购买数量
|
//订单类目id
|
||||||
private Integer count;
|
private Long orderCategoryId;
|
||||||
//商品单价
|
//订单类目名称
|
||||||
private Integer price;
|
private String orderCategoryName;
|
||||||
//商品单位
|
|
||||||
private String unit;
|
|
||||||
//到手价(单价 - 优惠)
|
|
||||||
private Integer handedPrice;
|
|
||||||
//成本价
|
|
||||||
private Integer expensePrice;
|
|
||||||
//保障
|
|
||||||
private List<String> properties;
|
|
||||||
//服务内容
|
|
||||||
private String serveContent;
|
|
||||||
|
|
||||||
|
|
||||||
|
// 购买的商品数量
|
||||||
|
private Integer count;
|
||||||
|
// 订单总价
|
||||||
|
private Integer price;
|
||||||
|
// 单位
|
||||||
|
private String unit;
|
||||||
//商品总价
|
//商品总价
|
||||||
private Integer totalPrice;
|
private Integer totalPrice;
|
||||||
//优惠金额
|
//优惠金额
|
||||||
private Integer discountPrice;
|
private Integer discountPrice;
|
||||||
//实付金额
|
//实付金额
|
||||||
private Integer payPrice;
|
private Integer payPrice;
|
||||||
|
|
||||||
//累计退款金额
|
//累计退款金额
|
||||||
private Integer refundPrice;
|
private Integer refundPrice;
|
||||||
//累计退款数量
|
//累计退款数量
|
||||||
private Integer refundCount;
|
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;
|
package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||||
|
|
||||||
// 移除Swagger相关导入
|
// 移除Swagger相关导入
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,60 +9,7 @@ import lombok.Data;
|
|||||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
*/
|
*/
|
||||||
@Data
|
@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;
|
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 lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
// 管理后台 - 交易订单的分页项 Response VO
|
// 管理后台 - 交易订单的分页项 Response VO
|
||||||
@Data
|
@Data
|
||||||
public class TradeOrderPageRespVO extends TradeOrderBaseVO {
|
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;
|
||||||
|
}
|
||||||
@@ -10,13 +10,10 @@ public class TradeOrderSummaryRespVO {
|
|||||||
// 订单数量 - 必填,示例:1024
|
// 订单数量 - 必填,示例:1024
|
||||||
private Long orderCount;
|
private Long orderCount;
|
||||||
|
|
||||||
// 订单金额 - 必填,示例:1024
|
// 实付金额 - 必填,示例:1024
|
||||||
private Long orderPayPrice;
|
private Long payPrice;
|
||||||
|
|
||||||
// 退款单数 - 必填,示例:1024
|
// 最终实收金额 - 必填,示例:1024
|
||||||
private Long afterSaleCount;
|
private Long livePrice;
|
||||||
|
|
||||||
// 退款金额 - 必填,示例:1024
|
|
||||||
private Long afterSalePrice;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,12 +137,12 @@ public class AppTradeOrderController {
|
|||||||
Map<String, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(5);
|
Map<String, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(5);
|
||||||
// 全部
|
// 全部
|
||||||
orderCount.put("allCount", tradeOrderQueryService.getOrderCount(getLoginUserId(), null, null));
|
orderCount.put("allCount", tradeOrderQueryService.getOrderCount(getLoginUserId(), null, null));
|
||||||
// 待付款(未支付)
|
// // 待付款(未支付)
|
||||||
orderCount.put("unpaidCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
// orderCount.put("unpaidCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||||
TradeOrderStatusEnum.UNPAID.getStatus(), null));
|
// TradeOrderStatusEnum.UNPAID.getStatus(), null));
|
||||||
// 待发货
|
// // 待发货
|
||||||
orderCount.put("undeliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
// orderCount.put("undeliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||||
TradeOrderStatusEnum.UNDELIVERED.getStatus(), null));
|
// TradeOrderStatusEnum.UNDELIVERED.getStatus(), null));
|
||||||
// 待收货
|
// 待收货
|
||||||
orderCount.put("deliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
orderCount.put("deliveredCount", tradeOrderQueryService.getOrderCount(getLoginUserId(),
|
||||||
TradeOrderStatusEnum.DELIVERED.getStatus(), null));
|
TradeOrderStatusEnum.DELIVERED.getStatus(), null));
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public interface AfterSaleConvert {
|
|||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(target = "id", ignore = true),
|
@Mapping(target = "id", ignore = true),
|
||||||
|
@Mapping(target = "refundPrice", ignore = true),
|
||||||
@Mapping(target = "createTime", ignore = true),
|
@Mapping(target = "createTime", ignore = true),
|
||||||
@Mapping(target = "updateTime", ignore = true),
|
@Mapping(target = "updateTime", ignore = true),
|
||||||
@Mapping(target = "creator", 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.BooleanUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import com.tashow.cloud.common.util.collection.CollectionUtils;
|
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.ip.AreaUtils;
|
||||||
import com.tashow.cloud.common.util.string.StrUtils;
|
import com.tashow.cloud.common.util.string.StrUtils;
|
||||||
import com.tashow.cloud.excel.dict.core.DictFrameworkUtils;
|
import com.tashow.cloud.excel.dict.core.DictFrameworkUtils;
|
||||||
@@ -29,15 +32,18 @@ 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.TradePriceCalculateReqBO;
|
||||||
import com.tashow.cloud.trade.service.price.bo.TradePriceCalculateRespBO;
|
import com.tashow.cloud.trade.service.price.bo.TradePriceCalculateRespBO;
|
||||||
import com.tashow.cloud.tradeapi.api.order.dto.TradeOrderRespDTO;
|
import com.tashow.cloud.tradeapi.api.order.dto.TradeOrderRespDTO;
|
||||||
|
import com.tashow.cloud.tradeapi.enums.order.TradeOrderStatusEnum;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.Named;
|
import org.mapstruct.Named;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.convertMap;
|
||||||
import static com.tashow.cloud.common.util.collection.CollectionUtils.convertMultiMap;
|
import static com.tashow.cloud.common.util.collection.CollectionUtils.convertMultiMap;
|
||||||
@@ -50,15 +56,16 @@ public interface TradeOrderConvert {
|
|||||||
TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class);
|
TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class);
|
||||||
|
|
||||||
//region 分页结果
|
//region 分页结果
|
||||||
|
|
||||||
default PageResult<TradeOrderPageRespVO> convertPage(PageResult<TradeOrderDO> pageResult, List<TradeOrderItemDO> orderItems) {
|
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
|
||||||
List<TradeOrderPageRespVO> orderVOs = CollectionUtils.convertList(pageResult.getList(), order -> {
|
List<TradeOrderPageRespVO> orderVOs = CollectionUtils.convertList(pageResult.getList(), order -> {
|
||||||
TradeOrderItemDO itemDO = orderItemMap.get(order.getId());
|
List<TradeOrderItemDO> itemDO = orderItemMap.get(order.getId());
|
||||||
TradeOrderPageRespVO orderVO = convert(order, itemDO);
|
TradeOrderPageRespVO orderPageRespVO = convert(order, itemDO);
|
||||||
orderVO.setHandedPrice(itemDO.getPrice()-itemDO.getDiscountPrice());
|
orderPageRespVO.getItems().stream().forEach(item -> {
|
||||||
return orderVO;
|
item.setHandedPrice(item.getPrice() - item.getDiscountPrice());
|
||||||
|
});
|
||||||
|
return orderPageRespVO;
|
||||||
});
|
});
|
||||||
return new PageResult<>(orderVOs, pageResult.getTotal());
|
return new PageResult<>(orderVOs, pageResult.getTotal());
|
||||||
}
|
}
|
||||||
@@ -66,29 +73,55 @@ public interface TradeOrderConvert {
|
|||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(source = "order.id", target = "id"),
|
@Mapping(source = "order.id", target = "id"),
|
||||||
@Mapping(source = "order.userId", target = "userId"),
|
@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
|
//endregion
|
||||||
|
|
||||||
//region 订单详情
|
//region 订单详情
|
||||||
|
default TradeOrderDetailRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, List<TradeOrderLogDO> orderLogs) {
|
||||||
|
//订单基本信息
|
||||||
|
TradeOrderDetailRespVO orderVO = convert2(order, orderItems, orderLogs);
|
||||||
|
//计算商品到手价
|
||||||
|
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(a -> {
|
||||||
|
orderVO.setTradeServeInfo(JSON.parseObject(a.getServeInfo()));
|
||||||
|
orderVO.setTradeExtendServeInfo(JSON.parseArray(a.getServeExtInfo()));
|
||||||
|
orderVO.setTradeExtendCostInfo(JSON.parseArray(a.getPriceExtInfo()));
|
||||||
|
});
|
||||||
|
|
||||||
default TradeOrderDetailRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,List<TradeOrderLogDO> orderLogs) {
|
//保障时间 保障状态 如果状态是已完成 则
|
||||||
//
|
if (Objects.equals(order.getOrderStatus(), TradeOrderStatusEnum.COMPLETED.getStatus())) {
|
||||||
TradeOrderDetailRespVO orderVO = convert2(order, orderItems);
|
LocalDateTime finishTime = order.getFinishTime();
|
||||||
|
Long between = LocalDateTimeUtils.between(finishTime);
|
||||||
|
|
||||||
|
orderVO.setPropertyStatus(between >= 7 ? 0 : 1);
|
||||||
|
orderVO.setPropertyTime(LocalDateTimeUtils.getPlusDay(7));
|
||||||
|
}
|
||||||
return orderVO;
|
return orderVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mappings({
|
// @Mappings(
|
||||||
@Mapping(source = "order", target = "tradeOrderInfoBase"),
|
// @Mapping(target ="items.tradeServeInfo", source = "tradeServeInfo",qualifiedByName = "jsonToMap")
|
||||||
})
|
// )
|
||||||
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items);
|
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items, List<TradeOrderLogDO> statusList);
|
||||||
@Mappings({
|
|
||||||
@Mapping(source = "items", target = "tradeOrderInfoBase"),
|
@Named("jsonToMap")
|
||||||
})
|
default Map<String, Object> jsonToMap(String json) {
|
||||||
TradeOrderDetailRespVO convert3(TradeOrderItemDO items);
|
try {
|
||||||
|
return new ObjectMapper().readValue(json, Map.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("json转换map出错", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
@@ -141,15 +174,6 @@ public interface TradeOrderConvert {
|
|||||||
return createReqDTO;
|
return createReqDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<TradeOrderDetailRespVO> convertList03(List<TradeOrderLogDO> orderLogs);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MemberUserRespVO convert(MemberUserRespDTO bean);
|
MemberUserRespVO convert(MemberUserRespDTO bean);
|
||||||
|
|
||||||
default PageResult<AppTradeOrderPageItemRespVO> convertPage02(PageResult<TradeOrderDO> pageResult,
|
default PageResult<AppTradeOrderPageItemRespVO> convertPage02(PageResult<TradeOrderDO> pageResult,
|
||||||
@@ -165,8 +189,6 @@ public interface TradeOrderConvert {
|
|||||||
|
|
||||||
AppTradeOrderPageItemRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> items);
|
AppTradeOrderPageItemRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||||
|
|
||||||
// AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
|
|
||||||
|
|
||||||
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||||
TradeOrderProperties tradeOrderProperties,
|
TradeOrderProperties tradeOrderProperties,
|
||||||
DeliveryExpressDO express) {
|
DeliveryExpressDO express) {
|
||||||
@@ -198,10 +220,6 @@ public interface TradeOrderConvert {
|
|||||||
@Mapping(target = "anonymous", source = "createReqVO.anonymous"),
|
@Mapping(target = "anonymous", source = "createReqVO.anonymous"),
|
||||||
@Mapping(target = "userId", source = "tradeOrderItemDO.userId")
|
@Mapping(target = "userId", source = "tradeOrderItemDO.userId")
|
||||||
})
|
})
|
||||||
// ProductCommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO, TradeOrderItemDO tradeOrderItemDO);
|
|
||||||
//
|
|
||||||
// TradePriceCalculateReqBO convert(AppTradeOrderSettlementReqVO settlementReqVO);
|
|
||||||
//
|
|
||||||
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
|
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
|
||||||
List<CartDO> cartList) {
|
List<CartDO> cartList) {
|
||||||
TradePriceCalculateReqBO reqBO = new TradePriceCalculateReqBO().setUserId(userId)
|
TradePriceCalculateReqBO reqBO = new TradePriceCalculateReqBO().setUserId(userId)
|
||||||
@@ -268,7 +286,4 @@ public interface TradeOrderConvert {
|
|||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Named("convertList04")
|
|
||||||
List<TradeOrderRespDTO> convertList04(List<TradeOrderDO> list);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,14 +32,7 @@ public class TradeOrderDO extends BaseDO {
|
|||||||
* 订单流水号
|
* 订单流水号
|
||||||
*/
|
*/
|
||||||
private String orderNum;
|
private String orderNum;
|
||||||
/**
|
|
||||||
* 订单类目id
|
|
||||||
*/
|
|
||||||
private Long orderCategoryId;
|
|
||||||
/**
|
|
||||||
* 订单类目名称
|
|
||||||
*/
|
|
||||||
private String orderCategoryName;
|
|
||||||
/**
|
/**
|
||||||
* 订单类型 (枚举 TradeOrderTypeEnum)
|
* 订单类型 (枚举 TradeOrderTypeEnum)
|
||||||
*/
|
*/
|
||||||
@@ -112,14 +105,7 @@ public class TradeOrderDO extends BaseDO {
|
|||||||
* 实收金额(总),单位:分
|
* 实收金额(总),单位:分
|
||||||
*/
|
*/
|
||||||
private Integer livePrice;
|
private Integer livePrice;
|
||||||
/**
|
|
||||||
* 预约类型(1预约 2 加急)
|
|
||||||
*/
|
|
||||||
private Boolean subType;
|
|
||||||
/**
|
|
||||||
* 预约时间
|
|
||||||
*/
|
|
||||||
private LocalDateTime subTime;
|
|
||||||
/**
|
/**
|
||||||
* 支付订单编号
|
* 支付订单编号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,6 +60,22 @@ public class TradeOrderItemDO extends BaseDO {
|
|||||||
* 商品 SKU 名称
|
* 商品 SKU 名称
|
||||||
*/
|
*/
|
||||||
private String skuName;
|
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 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) {
|
default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
||||||
.likeIfPresent(TradeOrderDO::getMerchantName, reqVO.getMerchantName())
|
.likeIfPresent(TradeOrderDO::getMerchantName, reqVO.getMerchantName())
|
||||||
.eqIfPresent(TradeOrderDO::getOrderCategoryId, reqVO.getOrderCategoryId())
|
|
||||||
.eqIfPresent(TradeOrderDO::getOrderTerminal, reqVO.getOrderTerminal())
|
.eqIfPresent(TradeOrderDO::getOrderTerminal, reqVO.getOrderTerminal())
|
||||||
.eqIfPresent(TradeOrderDO::getFinanceStatus, reqVO.getFinanceStatus())
|
.eqIfPresent(TradeOrderDO::getFinanceStatus, reqVO.getFinanceStatus())
|
||||||
.eqIfPresent(TradeOrderDO::getAfterSaleStatus, reqVO.getAfterSaleStatus())
|
.eqIfPresent(TradeOrderDO::getAfterSaleStatus, reqVO.getAfterSaleStatus())
|
||||||
.eqIfPresent(TradeOrderDO::getSubType, reqVO.getSubType())
|
|
||||||
.betweenIfPresent(TradeOrderDO::getSubTime, reqVO.getSubTime())
|
|
||||||
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.and(StrUtil.isNotBlank(reqVO.getProdSearch()),
|
.and(StrUtil.isNotBlank(reqVO.getProdSearch()),
|
||||||
qw->qw.like(TradeOrderDO::getOrderNum, reqVO.getProdSearch())
|
qw->qw.like(TradeOrderDO::getOrderNum, reqVO.getProdSearch())
|
||||||
@@ -49,15 +46,13 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
|||||||
.orderByDesc(TradeOrderDO::getId));
|
.orderByDesc(TradeOrderDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @疯狂:如果用 map 返回,要不这里直接用 TradeOrderSummaryRespVO 返回?也算合理,就当 sql 查询出这么个玩意~~
|
default List<Map<String, Object>> selectOrderSummary() {
|
||||||
default List<Map<String, Object>> selectOrderSummaryGroupByRefundStatus(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
|
|
||||||
return selectMaps(new MPJLambdaWrapperX<TradeOrderDO>()
|
return selectMaps(new MPJLambdaWrapperX<TradeOrderDO>()
|
||||||
.selectAs(TradeOrderDO::getRefundStatus, TradeOrderDO::getRefundStatus) // 售后状态
|
.selectCount(TradeOrderDO::getId, "count")
|
||||||
.selectCount(TradeOrderDO::getId, "count") // 售后状态对应的数量
|
.selectSum(TradeOrderDO::getPayPrice, "payPrice")
|
||||||
.selectSum(TradeOrderDO::getPayPrice, "price") // 售后状态对应的支付金额
|
.selectSum(TradeOrderDO::getLivePrice, "livePrice")
|
||||||
.inIfPresent(TradeOrderDO::getUserId, userIds)
|
.groupBy(TradeOrderDO::getId)
|
||||||
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
|
);
|
||||||
.groupBy(TradeOrderDO::getRefundStatus)); // 按售后状态分组
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default PageResult<TradeOrderDO> selectPage(AppTradeOrderPageReqVO reqVO, Long userId) {
|
default PageResult<TradeOrderDO> selectPage(AppTradeOrderPageReqVO reqVO, Long userId) {
|
||||||
|
|||||||
@@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -70,10 +70,9 @@ public interface TradeOrderQueryService {
|
|||||||
/**
|
/**
|
||||||
* 获得订单统计
|
* 获得订单统计
|
||||||
*
|
*
|
||||||
* @param reqVO 请求参数
|
|
||||||
* @return 订单统计
|
* @return 订单统计
|
||||||
*/
|
*/
|
||||||
TradeOrderSummaryRespVO getOrderSummary(TradeOrderPageReqVO reqVO);
|
TradeOrderSummaryRespVO getOrderSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【会员】获得交易订单分页
|
* 【会员】获得交易订单分页
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.tashow.cloud.trade.service.order;
|
package com.tashow.cloud.trade.service.order;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
@@ -18,7 +17,6 @@ import com.tashow.cloud.trade.framework.delivery.core.client.ExpressClientFactor
|
|||||||
import com.tashow.cloud.trade.framework.delivery.core.client.dto.ExpressTrackQueryReqDTO;
|
import com.tashow.cloud.trade.framework.delivery.core.client.dto.ExpressTrackQueryReqDTO;
|
||||||
import com.tashow.cloud.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
|
import com.tashow.cloud.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
|
||||||
import com.tashow.cloud.trade.service.delivery.DeliveryExpressService;
|
import com.tashow.cloud.trade.service.delivery.DeliveryExpressService;
|
||||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderRefundStatusEnum;
|
|
||||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderStatusEnum;
|
import com.tashow.cloud.tradeapi.enums.order.TradeOrderStatusEnum;
|
||||||
import com.tashow.cloud.tradeapi.enums.order.TradeOrderTypeEnum;
|
import com.tashow.cloud.tradeapi.enums.order.TradeOrderTypeEnum;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -118,27 +116,12 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TradeOrderSummaryRespVO getOrderSummary(TradeOrderPageReqVO reqVO) {
|
public TradeOrderSummaryRespVO getOrderSummary() {
|
||||||
// 根据用户查询条件构建用户编号列表
|
List<Map<String, Object>> list = tradeOrderMapper.selectOrderSummary();
|
||||||
Set<Long> userIds = buildQueryConditionUserIds(reqVO);
|
return new TradeOrderSummaryRespVO()
|
||||||
if (userIds == null) { // 没查询到用户,说明肯定也没他的订单
|
.setOrderCount(list.stream().mapToLong(x -> Long.parseLong(x.get("count").toString())).sum())
|
||||||
return new TradeOrderSummaryRespVO();
|
.setLivePrice(list.stream().mapToLong(x -> Long.parseLong(x.get("livePrice").toString())).sum())
|
||||||
}
|
.setPayPrice(list.stream().mapToLong(x -> Long.parseLong(x.get("payPrice").toString())).sum());
|
||||||
// 查询每个售后状态对应的数量、金额
|
|
||||||
List<Map<String, Object>> list = tradeOrderMapper.selectOrderSummaryGroupByRefundStatus(reqVO, userIds);
|
|
||||||
|
|
||||||
TradeOrderSummaryRespVO vo = new TradeOrderSummaryRespVO().setAfterSaleCount(0L).setAfterSalePrice(0L);
|
|
||||||
for (Map<String, Object> map : list) {
|
|
||||||
Long count = MapUtil.getLong(map, "count", 0L);
|
|
||||||
Long price = MapUtil.getLong(map, "price", 0L);
|
|
||||||
// 未退款的计入订单,部分退款、全部退款计入售后
|
|
||||||
if (TradeOrderRefundStatusEnum.NONE.getStatus().equals(MapUtil.getInt(map, "refundStatus"))) {
|
|
||||||
vo.setOrderCount(count).setOrderPayPrice(price);
|
|
||||||
} else {
|
|
||||||
vo.setAfterSaleCount(vo.getAfterSaleCount() + count).setAfterSalePrice(vo.getAfterSalePrice() + price);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return vo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -268,19 +268,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
PayOrderRespDTO payOrder = validatePayOrderPaid(order, payOrderId);
|
PayOrderRespDTO payOrder = validatePayOrderPaid(order, payOrderId);
|
||||||
|
|
||||||
// 3. 更新 TradeOrderDO 状态为已支付,等待发货
|
// 3. 更新 TradeOrderDO 状态为已支付,等待发货
|
||||||
int updateCount = tradeOrderMapper.updateByIdAndStatus(id, order.getOrderStatus(),
|
// int updateCount = tradeOrderMapper.updateByIdAndStatus(id, order.getOrderStatus(),
|
||||||
new TradeOrderDO().setOrderStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayStatus(true)
|
// new TradeOrderDO().setOrderStatus(TradeOrderStatusEnum.UNDELIVERED.getStatus()).setPayStatus(true)
|
||||||
.setPayTime(LocalDateTime.now()).setPayChannelCode(1));
|
// .setPayTime(LocalDateTime.now()).setPayChannelCode(1));
|
||||||
if (updateCount == 0) {
|
// if (updateCount == 0) {
|
||||||
throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
|
// throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 4. 执行 TradeOrderHandler 的后置处理
|
// 4. 执行 TradeOrderHandler 的后置处理
|
||||||
List<TradeOrderItemDO> orderItems = tradeOrderItemMapper.selectListByOrderId(id);
|
List<TradeOrderItemDO> orderItems = tradeOrderItemMapper.selectListByOrderId(id);
|
||||||
tradeOrderHandlers.forEach(handler -> handler.afterPayOrder(order, orderItems));
|
tradeOrderHandlers.forEach(handler -> handler.afterPayOrder(order, orderItems));
|
||||||
|
|
||||||
// 5. 记录订单日志
|
// 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());
|
TradeOrderLogUtils.setUserInfo(order.getUserId(), UserTypeEnum.MEMBER.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,9 +516,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
throw exception(ORDER_NOT_FOUND);
|
throw exception(ORDER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
// 1.2 校验状态
|
// 1.2 校验状态
|
||||||
if (ObjectUtil.notEqual(order.getOrderStatus(), TradeOrderStatusEnum.UNPAID.getStatus())) {
|
// if (ObjectUtil.notEqual(order.getOrderStatus(), TradeOrderStatusEnum.UNPAID.getStatus())) {
|
||||||
throw exception(ORDER_CANCEL_FAIL_STATUS_NOT_UNPAID);
|
// throw exception(ORDER_CANCEL_FAIL_STATUS_NOT_UNPAID);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 2. 取消订单
|
// 2. 取消订单
|
||||||
cancelOrder0(order, TradeOrderCancelTypeEnum.MEMBER_CANCEL);
|
cancelOrder0(order, TradeOrderCancelTypeEnum.MEMBER_CANCEL);
|
||||||
@@ -529,7 +529,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
// 1. 查询过期的待支付订单
|
// 1. 查询过期的待支付订单
|
||||||
LocalDateTime expireTime = minusTime(tradeOrderProperties.getPayExpireTime());
|
LocalDateTime expireTime = minusTime(tradeOrderProperties.getPayExpireTime());
|
||||||
List<TradeOrderDO> orders = tradeOrderMapper.selectListByStatusAndCreateTimeLt(
|
List<TradeOrderDO> orders = tradeOrderMapper.selectListByStatusAndCreateTimeLt(
|
||||||
TradeOrderStatusEnum.UNPAID.getStatus(), expireTime);
|
TradeOrderStatusEnum.WAITPAID.getStatus(), expireTime);
|
||||||
if (CollUtil.isEmpty(orders)) {
|
if (CollUtil.isEmpty(orders)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,184 @@
|
|||||||
|
{
|
||||||
|
"serveInfo": {
|
||||||
|
"boneInfo": {
|
||||||
|
"petName": "aaa",
|
||||||
|
"petType": "aaa",
|
||||||
|
"weight": "aaa",
|
||||||
|
"diedTime": "aaa",
|
||||||
|
"diedReason": "aaa",
|
||||||
|
"boneUrl": [
|
||||||
|
"aaa",
|
||||||
|
"bbb"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subInfo": {
|
||||||
|
"subType": "bbbb",
|
||||||
|
"changeRule": "bbbb",
|
||||||
|
"subOrder": "bbbb",
|
||||||
|
"userRemark": "bbbb",
|
||||||
|
"merchantRemark": "bbbb",
|
||||||
|
"pickUpAddress": "bbbb",
|
||||||
|
"sendAddress": "bbbb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"selectedServeInfo": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"tempType": 1,
|
||||||
|
"serve": [
|
||||||
|
{
|
||||||
|
"serveUrl": "ccc",
|
||||||
|
"serveName": "ccc",
|
||||||
|
"serveDesc": "ccc",
|
||||||
|
"count": "ccc",
|
||||||
|
"price": "ccc",
|
||||||
|
"handPrice": "ccc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalPrice": "ccc",
|
||||||
|
"discountPrice": "ccc",
|
||||||
|
"payPrice": "ccc",
|
||||||
|
"refundMoney": "ccc",
|
||||||
|
"refundCount": "ccc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tempType": 2,
|
||||||
|
"serve": [
|
||||||
|
{
|
||||||
|
"serveUrl": "ccc",
|
||||||
|
"serveName": "ccc",
|
||||||
|
"serveDesc": "ccc",
|
||||||
|
"count": "ccc",
|
||||||
|
"price": "ccc",
|
||||||
|
"handPrice": "ccc",
|
||||||
|
"parentActive": "ccc",
|
||||||
|
"riteAddress": "ccc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalPrice": "ccc",
|
||||||
|
"discountPrice": "ccc",
|
||||||
|
"payPrice": "ccc",
|
||||||
|
"refundMoney": "ccc",
|
||||||
|
"refundCount": "ccc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"tempType": 3,
|
||||||
|
"serveTitle": "骨灰处理",
|
||||||
|
"serveType": "处理方式",
|
||||||
|
"serve": [
|
||||||
|
{
|
||||||
|
"serveUrl": "ccc",
|
||||||
|
"serveName": "ccc",
|
||||||
|
"serveDesc": "ccc",
|
||||||
|
"count": "ccc",
|
||||||
|
"price": "ccc",
|
||||||
|
"handPrice": "ccc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"serveUrl": "ccc",
|
||||||
|
"serveName": "ccc",
|
||||||
|
"serveDesc": "ccc",
|
||||||
|
"count": "ccc",
|
||||||
|
"price": "ccc",
|
||||||
|
"handPrice": "ccc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalPrice": "ccc",
|
||||||
|
"discountPrice": "ccc",
|
||||||
|
"payPrice": "ccc",
|
||||||
|
"refundMoney": "ccc",
|
||||||
|
"refundCount": "ccc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deliveryType": "配送方式",
|
||||||
|
"receiveUser": "收货人",
|
||||||
|
"sendUser": "提货人",
|
||||||
|
"userMobile": "手机号码",
|
||||||
|
"address": "收货地址"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"tempType": 4,
|
||||||
|
"serve": [
|
||||||
|
{
|
||||||
|
"prodUrl": "ccc",
|
||||||
|
"prodName": "ccc",
|
||||||
|
"prodDesc": "ccc",
|
||||||
|
"prodType": "ccc",
|
||||||
|
"parentActivity": "ccc",
|
||||||
|
"count": "ccc",
|
||||||
|
"price": "ccc",
|
||||||
|
"handPrice": "ccc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalPrice": "ccc",
|
||||||
|
"discountPrice": "ccc",
|
||||||
|
"payPrice": "ccc",
|
||||||
|
"refundMoney": "ccc",
|
||||||
|
"refundCount": "ccc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deliveryType": "配送方式",
|
||||||
|
"receiveUser": "收货人",
|
||||||
|
"sendUser": "提货人",
|
||||||
|
"userMobile": "手机号码",
|
||||||
|
"address": "收货地址"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"priceExtInfo": [
|
||||||
|
{
|
||||||
|
"serveExtFee": "",
|
||||||
|
"costName": "超区域服务费",
|
||||||
|
"serveArea": "可服务区域",
|
||||||
|
"targetArea": "目标区域",
|
||||||
|
"chargeType": "收费方式",
|
||||||
|
"payInfo": {
|
||||||
|
"totalPrice": "11",
|
||||||
|
"discountPrice": "222",
|
||||||
|
"payPrice": "333"
|
||||||
|
},
|
||||||
|
"refundPrice": "11"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"serveExtFee": "",
|
||||||
|
"respMode": "响应模式",
|
||||||
|
"respTime": "响应时间",
|
||||||
|
"chargeType": "收费方式",
|
||||||
|
"payInfo": {
|
||||||
|
"totalPrice": "11",
|
||||||
|
"discountPrice": "222",
|
||||||
|
"payPrice": "333"
|
||||||
|
},
|
||||||
|
"refundPrice": "11"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"serveExtFee": "",
|
||||||
|
"costName": "超区域服务费",
|
||||||
|
"weight": "体型/体重",
|
||||||
|
"chargeType": "收费方式",
|
||||||
|
"payInfo": {
|
||||||
|
"totalPrice": "11",
|
||||||
|
"discountPrice": "222",
|
||||||
|
"payPrice": "333"
|
||||||
|
},
|
||||||
|
"refundPrice": "11"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"serveExtFee": "",
|
||||||
|
"costName": "超区域服务费",
|
||||||
|
"chargeTime": "收费时段",
|
||||||
|
"chargeType": "收费方式",
|
||||||
|
"payInfo": {
|
||||||
|
"totalPrice": "11",
|
||||||
|
"discountPrice": "222",
|
||||||
|
"payPrice": "333"
|
||||||
|
},
|
||||||
|
"refundPrice": "11"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user