!519 订单详情后端修改

Merge pull request !519 from 矿泉水/feature/mall_product
This commit is contained in:
芋道源码 2023-06-23 13:30:53 +00:00 committed by Gitee
commit b92ed60136
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 34 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
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;
@ -54,6 +55,10 @@ public class TradeOrderController {
if (CollUtil.isEmpty(pageResult.getList())) { if (CollUtil.isEmpty(pageResult.getList())) {
return success(PageResult.empty()); return success(PageResult.empty());
} }
//查询用户信息 mod by 矿泉水 20230614 begin
Map<Long, MemberUserRespDTO> userRespVOMap = memberUserApi.getUserMap(convertSet(pageResult.getList(),TradeOrderDO::getUserId));;
// end
// 查询订单项 // 查询订单项
List<TradeOrderItemDO> orderItems = tradeOrderService.getOrderItemListByOrderId( List<TradeOrderItemDO> orderItems = tradeOrderService.getOrderItemListByOrderId(
convertSet(pageResult.getList(), TradeOrderDO::getId)); convertSet(pageResult.getList(), TradeOrderDO::getId));
@ -61,7 +66,7 @@ public class TradeOrderController {
List<ProductPropertyValueDetailRespDTO> propertyValueDetails = productPropertyValueApi List<ProductPropertyValueDetailRespDTO> propertyValueDetails = productPropertyValueApi
.getPropertyValueDetailList(TradeOrderConvert.INSTANCE.convertPropertyValueIds(orderItems)); .getPropertyValueDetailList(TradeOrderConvert.INSTANCE.convertPropertyValueIds(orderItems));
// 最终组合 // 最终组合
return success(TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems, propertyValueDetails)); return success(TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems, propertyValueDetails, userRespVOMap));
} }
@GetMapping("/get-detail") @GetMapping("/get-detail")

View File

@ -71,7 +71,7 @@ public class TradeOrderBaseVO {
private String payChannelCode; private String payChannelCode;
@Schema(description = "商品原价(总)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") @Schema(description = "商品原价(总)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Integer originalPrice; private Integer totalPrice;
@Schema(description = "订单优惠(总)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "订单优惠(总)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer discountPrice; private Integer discountPrice;

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo; package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -18,6 +19,11 @@ public class TradeOrderPageItemRespVO extends TradeOrderBaseVO {
*/ */
private List<Item> items; private List<Item> items;
/**
* 用户信息
*/
private MemberUserRespDTO user;
@Schema(description = "管理后台 - 交易订单的分页项的订单项目") @Schema(description = "管理后台 - 交易订单的分页项的订单项目")
@Data @Data
public static class Item extends TradeOrderItemBaseVO { public static class Item extends TradeOrderItemBaseVO {

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo; package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.common.validation.Mobile; import cn.iocoder.yudao.framework.common.validation.Mobile;
@ -50,4 +51,8 @@ public class TradeOrderPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@Schema(description = "订单来源", example = "10")
@InEnum(value = TerminalEnum.class, message = "订单来源 {value}")
private Integer terminal;
} }

View File

@ -119,8 +119,18 @@ public interface TradeOrderConvert {
} }
// TODO 芋艿可简化 // TODO 芋艿可简化
/**
*
* @param pageResult
* @param orderItems
* @param propertyValueDetails
* @param memberUserRespDTOMap 新增参数会员DTO
* @return
*/
default PageResult<TradeOrderPageItemRespVO> convertPage(PageResult<TradeOrderDO> pageResult, List<TradeOrderItemDO> orderItems, default PageResult<TradeOrderPageItemRespVO> convertPage(PageResult<TradeOrderDO> pageResult, List<TradeOrderItemDO> orderItems,
List<ProductPropertyValueDetailRespDTO> propertyValueDetails) { List<ProductPropertyValueDetailRespDTO> propertyValueDetails,
Map<Long,MemberUserRespDTO> memberUserRespDTOMap) {
Map<Long, List<TradeOrderItemDO>> orderItemMap = convertMultiMap(orderItems, TradeOrderItemDO::getOrderId); Map<Long, List<TradeOrderItemDO>> orderItemMap = convertMultiMap(orderItems, TradeOrderItemDO::getOrderId);
Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId); Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId);
// 转化 List // 转化 List
@ -148,6 +158,10 @@ public interface TradeOrderConvert {
} }
// 处理收货地址 // 处理收货地址
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId())); orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
// 增加用户昵称
orderVO.setUser(memberUserRespDTOMap.get(orderVO.getUserId()));
return orderVO; return orderVO;
}); });
return new PageResult<>(orderVOs, pageResult.getTotal()); return new PageResult<>(orderVOs, pageResult.getTotal());

View File

@ -33,6 +33,7 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
.eqIfPresent(TradeOrderDO::getType, reqVO.getType()) .eqIfPresent(TradeOrderDO::getType, reqVO.getType())
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus()) .eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode()) .eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
.eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal()) //add by 矿泉水 20230615
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())); .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
} }