From e56db093f5dc2d2a7d317add44498982da5702d2 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期五, 27 六月 2025 15:28:27 +0800
Subject: [PATCH] 管理后台二期

---
 ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 102 insertions(+), 8 deletions(-)

diff --git a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java
index 4570268..4e8b2c7 100644
--- a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java
+++ b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.plugins.Page;
 import com.stylefeng.guns.core.base.controller.BaseController;
 import com.stylefeng.guns.core.common.constant.factory.PageFactory;
+import com.stylefeng.guns.core.log.LogObjectHolder;
 import com.stylefeng.guns.core.shiro.ShiroKit;
 import com.stylefeng.guns.core.shiro.ShiroUser;
 import com.stylefeng.guns.core.util.SinataUtil;
@@ -14,20 +15,19 @@
 import com.stylefeng.guns.modular.system.model.*;
 import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.HttpRequestUtil;
+import com.stylefeng.guns.modular.system.util.PayMoneyUtil;
 import com.stylefeng.guns.modular.system.util.PushURL;
 import com.stylefeng.guns.modular.system.util.ResultUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.ui.Model;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.annotation.Resource;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
+import java.io.*;
 import java.math.BigDecimal;
 import java.util.*;
 
@@ -54,7 +54,8 @@
 
     @Autowired
     private ITOrderPositionService tOrderPositionService;
-
+    @Autowired
+    private ITPubTransactionDetailsService pubTransactionDetailsService;
     private ResultUtil resultUtil;
 
     @Value("${filePath}")
