From 73b750200f25df08aa64124da49e7461f9de6653 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 13 十二月 2024 15:09:49 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/NTTravel

---
 UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java |  253 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 230 insertions(+), 23 deletions(-)

diff --git a/UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
index 210ed94..7e086e7 100644
--- a/UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
+++ b/UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -10,6 +10,8 @@
 import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
 import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
 import com.stylefeng.guns.modular.system.model.Driver;
+import com.stylefeng.guns.modular.system.model.TActivityGeneralization;
+import com.stylefeng.guns.modular.system.model.UserCouponRecord;
 import com.stylefeng.guns.modular.system.model.UserInfo;
 import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.*;
@@ -18,6 +20,8 @@
 import com.stylefeng.guns.modular.taxi.model.TransactionDetails;
 import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
 import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService;
+import com.stylefeng.guns.modular.transfer.model.OrderTransferCar;
+import com.stylefeng.guns.modular.transfer.server.IOrderTransferService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -98,6 +102,8 @@
     @Value("${pushMinistryOfTransport}")
     private boolean pushMinistryOfTransport;
 
+    @Autowired
+    private IOrderTransferService orderTransferService;
 
 
 
@@ -131,6 +137,19 @@
                 orderStatusWarpper.setState(orderPrivateCar.getState());
                 data.add(orderStatusWarpper);
             }
+
+            List<OrderTransferCar> orderTransferCars = orderTransferService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12);
+            for(OrderTransferCar orderPrivateCar : orderTransferCars){
+                if(orderPrivateCar.getState() == 11){
+                    orderPrivateCar.setState(orderPrivateCar.getOldState());
+                }
+                OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper();
+                orderStatusWarpper.setOrderId(orderPrivateCar.getId());
+                orderStatusWarpper.setOrderType(7);
+                orderStatusWarpper.setState(orderPrivateCar.getState());
+                data.add(orderStatusWarpper);
+            }
+
             List<OrderTaxi> list = orderTaxiService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12);
             for(OrderTaxi orderTaxi : list){
                 if(orderTaxi.getState() == 11){
@@ -175,7 +194,7 @@
     @PostMapping("/api/order/queryMyOrderList")
     @ApiOperation(value = "获取个人中心订单列表", tags = {"用户端-个人中心"}, notes = "")
     @ApiImplicitParams({
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=小件物流,5=包车)", name = "type", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=小件物流,5=包车,7接送机)", name = "type", required = true, dataType = "int"),
             @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"),
             @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
@@ -202,6 +221,9 @@
                     break;
                 case 5:
                     list = orderCharteredCarService.queryMyOrderList(uid, pageNum, size);
+                    break;
+                case 7:
+                    list = orderTransferService.queryMyOrderList(uid, pageNum, size);
                     break;
             }
             return ResultUtil.success(OrderWarpper.getOrderWarpper(list));
@@ -247,15 +269,18 @@
                 Map<String, Object> map = new HashMap<>();
                 map.put("money", transactionDetails1.getMoney());
                 map.put("time", sdf.format(transactionDetails1.getInsertTime()));
-                map.put("name", transactionDetails1.getOrderType() == 3 ? "直通车订单取消退款" : transactionDetails1.getOrderType() == 4 ? "小件物流订单取消退款" : "");
+                map.put("name", transactionDetails1.getOrderType() == 3 ? "跨城订单取消退款" : transactionDetails1.getOrderType() == 4 ? "小件物流订单取消退款" : "");
                 map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue());
                 list4.add(map);
             }
+            List<Map<String, Object>> list5 = orderTransferService.queryMyTravelRecord(uid);//专车
+
             list.addAll(maps);
             list.addAll(list1);
             list.addAll(list2);
             list.addAll(list3);
             list.addAll(list4);
+            list.addAll(list5);
 
             List<TravelRecordWarpper> orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list);
 
@@ -293,7 +318,7 @@
     @ApiOperation(value = "发票页获取订单列表", tags = {"用户端-个人中心"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单开票状态(1=未开票,2=其他)", name = "type", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = false, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流,5=跨城小件物流 ,7=接送机)", name = "orderType", required = false, dataType = "int"),
             @ApiImplicitParam(value = "开始日期", name = "startTime", required = false, dataType = "string"),
             @ApiImplicitParam(value = "结束日期", name = "endTime", required = false, dataType = "string"),
             @ApiImplicitParam(value = "开始金额", name = "startMoney", required = false, dataType = "double"),
@@ -330,6 +355,9 @@
                     case 5://跨城小件物流
                         list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType);
                         break;
