From 89351ad17c81b37495f21d4dfbf28f0d306a155a Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 22 十月 2025 18:23:05 +0800
Subject: [PATCH] 虚拟号修改
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java | 67 ++++++++++++++++++++-------------
1 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
index 098722f..d246d2d 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/WithdrawServiceImpl.java
@@ -14,16 +14,10 @@
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.vo.UserDto;
import com.ruoyi.common.redis.service.RedisService;
-import com.ruoyi.order.entity.Order;
-import com.ruoyi.order.entity.Withdraw;
-import com.ruoyi.order.entity.WithdrawDetail;
-import com.ruoyi.order.entity.WithdrawalSetting;
+import com.ruoyi.order.entity.*;
import com.ruoyi.order.mapper.WithdrawMapper;
import com.ruoyi.order.request.WithdrawExportRequest;
-import com.ruoyi.order.service.OrderService;
-import com.ruoyi.order.service.WithdrawDetailService;
-import com.ruoyi.order.service.WithdrawService;
-import com.ruoyi.order.service.WithdrawalSettingService;
+import com.ruoyi.order.service.*;
import com.ruoyi.order.vo.MoneyQueryRequest;
import com.ruoyi.order.vo.UserWithdrawRecordVO;
import com.ruoyi.order.vx.HttpUtil;
@@ -56,6 +50,8 @@
@Resource
private WithdrawalSettingService withdrawalSettingService;
+ @Resource
+ private WithdrawRecordService withdrawRecordService;
@Resource
private OrderService orderService;
@Resource
@@ -138,7 +134,7 @@
throw new GlobalException("当前订单提现申请已通过!");
}
- return weChatPay(order.getOrderMoney(), openId,list.get(0).getId(),order.getServeName());
+ return weChatPay(order.getSubsidy()!=null?order.getSubsidy().add(order.getOrderMoney()):order.getOrderMoney(), openId,list.get(0).getId(),order.getServeName());
}
@Override
@@ -245,17 +241,25 @@
withdraw.setApplyForMoney(order.getOrderMoney());
withdraw.setOrderId(orderId);
withdraw.setCityCode(order.getCityCode());
-
this.save(withdraw);
+ WithdrawRecord withdrawRecord = new WithdrawRecord();
+ withdrawRecord.setWithdrawId(withdraw.getId());
+ withdrawRecord.setOrderId(withdraw.getOrderId());
+ withdrawRecord.setUserId(withdraw.getUserId());
+ withdrawRecord.setWithdrawType(1);
+ withdrawRecord.setCreateTime(new Date());
+ withdrawRecord.setAuditStatus(1);
+ withdrawRecordService.save(withdrawRecord);
+
// 未开启全局 提现审核,则用户提现不需要后台审核
if (Constants.ZERO.equals(withdrawalSetting.getEnableProcess())) {
// 已通过
withdraw.setState(Constants.ONE);
// 商家微信打款至微信零钱
boolean update = weChatPay(order.getOrderMoney(), openId,withdraw.getId(),order.getServerName());
-// if (!update) {
-// throw new GlobalException("交易提现失败,请检查是否绑定微信!");
-// }
+ if (!update) {
+ throw new GlobalException("交易提现失败,请检查是否绑定微信!");
+ }
} else {
// 待审核
withdraw.setState(Constants.ZERO);
@@ -372,28 +376,39 @@
Map<String, Object> postMap = new HashMap<>(8);
postMap.put(WechatConstants.APP_ID, "wx98563d0ec9cf21c8");
// 订单号
- String s = String.valueOf(UUID.randomUUID()).replaceAll("-", "");
- postMap.put("out_bill_no", s);
- System.err.println("====="+postMap.get(WechatConstants.OUT_BATCH_NO));
+ postMap.put("out_bill_no", String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
+ System.err.println("====="+postMap.get("out_bill_no"));
postMap.put(WechatConstants.OPEN_ID, openId);
// 转账金额
postMap.put("transfer_amount", transferAmount);
+ postMap.put("transfer_scene_id", "1010");
// 转账备注
- postMap.put("transfer_remark", transferAmount);
+ postMap.put("transfer_remark", "二手回收提现确认收款");
// 回调地址
- postMap.put("notify_url", transferAmount);
+ postMap.put("notify_url", "https://hyhsbqgc.com/api/ruoyi-order/wx/wxChatPay");
// 转账场景报备信息
+ List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> info = new HashMap<>();
info.put("info_type","回收商品名称");
info.put("info_content",serverName);
- postMap.put("transfer_scene_report_infos", JSONObject.toJSONString(info));
+ list.add(info);
+ postMap.put("transfer_scene_report_infos", list);
String result = HttpUtil.postTransBatRequest(
WechatConstants.WE_CHAT_PAY_URL_PRE,
JSONObject.toJSONString(postMap),
"7EEA04429B006E12AAA421C002EC48BBEED5BE94",
"1665330417",
- "E:\\ershoucert\\apiclient_key.pem", WechatConstants.WE_CHAT_URL_SUF);
+// "D:\\apiclient_key.pem",
+ "/usr/local/vx/apiclient_key.pem",
+
+ "/v3/fund-app/mch-transfer/transfer-bills");
JSONObject jsonObject = JSONObject.parseObject(result);
+// WithdrawDetail withdrawDetail = new WithdrawDetail();
+// withdrawDetail.setWithdrawId(withdrawId);
+// withdrawDetail.setMoney(transferAmount);
+// withdrawDetail.setOutBatchNo((String) postMap.get(WechatConstants.OUT_BATCH_NO));
+// withdrawDetailService.save(withdrawDetail);
+ System.err.println(jsonObject);
// WithdrawDetail withdrawDetail = new WithdrawDetail();
// withdrawDetail.setWithdrawId(withdrawId);
// withdrawDetail.setMoney(transferAmount);
@@ -404,6 +419,7 @@
Withdraw withdraw = this.getById(withdrawId);
Order order = orderService.getById(withdraw.getOrderId());
+ order.setIsWithdrawal(2);
order.setPackageInfo(string);
orderService.updateById(order);
// 转账成功
@@ -411,17 +427,14 @@
WithdrawDetail withdrawDetail = new WithdrawDetail();
withdrawDetail.setWithdrawId(withdrawId);
withdrawDetail.setMoney(transferAmount);
- withdrawDetail.setOutBatchNo(s);
+ withdrawDetail.setOutBatchNo(postMap.get("out_bill_no")+"");
withdrawDetailService.save(withdrawDetail);
-
-
} else {
- allTransfersSuccessful = false;
- break;
+ throw new GlobalException("提现失败,失败原因:"+jsonObject.getString("message"));
+// allTransfersSuccessful = false;
+// break;
}
-
}
-
return allTransfersSuccessful;
}
--
Gitblit v1.7.1