@@ -91,6 +92,81 @@
     public String tOrderCrossCity_track(@PathVariable Integer tOrderCrossCityId, Model model) {
         model.addAttribute("tOrderCrossCityId",tOrderCrossCityId);
         return PREFIX + "tOrderCrossCity_track.html";
+    }
+
+    /**
+     * 跳转到修改出租车订单
+     */
+    @RequestMapping("/tOrderCrossCity_update/{tOrderCrossCityId}")
+    public String tOrderCrossCity_update(@PathVariable Integer tOrderCrossCityId, Model model) throws IOException {
+        Map<String, Object> tOrderTaxi = tOrderCrossCityService.getTaxiOrderDetailById(tOrderCrossCityId);
+        model.addAttribute("item",tOrderTaxi);
+        // 查询线路
+        TLine line = itLineService.selectById(Integer.parseInt(tOrderTaxi.get("lineId").toString()));
+        model.addAttribute("line",line);
+        // 查询司机扣款
+        List<TPubTransactionDetails> tPubTransactionDetails = pubTransactionDetailsService.selectList(new EntityWrapper<TPubTransactionDetails>()
+                .eq("userId", tOrderTaxi.get("driverId"))
+                .eq("orderId", tOrderTaxi.get("id"))
+                .eq("type", 1)
+                .eq("userType", 2));
+        if(CollectionUtils.isEmpty(tPubTransactionDetails)){
+            model.addAttribute("companyMoney","");
+            model.addAttribute("driverMoney","");
+        }else {
+            TPubTransactionDetails pubTransactionDetailCompany = tPubTransactionDetails.stream().filter(e -> e.getOrderType().equals(6)).findFirst().orElse(null);
+            if(Objects.nonNull(pubTransactionDetailCompany)){
+                model.addAttribute("companyMoney",pubTransactionDetailCompany.getMoney());
+            }else {
+                model.addAttribute("companyMoney","");
+            }
+            TPubTransactionDetails pubTransactionDetailDriver = tPubTransactionDetails.stream().filter(e -> e.getOrderType().equals(3)).findFirst().orElse(null);
+            if(Objects.nonNull(pubTransactionDetailDriver)){
+                model.addAttribute("driverMoney",pubTransactionDetailDriver.getMoney());
+            }else {
+                model.addAttribute("driverMoney","");
+            }
+        }
+        if(tOrderTaxi.get("payManner")!=null && Integer.parseInt(tOrderTaxi.get("payManner").toString()) == 1){
+            model.addAttribute("payMannerStr","线上收款");
+        }else {
+            model.addAttribute("payMannerStr","计费打表");
+        }
+        LogObjectHolder.me().set(tOrderTaxi);
+        try{
+            //将数据存储到文件中
+            File file = new File(filePath + tOrderCrossCityId + "_3.txt");
+
+            //读取文件(字符流)
+            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
+            //循环取出数据
+            String str = null;
+            StringBuffer sb = new StringBuffer();
+            while ((str = in.readLine()) != null) {
+                sb.append(str);
+            }
+            List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class);
+            List<Map> maps = new ArrayList<>();
+            for (TOrderPosition tOrderPosition : list) {
+                Map<String, String> map = new HashMap<>();
+                map.put("lon",tOrderPosition.getLon());
+                map.put("lat",tOrderPosition.getLat());
+                maps.add(map);
+            }
+
+//        resultUtil = ResultUtil.success(list);
+            // 将maps转化为jsonArray字符串
+            // 使用 Gson 转换为 JSON 字符串
+//        Gson gson = new Gson();
+//        String jsonString = gson.toJson(maps);
+//        System.out.println(jsonString);
+            model.addAttribute("guiji",maps);
+        }catch (Exception e){
+            e.printStackTrace();
+            resultUtil = ResultUtil.runErr();
+            model.addAttribute("guiji","");
+        }
+        return PREFIX + "tOrderCrossCity_edit.html";
     }
 
     /**
@@ -183,7 +259,8 @@
     @Autowired
     private IIncomeService incomeService;
 
-
+    @Autowired
+    private PayMoneyUtil payMoneyUtil;
 
 
     /**
@@ -246,6 +323,23 @@
                     return ResultUtil.error("订单还未进行支付");
                 }
 
+                if(query.getPayType() == 1){//微信
+                    Map<String, String> map1 = payMoneyUtil.wxRefund(query.getCode(), orderCrossCity.getOrderNum(), String.valueOf(query.getAmount()), String.valueOf(query.getAmount()), "");
+//                            if(!"SUCCESS".equals(map1.get("return_code"))){
+//                                return ResultUtil.error(map1.get("return_msg"));
+//                            }
+                    System.err.println("跨城退款数据:::"+map1);
+                    //添加交易明细
+                    transactionDetailsService.saveData(query.getUserId(), "跨城改派取消退款", query.getAmount(), 1, 1, query.getType(), 3, orderCrossCity.getId());
+                }else{//支付宝
+//                            Map<String, String> map1 = payMoneyUtil.aliRefund(query.getCode(), query.getAmount().toString());
+//                            if(!"10000".equals(map1.get("code"))){
+//                                return ResultUtil.error(map1.get("msg"));
+//                            }
+//                            //添加交易明细
+//                            transactionDetailsService.saveData(query.getUserId(), "跨城改派取消退款", query.getAmount(), 1, 1, query.getType(), 3, orderCrossCity.getId());
+                }
+
             }
 
             //添加负的收入明细
@@ -254,8 +348,8 @@
                 if(income.getUserType() == 2){//处理司机的收入
                     TDriver driver = tDriverService.selectById(income.getObjectId());
                     driver.setBalance(driver.getBalance().subtract(new BigDecimal(income.getMoney())));
-                    driver.setLaveBusinessMoney(new BigDecimal(driver.getLaveBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue());
-                    driver.setBusinessMoney(new BigDecimal(driver.getBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue());
+//                    driver.setLaveBusinessMoney(new BigDecimal(driver.getLaveBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue());
+//                    driver.setBusinessMoney(new BigDecimal(driver.getBusinessMoney()).subtract(new BigDecimal(income.getMoney())).doubleValue());
                     tDriverService.updateById(driver);
                 }
                 Income income1 = new Income();

--
Gitblit v1.7.1