From e2d1eddd9797f84573731f3c4c1e45d3b0952f93 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 25 七月 2025 16:43:41 +0800
Subject: [PATCH] 后台修改金额

---
 ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java |  321 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 277 insertions(+), 44 deletions(-)

diff --git a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java
index 869cec6..93ef897 100644
--- a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java
+++ b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderCrossCityController.java
@@ -1,25 +1,23 @@
 package com.stylefeng.guns.modular.system.controller.specialTrain;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.stylefeng.guns.core.base.controller.BaseController;
 import com.stylefeng.guns.core.beetl.ShiroExtUtil;
 import com.stylefeng.guns.core.common.constant.factory.PageFactory;
 import com.stylefeng.guns.core.shiro.ShiroUser;
+import com.stylefeng.guns.core.util.DateUtil;
 import com.stylefeng.guns.core.util.SinataUtil;
 import com.stylefeng.guns.core.util.ToolUtil;
-import com.stylefeng.guns.modular.system.controller.general.TDriverController;
-import com.stylefeng.guns.modular.system.controller.util.GetOpenBodySig;
 import com.stylefeng.guns.modular.system.dao.LineShiftDriverMapper;
 import com.stylefeng.guns.modular.system.dao.OrderCancelMapper;
 import com.stylefeng.guns.modular.system.model.*;
 import com.stylefeng.guns.modular.system.service.*;
+import com.stylefeng.guns.modular.system.util.*;
 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.apache.commons.lang.time.DateFormatUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Sort;
@@ -31,11 +29,10 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 跨城出行订单控制器
@@ -68,7 +65,7 @@
     
     @Resource
     private MongoTemplate mongoTemplate;
-    @Resource
+    @Autowired
     private ShiroExtUtil shiroExtUtil;
     
     
@@ -146,7 +143,10 @@
                        Integer serverCarModelId,
                        String driver,
                        Integer lineId,
-                       Integer state) {
+                       Integer state,
+                       Integer abnormal,
+                       Integer promotion,
+                       String promotionUser) {
         String beginTime = null;
         String endTime = null;
         if (SinataUtil.isNotEmpty(insertTime)){
@@ -155,9 +155,275 @@
             endTime = timeArray[1];
         }
         Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
-        page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state));
+        page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state, abnormal, promotion, promotionUser,null));
         return super.packForBT(page);
     }
