Commit 1f9968d78496fcb91a8d2f073f39fee11289ae8f
1 parent
60d4aa97
订单中心:修改获取售后订单详情接口,修改订单管理后台物流获取接口
Showing
8 changed files
with
93 additions
and
17 deletions
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.*; | @@ -27,6 +27,8 @@ import org.springframework.web.bind.annotation.*; | ||
| 27 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
| 28 | import javax.annotation.security.PermitAll; | 28 | import javax.annotation.security.PermitAll; |
| 29 | import javax.validation.Valid; | 29 | import javax.validation.Valid; |
| 30 | +import java.time.LocalDateTime; | ||
| 31 | +import java.util.ArrayList; | ||
| 30 | import java.util.List; | 32 | import java.util.List; |
| 31 | import java.util.Map; | 33 | import java.util.Map; |
| 32 | 34 | ||
| @@ -82,6 +84,24 @@ public class TradeAfterSaleController { | @@ -82,6 +84,24 @@ public class TradeAfterSaleController { | ||
| 82 | MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId()); | 84 | MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId()); |
| 83 | // 获取售后日志 | 85 | // 获取售后日志 |
| 84 | List<TradeAfterSaleLogRespDTO> logs = afterSaleLogService.getLog(afterSale.getId()); | 86 | List<TradeAfterSaleLogRespDTO> logs = afterSaleLogService.getLog(afterSale.getId()); |
| 87 | + // TODO 方便测试看效果,review 后移除 | ||
| 88 | + if (logs == null) { | ||
| 89 | + logs = new ArrayList<>(); | ||
| 90 | + } | ||
| 91 | + for (int i = 1; i <= 6; i++) { | ||
| 92 | + TradeAfterSaleLogRespDTO respVO = new TradeAfterSaleLogRespDTO(); | ||
| 93 | + respVO.setId((long) i); | ||
| 94 | + respVO.setUserId((long) i); | ||
| 95 | + respVO.setUserType(1); | ||
| 96 | + respVO.setAfterSaleId(id); | ||
| 97 | + respVO.setOrderId((long) i); | ||
| 98 | + respVO.setOrderItemId((long) i); | ||
| 99 | + respVO.setBeforeStatus((i - 1) * 10); | ||
| 100 | + respVO.setAfterStatus(i * 10); | ||
| 101 | + respVO.setContent("66+6"); | ||
| 102 | + respVO.setCreateTime(LocalDateTime.now()); | ||
| 103 | + logs.add(respVO); | ||
| 104 | + } | ||
| 85 | return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs)); | 105 | return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs)); |
| 86 | } | 106 | } |
| 87 | 107 |
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; | @@ -25,7 +25,6 @@ import java.util.Map; | ||
| 25 | 25 | ||
| 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | 27 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 28 | -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 29 | 28 | ||
| 30 | @Tag(name = "管理后台 - 交易订单") | 29 | @Tag(name = "管理后台 - 交易订单") |
| 31 | @RestController | 30 | @RestController |
| @@ -70,7 +69,7 @@ public class TradeOrderController { | @@ -70,7 +69,7 @@ public class TradeOrderController { | ||
| 70 | TradeOrderDO order = tradeOrderQueryService.getOrder(id); | 69 | TradeOrderDO order = tradeOrderQueryService.getOrder(id); |
| 71 | // 查询订单项 | 70 | // 查询订单项 |
| 72 | List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id); | 71 | List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id); |
| 73 | - | 72 | + // orderLog |
| 74 | // 拼接数据 | 73 | // 拼接数据 |
| 75 | MemberUserRespDTO user = memberUserApi.getUser(order.getUserId()); | 74 | MemberUserRespDTO user = memberUserApi.getUser(order.getUserId()); |
| 76 | return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user)); | 75 | return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user)); |
| @@ -82,7 +81,7 @@ public class TradeOrderController { | @@ -82,7 +81,7 @@ public class TradeOrderController { | ||
| 82 | @PreAuthorize("@ss.hasPermission('trade:order:query')") | 81 | @PreAuthorize("@ss.hasPermission('trade:order:query')") |
| 83 | public CommonResult<List<?>> getOrderExpressTrackList(@RequestParam("id") Long id) { | 82 | public CommonResult<List<?>> getOrderExpressTrackList(@RequestParam("id") Long id) { |
| 84 | return success(TradeOrderConvert.INSTANCE.convertList02( | 83 | return success(TradeOrderConvert.INSTANCE.convertList02( |
| 85 | - tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); | 84 | + tradeOrderQueryService.getExpressTrackList(id))); |
| 86 | } | 85 | } |
| 87 | 86 | ||
| 88 | @PutMapping("/delivery") | 87 | @PutMapping("/delivery") |
| @@ -117,11 +116,4 @@ public class TradeOrderController { | @@ -117,11 +116,4 @@ public class TradeOrderController { | ||
| 117 | return success(true); | 116 | return success(true); |
| 118 | } | 117 | } |
| 119 | 118 | ||
| 120 | - // TODO @puhui999 订单物流详情 | ||
| 121 | - // TODO @puhui999 【前台】订单取消 | ||
| 122 | - // TODO @puhui999 【后台】订单取消 | ||
| 123 | - // TODO @puhui999 【前台】订单核销 | ||
| 124 | - // TODO @puhui999 【前台】订单删除 | ||
| 125 | - // TODO @puhui999 【后台】订单统计 | ||
| 126 | - | ||
| 127 | } | 119 | } |
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 | @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.Prod | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| 8 | +import java.time.LocalDateTime; | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| 9 | 10 | ||
| 10 | @Schema(description = "管理后台 - 交易订单的详情 Response VO") | 11 | @Schema(description = "管理后台 - 交易订单的详情 Response VO") |
| @@ -24,6 +25,26 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO { | @@ -24,6 +25,26 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO { | ||
| 24 | */ | 25 | */ |
| 25 | private MemberUserRespVO user; | 26 | private MemberUserRespVO user; |
| 26 | 27 | ||
| 28 | + /** | ||
| 29 | + * TODO 订单操作日志, 先模拟一波 | ||
| 30 | + */ | ||
| 31 | + private List<OrderLog> orderLog; | ||
| 32 | + | ||
| 33 | + @Data | ||
| 34 | + public static class OrderLog { | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 内容 | ||
| 38 | + */ | ||
| 39 | + private String content; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 创建时间 | ||
| 43 | + */ | ||
| 44 | + private LocalDateTime createTime; | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | + | ||
| 27 | @Schema(description = "管理后台 - 交易订单的详情的订单项目") | 48 | @Schema(description = "管理后台 - 交易订单的详情的订单项目") |
| 28 | @Data | 49 | @Data |
| 29 | public static class Item extends TradeOrderItemBaseVO { | 50 | public static class Item extends TradeOrderItemBaseVO { |
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 { | @@ -61,5 +61,5 @@ public class TradeOrderPageReqVO extends PageParam { | ||
| 61 | @Schema(description = "订单来源", example = "10") | 61 | @Schema(description = "订单来源", example = "10") |
| 62 | @InEnum(value = TerminalEnum.class, message = "订单来源 {value}") | 62 | @InEnum(value = TerminalEnum.class, message = "订单来源 {value}") |
| 63 | private Integer terminal; | 63 | private Integer terminal; |
| 64 | - | 64 | +// TODO 添加配送方式筛选 |
| 65 | } | 65 | } |
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 { | @@ -72,16 +72,18 @@ public interface TradeAfterSaleConvert { | ||
| 72 | 72 | ||
| 73 | default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems, | 73 | default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 74 | MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) { | 74 | MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) { |
| 75 | - TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems, convertList1(logs)); | 75 | + TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems); |
| 76 | // 处理用户信息 | 76 | // 处理用户信息 |
| 77 | respVO.setUser(convert(user)); | 77 | respVO.setUser(convert(user)); |
| 78 | // 处理订单信息 | 78 | // 处理订单信息 |
| 79 | respVO.setOrder(convert(order)); | 79 | respVO.setOrder(convert(order)); |
| 80 | + // 处理售后日志 | ||
| 81 | + respVO.setAfterSaleLog(convertList1(logs)); | ||
| 80 | return respVO; | 82 | return respVO; |
| 81 | } | 83 | } |
| 82 | List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list); | 84 | List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list); |
| 83 | @Mapping(target = "id", source = "afterSale.id") | 85 | @Mapping(target = "id", source = "afterSale.id") |
| 84 | - TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems, List<TradeAfterSaleLogRespVO> logs); | 86 | + TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems); |
| 85 | TradeOrderBaseVO convert(TradeOrderDO order); | 87 | TradeOrderBaseVO convert(TradeOrderDO order); |
| 86 | 88 | ||
| 87 | } | 89 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| 1 | package cn.iocoder.yudao.module.trade.convert.order; | 1 | package cn.iocoder.yudao.module.trade.convert.order; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.util.StrUtil; | 3 | import cn.hutool.core.util.StrUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 5 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| @@ -37,8 +36,10 @@ import org.mapstruct.Mapping; | @@ -37,8 +36,10 @@ import org.mapstruct.Mapping; | ||
| 37 | import org.mapstruct.Mappings; | 36 | import org.mapstruct.Mappings; |
| 38 | import org.mapstruct.factory.Mappers; | 37 | import org.mapstruct.factory.Mappers; |
| 39 | 38 | ||
| 40 | -import java.util.*; | ||
| 41 | -import java.util.stream.Collectors; | 39 | +import java.time.LocalDateTime; |
| 40 | +import java.util.ArrayList; | ||
| 41 | +import java.util.List; | ||
| 42 | +import java.util.Map; | ||
| 42 | 43 | ||
| 43 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | 44 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 44 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; | 45 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; |
| @@ -86,7 +87,9 @@ public interface TradeOrderConvert { | @@ -86,7 +87,9 @@ public interface TradeOrderConvert { | ||
| 86 | default ProductSkuUpdateStockReqDTO convert(List<TradeOrderItemDO> list) { | 87 | default ProductSkuUpdateStockReqDTO convert(List<TradeOrderItemDO> list) { |
| 87 | return new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(list)); | 88 | return new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(list)); |
| 88 | } | 89 | } |
| 90 | + | ||
| 89 | List<ProductSkuUpdateStockReqDTO.Item> convertList(List<TradeOrderItemDO> list); | 91 | List<ProductSkuUpdateStockReqDTO.Item> convertList(List<TradeOrderItemDO> list); |
| 92 | + | ||
| 90 | @Mappings({ | 93 | @Mappings({ |
| 91 | @Mapping(source = "skuId", target = "id"), | 94 | @Mapping(source = "skuId", target = "id"), |
| 92 | @Mapping(source = "count", target = "incrCount"), | 95 | @Mapping(source = "count", target = "incrCount"), |
| @@ -137,6 +140,15 @@ public interface TradeOrderConvert { | @@ -137,6 +140,15 @@ public interface TradeOrderConvert { | ||
| 137 | orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId())); | 140 | orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId())); |
| 138 | // 处理用户信息 | 141 | // 处理用户信息 |
| 139 | orderVO.setUser(convert(user)); | 142 | orderVO.setUser(convert(user)); |
| 143 | + // TODO puhui999:模拟订单操作日志 | ||
| 144 | + ArrayList<TradeOrderDetailRespVO.OrderLog> orderLogs = new ArrayList<>(); | ||
| 145 | + for (int i = 0; i < 6; i++) { | ||
| 146 | + TradeOrderDetailRespVO.OrderLog orderLog = new TradeOrderDetailRespVO.OrderLog(); | ||
| 147 | + orderLog.setContent("订单操作" + i); | ||
| 148 | + orderLog.setCreateTime(LocalDateTime.now()); | ||
| 149 | + orderLogs.add(orderLog); | ||
| 150 | + } | ||
| 151 | + orderVO.setOrderLog(orderLogs); | ||
| 140 | return orderVO; | 152 | return orderVO; |
| 141 | } | 153 | } |
| 142 | 154 |
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 { | @@ -66,7 +66,7 @@ public interface TradeOrderQueryService { | ||
| 66 | Long getOrderCount(Long userId, Integer status, Boolean commonStatus); | 66 | Long getOrderCount(Long userId, Integer status, Boolean commonStatus); |
| 67 | 67 | ||
| 68 | /** | 68 | /** |
| 69 | - * 获得订单的物流轨迹 | 69 | + * 【前台】获得订单的物流轨迹 |
| 70 | * | 70 | * |
| 71 | * @param id 订单编号 | 71 | * @param id 订单编号 |
| 72 | * @param userId 用户编号 | 72 | * @param userId 用户编号 |
| @@ -74,6 +74,14 @@ public interface TradeOrderQueryService { | @@ -74,6 +74,14 @@ public interface TradeOrderQueryService { | ||
| 74 | */ | 74 | */ |
| 75 | List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId); | 75 | List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId); |
| 76 | 76 | ||
| 77 | + /** | ||
| 78 | + * 【后台】获得订单的物流轨迹 | ||
| 79 | + * | ||
| 80 | + * @param id 订单编号 | ||
| 81 | + * @return 物流轨迹数组 | ||
| 82 | + */ | ||
| 83 | + List<ExpressTrackRespDTO> getExpressTrackList(Long id); | ||
| 84 | + | ||
| 77 | // =================== Order Item =================== | 85 | // =================== Order Item =================== |
| 78 | 86 | ||
| 79 | /** | 87 | /** |
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 { | @@ -106,6 +106,27 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService { | ||
| 106 | throw exception(ORDER_NOT_FOUND); | 106 | throw exception(ORDER_NOT_FOUND); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | + return getTrackRespDTOs(order); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @Override | ||
| 113 | + public List<ExpressTrackRespDTO> getExpressTrackList(Long id) { | ||
| 114 | + // 查询订单 | ||
| 115 | + TradeOrderDO order = tradeOrderMapper.selectById(id); | ||
| 116 | + if (order == null) { | ||
| 117 | + throw exception(ORDER_NOT_FOUND); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + return getTrackRespDTOs(order); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 得到物流轨迹 | ||
| 125 | + * | ||
| 126 | + * @param order 订单 | ||
| 127 | + * @return 物流轨迹 | ||
| 128 | + */ | ||
| 129 | + private List<ExpressTrackRespDTO> getTrackRespDTOs(TradeOrderDO order) { | ||
| 109 | // 查询物流公司 | 130 | // 查询物流公司 |
| 110 | if (order.getLogisticsId() == null) { | 131 | if (order.getLogisticsId() == null) { |
| 111 | return Collections.emptyList(); | 132 | return Collections.emptyList(); |