|
@@ -1,36 +1,50 @@
|
|
|
package cn.newfeifan.mall.module.trade.controller.admin.order;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.newfeifan.mall.framework.common.pojo.CommonResult;
|
|
|
import cn.newfeifan.mall.framework.common.pojo.PageResult;
|
|
|
import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
|
|
|
import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
|
|
|
+import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
|
|
|
+import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageReqVO;
|
|
|
+import cn.newfeifan.mall.module.pay.convert.order.PayOrderConvert;
|
|
|
+import cn.newfeifan.mall.module.pay.dal.dataobject.app.PayAppDO;
|
|
|
+import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
|
|
|
+import cn.newfeifan.mall.module.pay.service.app.PayAppService;
|
|
|
+import cn.newfeifan.mall.module.pay.service.order.PayOrderService;
|
|
|
import cn.newfeifan.mall.module.trade.controller.admin.order.vo.*;
|
|
|
import cn.newfeifan.mall.module.trade.convert.order.TradeOrderConvert;
|
|
|
+import cn.newfeifan.mall.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
|
|
import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderDO;
|
|
|
import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
|
|
import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderLogDO;
|
|
|
+import cn.newfeifan.mall.module.trade.enums.order.TradeOrderStatusEnum;
|
|
|
+import cn.newfeifan.mall.module.trade.framework.order.config.TradeOrderProperties;
|
|
|
import cn.newfeifan.mall.module.trade.service.aftersale.AfterSaleService;
|
|
|
+import cn.newfeifan.mall.module.trade.service.delivery.DeliveryExpressService;
|
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderLogService;
|
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
|
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.Set;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
|
|
|
import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
+import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
|
|
|
|
@Tag(name = "管理后台 - 交易订单")
|
|
|
@RestController
|
|
@@ -45,10 +59,22 @@ public class TradeOrderController {
|
|
|
private TradeOrderQueryService tradeOrderQueryService;
|
|
|
@Resource
|
|
|
private TradeOrderLogService tradeOrderLogService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private TradeOrderProperties tradeOrderProperties;
|
|
|
@Resource
|
|
|
private MemberUserApi memberUserApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private DeliveryExpressService deliveryExpressService;
|
|
|
+ @Resource
|
|
|
+ private AfterSaleService afterSaleService;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private PayOrderService orderService;
|
|
|
+ @Resource
|
|
|
+ private PayAppService appService;
|
|
|
+
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得交易订单分页")
|
|
|
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
|
@@ -77,6 +103,15 @@ public class TradeOrderController {
|
|
|
return success(tradeOrderQueryService.getOrderSummary(reqVO));
|
|
|
}
|
|
|
|
|
|
+ /* @GetMapping("/order-count")
|
|
|
+ @Operation(summary = "获得交易订单统计")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
|
|
+ public CommonResult<TradeOrderSummaryRespVO> getOrderCount(TradeOrderPageReqVO reqVO) {
|
|
|
+ Long orderCount = tradeOrderQueryService.getOrderCount(getLoginUserId(), null, null);
|
|
|
+ return success(orderCount);
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/get-detail")
|
|
|
@Operation(summary = "获得交易订单详情")
|
|
|
@Parameter(name = "id", description = "订单编号", required = true, example = "1")
|
|
@@ -166,4 +201,40 @@ public class TradeOrderController {
|
|
|
return success(TradeOrderConvert.INSTANCE.convert2(tradeOrder, null));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/get-count")
|
|
|
+ @Operation(summary = "获得交易订单数量")
|
|
|
+ public CommonResult<Map<Integer, Long>> getOrderCount(@RequestParam(value = "shopId", required = false) Long shopId,
|
|
|
+ @RequestParam(value = "merId", required = false) Long merId) {
|
|
|
+ Map<Integer, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(6);
|
|
|
+ orderCount.put(-1, tradeOrderQueryService.getOrderCount(null));
|
|
|
+ orderCount.put(-2, afterSaleService.getApplyingAfterSaleCount(null));
|
|
|
+ orderCount.put(TradeOrderStatusEnum.UNPAID.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNPAID.getStatus(), shopId, merId));
|
|
|
+ orderCount.put(TradeOrderStatusEnum.UNDELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.UNDELIVERED.getStatus(), shopId, merId));
|
|
|
+ orderCount.put(TradeOrderStatusEnum.DELIVERED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.DELIVERED.getStatus(), shopId, merId));
|
|
|
+ orderCount.put(TradeOrderStatusEnum.COMPLETED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.COMPLETED.getStatus(), shopId, merId));
|
|
|
+ orderCount.put(TradeOrderStatusEnum.CANCELED.getStatus(), tradeOrderQueryService.getOrderCount(TradeOrderStatusEnum.CANCELED.getStatus(), shopId, merId));
|
|
|
+ return success(orderCount);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/pay/page")
|
|
|
+ @Operation(summary = "获得支付订单分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pay:order:query')")
|
|
|
+ public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) {
|
|
|
+ PageResult<PayOrderDO> pageResult = orderService.getOrderPage(pageVO);
|
|
|
+ if (CollectionUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 拼接返回
|
|
|
+ Map<Long, PayAppDO> appMap = appService.getAppMap(convertList(pageResult.getList(), PayOrderDO::getAppId));
|
|
|
+ PageResult<PayOrderPageItemRespVO> data = PayOrderConvert.INSTANCE.convertPage(pageResult, appMap);
|
|
|
+ List<PayOrderPageItemRespVO> list = tradeOrderQueryService.getOrderNoAndPicUrl(data.getList());
|
|
|
+ data.setList(list);
|
|
|
+
|
|
|
+ return success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|