mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
订单中心:修改获取售后订单详情接口,修改订单管理后台物流获取接口
This commit is contained in:
parent
60d4aa97fb
commit
1f9968d784
@ -27,6 +27,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.annotation.security.PermitAll;
|
import javax.annotation.security.PermitAll;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -82,6 +84,24 @@ public class TradeAfterSaleController {
|
|||||||
MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId());
|
MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId());
|
||||||
// 获取售后日志
|
// 获取售后日志
|
||||||
List<TradeAfterSaleLogRespDTO> logs = afterSaleLogService.getLog(afterSale.getId());
|
List<TradeAfterSaleLogRespDTO> 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));
|
return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 交易订单")
|
@Tag(name = "管理后台 - 交易订单")
|
||||||
@RestController
|
@RestController
|
||||||
@ -70,7 +69,7 @@ public class TradeOrderController {
|
|||||||
TradeOrderDO order = tradeOrderQueryService.getOrder(id);
|
TradeOrderDO order = tradeOrderQueryService.getOrder(id);
|
||||||
// 查询订单项
|
// 查询订单项
|
||||||
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id);
|
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id);
|
||||||
|
// orderLog
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
MemberUserRespDTO user = memberUserApi.getUser(order.getUserId());
|
MemberUserRespDTO user = memberUserApi.getUser(order.getUserId());
|
||||||
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user));
|
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user));
|
||||||
@ -82,7 +81,7 @@ public class TradeOrderController {
|
|||||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||||
public CommonResult<List<?>> getOrderExpressTrackList(@RequestParam("id") Long id) {
|
public CommonResult<List<?>> getOrderExpressTrackList(@RequestParam("id") Long id) {
|
||||||
return success(TradeOrderConvert.INSTANCE.convertList02(
|
return success(TradeOrderConvert.INSTANCE.convertList02(
|
||||||
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
|
tradeOrderQueryService.getExpressTrackList(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/delivery")
|
@PutMapping("/delivery")
|
||||||
@ -117,11 +116,4 @@ public class TradeOrderController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999 订单物流详情
|
|
||||||
// TODO @puhui999 【前台】订单取消
|
|
||||||
// TODO @puhui999 【后台】订单取消
|
|
||||||
// TODO @puhui999 【前台】订单核销
|
|
||||||
// TODO @puhui999 【前台】订单删除
|
|
||||||
// TODO @puhui999 【后台】订单统计
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 交易订单的详情 Response VO")
|
@Schema(description = "管理后台 - 交易订单的详情 Response VO")
|
||||||
@ -24,6 +25,26 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO {
|
|||||||
*/
|
*/
|
||||||
private MemberUserRespVO user;
|
private MemberUserRespVO user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO 订单操作日志, 先模拟一波
|
||||||
|
*/
|
||||||
|
private List<OrderLog> orderLog;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class OrderLog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 交易订单的详情的订单项目")
|
@Schema(description = "管理后台 - 交易订单的详情的订单项目")
|
||||||
@Data
|
@Data
|
||||||
public static class Item extends TradeOrderItemBaseVO {
|
public static class Item extends TradeOrderItemBaseVO {
|
||||||
|
@ -61,5 +61,5 @@ public class TradeOrderPageReqVO extends PageParam {
|
|||||||
@Schema(description = "订单来源", example = "10")
|
@Schema(description = "订单来源", example = "10")
|
||||||
@InEnum(value = TerminalEnum.class, message = "订单来源 {value}")
|
@InEnum(value = TerminalEnum.class, message = "订单来源 {value}")
|
||||||
private Integer terminal;
|
private Integer terminal;
|
||||||
|
// TODO 添加配送方式筛选
|
||||||
}
|
}
|
||||||
|
@ -72,16 +72,18 @@ public interface TradeAfterSaleConvert {
|
|||||||
|
|
||||||
default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||||
MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) {
|
MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) {
|
||||||
TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems, convertList1(logs));
|
TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems);
|
||||||
// 处理用户信息
|
// 处理用户信息
|
||||||
respVO.setUser(convert(user));
|
respVO.setUser(convert(user));
|
||||||
// 处理订单信息
|
// 处理订单信息
|
||||||
respVO.setOrder(convert(order));
|
respVO.setOrder(convert(order));
|
||||||
|
// 处理售后日志
|
||||||
|
respVO.setAfterSaleLog(convertList1(logs));
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list);
|
List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list);
|
||||||
@Mapping(target = "id", source = "afterSale.id")
|
@Mapping(target = "id", source = "afterSale.id")
|
||||||
TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems, List<TradeAfterSaleLogRespVO> logs);
|
TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems);
|
||||||
TradeOrderBaseVO convert(TradeOrderDO order);
|
TradeOrderBaseVO convert(TradeOrderDO order);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.trade.convert.order;
|
package cn.iocoder.yudao.module.trade.convert.order;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
@ -37,8 +36,10 @@ import org.mapstruct.Mapping;
|
|||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.*;
|
import java.time.LocalDateTime;
|
||||||
import java.util.stream.Collectors;
|
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.convertMap;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
|
||||||
@ -86,7 +87,9 @@ public interface TradeOrderConvert {
|
|||||||
default ProductSkuUpdateStockReqDTO convert(List<TradeOrderItemDO> list) {
|
default ProductSkuUpdateStockReqDTO convert(List<TradeOrderItemDO> list) {
|
||||||
return new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(list));
|
return new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ProductSkuUpdateStockReqDTO.Item> convertList(List<TradeOrderItemDO> list);
|
List<ProductSkuUpdateStockReqDTO.Item> convertList(List<TradeOrderItemDO> list);
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(source = "skuId", target = "id"),
|
@Mapping(source = "skuId", target = "id"),
|
||||||
@Mapping(source = "count", target = "incrCount"),
|
@Mapping(source = "count", target = "incrCount"),
|
||||||
@ -137,6 +140,15 @@ public interface TradeOrderConvert {
|
|||||||
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
||||||
// 处理用户信息
|
// 处理用户信息
|
||||||
orderVO.setUser(convert(user));
|
orderVO.setUser(convert(user));
|
||||||
|
// TODO puhui999:模拟订单操作日志
|
||||||
|
ArrayList<TradeOrderDetailRespVO.OrderLog> 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;
|
return orderVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public interface TradeOrderQueryService {
|
|||||||
Long getOrderCount(Long userId, Integer status, Boolean commonStatus);
|
Long getOrderCount(Long userId, Integer status, Boolean commonStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得订单的物流轨迹
|
* 【前台】获得订单的物流轨迹
|
||||||
*
|
*
|
||||||
* @param id 订单编号
|
* @param id 订单编号
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
@ -74,6 +74,14 @@ public interface TradeOrderQueryService {
|
|||||||
*/
|
*/
|
||||||
List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId);
|
List<ExpressTrackRespDTO> getExpressTrackList(Long id, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【后台】获得订单的物流轨迹
|
||||||
|
*
|
||||||
|
* @param id 订单编号
|
||||||
|
* @return 物流轨迹数组
|
||||||
|
*/
|
||||||
|
List<ExpressTrackRespDTO> getExpressTrackList(Long id);
|
||||||
|
|
||||||
// =================== Order Item ===================
|
// =================== Order Item ===================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,6 +106,27 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|||||||
throw exception(ORDER_NOT_FOUND);
|
throw exception(ORDER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return getTrackRespDTOs(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExpressTrackRespDTO> getExpressTrackList(Long id) {
|
||||||
|
// 查询订单
|
||||||
|
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
||||||
|
if (order == null) {
|
||||||
|
throw exception(ORDER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTrackRespDTOs(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到物流轨迹
|
||||||
|
*
|
||||||
|
* @param order 订单
|
||||||
|
* @return 物流轨迹
|
||||||
|
*/
|
||||||
|
private List<ExpressTrackRespDTO> getTrackRespDTOs(TradeOrderDO order) {
|
||||||
// 查询物流公司
|
// 查询物流公司
|
||||||
if (order.getLogisticsId() == null) {
|
if (order.getLogisticsId() == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
Loading…
Reference in New Issue
Block a user