mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
commit
8bd1942083
2
sql/mysql/mall.sql
Normal file
2
sql/mysql/mall.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name)
|
||||||
|
VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder');
|
@ -0,0 +1,313 @@
|
|||||||
|
package cn.iocoder.yudao.framework.mybatis.core.query;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
import com.github.yulichang.toolkit.MPJWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拓展 MyBatis Plus Join QueryWrapper 类,主要增加如下功能:
|
||||||
|
* <p>
|
||||||
|
* 1. 拼接条件的方法,增加 xxxIfPresent 方法,用于判断值不存在的时候,不要拼接到条件中。
|
||||||
|
*
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> {
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> likeIfPresent(SFunction<T, ?> column, String val) {
|
||||||
|
MPJWrappers.lambdaJoin().like(column, val);
|
||||||
|
if (StringUtils.hasText(val)) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.like(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> inIfPresent(SFunction<T, ?> column, Collection<?> values) {
|
||||||
|
if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.in(column, values);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) {
|
||||||
|
if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.in(column, values);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> eqIfPresent(SFunction<T, ?> column, Object val) {
|
||||||
|
if (ObjectUtil.isNotEmpty(val)) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.eq(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> neIfPresent(SFunction<T, ?> column, Object val) {
|
||||||
|
if (ObjectUtil.isNotEmpty(val)) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.ne(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> gtIfPresent(SFunction<T, ?> column, Object val) {
|
||||||
|
if (val != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.gt(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> geIfPresent(SFunction<T, ?> column, Object val) {
|
||||||
|
if (val != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.ge(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> ltIfPresent(SFunction<T, ?> column, Object val) {
|
||||||
|
if (val != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.lt(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> leIfPresent(SFunction<T, ?> column, Object val) {
|
||||||
|
if (val != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.le(column, val);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object val1, Object val2) {
|
||||||
|
if (val1 != null && val2 != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) super.between(column, val1, val2);
|
||||||
|
}
|
||||||
|
if (val1 != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) ge(column, val1);
|
||||||
|
}
|
||||||
|
if (val2 != null) {
|
||||||
|
return (MPJLambdaWrapperX<T>) le(column, val2);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MPJLambdaWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) {
|
||||||
|
Object val1 = ArrayUtils.get(values, 0);
|
||||||
|
Object val2 = ArrayUtils.get(values, 1);
|
||||||
|
return betweenIfPresent(column, val1, val2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 重写父类方法,方便链式调用 ==========
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> MPJLambdaWrapperX<T> eq(boolean condition, SFunction<X, ?> column, Object val) {
|
||||||
|
super.eq(condition, column, val);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> MPJLambdaWrapperX<T> eq(SFunction<X, ?> column, Object val) {
|
||||||
|
super.eq(column, val);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> MPJLambdaWrapperX<T> orderByDesc(SFunction<X, ?> column) {
|
||||||
|
//noinspection unchecked
|
||||||
|
super.orderByDesc(true, column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MPJLambdaWrapperX<T> last(String lastSql) {
|
||||||
|
super.last(lastSql);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> MPJLambdaWrapperX<T> in(SFunction<X, ?> column, Collection<?> coll) {
|
||||||
|
super.in(column, coll);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MPJLambdaWrapperX<T> selectAll(Class<?> clazz) {
|
||||||
|
super.selectAll(clazz);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MPJLambdaWrapperX<T> selectAll(Class<?> clazz, String prefix) {
|
||||||
|
super.selectAll(clazz, prefix);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectAs(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectAs(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> MPJLambdaWrapperX<T> selectAs(String column, SFunction<E, ?> alias) {
|
||||||
|
super.selectAs(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectAs(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectAs(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E, X> MPJLambdaWrapperX<T> selectAs(String index, SFunction<E, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectAs(index, column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> MPJLambdaWrapperX<T> selectAsClass(Class<E> source, Class<?> tag) {
|
||||||
|
super.selectAsClass(source, tag);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E, F> MPJLambdaWrapperX<T> selectSub(Class<E> clazz, Consumer<MPJLambdaWrapper<E>> consumer, SFunction<F, ?> alias) {
|
||||||
|
super.selectSub(clazz, consumer, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E, F> MPJLambdaWrapperX<T> selectSub(Class<E> clazz, String st, Consumer<MPJLambdaWrapper<E>> consumer, SFunction<F, ?> alias) {
|
||||||
|
super.selectSub(clazz, st, consumer, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column) {
|
||||||
|
super.selectCount(column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MPJLambdaWrapperX<T> selectCount(Object column, String alias) {
|
||||||
|
super.selectCount(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> MPJLambdaWrapperX<T> selectCount(Object column, SFunction<X, ?> alias) {
|
||||||
|
super.selectCount(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectCount(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectCount(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column) {
|
||||||
|
super.selectSum(column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectSum(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectSum(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column) {
|
||||||
|
super.selectMax(column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectMax(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectMax(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column) {
|
||||||
|
super.selectMin(column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectMin(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectMin(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column) {
|
||||||
|
super.selectAvg(column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectAvg(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectAvg(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column) {
|
||||||
|
super.selectLen(column);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column, String alias) {
|
||||||
|
super.selectLen(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S, X> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column, SFunction<X, ?> alias) {
|
||||||
|
super.selectLen(column, alias);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,8 +24,11 @@ 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 java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
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.convertList;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 交易订单")
|
@Tag(name = "管理后台 - 交易订单")
|
||||||
@ -56,7 +59,9 @@ public class TradeOrderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(convertSet(pageResult.getList(), TradeOrderDO::getUserId));
|
Set<Long> userIds = CollUtil.unionDistinct(convertList(pageResult.getList(), TradeOrderDO::getUserId),
|
||||||
|
convertList(pageResult.getList(), TradeOrderDO::getBrokerageUserId, Objects::nonNull));
|
||||||
|
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds);
|
||||||
// 查询订单项
|
// 查询订单项
|
||||||
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(
|
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(
|
||||||
convertSet(pageResult.getList(), TradeOrderDO::getId));
|
convertSet(pageResult.getList(), TradeOrderDO::getId));
|
||||||
@ -64,6 +69,13 @@ public class TradeOrderController {
|
|||||||
return success(TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems, userMap));
|
return success(TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems, userMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/summary")
|
||||||
|
@Operation(summary = "获得交易订单统计")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||||
|
public CommonResult<TradeOrderSummaryRespVO> getOrderSummary(TradeOrderPageReqVO reqVO) {
|
||||||
|
return success(tradeOrderQueryService.getOrderSummary(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get-detail")
|
@GetMapping("/get-detail")
|
||||||
@Operation(summary = "获得交易订单详情")
|
@Operation(summary = "获得交易订单详情")
|
||||||
@Parameter(name = "id", description = "订单编号", required = true, example = "1")
|
@Parameter(name = "id", description = "订单编号", required = true, example = "1")
|
||||||
|
@ -145,4 +145,7 @@ public class TradeOrderBaseVO {
|
|||||||
@Schema(description = "VIP 减免金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
|
@Schema(description = "VIP 减免金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
|
||||||
private Integer vipPrice;
|
private Integer vipPrice;
|
||||||
|
|
||||||
|
@Schema(description = "推广人编号", example = "1")
|
||||||
|
private Long brokerageUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +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.member.user.MemberUserRespVO;
|
||||||
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;
|
||||||
@ -14,24 +14,20 @@ public class TradeOrderPageItemRespVO extends TradeOrderBaseVO {
|
|||||||
@Schema(description = "收件人地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海 上海市 普陀区")
|
@Schema(description = "收件人地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海 上海市 普陀区")
|
||||||
private String receiverAreaName;
|
private String receiverAreaName;
|
||||||
|
|
||||||
/**
|
@Schema(description = "订单项列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
* 订单项列表
|
|
||||||
*/
|
|
||||||
private List<Item> items;
|
private List<Item> items;
|
||||||
|
|
||||||
// TODO @xiaobai:使用 MemberUserRespVO 返回哈;DTO 不直接给前端
|
@Schema(description = "用户信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
/**
|
private MemberUserRespVO user;
|
||||||
* 用户信息
|
|
||||||
*/
|
@Schema(description = "推广人信息")
|
||||||
private MemberUserRespDTO user;
|
private MemberUserRespVO brokerageUser;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 交易订单的分页项的订单项目")
|
@Schema(description = "管理后台 - 交易订单的分页项的订单项目")
|
||||||
@Data
|
@Data
|
||||||
public static class Item extends TradeOrderItemBaseVO {
|
public static class Item extends TradeOrderItemBaseVO {
|
||||||
|
|
||||||
/**
|
@Schema(description = "属性列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
* 属性数组
|
|
||||||
*/
|
|
||||||
private List<ProductPropertyValueDetailRespVO> properties;
|
private List<ProductPropertyValueDetailRespVO> properties;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 交易订单统计 Response VO")
|
||||||
|
@Data
|
||||||
|
public class TradeOrderSummaryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long orderCount;
|
||||||
|
|
||||||
|
@Schema(description = "订单金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long orderPayPrice;
|
||||||
|
|
||||||
|
@Schema(description = "退款单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long afterSaleCount;
|
||||||
|
|
||||||
|
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long afterSalePrice;
|
||||||
|
|
||||||
|
}
|
@ -124,13 +124,17 @@ public interface TradeOrderConvert {
|
|||||||
TradeOrderPageItemRespVO orderVO = convert(order, xOrderItems);
|
TradeOrderPageItemRespVO orderVO = convert(order, xOrderItems);
|
||||||
// 处理收货地址
|
// 处理收货地址
|
||||||
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
||||||
// 增加用户昵称
|
// 增加用户信息
|
||||||
orderVO.setUser(memberUserMap.get(orderVO.getUserId()));
|
orderVO.setUser(convertUser(memberUserMap.get(orderVO.getUserId())));
|
||||||
|
// 增加推广人信息
|
||||||
|
orderVO.setBrokerageUser(convertUser(memberUserMap.get(orderVO.getBrokerageUserId())));
|
||||||
return orderVO;
|
return orderVO;
|
||||||
});
|
});
|
||||||
return new PageResult<>(orderVOs, pageResult.getTotal());
|
return new PageResult<>(orderVOs, pageResult.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MemberUserRespVO convertUser(MemberUserRespDTO memberUserRespDTO);
|
||||||
|
|
||||||
TradeOrderPageItemRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> items);
|
TradeOrderPageItemRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||||
|
|
||||||
ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
|
ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.dal.mysql.order;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@ -42,6 +44,26 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
|||||||
.orderByDesc(TradeOrderDO::getId));
|
.orderByDesc(TradeOrderDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<Map<String, Object>> selectOrderSummaryGroupByRefundStatus(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
|
||||||
|
return selectMaps(new MPJLambdaWrapperX<TradeOrderDO>()
|
||||||
|
.selectAs(TradeOrderDO::getRefundStatus, TradeOrderDO::getRefundStatus) // 售后状态
|
||||||
|
.selectCount(TradeOrderDO::getId, "count") // 售后状态对应的数量
|
||||||
|
.selectSum(TradeOrderDO::getPayPrice, "price") // 售后状态对应的支付金额
|
||||||
|
.likeIfPresent(TradeOrderDO::getNo, reqVO.getNo())
|
||||||
|
.eqIfPresent(TradeOrderDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(TradeOrderDO::getDeliveryType, reqVO.getDeliveryType())
|
||||||
|
.inIfPresent(TradeOrderDO::getUserId, userIds)
|
||||||
|
.eqIfPresent(TradeOrderDO::getType, reqVO.getType())
|
||||||
|
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
|
||||||
|
.eqIfPresent(TradeOrderDO::getTerminal, reqVO.getTerminal())
|
||||||
|
.eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
|
||||||
|
.inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
|
||||||
|
.likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
|
||||||
|
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.groupBy(TradeOrderDO::getRefundStatus)); // 按售后状态分组
|
||||||
|
}
|
||||||
|
|
||||||
default PageResult<TradeOrderDO> selectPage(AppTradeOrderPageReqVO reqVO, Long userId) {
|
default PageResult<TradeOrderDO> selectPage(AppTradeOrderPageReqVO reqVO, Long userId) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
||||||
.eq(TradeOrderDO::getUserId, userId)
|
.eq(TradeOrderDO::getUserId, userId)
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.service.order;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
@ -64,6 +65,14 @@ public interface TradeOrderQueryService {
|
|||||||
*/
|
*/
|
||||||
PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO);
|
PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得订单统计
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 订单统计
|
||||||
|
*/
|
||||||
|
TradeOrderSummaryRespVO getOrderSummary(TradeOrderPageReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【会员】获得交易订单分页
|
* 【会员】获得交易订单分页
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.trade.service.order;
|
package cn.iocoder.yudao.module.trade.service.order;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
@ -8,6 +9,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
@ -15,6 +17,7 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
|||||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
||||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
|
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
|
||||||
import cn.iocoder.yudao.module.trade.dal.redis.RedisKeyConstants;
|
import cn.iocoder.yudao.module.trade.dal.redis.RedisKeyConstants;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
|
||||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||||
import cn.iocoder.yudao.module.trade.framework.delivery.core.client.ExpressClientFactory;
|
import cn.iocoder.yudao.module.trade.framework.delivery.core.client.ExpressClientFactory;
|
||||||
import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackQueryReqDTO;
|
import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackQueryReqDTO;
|
||||||
@ -85,24 +88,57 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO) {
|
public PageResult<TradeOrderDO> getOrderPage(TradeOrderPageReqVO reqVO) {
|
||||||
|
// 根据用户查询条件构建用户编号列表
|
||||||
|
Set<Long> userIds = buildQueryConditionUserIds(reqVO);
|
||||||
|
if (userIds == null) { // 没查询到用户,说明肯定也没他的订单
|
||||||
|
return PageResult.empty();
|
||||||
|
}
|
||||||
|
// 分页查询
|
||||||
|
return tradeOrderMapper.selectPage(reqVO, userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<Long> buildQueryConditionUserIds(TradeOrderPageReqVO reqVO) {
|
||||||
// 获得 userId 相关的查询
|
// 获得 userId 相关的查询
|
||||||
Set<Long> userIds = new HashSet<>();
|
Set<Long> userIds = new HashSet<>();
|
||||||
if (StrUtil.isNotEmpty(reqVO.getUserMobile())) {
|
if (StrUtil.isNotEmpty(reqVO.getUserMobile())) {
|
||||||
MemberUserRespDTO user = memberUserApi.getUserByMobile(reqVO.getUserMobile());
|
MemberUserRespDTO user = memberUserApi.getUserByMobile(reqVO.getUserMobile());
|
||||||
if (user == null) { // 没查询到用户,说明肯定也没他的订单
|
if (user == null) { // 没查询到用户,说明肯定也没他的订单
|
||||||
return new PageResult<>();
|
return null;
|
||||||
}
|
}
|
||||||
userIds.add(user.getId());
|
userIds.add(user.getId());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
||||||
List<MemberUserRespDTO> users = memberUserApi.getUserListByNickname(reqVO.getUserNickname());
|
List<MemberUserRespDTO> users = memberUserApi.getUserListByNickname(reqVO.getUserNickname());
|
||||||
if (CollUtil.isEmpty(users)) { // 没查询到用户,说明肯定也没他的订单
|
if (CollUtil.isEmpty(users)) { // 没查询到用户,说明肯定也没他的订单
|
||||||
return new PageResult<>();
|
return null;
|
||||||
}
|
}
|
||||||
userIds.addAll(convertSet(users, MemberUserRespDTO::getId));
|
userIds.addAll(convertSet(users, MemberUserRespDTO::getId));
|
||||||
}
|
}
|
||||||
// 分页查询
|
return userIds;
|
||||||
return tradeOrderMapper.selectPage(reqVO, userIds);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TradeOrderSummaryRespVO getOrderSummary(TradeOrderPageReqVO reqVO) {
|
||||||
|
// 根据用户查询条件构建用户编号列表
|
||||||
|
Set<Long> userIds = buildQueryConditionUserIds(reqVO);
|
||||||
|
if (userIds == null) { // 没查询到用户,说明肯定也没他的订单
|
||||||
|
return new TradeOrderSummaryRespVO();
|
||||||
|
}
|
||||||
|
// 查询每个售后状态对应的数量、金额
|
||||||
|
List<Map<String, Object>> list = tradeOrderMapper.selectOrderSummaryGroupByRefundStatus(reqVO, null);
|
||||||
|
|
||||||
|
TradeOrderSummaryRespVO vo = new TradeOrderSummaryRespVO().setAfterSaleCount(0L).setAfterSalePrice(0L);
|
||||||
|
for (Map<String, Object> map : list) {
|
||||||
|
Long count = MapUtil.getLong(map, "count", 0L);
|
||||||
|
Long price = MapUtil.getLong(map, "price", 0L);
|
||||||
|
// 未退款的计入订单,部分退款、全部退款计入售后
|
||||||
|
if (TradeOrderRefundStatusEnum.NONE.getStatus().equals(MapUtil.getInt(map, "refundStatus"))) {
|
||||||
|
vo.setOrderCount(count).setOrderPayPrice(price);
|
||||||
|
} else {
|
||||||
|
vo.setAfterSaleCount(vo.getAfterSaleCount() + count).setAfterSalePrice(vo.getAfterSalePrice() + price);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user