From cabda12d788eeb6e056113ac8352dfaf972490d9 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期一, 20 十月 2025 17:10:44 +0800
Subject: [PATCH] bug修改,后台新增预约记录,玩湃惠民卡修改二维码参数规则,启动游戏取消校验是否订场校验
---
cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java | 193 ++++++++++++++++++++++--------------------------
1 files changed, 88 insertions(+), 105 deletions(-)
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
index b49bc3e..f0ca39a 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -65,6 +65,7 @@
@Resource
private UserCouponClient userCouponClient;
+
@Resource
private CouponClient couponClient;
@@ -469,16 +470,14 @@
String code = siteBooking.getOrderNo();
Integer id = siteBooking.getId();
Site byId = siteService.getById(siteBooking.getSiteId());
- // 是否分账 0否1是
- int isFenZhang= 1;
- String merchantNumber = "";
- if (byId.getOperatorId()==null || byId.getOperatorId()==0){
+ Store store = storeService.getById(byId.getStoreId());
+ if (store.getOperatorId()==null || store.getOperatorId()==0){
// 平台
- ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地-"+isFenZhang, id.toString(), code, paymentPrice.toString(),
+ ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地", id.toString(), code, paymentPrice.toString(),
"/base/site/weChatPaymentSiteCallback", "APP", "");
return weixinpay;
}else{
- String smidVx= operatorUserService.getmerchantNumberByOperatorId(byId.getOperatorId());
+ String smidVx= operatorUserService.getmerchantNumberByOperatorId(store.getOperatorId());
if (!StringUtils.hasLength(smidVx)){
return ResultUtil.error("运营商未配置微信商户号,获取支付失败!");
}
@@ -521,71 +520,59 @@
}
ResultUtil alipay = payMoneyUtil.alipay(smid1,"预约场地", "预约场地", id.toString(), code, paymentPrice.toString(), "/base/site/aliPaymentSiteCallback");
System.out.println("预约场地----" + alipay.getCode());
-// if (alipay.getCode() == 200) {
-// new Thread(new Runnable() {
-// @Override
-// public void run() {
-// try {
-// int num = 1;
-// int wait = 0;
-// while (num <= 10) {
-// int min = 5000;
-// wait += (min * num);
-// Thread.sleep(wait);
-// SiteBooking siteBooking = siteBookingService.getById(id);
-// if (siteBooking.getStatus() != 0) {
-// break;
-// }
-// AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
-// if (resultUtil.getCode().equals("10000") && siteBooking.getStatus() == 0) {
-// /**
-// * WAIT_BUYER_PAY(交易创建,等待买家付款)、
-// * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
-// * TRADE_SUCCESS(交易支付成功)、
-// * TRADE_FINISHED(交易结束,不可退款)
-// */
-//// Map<String, String> data1 = resultUtil.getData();
-//// String s = data1.get("tradeStatus");
-// String tradeNo = resultUtil.getTradeNo();
-// String s = resultUtil.getTradeStatus();
-// System.out.println("ssssss" + s);
-// if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) {
-// break;
-// }
-// if ("TRADE_SUCCESS".equals(s)) {
-// siteBooking.setPayTime(new Date());
-// siteBooking.setStatus(1);
-// siteBooking.setPayOrderNo(tradeNo);
-// siteBookingService.updateById(siteBooking);
-// System.err.println("======完成支付");
-// // 判断预约的门店 属于哪个运营商
-// Integer storeId = siteBooking.getStoreId();
-// Store byId = storeService.getById(storeId);
-// Integer operatorId = byId.getOperatorId();
-// String smid1 = "";
-// if (operatorId == null || operatorId == 0){
-// // 平台的门店 不冻结资金不做分账处理
-// payMoneyUtil.confirm1(smid1,code,tradeNo,paymentPrice.toString());
-// }else{
-// smid1 = siteService.getSMIDByOperatorId(operatorId);
-// payMoneyUtil.confirm(smid1,code,tradeNo,paymentPrice.toString());
-// // 分账
-// extracted(operatorId, new BigDecimal(paymentPrice.toString()), tradeNo);
-// }
-//
-// break;
-// }
-// if ("WAIT_BUYER_PAY".equals(s)) {
-// num++;
-// }
-// }
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-// }).start();
-// }
+ if (alipay.getCode() == 200) {
+ String finalSmid = smid1;
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ int num = 1;
+ int wait = 0;
+ while (num <= 10) {
+ int min = 5000;
+ wait += (min * num);
+ Thread.sleep(wait);
+ SiteBooking siteBooking = siteBookingService.getById(id);
+ if (siteBooking.getStatus() != 0) {
+ break;
+ }
+ AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
+ if (resultUtil.getCode().equals("10000") && siteBooking.getStatus() == 0) {
+ /**
+ * WAIT_BUYER_PAY(交易创建,等待买家付款)、
+ * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
+ * TRADE_SUCCESS(交易支付成功)、
+ * TRADE_FINISHED(交易结束,不可退款)
+ */
+// Map<String, String> data1 = resultUtil.getData();
+// String s = data1.get("tradeStatus");
+ String tradeNo = resultUtil.getTradeNo();
+ String s = resultUtil.getTradeStatus();
+ System.out.println("ssssss" + s);
+ if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) {
+ break;
+ }
+ if ("TRADE_SUCCESS".equals(s)) {
+ siteBooking.setPayTime(new Date());
+ siteBooking.setStatus(1);
+ siteBooking.setPayOrderNo(tradeNo);
+ siteBookingService.updateById(siteBooking);
+ System.err.println("======完成支付");
+ Thread.sleep(30000);
+ payMoneyUtil.confirm(finalSmid, code, tradeNo, paymentPrice.toString());
+ break;
+ }
+ if ("WAIT_BUYER_PAY".equals(s)) {
+ num++;
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ }
return alipay;
}
@@ -722,43 +709,39 @@
if (siteBooking.getStatus() != 1 && siteBooking.getStatus() != 2) {
return ResultUtil.error("不能进行取消操作");
}
+ Integer storeId = siteBooking.getStoreId();
+ Store store = storeService.getById(storeId);
+
if (siteBooking.getPayType() == 1) {//微信支付
- if (StringUtils.hasLength(siteBooking.getFenzhangNo())){
- // 是分账订单 如果分账金额不为0 那么回退分账金额
- if (siteBooking.getFenzhangAmount()!=null && siteBooking.getFenzhangAmount().compareTo(BigDecimal.ZERO)>0){
- String randomCode = UUIDUtil.getRandomCode(16);
- String randomCode1 = UUIDUtil.getRandomCode(16);
- if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){
- // 微信商户号
- String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId());
- ResultUtil resultUtil = payMoneyUtil.fenzhangRefund(siteBooking.getFenzhangNo(), siteBooking.getFenzhangAmount().multiply(new BigDecimal("100")), s2, randomCode, randomCode1);
- if (!resultUtil.getCode().equals(200)){
- System.err.println("分账回退失败 原因是:"+resultUtil.getMsg()+resultUtil.getData());
- }else{
- siteBooking.setFenzhangRefundNo(resultUtil.getMsg());
- siteBookingService.updateById(siteBooking);
- }
-
- }
+ if (store.getOperatorId()!=null && store.getOperatorId()!=0){
+ String smidVx= operatorUserService.getmerchantNumberByOperatorId(store.getOperatorId());
+ if (!StringUtils.hasLength(smidVx)){
+ return ResultUtil.error("运营商未配置微信商户号,获取支付失败!");
}
- }
- Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(),
- siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback");
- if (null == map) {
- return ResultUtil.error("取消退款异常");
- }
- String return_code = map.get("return_code");
- if (!"SUCCESS".equals(return_code)) {
- return ResultUtil.error(map.get("return_msg"));
- }
- siteBooking.setCancelUserId(uid);
- siteBookingService.updateById(siteBooking);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);// 退款单号
+ // 运营商退款
+ payMoneyUtil.weixinRefundV3(smidVx, code, siteBooking.getPayOrderNo(), siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback1");
+ }else{
+ Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(),
+ siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback");
+ if (null == map) {
+ return ResultUtil.error("取消退款异常");
+ }
+ String return_code = map.get("return_code");
+ if (!"SUCCESS".equals(return_code)) {
+ return ResultUtil.error(map.get("return_msg"));
+ }
+ siteBooking.setCancelUserId(uid);
+ siteBookingService.updateById(siteBooking);
- TBackRecord tBackRecord = new TBackRecord();
- tBackRecord.setMoney(siteBooking.getPayMoney());
- tBackRecord.setUserId(siteBooking.getAppUserId());
- tBackRecord.setTime(new Date());
- backRecordService.save(tBackRecord);
+ TBackRecord tBackRecord = new TBackRecord();
+ tBackRecord.setMoney(siteBooking.getPayMoney());
+ tBackRecord.setUserId(siteBooking.getAppUserId());
+ tBackRecord.setTime(new Date());
+ backRecordService.save(tBackRecord);
+ }
+
}
if (siteBooking.getPayType() == 2) {//支付宝
--
Gitblit v1.7.1