+                    case 7://专车
+                        list = orderTransferService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid);
+                        break;
                 }
             }else{
                 //专车
@@ -347,6 +375,9 @@
                 //跨城小件物流
                 List<Map<String, Object>> list4 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType);
                 list.addAll(list4);
+
+                List<Map<String, Object>> list5 = orderTransferService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid);
+                list.addAll(list5);
             }
 
             //分页
@@ -374,10 +405,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/pushOrderTaxi")
-    @ApiOperation(value = "继续等待推单操作", tags = {"用户端-出租车", "用户端-专车"}, notes = "")
+    @ApiOperation(value = "继续等待推单操作", tags = {"用户端-出租车", "用户端-专车","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil pushOrderTaxi(Integer id, Integer orderType){
@@ -387,6 +418,8 @@
                     return orderPrivateCarService.pushOrderPrivateCar(id);
                 case 2:
                     return orderTaxiService.pushOrderTaxi(id);
+                case 7 :
+                    return orderTransferService.pushOrderPrivateCar(id);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -409,7 +442,7 @@
     @ApiOperation(value = "获取服务中的详情数据", tags = {"用户端-服务中"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,7接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<OrderInfoWarpper> queryOrderInfo(Integer orderId, Integer orderType){
@@ -424,6 +457,9 @@
                     break;
                 case 3://跨城
                     map = orderCrossCityService.queryOrderInfo(orderId);
+                    break;
+                case 7://接送机
+                    map = orderTransferService.queryOrderInfo(orderId);
                     break;
             }
             if(map.get("telX") != null){
@@ -449,7 +485,7 @@
     @ApiOperation(value = "获取服务中的详情数据", tags = {"分享专用"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,7=接送机)", name = "orderType", required = true, dataType = "int"),
     })
     public ResultUtil<OrderInfoWarpper> queryOrderInfo_(Integer orderId, Integer orderType){
         try {
@@ -463,6 +499,9 @@
                     break;
                 case 3://跨城
                     map = orderCrossCityService.queryOrderInfo(orderId);
+                    break;
+                case 7://接送机
+                    map = orderTransferService.queryOrderInfo(orderId);
                     break;
             }
             if(null != map.get("telX")){
@@ -490,7 +529,7 @@
     @ApiOperation(value = "获取订单取消支付页面详情", tags = {"用户端-服务中"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<OrderInfoWarpper> queryCancelPage(Integer orderId, Integer orderType){
@@ -511,6 +550,11 @@
                     map = orderCrossCityService.queryOrderInfo(orderId);
                     ResultUtil<BaseWarpper> r = orderCrossCityService.queryCancleAmount(orderId);
                     map.put("cancelPayMoney", r.getData().getAmount());
+                    break;
+                case 7://接送机
+                    map = orderTransferService.queryOrderInfo(orderId);
+                    ResultUtil<BaseWarpper> r1 = orderTransferService.queryCancleAmount(orderId);
+                    map.put("cancelPayMoney", r1.getData().getAmount());
                     break;
             }
             return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
@@ -636,6 +680,16 @@
                         pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
                     }
                     break;
+
+                case 7:
+                    OrderTransferCar orderTransferCar = orderTransferService.selectById(id);
+                    driverId = orderTransferCar.getDriverId();
+                    userId = orderTransferCar.getUserId();
+                    state = orderTransferCar.getState();
+                    if(null != driverId){
+                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
+                    }
+                    break;
             }
             pushUtil.pushOrderState(1, userId, id, orderType, state, 0);
             return ResultUtil.success();
@@ -756,10 +810,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/queryCancleAmount")
-    @ApiOperation(value = "获取取消订单需要支付的费用金额", tags = {"用户端-出租车", "用户端-专车"}, notes = "返回金额为0则不需要支付")
+    @ApiOperation(value = "获取取消订单需要支付的费用金额", tags = {"用户端-出租车", "用户端-专车","用户端-接送机"}, notes = "返回金额为0则不需要支付")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer orderType){
@@ -771,6 +825,8 @@
                     return orderTaxiService.queryCancleAmount(id);
                 case 3:
                     return orderCrossCityService.queryCancleAmount(id);
+                    case 7:
+                    return orderTransferService.queryCancleAmount(id);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -792,10 +848,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/addCancle")
-    @ApiOperation(value = "添加取消记录", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "")
+    @ApiOperation(value = "添加取消记录", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(value = "取消原因", name = "reason", required = true, dataType = "string"),
             @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
@@ -819,6 +875,8 @@
                     return orderLogisticsService.addCancle(id, reason, remark, uid);
                 case 6:
                     return orderCharteredCarService.addCancle(id, reason, remark, uid);
+                case 7:
+                    return orderTransferService.addCancle(id, reason, remark, uid);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -837,10 +895,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/cancleOrderTaxi")
-    @ApiOperation(value = "取消操作支付", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "")
+    @ApiOperation(value = "取消操作支付", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"),
             @ApiImplicitParam(value = "取消单id(取消操作返回)", name = "cancleId", required = false, dataType = "int"),
             @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"),
@@ -859,6 +917,8 @@
                     return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type);
                 case 3:
                     return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type);
+                case 7:
+                    return orderTransferService.cancleOrderPrivateCar(id, payType, cancleId, type);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -910,10 +970,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/queryBalance")
-    @ApiOperation(value = "支付页面获取可用优惠券数量和余额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "balance=余额,coupon=优惠券")
+    @ApiOperation(value = "支付页面获取可用优惠券数量和余额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "balance=余额,coupon=优惠券")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil queryBalance(Integer orderId, Integer orderType, HttpServletRequest request){
@@ -939,6 +999,9 @@
                 case 5:
                     map = orderLogisticsService.queryBalance(orderId, uid);
                     break;
+                case 7:
+                    map = orderTransferService.queryBalance(orderId, uid);
+                    break;
             }
             return ResultUtil.success(map);
         }catch (Exception e){
@@ -947,6 +1010,8 @@
         }
     }
 
+    @Autowired
+    private IUserCouponRecordService userCouponRecordService;
 
 
     /**
@@ -959,10 +1024,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/queryCoupon")
-    @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "")
+    @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
             @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
@@ -984,13 +1049,123 @@
                 case 3:
                     list = orderCrossCityService.queryCoupon(orderId, uid, pageNum, size);
                     break;
+                case 7:
+                    list = orderTransferService.queryCoupon(orderId, uid, pageNum, size);
+                    break;
             }
+            //将activityType=5的数据进行处理
+
+//            List<Integer> ids = new ArrayList<>();
+
+//            if (list != null && list.size() > 0) {
+//                Map<Object, Integer> couponIdMonthlyCount = new HashMap<>(); // 用来统计每个月各couponId的出现次数
+//                Date currentDate = new Date(); // 获取当前日期
+//                Calendar cal = Calendar.getInstance();
+//                cal.setTime(currentDate);
+//                int currentMonth = cal.get(Calendar.MONTH) + 1; // 获取当前月份(注意Calendar.MONTH是从0开始的)
+//
+//                // 首先,统计每个月各couponId的出现次数
+//                for (Map<String, Object> map : list) {
+//                    if (map.get("activityType").equals(5)) {
+//                        for (UserCouponRecord userCouponRecord : userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("couponId", map.get("couponId")))) {
+//                            Date endTime = userCouponRecord.getEndTime();
+//                            Calendar recordCal = Calendar.getInstance();
+//                            if (endTime==null){
+//                                continue;
+//                            }
+//                            recordCal.setTime(endTime);
+//                            int recordMonth = recordCal.get(Calendar.MONTH) + 1;
+//
+//                            if (recordMonth == currentMonth) {
+//                                Object couponId = map.get("couponId");
+//                                couponIdMonthlyCount.put(couponId, couponIdMonthlyCount.getOrDefault(couponId, 0) + 1);
+//                            }
+//                        }
+//                    }
+//                }
+//
+//                // 然后,根据统计结果移除当月数量超过1的couponId对应的记录
+//                List<Map<String, Object>> newList = new ArrayList<>();
+//                for (Map<String, Object> map : list) {
+//                    Object couponId = map.get("couponId");
+//                    if (!couponIdMonthlyCount.containsKey(couponId) || couponIdMonthlyCount.get(couponId) <= 1) {
+//                        newList.add(map);
+//                    }
+//                }
+//                list.clear();
+//                list.addAll(newList);
+//            }
+
+
             return ResultUtil.success(CouponWarpper.getCouponWarppers(list));
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
         }
     }
+
+    @Autowired
+    private ITActivityGeneralizationService activityGeneralizationService;
+    @ResponseBody
+    @PostMapping("/api/taxi/check")
+    @ApiOperation(value = "判断是否到到当月限额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "id", name = "id", required = true, dataType = "int"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil check(Integer id,HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            // 查询当前活动的限制数量
+            UserCouponRecord userCouponRecords1 = userCouponRecordService.selectById(id);
+
+            List<UserCouponRecord> userCouponRecords = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("couponId", userCouponRecords1.getCouponId()));
+
+            // 获取活动限制数量
+            TActivityGeneralization tActivityGeneralization = activityGeneralizationService.selectById(userCouponRecords.get(0).getCouponActivityId());
+            if (tActivityGeneralization == null) {
+                throw new RuntimeException("未能找到对应的活动信息");
+            }
+            int limitQuantity = tActivityGeneralization.getMonthUseCount(); // 假设limitQuantity字段代表限制数量
+
+            // 判断当月的优惠券是否超过限制
+            Calendar currentCal = Calendar.getInstance();
+            int currentMonth = currentCal.get(Calendar.MONTH) + 1; // 当前月份
+
+            // 统计当月的优惠券使用数量
+            int usedThisMonth = 0;
+            for (UserCouponRecord record : userCouponRecords) {
+                if (record.getEndTime()==null){
+                    continue;
+                }
+                Calendar recordCal = Calendar.getInstance();
+                recordCal.setTime(record.getEndTime());
+                int recordMonth = recordCal.get(Calendar.MONTH) + 1;
+
+                // 判断endTime是否在当月
+                if (recordMonth == currentMonth) {
+                    usedThisMonth++;
+                }
+            }
+
+            // 判断是否超过限制
+            if (usedThisMonth >= limitQuantity) {
+                return ResultUtil.error("本月使用数量已经超出限制");
+                // 这里可以添加更多的逻辑处理,比如抛出异常、记录日志等
+            } else {
+                return ResultUtil.success();
+            }
+
+
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
 
 
 
@@ -1004,11 +1179,11 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/payTaxiOrder")
-    @ApiOperation(value = "订单完成支付订单操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "")
+    @ApiOperation(value = "订单完成支付订单操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"),
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(value = "优惠券id", name = "couponId", required = false, dataType = "int"),
             @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
@@ -1030,6 +1205,8 @@
                     return orderLogisticsService.payLogisticsOrder(payType, orderId, type);
                 case 5:
                     return orderLogisticsService.payLogisticsOrder(payType, orderId, type);
+                case 7:
+                    return orderTransferService.payPrivateCarOrder(payType, orderId, couponId, type);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -1086,6 +1263,20 @@
                         orderCrossCity.setState(9);
                         orderCrossCityService.updateById(orderCrossCity);
                         break;
+                    case 7:
+                        OrderTransferCar orderTransferCar = orderTransferService.selectById(orderId);
+                        orderTransferCar.setState(9);
+                        orderTransferService.updateById(orderTransferCar);
+                        new Thread(new Runnable() {
+                            @Override
+                            public void run() {
+                                if(pushMinistryOfTransport){//上传数据
+                                    pushMinistryOfTransportUtil.ratedPassenger(Integer.valueOf(resultUtil.getData().toString()));
+                                    pushMinistryOfTransportUtil.ratedDriver(orderTransferCar.getDriverId());
+                                }
+                            }
+                        }).start();
+                        break;
                 }
             }
             return resultUtil.getCode() == 200 ? ResultUtil.success() : resultUtil;
@@ -1104,10 +1295,10 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/queryRedMoney")
-    @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "")
+    @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
-            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<BaseWarpper> queryRedMoney(Integer orderId, Integer orderType){
@@ -1119,6 +1310,8 @@
                     return orderTaxiService.queryRedMoney(orderId);
                 case 3:
                     return orderCrossCityService.queryRedMoney(orderId);
+                case 7:
+                    return orderTransferService.queryRedMoney(orderId);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -1137,7 +1330,7 @@
      */
     @ResponseBody
     @PostMapping("/api/taxi/shareRedEnvelope")
-    @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "")
+    @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
             @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"),
@@ -1152,6 +1345,8 @@
                     return orderTaxiService.shareRedEnvelope(orderId);
                 case 3:
                     return orderCrossCityService.shareRedEnvelope(orderId);
+                case 7:
+                    return orderTransferService.shareRedEnvelope(orderId);
             }
             return ResultUtil.success();
         }catch (Exception e){
@@ -1194,6 +1389,9 @@
                             break;
                         case 3:
                             orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1);
+                            break;
+                        case 7:
+                            orderTransferService.payCancelOrderPrivateCar(id, order_id, 1);
                             break;
                     }
                 }
@@ -1257,6 +1455,9 @@
                             break;
                         case 3:
                             orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2);
+                            break;
+                        case 7:
+                            orderTransferService.payCancelOrderPrivateCar(id, order_id, 2);
                             break;
                     }
                 }
@@ -1333,6 +1534,9 @@
                         case 5:
                             orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1);
                             break;
+                        case 7:
+                            orderTransferService.payOrderPrivateCarCallback(id, order_id, 1);
+                            break;
                     }
                 }
             }
@@ -1407,6 +1611,9 @@
                         case 5:
                             orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2);
                             break;
+                        case 7:
+                            orderTransferService.payOrderPrivateCarCallback(id, order_id, 2);
+                            break;
                     }
                 }
 

--
Gitblit v1.7.1