+
+
+
+    @GetMapping("/export")
+    @ResponseBody
+    public void export(String insertTime,
+                       String orderNum,
+                       Integer orderSource,
+                       String userName,
+                       String userPhone,
+                       String passengers,
+                       String passengersPhone,
+                       Integer serverCarModelId,
+                       String driver,
+                       Integer lineId,
+                       Integer state,
+                       Integer abnormal,
+                       Integer promotion,
+                       String promotionUser, HttpServletRequest request, HttpServletResponse response) {
+        try {
+            String beginTime = null;
+            String endTime = null;
+            if (SinataUtil.isNotEmpty(insertTime)) {
+                String[] timeArray = insertTime.split(" - ");
+                beginTime = timeArray[0];
+                endTime = timeArray[1];
+            }
+            List<Map<String, Object>> list = tOrderCrossCityService.getCrossCityOrderListExport(null, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state, abnormal, promotion, promotionUser,null);
+
+            // 表格数据【封装】
+            List<List<String>> dataList = new ArrayList<>();
+
+            //第一行显示【封装】
+            List<String> twoList = new ArrayList<String>();
+            twoList.add("总计:");
+            twoList.add(String.valueOf(list.size())+"条");
+            dataList.add(twoList);
+
+            // 列【封装】
+            List<String> shellList = new ArrayList<String>();
+            shellList.add("下单时间");
+            shellList.add("订单编号");
+            shellList.add("订单来源");
+            shellList.add("乘车时间");
+            shellList.add("下单用户昵称");
+            shellList.add("下单用户手机");
+            shellList.add("乘车用户姓名");
+            shellList.add("乘车用户手机");
+            shellList.add("起点");
+            shellList.add("终点");
+            shellList.add("线路名称");
+            shellList.add("选择车型");
+            shellList.add("接单司机");
+            shellList.add("接单车辆");
+            shellList.add("订单金额");
+            shellList.add("状态");
+            shellList.add("是否异常订单");
+            shellList.add("是否推广订单");
+            shellList.add("推广员姓名");
+            shellList.add("推广员电话");
+            dataList.add(shellList);
+
+            for (Map<String,Object> object : list){
+                // 详细数据列【封装】
+                shellList = new ArrayList<String>();
+                if(SinataUtil.isNotEmpty(object.get("insertTime"))){
+                    shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss"));
+                }else{
+                    shellList.add("-");
+                }
+                if(SinataUtil.isNotEmpty(object.get("orderNum"))){
+                    shellList.add(object.get("orderNum").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                // 1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单
+                if(SinataUtil.isNotEmpty(object.get("orderSource"))){
+                    switch (object.get("orderSource").toString()){
+                        case "1":
+                            shellList.add("APP下单");
+                            break;
+                        case "2":
+                            shellList.add("扫码下单");
+                            break;
+                        case "3":
+                            shellList.add("小程序下单");
+                            break;
+                        case "4":
+                            shellList.add("司机下单");
+                            break;
+                        case "5":
+                            shellList.add("调度下单");
+                            break;
+                        case "6":
+                            shellList.add("道行龙城下单");
+                            break;
+                        default:
+                            shellList.add("-");
+                            break;
+                    }
+
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("travelTime"))){
+                    shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("travelTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss"));
+                }else{
+                    shellList.add("-");
+                }
+
+
+                if(SinataUtil.isNotEmpty(object.get("userName"))){
+                    shellList.add(object.get("userName").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("userPhone"))){
+                    shellList.add(object.get("userPhone").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("passengers"))){
+                    shellList.add(object.get("passengers").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("passengersPhone"))){
+                    shellList.add(object.get("passengersPhone").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("contactPersonPhone"))){
+                    shellList.add(object.get("contactPersonPhone").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("startAddress"))){
+                    shellList.add(object.get("startAddress").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("endAddress"))){
+                    shellList.add(object.get("endAddress").toString());
+                }else{
+                    shellList.add("-");
+                }
+                if(SinataUtil.isNotEmpty(object.get("lineName"))){
+                    shellList.add(object.get("lineName").toString());
+                }else{
+                    shellList.add("-");
+                }
+                if(SinataUtil.isNotEmpty(object.get("serverCarModelName"))){
+                    shellList.add(object.get("serverCarModelName").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("driver"))){
+                    shellList.add(object.get("driver").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("car"))){
+                    shellList.add(object.get("car").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                if(SinataUtil.isNotEmpty(object.get("orderMoney"))){
+                    shellList.add(object.get("orderMoney").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+                // 1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付
+                if(SinataUtil.isNotEmpty(object.get("state"))){
+                    switch (object.get("state").toString()){
+                        case "1":
+                            shellList.add("待接单");
+                            break;
+                        case "2":
+                            shellList.add("待出发");
+                            break;
+                        case "3":
+                            shellList.add("待到达预约地点");
+                            break;
+                        case "4":
+                            shellList.add("待乘客上车");
+                            break;
+                        case "5":
+                            shellList.add("服务中");
+                            break;
+                        case "6":
+                            shellList.add("完成服务");
+                            break;
+                        case "7":
+                            shellList.add("待支付");
+                            break;
+                        case "8":
+                            shellList.add("待评价");
+                            break;
+                        case "9":
+                            shellList.add("已完成");
+                            break;
+                        case "10":
+                            shellList.add("已取消");
+                            break;
+                        case "11":
+                            shellList.add("改派中");
+                            break;
+                        case "12":
+                            shellList.add("取消待支付");
+                            break;
+                        default:
+                            shellList.add("-");
+                            break;
+                    }
+                }
+
+
+                if(SinataUtil.isNotEmpty(object.get("abnormal"))){
+                    shellList.add(object.get("abnormal").toString().equals("1")?"否":"是");
+                }else{
+                    shellList.add("-");
+                }
+
+
+                if(SinataUtil.isNotEmpty(object.get("promotion"))){
+                    shellList.add(object.get("promotion").toString().equals("1")?"否":"是");
+                }else{
+                    shellList.add("-");
+                }
+
+
+                if(SinataUtil.isNotEmpty(object.get("promotionUser"))){
+                    shellList.add(object.get("promotionUser").toString());
+                }else{
+                    shellList.add("-");
+                }
+                if(SinataUtil.isNotEmpty(object.get("promotionPhone"))){
+                    shellList.add(object.get("promotionPhone").toString());
+                }else{
+                    shellList.add("-");
+                }
+
+
+                dataList.add(shellList);
+            }
+            try {
+                // 调用工具类进行导出
+                ExcelExportUtil.easySheet("订单导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "订单导出记录", dataList,request, response);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
 
     @Autowired
     private ITDriverService tDriverService;
@@ -179,9 +445,6 @@
 
     @Autowired
     private IIncomeService incomeService;
-
-@Autowired
-private TDriverController tDriverController;
 
 
     /**
@@ -340,34 +603,4 @@
         return SUCCESS_TIP;
     }
     
-    
-    public static ResultUtil cancleMoney(BigDecimal amount,String no) throws Exception {
-        JSONObject json = new JSONObject();
-        json.put("requestTimestamp", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));    // 报文请求时间
-//        json.put("merOrderId", Util.getMerOrderId("34U0")); // 商户订单号
-        json.put("merOrderId", no); // 商户订单号
-        json.put("mid", "898150841210108"); // 商户号
-        json.put("tid", "84UJWSE8");    // 终端号
-        json.put("instMid", "QRPAYDEFAULT"); // 业务类型
-        BigDecimal multiply = amount.multiply(new BigDecimal(100));
-        int money = multiply.intValue();
-        json.put("refundAmount",money);      // 支付总金额
-        System.err.println("请求报文json:\n" + json);
-        String  url = "https://test-api-open.chinaums.com/v1/netpay/refund";
-//        String  url = "https://api-mop.chinaums.com/v1/netpay/refund";
-        //OPEN-BODY-SIG 方式
-        String result = GetOpenBodySig.sendOpenBodySig(url, json.toString());
-        System.err.println("响应报文json:\n" + result);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Object appPayRequest = jsonObject.get("appPayRequest");
-        System.out.println(appPayRequest);
-        return ResultUtil.success(appPayRequest);
-    }
-
-    @Autowired
-    private ITEnterpriseWithdrawalService tEnterpriseWithdrawalService;
-    @Autowired
-    private IUserWithdrawalService userWithdrawalService;
-
-
 }

--
Gitblit v1.7.1