From 1c40baaf9ca0183945b9881d11ceed5aeebc8290 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 23 十月 2025 11:35:44 +0800
Subject: [PATCH] 修改bug
---
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/CallbackController.java | 151 +++++++++++++++++++++++++-------------------------
1 files changed, 75 insertions(+), 76 deletions(-)
diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/CallbackController.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/CallbackController.java
index cc4238d..8c9fc2f 100644
--- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/CallbackController.java
+++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/CallbackController.java
@@ -1,28 +1,23 @@
package com.stylefeng.guns.modular.api;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.stylefeng.guns.core.exception.GunsException;
-import com.stylefeng.guns.core.exception.ServiceExceptionEnum;
import com.stylefeng.guns.core.util.ToolUtil;
-import com.stylefeng.guns.modular.account.model.TEnterpriseWithdrawal;
import com.stylefeng.guns.modular.account.service.ITEnterpriseWithdrawalService;
import com.stylefeng.guns.modular.account.service.UserWithdrawalService;
-import com.stylefeng.guns.modular.account.util.Base64Util;
-import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample;
-import com.stylefeng.guns.modular.cloudPayment.example.DepositExample;
-import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq;
-import com.stylefeng.guns.modular.cloudPayment.req.DepositReq;
-import com.stylefeng.guns.modular.enums.PaymentTypeEnum;
-import com.stylefeng.guns.modular.system.model.Company;
-import com.stylefeng.guns.modular.system.model.Driver;
-import com.stylefeng.guns.modular.system.model.Reassign;
-import com.stylefeng.guns.modular.system.model.UserWithdrawal;
+import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
+import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
+import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
+import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.service.ICompanyService;
import com.stylefeng.guns.modular.system.service.IDriverService;
import com.stylefeng.guns.modular.system.service.IReassignService;
import com.stylefeng.guns.modular.system.util.PayMoneyUtil;
-import com.unionpay.upyzt.resp.AllocationResp;
-import com.unionpay.upyzt.resp.DepositResp;
+import com.stylefeng.guns.modular.system.util.rongyun.RongYunUtil;
+import com.stylefeng.guns.modular.system.util.rongyun.model.CloudRecordingCallback;
+import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
+import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,10 +26,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.IOException;
import java.io.PrintWriter;
-import java.math.BigDecimal;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* 第三方支付回调控制器
@@ -48,15 +47,16 @@
@Autowired
private PayMoneyUtil payMoneyUtil;
- @Autowired
- private IDriverService driverService;
- @Autowired
- private ICompanyService companyService;
- @Autowired
- private ITEnterpriseWithdrawalService enterpriseWithdrawalService;
- @Autowired
- private UserWithdrawalService userWithdrawalService;
+
+ @Autowired
+ private IOrderPrivateCarService orderPrivateCarService;
+
+ @Autowired
+ private IOrderTaxiService orderTaxiService;
+
+ @Autowired
+ private IOrderCrossCityService orderCrossCityService;
@@ -136,61 +136,60 @@
}
}
- private void cloudPay(Integer uid,String total_fee,String transaction_id,int type) {
- if(type==1){
- BigDecimal divide = new BigDecimal(total_fee).divide(new BigDecimal(100));
- total_fee=divide.toString();
+
+ @ResponseBody
+ @PostMapping("/rongYunCallBack")
+ public void rongYunCallBack(HttpServletRequest request, HttpServletResponse response){
+ CloudRecordingCallback cloudRecordingCallback = RongYunUtil.cloudRecordingCallback(request);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ System.err.println(sdf.format(new Date()) + "-------------------云端录制状态回调!-------------------");
+ System.err.println(JSON.toJSONString(cloudRecordingCallback));
+ if(null == cloudRecordingCallback){
+ System.err.println("云端录制状态回调解析出错!");
+ return;
}
- System.out.println("回调参数:"+total_fee+"---"+transaction_id);
- Driver driver = driverService.selectById(uid);
- if(Objects.isNull(driver)){
- throw new RuntimeException("该司机不存在!"+uid);
+ Integer type = cloudRecordingCallback.getType();
+ if(4 == type){//文件上传
+ String fileUrl = cloudRecordingCallback.getOutput().getFileUrl();
+ String roomId = cloudRecordingCallback.getRoomId();
+ String[] split = roomId.split("_");
+ String orderType = split[0];
+ String orderId = split[1];
+ if("1".equals(orderType)){
+ OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
+ orderPrivateCar.setVoice(fileUrl);
+ orderPrivateCar.setVoiceTime(new Date());
+ orderPrivateCarService.updateById(orderPrivateCar);
+ List<OrderPrivateCar> orderPrivateCars = orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().eq("pid", orderId));
+ for(OrderPrivateCar orderPrivateCar1 : orderPrivateCars){
+ orderPrivateCar1.setVoice(fileUrl);
+ orderPrivateCar1.setVoiceTime(new Date());
+ orderPrivateCarService.updateById(orderPrivateCar1);
+ }
+ }
+ if("2".equals(orderType)){
+ OrderTaxi orderTaxi = orderTaxiService.selectById(orderId);
+ orderTaxi.setVoice(fileUrl);
+ orderTaxi.setVoiceTime(new Date());
+ orderTaxiService.updateById(orderTaxi);
+ }
+ if("3".equals(orderType)){
+ OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId);
+ orderCrossCity.setVoice(fileUrl);
+ orderCrossCity.setVoiceTime(new Date());
+ orderCrossCityService.updateById(orderCrossCity);
+ }
+
}
- // 查询平台账户
- Company company = companyService.selectOne(new EntityWrapper<Company>()
- .eq("type", 1)
- .last("LIMIT 1"));
- System.out.println("查询平台账户==============="+company);
- // 查询平台开户信息
- TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>()
- .eq("companyId", company.getId())); // 替换为公司id
- System.out.println("查询平台开户信息==============="+enterpriseWithdrawal);
- // TODO 司机进件信息
- UserWithdrawal driverWith = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>()
- .eq("phone", driver.getPhone())
- .last("LIMIT 1"));
-// DepositReq depositReq = new DepositReq();
-// depositReq.setOutOrderNo(ToolUtil.getRandomString(32));
-// depositReq.setTotalAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).intValue()); // 总金额
-// depositReq.setAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).intValue()); // 支付金额
-// depositReq.setDiscountAmount(0); // 优惠金额
-// depositReq.setBalanceAcctId(driverWith.getBalanceAcctId());
-// depositReq.setDepositType("1");
-// depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode());
-// depositReq.setPaymentTradeNo(transaction_id); // 系统交易流水号
-// depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()));
-// depositReq.setOrderNo(transaction_id);
-// depositReq.setOrderAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).longValue());
-// depositReq.setProductName("司机支付充值");
-// depositReq.setProductCount(1);
+ PrintWriter out = null;
try {
-// DepositResp depositResp = DepositExample.create(depositReq);
-// System.err.println(depositResp);
- AllocationReq allocationReq = new AllocationReq();
- allocationReq.setPayBalanceAcctId(driverWith.getBalanceAcctId()); // 发送方
- allocationReq.setRecvBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId()); // 接收方
- BigDecimal multiply = new BigDecimal(100).multiply(new BigDecimal(total_fee));
- allocationReq.setAmount(multiply.intValue()); // 金额
- allocationReq.setPassword(Base64Util.decode(enterpriseWithdrawal.getTransactionAuthorizationCode())); // 密码
- allocationReq.setOrderNo(transaction_id);
- allocationReq.setOrderAmount(Long.valueOf(total_fee));
- allocationReq.setProductName("订单改派");
- allocationReq.setProductCount(1);
- AllocationResp allocationResp = AllocationExample.create(allocationReq);
- System.err.println("司机分账信息:"+allocationResp);
- } catch (Exception e) {
+ out = response.getWriter();
+ } catch (IOException e) {
e.printStackTrace();
}
-
+ out.print("OK");
+ out.flush();
+ out.close();
}
+
}
--
Gitblit v1.7.1