From c8b503726415980e5fa9a5ffc0e4e751eb7466e9 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 01 八月 2025 11:45:53 +0800
Subject: [PATCH] 新增加三方业务流程代码
---
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java | 137 +++++++++++----------------------------------
1 files changed, 35 insertions(+), 102 deletions(-)
diff --git a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java
index 839f3ca..3868cfe 100644
--- a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java
+++ b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java
@@ -3,33 +3,25 @@
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.ShiroKit;
import com.stylefeng.guns.core.util.SinataUtil;
-import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample;
-import com.stylefeng.guns.modular.cloudPayment.example.WithdrawalExample;
-import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq;
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.PushURL;
-import com.stylefeng.guns.modular.system.util.ResultUtil;
-import com.unionpay.upyzt.exception.UpyztException;
-import com.unionpay.upyzt.resp.AllocationResp;
-import com.unionpay.upyzt.resp.WithdrawalResp;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Controller;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;
-import com.stylefeng.guns.core.log.LogObjectHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.*;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
/**
* 提现列表控制器
@@ -41,26 +33,29 @@
@Slf4j
@RequestMapping("/tPubWithdrawal")
public class TPubWithdrawalController extends BaseController {
-
+
private String PREFIX = "/system/tPubWithdrawal/";
-
+
@Autowired
private ITPubWithdrawalService tPubWithdrawalService;
-
+
@Autowired
private ITSystemNoticeService tSystemNoticeService;
@Resource
private IUserWithdrawalService userWithdrawalService;
-
+
+ @Autowired
+ private ShiroExtUtil shiroExtUtil;
+
/**
* 跳转到提现列表首页
*/
@RequestMapping("")
public String index(Model model) {
- model.addAttribute("id",ShiroKit.getUser().getObjectId());
+ model.addAttribute("id", shiroExtUtil.getUser().getObjectId());
return PREFIX + "tPubWithdrawal.html";
}
-
+
/**
* 跳转到查看详情
*/
@@ -134,7 +129,6 @@
*/
@RequestMapping(value = "/immediately")
@ResponseBody
- @Transactional(rollbackFor = UpyztException.class,propagation = Propagation.REQUIRES_NEW)
public synchronized Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) {
TPubWithdrawal tPubWithdrawal = tPubWithdrawalService.selectById(id);
if(tPubWithdrawal.getState()!=1){
@@ -144,23 +138,21 @@
tPubWithdrawal.setHandleTime(new Date());
if (SinataUtil.isNotEmpty(tPubWithdrawal)){
// tPubWithdrawal.setState(state); //调用接口修改状态
-
-
-
-
+
+
Integer stateObj = 1;
- if (2 == state){ //同意提现
+ if (2 == state) { //同意提现
stateObj = 1;
- }else if (3 == state){ //拒绝提现
+ } else if (3 == state) { //拒绝提现
stateObj = 2;
}
-
- Integer objectId = ShiroKit.getUser().getObjectId();
+
+ Integer objectId = shiroExtUtil.getUser().getObjectId();
// 获取手续费
Double poundage = tPubWithdrawalService.getPoundage(objectId);
- if(poundage!=null && poundage>0){
+ if (poundage != null && poundage > 0) {
BigDecimal money = tPubWithdrawal.getMoney();
- if(money.doubleValue()>=1){
+ if (money.doubleValue() >= 1) {
BigDecimal divide = new BigDecimal(poundage).divide(new BigDecimal(100));
tPubWithdrawal.setMoney(money.subtract(money.multiply(divide)));
}
@@ -171,37 +163,10 @@
TUser tUser1 = userService.selectById(tPubWithdrawal.getUserId());
// 用户
List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser1.getPhone()).eq("applicationStatus","succeeded"));
- if(userWithdrawals.size()>0){
- System.out.println("用户:"+userWithdrawals);
- System.out.println("用户:"+userWithdrawals.get(0));
- try {
- log.info("用户提现创建=========");
- WithdrawalResp withdrawalResp = WithdrawalExample.create(userWithdrawalService.createInfo(userWithdrawals.get(0), tPubWithdrawal));
- tPubWithdrawal.setWithdrawId(withdrawalResp.getWithdrawalId());
- tPubWithdrawalService.updateById(tPubWithdrawal);
- log.info("用户提现创建信息========="+withdrawalResp.toString());
- log.info("用户提现创建成功=========");
- } catch (UpyztException e) {
- log.info("用户提现创建失败=========");
- e.printStackTrace();
- if(userType==1){
- TUser tUser = userService.selectById(tPubWithdrawal.getUserId());
- BigDecimal balance = tUser.getBalance();
- BigDecimal money = balance.add(tPubWithdrawal.getMoney());
- tUser.setBalance(money);
- userService.updateById(tUser);
-
- }else {
- TDriver tDriver = driverService.selectById(tPubWithdrawal.getUserId());
- BigDecimal balance = tDriver.getBalance();
- BigDecimal money = balance.add(tPubWithdrawal.getMoney());
- tDriver.setBalance(money);
- driverService.updateById(tDriver);
- }
- tPubWithdrawal.setState(3);
- tPubWithdrawalService.updateById(tPubWithdrawal);
- return e.getMessage();
- }
+ if(userWithdrawals.size()>0) {
+ System.out.println("用户:" + userWithdrawals);
+ System.out.println("用户:" + userWithdrawals.get(0));
+ tPubWithdrawalService.updateById(tPubWithdrawal);
}else {
return "该用户未进件";
}
@@ -213,44 +178,12 @@
.eq("phone", tUser1.getPhone())
.last("LIMIT 1"));
// 先从平台进行分账到用户电子账簿
- if(userWithdrawal==null){
+ if (userWithdrawal == null) {
return "该司机未进件";
}
- try {
- log.info("司机提现创建=========");
- WithdrawalResp withdrawalResp = WithdrawalExample.create(userWithdrawalService.createInfo(userWithdrawal, tPubWithdrawal));
- tPubWithdrawal.setWithdrawId(withdrawalResp.getWithdrawalId());
- tPubWithdrawalService.updateById(tPubWithdrawal);
- log.info("司机提现创建信息========="+withdrawalResp.toString());
- log.info("司机提现创建成功=========");
- } catch (UpyztException e) {
- log.info("司机提现创建失败=========");
- e.printStackTrace();
- if(userType==1){
- TUser tUser = userService.selectById(tPubWithdrawal.getUserId());
- BigDecimal balance = tUser.getBalance();
- BigDecimal money = balance.add(tPubWithdrawal.getMoney());
- tUser.setBalance(money);
- userService.updateById(tUser);
- }else {
- TDriver tDriver = driverService.selectById(tPubWithdrawal.getUserId());
- if(tPubWithdrawal.getType()==2){
- BigDecimal balance = new BigDecimal(tDriver.getLaveBusinessMoney());
- BigDecimal money = balance.add(tPubWithdrawal.getMoney());
- tDriver.setLaveBusinessMoney(money.doubleValue());
- }else
- {
- BigDecimal balance = new BigDecimal(tDriver.getLaveActivityMoney());
- BigDecimal money = balance.add(tPubWithdrawal.getMoney());
- tDriver.setLaveActivityMoney(money.doubleValue());
- }
-
- driverService.updateById(tDriver);
- }
- tPubWithdrawal.setState(3);
- tPubWithdrawalService.updateById(tPubWithdrawal);
- return e.getMessage();
- }
+ log.info("司机提现创建=========");
+ tPubWithdrawalService.updateById(tPubWithdrawal);
+ log.info("司机提现创建成功=========");
}
}else {
tPubWithdrawal.setState(state);
--
Gitblit v1.7.1