From 7b1772169b274e87fe441923f0dbf5e25ee30a72 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期四, 31 七月 2025 14:05:56 +0800
Subject: [PATCH] 优化

---
 pt-errand/src/main/java/com/ruoyi/errand/service/impl/OrderServiceImpl.java |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/pt-errand/src/main/java/com/ruoyi/errand/service/impl/OrderServiceImpl.java b/pt-errand/src/main/java/com/ruoyi/errand/service/impl/OrderServiceImpl.java
index f5c55a3..c5c1e55 100644
--- a/pt-errand/src/main/java/com/ruoyi/errand/service/impl/OrderServiceImpl.java
+++ b/pt-errand/src/main/java/com/ruoyi/errand/service/impl/OrderServiceImpl.java
@@ -223,11 +223,11 @@
         Map<String,Object> courier= appUserMapper.getCourierByCommunityId(order.getCommunityId());
         if (courier == null || courier.isEmpty() ||null == courier.get("id")  ) {
             log.warn("未找到社区ID={}对应的骑手", order.getCommunityId());
-            return R.ok();
+            return R.ok(order.getId());
         }
         if (courier.get("status").equals("0")){
             log.warn("当前社区骑手离职中,骑手id={}", courier.get("courierId"));
-            return R.ok();
+            return R.ok(order.getId());
         }
         Integer courierIdLong = (Integer) courier.get("courierId");
         order.setCourierId(courierIdLong);
@@ -236,8 +236,7 @@
         //小程序弹窗通知
         notifyDeliveryPerson((Long) courier.get("id"), order,1);//1=新订单
 
-        //登录访问
-        return R.ok(order.getId().toString());
+        return R.ok(order.getId());
     }
 
 
@@ -268,6 +267,7 @@
         message.put("orderId", order.getId());
         message.put("orderTime", order.getOrderTime());
         deliveryWebSocket.sendNotification(deliveryPersonId.toString(), message.toJSONString());
+        deliveryWebSocket.sendWaitOrderNum(deliveryPersonId.toString());
     }
 
     @Override
@@ -354,11 +354,16 @@
         if (order==null
                 ||order.getDelFlag().equals(DelFlagConstant.DELETE)
                 ||!Objects.equals(order.getAppUserId(), appuser.getId())){
-            throw new ServiceException("订单id错误");
+            throw new ServiceException("该订单不存在");
         }
-        if (order.getOrderStatus()!=1 && order.getOrderStatus()!=2){
-            throw new ServiceException("订单状态错误");
+        if (order.getOrderStatus()==3){
+            throw new ServiceException("订单已被取消");
+        }else if (order.getOrderStatus()==4){
+            throw new ServiceException("订单已完成,不可修改");
+        }else if (order.getOrderStatus()==5){
+            throw new ServiceException("订单已完成,不可修改");
         }
+
         //判断地址簿id是否存在
         if (setConfirmOrderDTO.getAddressBookId()!=null){
             AddressBook addressBook = addressBookMapper.selectById(setConfirmOrderDTO.getAddressBookId());

--
Gitblit v1.7.1