From def5feab50f17c2193470c29d8c4331dcc7894d2 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 24 六月 2025 15:37:00 +0800
Subject: [PATCH] bug修改

---
 UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
index 90c24ec..588d8d9 100644
--- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
+++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -48,6 +48,7 @@
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.math.RoundingMode;
 import java.util.*;
 
@@ -359,7 +360,7 @@
                 return ResultUtil.error("计算行驶距离失败");
             }
             double d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
-            double t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+            double t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
             double amount = setMoney2(query.getId(), d, t);
             if(warpper.getPayManner() == 2){//其他支付,不需要操作,直接完成订单
                 amount = amount + (new BigDecimal(Math.random()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -410,7 +411,7 @@
         
         if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){
             if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
-                yt1 = rule.getDouble("num18") * d;
+                yt1 = rule.getDouble("num18") * (d-rule.getDouble("num6"));
             }
             if(d >  rule.getDouble("num9") && d < rule.getDouble("num10")){
                 yt1 = rule.getDouble("num18") * rule.getDouble("num7");
@@ -449,7 +450,7 @@
             //高峰时段处理逻辑
             if((date.getTime() > s1.getTimeInMillis() && date.getTime() < e1.getTimeInMillis()) || (date.getTime() > s2.getTimeInMillis() && date.getTime() < e2.getTimeInMillis())){
                 if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
-                    yt1 = rule.getDouble("num26") * d;
+                    yt1 = rule.getDouble("num26") * (d-rule.getDouble("num6"));
                 }
                 if(d >  rule.getDouble("num9") && d < rule.getDouble("num10")){
                     yt1 = rule.getDouble("num26") * rule.getDouble("num7");
@@ -468,7 +469,7 @@
             }else{
                 //其他时间段的计算
                 if(d > rule.getDouble("num6") && d < rule.getDouble("num7")){
-                    yt1 = rule.getDouble("num8") * d;
+                    yt1 = rule.getDouble("num8") * (d-rule.getDouble("num6"));
                 }
                 if(d >  rule.getDouble("num9") && d < rule.getDouble("num10")){
                     yt1 = rule.getDouble("num8") * rule.getDouble("num7");
@@ -809,9 +810,29 @@
         UserInfo userInfo = userInfoService.selectById(uid);
         map.put("balance", userInfo.getBalance());
         OrderTaxi orderTaxi = this.selectById(orderId);
-        int i = userCouponRecordService.queryAvailable(uid, null, 1, 2, orderTaxi.getOrderMoney());
-        i = i + userCouponRecordService.queryAvailable(uid, null, 1, 0, orderTaxi.getOrderMoney());
-        map.put("coupon", i);
+        Driver driver = driverService.selectById(orderTaxi.getDriverId());
+        Integer companyId = driver.getCompanyId();
+        List<CompanyCity> companyCityList = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("companyId", companyId));
+        List<Map<String, Object>> cityCode = new ArrayList<>();
+        List<Region> regions = regionMapper.selectList(null);
+        for (CompanyCity companyCity : companyCityList) {
+            Map<String, Object> city = new HashMap<>();
+            if(ToolUtil.isNotEmpty(companyCity.getAreaCode())){
+                city.put("code", Integer.valueOf(companyCity.getAreaCode()));
+                city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getAreaCode())).findFirst().get().getName());
+            }else if(ToolUtil.isEmpty(companyCity.getAreaCode()) && ToolUtil.isNotEmpty(companyCity.getCityCode())){
+                city.put("code", Integer.valueOf(companyCity.getCityCode()));
+                city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getCityCode())).findFirst().get().getName());
+            }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){
+                city.put("code", Integer.valueOf(companyCity.getProvinceCode()));
+                city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getProvinceCode())).findFirst().get().getName());
+            }
+            cityCode.add(city);
+        }
+        List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), null, null);
+        List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), null, null);
+        list.addAll(list1);
+        map.put("coupon", list.size());
         return map;
     }
 
@@ -828,16 +849,21 @@
         Driver driver = driverService.selectById(orderTaxi.getDriverId());
         Integer companyId = driver.getCompanyId();
         List<CompanyCity> companyCityList = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("companyId", companyId));
-        List<Map<String, Integer>> cityCode = new ArrayList<>();
+        List<Map<String, Object>> cityCode = new ArrayList<>();
+        List<Region> regions = regionMapper.selectList(null);
         for (CompanyCity companyCity : companyCityList) {
-            Map<String, Integer> city = new HashMap<>();
+            Map<String, Object> city = new HashMap<>();
             if(ToolUtil.isNotEmpty(companyCity.getAreaCode())){
                 city.put("code", Integer.valueOf(companyCity.getAreaCode()));
+                city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getAreaCode())).findFirst().get().getName());
             }else if(ToolUtil.isEmpty(companyCity.getAreaCode()) && ToolUtil.isNotEmpty(companyCity.getCityCode())){
                 city.put("code", Integer.valueOf(companyCity.getCityCode()));
+                city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getCityCode())).findFirst().get().getName());
             }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){
                 city.put("code", Integer.valueOf(companyCity.getProvinceCode()));
+                city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getProvinceCode())).findFirst().get().getName());
             }
+            cityCode.add(city);
         }
         List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), pageNum, size);
         List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), pageNum, size);
@@ -1260,6 +1286,7 @@
         OrderServerWarpper orderServerWarpper = new OrderServerWarpper();
         orderServerWarpper.setOrderId(orderTaxi.getId());
         orderServerWarpper.setOrderType(2);
+        orderServerWarpper.setPayManner(orderTaxi.getPayManner());
         orderServerWarpper.setState(orderTaxi.getState());
         orderServerWarpper.setLon(null != value ? value.split(",")[1] : "0.0");
         orderServerWarpper.setLat(null != value ? value.split(",")[0] : "0.0");

--
Gitblit v1.7.1