xuhy
2025-01-15 c27c1f2beb4ca89a94eaa854fce6b4553db8f2f8
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -16,8 +16,10 @@
import com.ruoyi.order.enums.OrderStatus;
import com.ruoyi.order.mapper.OrderMapper;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.util.payment.model.RefundCallbackResult;
import com.ruoyi.order.util.vo.MapTrackKD100Vo;
import com.ruoyi.order.vo.*;
@@ -69,6 +71,8 @@
    private OrderMapper orderMapper;
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private RefundPassService refundPassService;
    /**
@@ -127,9 +131,9 @@
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "String"),
    })
    @GetMapping("/writeOff/{id}/{shopId}")
    public R<Void> writeOff(@PathVariable("id") String id, @PathVariable("shopId") Integer shopId){
        orderService.writeOff(id, shopId);
    @GetMapping("/writeOff")
    public R<Void> writeOff(String code, Integer shopId, String technicianId){
        orderService.writeOff(code, shopId, technicianId);
        return R.ok();
    }
@@ -230,12 +234,12 @@
    @PostMapping("/byUserId")
    public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId){
        return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).list());
    public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Long shopId){
        return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).eq(Order::getShopId, shopId).list());
    }
    @PostMapping("/byShopId")
    public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){
        return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).list());
        return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).in(Order::getOrderStatus,4,7,8).list());
    }
    
@@ -246,7 +250,7 @@
    @PostMapping("/confirmDelivery")
    @ApiOperation(value = "已发货操作", tags = {"管理后台-订单管理"})
    public R confirmDelivery(@RequestBody ConfirmDelivery confirmDelivery){
        return orderService.confirmDelivery(confirmDelivery.getOrderId(), confirmDelivery.getCode());
        return orderService.confirmDelivery(confirmDelivery);
    }
    
    
@@ -267,6 +271,11 @@
    @ApiOperation(value = "查询订单详情", tags = {"管理后台-订单管理"})
    public R<OrderInfoVo> getOrderInfo(@PathVariable("orderId") Long orderId){
        OrderInfoVo orderInfo = orderService.getOrderInfo(orderId);
        RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId)
                .eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0,1"));
        if (one!=null){
            orderInfo.setRefundPassId(one.getId().toString());
        }
        return R.ok(orderInfo);
    }
    
@@ -293,8 +302,12 @@
                .orderByAsc(Order::getCreateTime));
        Map<String, List<Order>> map = orderList.stream().collect(Collectors.groupingBy(item -> item.getCreateTime()
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
        Map<String, List<Order>> map = orderList.stream()
                .collect(Collectors.groupingBy(
                        item -> item.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
                        TreeMap::new, // 使用 TreeMap 按键排序
                        Collectors.toList()
                ));
        List<OrderStatisticsDetail> orderStatisticsDetails = new ArrayList<>();
        map.forEach((key, value) -> {
@@ -309,12 +322,14 @@
                if (order.getOrderType().equals(1)) {
                    serviceTotal++;
                    serviceTotalMoney = serviceTotalMoney.add(order.getPaymentAmount());
                }else if (order.getOrderType().equals(2)){
                    total++;
                    totalMoney = totalMoney.add(order.getPaymentAmount());
                }else if (order.getOrderType().equals(2) && 1 == order.getDistributionMode()){
                    singleTotal++;
                    singleTotalMoney = singleTotalMoney.add(order.getPaymentAmount());
                    total++;
                    totalMoney = totalMoney.add(order.getPaymentAmount());
                }
                total++;
                totalMoney = totalMoney.add(order.getPaymentAmount());
            }
            orderStatisticsDetail.setDate(key);
            orderStatisticsDetail.setServiceTotal(serviceTotal);
@@ -404,7 +419,7 @@
     */
    @PostMapping("/getGoodsSaleNum")
    public R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type){
        Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type);
        Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type, null);
        return R.ok(goodsSaleNum);
    }