diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java index 56fdc06da9..689f3540b6 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java @@ -27,6 +27,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.annotation.security.PermitAll; import javax.validation.Valid; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -82,6 +84,24 @@ public class TradeAfterSaleController { MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId()); // 获取售后日志 List logs = afterSaleLogService.getLog(afterSale.getId()); + // TODO 方便测试看效果,review 后移除 + if (logs == null) { + logs = new ArrayList<>(); + } + for (int i = 1; i <= 6; i++) { + TradeAfterSaleLogRespDTO respVO = new TradeAfterSaleLogRespDTO(); + respVO.setId((long) i); + respVO.setUserId((long) i); + respVO.setUserType(1); + respVO.setAfterSaleId(id); + respVO.setOrderId((long) i); + respVO.setOrderItemId((long) i); + respVO.setBeforeStatus((i - 1) * 10); + respVO.setAfterStatus(i * 10); + respVO.setContent("66+6"); + respVO.setCreateTime(LocalDateTime.now()); + logs.add(respVO); + } return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs)); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java index 57b21bee05..926c2408c1 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java @@ -25,7 +25,6 @@ import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @Tag(name = "管理后台 - 交易订单") @RestController @@ -70,7 +69,7 @@ public class TradeOrderController { TradeOrderDO order = tradeOrderQueryService.getOrder(id); // 查询订单项 List orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id); - + // orderLog // 拼接数据 MemberUserRespDTO user = memberUserApi.getUser(order.getUserId()); return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user)); @@ -82,7 +81,7 @@ public class TradeOrderController { @PreAuthorize("@ss.hasPermission('trade:order:query')") public CommonResult> getOrderExpressTrackList(@RequestParam("id") Long id) { return success(TradeOrderConvert.INSTANCE.convertList02( - tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); + tradeOrderQueryService.getExpressTrackList(id))); } @PutMapping("/delivery") @@ -117,11 +116,4 @@ public class TradeOrderController { return success(true); } - // TODO @puhui999 订单物流详情 - // TODO @puhui999 【前台】订单取消 - // TODO @puhui999 【后台】订单取消 - // TODO @puhui999 【前台】订单核销 - // TODO @puhui999 【前台】订单删除 - // TODO @puhui999 【后台】订单统计 - } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderDetailRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderDetailRespVO.java index ae135c95ea..dd84a3ad67 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderDetailRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderDetailRespVO.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.Prod import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.time.LocalDateTime; import java.util.List; @Schema(description = "管理后台 - 交易订单的详情 Response VO") @@ -24,6 +25,26 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO { */ private MemberUserRespVO user; + /** + * TODO 订单操作日志, 先模拟一波 + */ + private List orderLog; + + @Data + public static class OrderLog { + + /** + * 内容 + */ + private String content; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + } + @Schema(description = "管理后台 - 交易订单的详情的订单项目") @Data public static class Item extends TradeOrderItemBaseVO { diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java index 33c4cc400d..58361379c3 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java @@ -61,5 +61,5 @@ public class TradeOrderPageReqVO extends PageParam { @Schema(description = "订单来源", example = "10") @InEnum(value = TerminalEnum.class, message = "订单来源 {value}") private Integer terminal; - +// TODO 添加配送方式筛选 } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java index 4d83fe1470..d4f481c371 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java @@ -72,16 +72,18 @@ public interface TradeAfterSaleConvert { default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List orderItems, MemberUserRespDTO user, List logs) { - TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems, convertList1(logs)); + TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems); // 处理用户信息 respVO.setUser(convert(user)); // 处理订单信息 respVO.setOrder(convert(order)); + // 处理售后日志 + respVO.setAfterSaleLog(convertList1(logs)); return respVO; } List convertList1(List list); @Mapping(target = "id", source = "afterSale.id") - TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List orderItems, List logs); + TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List orderItems); TradeOrderBaseVO convert(TradeOrderDO order); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java index 0285a63546..a928bb9a51 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.trade.convert.order; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; @@ -37,8 +36,10 @@ import org.mapstruct.Mapping; import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; -import java.util.*; -import java.util.stream.Collectors; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; @@ -86,7 +87,9 @@ public interface TradeOrderConvert { default ProductSkuUpdateStockReqDTO convert(List list) { return new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(list)); } + List convertList(List list); + @Mappings({ @Mapping(source = "skuId", target = "id"), @Mapping(source = "count", target = "incrCount"), @@ -137,6 +140,15 @@ public interface TradeOrderConvert { orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId())); // 处理用户信息 orderVO.setUser(convert(user)); + // TODO puhui999:模拟订单操作日志 + ArrayList orderLogs = new ArrayList<>(); + for (int i = 0; i < 6; i++) { + TradeOrderDetailRespVO.OrderLog orderLog = new TradeOrderDetailRespVO.OrderLog(); + orderLog.setContent("订单操作" + i); + orderLog.setCreateTime(LocalDateTime.now()); + orderLogs.add(orderLog); + } + orderVO.setOrderLog(orderLogs); return orderVO; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryService.java index 0c03802a39..0cd5240bd2 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryService.java @@ -66,7 +66,7 @@ public interface TradeOrderQueryService { Long getOrderCount(Long userId, Integer status, Boolean commonStatus); /** - * 获得订单的物流轨迹 + * 【前台】获得订单的物流轨迹 * * @param id 订单编号 * @param userId 用户编号 @@ -74,6 +74,14 @@ public interface TradeOrderQueryService { */ List getExpressTrackList(Long id, Long userId); + /** + * 【后台】获得订单的物流轨迹 + * + * @param id 订单编号 + * @return 物流轨迹数组 + */ + List getExpressTrackList(Long id); + // =================== Order Item =================== /** diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java index 9fb2384657..3cf2c17f62 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java @@ -106,6 +106,27 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService { throw exception(ORDER_NOT_FOUND); } + return getTrackRespDTOs(order); + } + + @Override + public List getExpressTrackList(Long id) { + // 查询订单 + TradeOrderDO order = tradeOrderMapper.selectById(id); + if (order == null) { + throw exception(ORDER_NOT_FOUND); + } + + return getTrackRespDTOs(order); + } + + /** + * 得到物流轨迹 + * + * @param order 订单 + * @return 物流轨迹 + */ + private List getTrackRespDTOs(TradeOrderDO order) { // 查询物流公司 if (order.getLogisticsId() == null) { return Collections.emptyList();