From 79c06273ba713f73fb08fd3698622f28e663b96a Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 04 八月 2025 16:53:44 +0800
Subject: [PATCH] update
---
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AppOrderController.java | 238 +++++++++++++++++++++++++++--------------------------------
1 files changed, 110 insertions(+), 128 deletions(-)
diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AppOrderController.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AppOrderController.java
index 6805c3f..a74f8ef 100644
--- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AppOrderController.java
+++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AppOrderController.java
@@ -4,25 +4,15 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.util.GetOpenBodySig;
import com.stylefeng.guns.core.util.NotifyDemo;
-import com.stylefeng.guns.core.util.ToolUtil;
-import com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar;
import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService;
import com.stylefeng.guns.modular.account.model.TEnterpriseWithdrawal;
import com.stylefeng.guns.modular.account.server.ITEnterpriseWithdrawalService;
import com.stylefeng.guns.modular.account.server.UserWithdrawalService;
-import com.stylefeng.guns.modular.account.util.Base64Util;
import com.stylefeng.guns.modular.account.util.QrCodeConfiguration;
import com.stylefeng.guns.modular.account.util.Util;
-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.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
-import com.stylefeng.guns.modular.enums.PaymentTypeEnum;
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
-import com.stylefeng.guns.modular.system.dao.UserInfoMapper;
import com.stylefeng.guns.modular.system.model.Company;
import com.stylefeng.guns.modular.system.model.Driver;
import com.stylefeng.guns.modular.system.model.UserInfo;
@@ -32,34 +22,26 @@
import com.stylefeng.guns.modular.system.service.ITaxiCardService;
import com.stylefeng.guns.modular.system.service.IUserInfoService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
-import com.stylefeng.guns.modular.taxi.model.TransactionDetails;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
-import com.unionpay.upyzt.exception.UpyztException;
-import com.unionpay.upyzt.resp.AllocationResp;
-import com.unionpay.upyzt.resp.DepositResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.time.DateFormatUtils;
-import org.apache.shiro.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
/**
* @program: openPlatform
@@ -294,7 +276,7 @@
TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>()
.eq("companyId", company.getId())); // TODO 替换为公司id
- DepositReq depositReq = new DepositReq();
+// DepositReq depositReq = new DepositReq();
if(integer==7){ // 充值回调
@@ -318,27 +300,27 @@
// depositReq.setProductName("用户支付充值");
// depositReq.setProductCount(1);
}
- depositReq.setOutOrderNo(ToolUtil.getRandomString(32));
- depositReq.setTotalAmount(totalAmount); // 总金额
- depositReq.setAmount(buyerPayAmount); // 支付金额
- depositReq.setDiscountAmount(couponAmount); // 优惠金额
- depositReq.setBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId());
- depositReq.setDepositType("1");
- depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode());
- depositReq.setPaymentTradeNo(targetOrderId); // 系统交易流水号
- depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()));
- depositReq.setOrderNo(targetOrderId);
- depositReq.setOrderAmount(Long.valueOf(totalAmount));
- depositReq.setProductName("用户支付充值");
- depositReq.setProductCount(1);
-
+// depositReq.setOutOrderNo(ToolUtil.getRandomString(32));
+// depositReq.setTotalAmount(totalAmount); // 总金额
+// depositReq.setAmount(buyerPayAmount); // 支付金额
+// depositReq.setDiscountAmount(couponAmount); // 优惠金额
+// depositReq.setBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId());
+// depositReq.setDepositType("1");
+// depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode());
+// depositReq.setPaymentTradeNo(targetOrderId); // 系统交易流水号
+// depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date()));
+// depositReq.setOrderNo(targetOrderId);
+// depositReq.setOrderAmount(Long.valueOf(totalAmount));
+// depositReq.setProductName("用户支付充值");
+// depositReq.setProductCount(1);
+
try {
// DepositResp depositResp = DepositExample.create(depositReq);
// System.err.println(depositResp);
// log.info("支付充值成功:{}",depositResp);
} catch (Exception e) {
e.printStackTrace();
- log.error("支付充值失败:{}",e.getMessage());
+ log.error("支付充值失败:{}", e.getMessage());
PrintWriter writer = response.getWriter();
response.setStatus(200);
writer.write("FAILED");
@@ -376,6 +358,42 @@
}
}
+ public String createAllocationReqUser(Integer companyId,Integer userId,int type,double money) {
+ List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId));
+ UserInfo tUser = userInfoService.selectById(userId);
+ List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone()));
+ if (userWithdrawals.size() == 0) {
+ return "error";
+ }
+
+// AllocationReq allocationReq= new AllocationReq();
+// allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
+// if(type==1){
+// allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
+// allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
+//
+// allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode()));
+// }else {
+// allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
+// allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
+// allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode()));
+// }
+// money = money * 100;
+// allocationReq.setAmount((int) money);
+// allocationReq.setProductName("分账");
+// allocationReq.setProductCount(1);
+// allocationReq.setOrderNo(ToolUtil.getRandomString(32));
+// allocationReq.setOrderAmount(1l);
+// try {
+// AllocationResp allocationResp = AllocationExample.create(allocationReq);
+// System.out.println(allocationResp);
+// return "ok";
+// } catch (UpyztException e) {
+// e.printStackTrace();
+// return e.getMessage();
+// }
+ return "ok";
+ }
public ResultUtil moneyPay(Integer id,Integer userId,Double money){
@@ -386,115 +404,79 @@
TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>()
.eq("companyId", company.getId()));
UserInfo userInfo = userInfoService.selectById(userId);
- System.out.println("用户信息:"+userInfo);
+ System.out.println("用户信息:" + userInfo);
UserWithdrawal driverWith = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>()
.eq("phone", userInfo.getPhone())
.last("LIMIT 1"));
- System.out.println("用户进件信息:"+driverWith);
- if(driverWith==null){
+ System.out.println("用户进件信息:" + driverWith);
+ if (driverWith == null) {
return ResultUtil.error("领取失败,请先设置进件信息");
}
- AllocationReq allocationReq = new AllocationReq();
- allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
- allocationReq.setProductCount(1);
- allocationReq.setPayBalanceAcctId(driverWith.getBalanceAcctId());
-// allocationReq.setPayBalanceAcctId("2008322294132024868");
- allocationReq.setOrderAmount((long) (money*100));
- allocationReq.setAmount((int) (money*100));
- allocationReq.setProductName("余额支付");
- allocationReq.setRecvBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId());
-// allocationReq.setRecvBalanceAcctId("2007982285722883157");
- allocationReq.setOrderNo(id.toString());
- allocationReq.setPassword(Base64Util.decode(driverWith.getTransactionAuthorizationCode()));
+// AllocationReq allocationReq = new AllocationReq();
+// allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
+// allocationReq.setProductCount(1);
+// allocationReq.setPayBalanceAcctId(driverWith.getBalanceAcctId());
+//// allocationReq.setPayBalanceAcctId("2008322294132024868");
+// allocationReq.setOrderAmount((long) (money * 100));
+// allocationReq.setAmount((int) (money * 100));
+// allocationReq.setProductName("余额支付");
+// allocationReq.setRecvBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId());
+//// allocationReq.setRecvBalanceAcctId("2007982285722883157");
+// allocationReq.setOrderNo(id.toString());
+// allocationReq.setPassword(Base64Util.decode(driverWith.getTransactionAuthorizationCode()));
// allocationReq.setPassword("MTIzNDU2");
- System.out.println("余额支付请求信息:"+allocationReq);
- try {
-
- AllocationResp allocationResp = AllocationExample.create(allocationReq);
- System.out.println("余额支付操作:"+allocationResp);
- return ResultUtil.success();
- } catch (UpyztException e) {
- e.printStackTrace();
- System.out.println("余额支付操作error:"+e);
- System.out.println(e.getIssue());
- return ResultUtil.error(e.getMessage());
- }
- }
-
-
- public String createAllocationReqUser(Integer companyId,Integer userId,int type,double money){
- List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId));
- UserInfo tUser = userInfoService.selectById(userId);
- List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone()));
- if(userWithdrawals.size()==0){
- return "error";
- }
-
- AllocationReq allocationReq= new AllocationReq();
- allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
- if(type==1){
- allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
- allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
-
- allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode()));
- }else {
- allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
- allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
- allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode()));
- }
- money=money*100;
- allocationReq.setAmount((int)money);
- allocationReq.setProductName("分账");
- allocationReq.setProductCount(1);
- allocationReq.setOrderNo(ToolUtil.getRandomString(32));
- allocationReq.setOrderAmount(1l);
- try {
- AllocationResp allocationResp = AllocationExample.create(allocationReq);
- System.out.println(allocationResp);
- return "ok";
- } catch (UpyztException e) {
- e.printStackTrace();
- return e.getMessage();
- }
-
+// System.out.println("余额支付请求信息:" + allocationReq);
+// try {
+//
+// AllocationResp allocationResp = AllocationExample.create(allocationReq);
+// System.out.println("余额支付操作:"+allocationResp);
+// return ResultUtil.success();
+// } catch (UpyztException e) {
+// e.printStackTrace();
+// System.out.println("余额支付操作error:"+e);
+// System.out.println(e.getIssue());
+// return ResultUtil.error(e.getMessage());
+// }
+ return ResultUtil.success();
}
@Autowired
private IDriverService driverService;
- public String createAllocationReqDriver(Integer companyId,Integer userId,int type,double money){
+
+ public String createAllocationReqDriver(Integer companyId,Integer userId,int type,double money) {
List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId));
Driver tUser = driverService.selectById(userId);
List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone()));
- if(userWithdrawals.size()==0){
+ if (userWithdrawals.size() == 0) {
return "error";
}
- AllocationReq allocationReq= new AllocationReq();
- allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
- if(type==1){
- allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
- allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
-
- allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode()));
- }else {
- allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
- allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
- allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode()));
- }
- money=money*100;
- allocationReq.setAmount((int)money);
- allocationReq.setProductName("分账");
- allocationReq.setProductCount(1);
- allocationReq.setOrderNo(ToolUtil.getRandomString(32));
- allocationReq.setOrderAmount(1l);
- try {
- AllocationResp allocationResp = AllocationExample.create(allocationReq);
- System.out.println(allocationResp);
- return "ok";
- } catch (UpyztException e) {
- e.printStackTrace();
- return e.getMessage();
- }
-
+// AllocationReq allocationReq= new AllocationReq();
+// allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
+// if(type==1){
+// allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
+// allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
+//
+// allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode()));
+// }else {
+// allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
+// allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
+// allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode()));
+// }
+// money = money * 100;
+// allocationReq.setAmount((int) money);
+// allocationReq.setProductName("分账");
+// allocationReq.setProductCount(1);
+// allocationReq.setOrderNo(ToolUtil.getRandomString(32));
+// allocationReq.setOrderAmount(1l);
+// try {
+// AllocationResp allocationResp = AllocationExample.create(allocationReq);
+// System.out.println(allocationResp);
+// return "ok";
+// } catch (UpyztException e) {
+// e.printStackTrace();
+// return e.getMessage();
+// }
+ return "ok";
}
}
--
Gitblit v1.7.1