订单详情修改20230619

This commit is contained in:
xiaobai 2023-06-19 12:50:28 +08:00
parent dcb1660880
commit 6b3af71735
7 changed files with 36 additions and 5 deletions

0
tmp.json Normal file
View File

View File

@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
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.util.collection.CollectionUtils.convertSet;
@ -54,6 +55,10 @@ public class TradeOrderController {
if (CollUtil.isEmpty(pageResult.getList())) {
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(
convertSet(pageResult.getList(), TradeOrderDO::getId));
@ -61,7 +66,7 @@ public class TradeOrderController {
List<ProductPropertyValueDetailRespDTO> propertyValueDetails = productPropertyValueApi
.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")

View File

@ -70,10 +70,10 @@ public class TradeOrderBaseVO {
@Schema(description = "支付渠道", required = true, example = "wx_lite")
private String payChannelCode;
@Schema(description = "商品原价(总)", required = true, example = "1000")
private Integer originalPrice;
@Schema(description = "商品原价(总),单位:分", required = true, example = "1000")
private Integer totalPrice;
@Schema(description = "订单优惠(总)", required = true, example = "100")
@Schema(description = "订单优惠(总),单位:分", required = true, example = "100")
private Integer discountPrice;
@Schema(description = "运费金额", required = true, example = "100")

View File

@ -1,5 +1,6 @@
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -18,6 +19,11 @@ public class TradeOrderPageItemRespVO extends TradeOrderBaseVO {
*/
private List<Item> items;
/**
* 用户信息
*/
private MemberUserRespDTO user;
@Schema(description = "管理后台 - 交易订单的分页项的订单项目")
@Data
public static class Item extends TradeOrderItemBaseVO {

View File

@ -1,5 +1,6 @@
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.validation.InEnum;
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)
private LocalDateTime[] createTime;
@Schema(description = "订单来源", example = "10")
@InEnum(value = TerminalEnum.class, message = "订单来源 {value}")
private Integer terminal;
}

View File

@ -115,8 +115,18 @@ public interface TradeOrderConvert {
}
// TODO 芋艿可简化
/**
*
* @param pageResult
* @param orderItems
* @param propertyValueDetails
* @param memberUserRespDTOMap 新增参数会员DTO
* @return
*/
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, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId);
// 转化 List
@ -144,6 +154,10 @@ public interface TradeOrderConvert {
}
// 处理收货地址
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
// 增加用户昵称
orderVO.setUser(memberUserRespDTOMap.get(orderVO.getUserId()));
return orderVO;
});
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::getStatus, reqVO.getStatus())
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
.eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal()) //add by 矿泉水 20230615
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
}