刘帅
2026-09-29 8a89ba02db5c19db669a5cf9bb7d443223bdfb71
cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -13,6 +13,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsh.other.entity.*;
import com.dsh.other.enums.SiteBookingStatusEnum;
import com.dsh.other.feignclient.StoreClient;
import com.dsh.other.feignclient.account.AppUserClient;
import com.dsh.other.feignclient.account.model.AppUser;
@@ -896,8 +897,9 @@
            siteBooking.setPayTime(new Date());
            siteBookingService.updateById(siteBooking);
            consumeCouponAfterSuccessfulPayment(siteBooking);
            HashMap<String, String> map = new HashMap<>();
            HashMap<String, Object> map = new HashMap<>();
            map.put("siteBooking", siteBooking.getId().toString());
            map.put("paySuccess", true);
            return ResultUtil.success(map);
        }
        if (reservationSite.getPayType() == 1 ) {//微信支付
@@ -932,15 +934,15 @@
            // 平台
            ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地", id.toString(), code, paymentPrice.toString(),
                    "/base/site/weChatPaymentSiteCallback", "APP", "");
            return weixinpay;
            return appendPaySuccess(weixinpay, false);
        } else {
            String smidVx = operatorUserService.getmerchantNumberByOperatorId(store.getOperatorId());
            if (!StringUtils.hasLength(smidVx)) {
                return ResultUtil.error("运营商未配置微信商户号,获取支付失败!");
            }
            return payMoneyUtil.weixinpayV3(smidVx, "预约场地"
            return appendPaySuccess(payMoneyUtil.weixinpayV3(smidVx, "预约场地"
                    , code, "/base/site/weChatPaymentSiteCallback1",
                    paymentPrice.toString(), id.toString());
                    paymentPrice.toString(), id.toString()), false);
        }
@@ -978,7 +980,7 @@
        }
        ResultUtil alipay = payMoneyUtil.alipay(smid1, "预约场地", "预约场地", id.toString(), code, paymentPrice.toString(), "/base/site/aliPaymentSiteCallback");
        System.out.println("预约场地----" + alipay.getCode());
        return alipay;
        return appendPaySuccess(alipay, false);
    }
    private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception {
@@ -1045,9 +1047,21 @@
        siteBooking.setStatus(1);
        siteBookingService.updateById(siteBooking);
        consumeCouponAfterSuccessfulPayment(siteBooking);
        HashMap<String, String> map = new HashMap<>();
        HashMap<String, Object> map = new HashMap<>();
        map.put("siteBooking", siteBooking.getId().toString());
        map.put("paySuccess", true);
        return ResultUtil.success(map);
    }
    /** 支付参数生成成功不等于已支付,前端仍需拉起微信或支付宝。 */
    private ResultUtil appendPaySuccess(ResultUtil paymentResult, boolean paySuccess) {
        JSONObject data = paymentResult.getData() == null ? new JSONObject()
                : JSON.parseObject(JSON.toJSONString(paymentResult.getData()));
        if (data == null) {
            data = new JSONObject();
        }
        data.put("paySuccess", paySuccess);
        return ResultUtil.getResult(paymentResult.getCode(), paymentResult.getMsg(), data);
    }
    /**
@@ -1173,7 +1187,10 @@
                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");
                ResultUtil refundResult = payMoneyUtil.weixinRefundV3(smidVx, code, siteBooking.getPayOrderNo(), siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback1");
                if (!ResultUtil.SUCCESS.equals(refundResult.getCode())) {
                    return refundResult;
                }
            } else {
                Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(),
                        siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback");
@@ -1184,9 +1201,6 @@
                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());
@@ -1194,6 +1208,13 @@
                backRecordService.save(tBackRecord);
            }
            // 退款请求已受理即结束该预约,不能继续在“待核销”列表中展示。
            // 微信退款回调用于补充退款流水号及恢复优惠券,重复更新状态不会影响结果。
            siteBooking.setStatus(SiteBookingStatusEnum.CANCELED.getCode());
            siteBooking.setCancelUserId(uid);
            siteBooking.setCancelTime(new Date());
            siteBookingService.updateById(siteBooking);
        }
        if (siteBooking.getPayType() == 2) {//支付宝