From c52f83ef5f702b3c178881d3eee72267c77e7751 Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期三, 24 七月 2024 17:26:46 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0

---
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 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 61a4e05..767ab40 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
@@ -70,6 +70,12 @@
     @Autowired
     private TBackRecordService backRecordService;
 
+    @Autowired
+    private ISiteBookingService iSiteBookingService;
+
+    @Autowired
+    private ISiteService siteService;
+
 
     /**
      * 获取场地列表
@@ -155,10 +161,7 @@
     }
 
 
-    @Autowired
-    private ISiteBookingService iSiteBookingService;
-    @Autowired
-    private ISiteService siteService;
+
 
     /**
      * 获取场地预约日期数据
@@ -327,7 +330,6 @@
      */
     @Override
     public ResultUtil reservationSite(Integer uid, ReservationSite reservationSite) throws Exception {
-
         Site site = this.getById(reservationSite.getId());
         AppUser appUser = appUserClient.queryAppUser(uid);
         String[] split = reservationSite.getTimes().split(";");
@@ -358,7 +360,6 @@
                 payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
             if (appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0) {
-
                 return new ResultUtil(3, "玩湃币不足");
             }
         } else {
@@ -366,18 +367,14 @@
                 payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             } else {
                 payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-
             }
         }
 
         //校验优惠券
         Long couponId = reservationSite.getCouponId();
         if (couponId != null && couponId != 0) {
-
             if (null != couponId && reservationSite.getPayType() != 3) {
                 UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(reservationSite.getCouponId(), uid));
-
-
                 if (userCoupon != null && userCoupon.getStatus() == 2) {
                     return ResultUtil.error("优惠券已被核销");
                 }
@@ -387,7 +384,6 @@
                     return ResultUtil.error("优惠券已过期");
                 }
                 if (userCoupon != null && coupon.getType() == 1) {//满减
-//                {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
                     JSONObject jsonObject = JSON.parseObject(coupon.getContent());
                     Double num1 = jsonObject.getDouble("conditionalAmount");
                     Double num2 = jsonObject.getDouble("deductionAmount");
@@ -432,7 +428,6 @@
         siteBooking.setState(1);
         siteBooking.setInsertTime(new Date());
 
-        // 2.0
         siteBooking.setNextName(reservationSite.getNextName());
         siteBooking.setIsHalf(reservationSite.getIsHalf());
         siteBooking.setHalfName(reservationSite.getHalfName());
@@ -441,7 +436,6 @@
 
         if (reservationSite.getPayType() == 1) {//微信支付
             ResultUtil resultUtil = weChatPaymentSite(payMoney, siteBooking);
-
             return resultUtil;
         }
         if (reservationSite.getPayType() == 2) {//支付宝支付
@@ -468,7 +462,8 @@
     public ResultUtil weChatPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception {
         String code = siteBooking.getOrderNo();
         Integer id = siteBooking.getId();
-        ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地", id.toString(), code, paymentPrice.toString(), "/base/site/weChatPaymentSiteCallback", "APP", "");
+        ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地", id.toString(), code, paymentPrice.toString(),
+                "/base/site/weChatPaymentSiteCallback", "APP", "");
         if (weixinpay.getCode() == 200) {
             new Thread(new Runnable() {
                 @Override
@@ -498,7 +493,7 @@
                                 Map<String, String> data1 = resultUtil.getData();
                                 String s = data1.get("trade_state");
                                 String transaction_id = data1.get("transaction_id");
-                                if ("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
+                                if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
                                     break;
                                 }
                                 if ("SUCCESS".equals(s)) {
@@ -508,7 +503,7 @@
                                     siteBookingService.updateById(siteBooking);
                                     break;
                                 }
-                                if ("USERPAYING".equals(s)) {
+                                if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) {
                                     num++;
                                 }
                             }
@@ -688,7 +683,6 @@
         }
 
         if (siteBooking.getStatus() == 0) {
-//            return ResultUtil.error("请先进行支付");
             siteBooking.setStatus(5);
             siteBookingService.updateById(siteBooking);
             AppUser appUser = appUserClient.queryAppUser(siteBooking.getAppUserId());
@@ -705,12 +699,13 @@
             return ResultUtil.error("不能进行取消操作");
         }
         if (siteBooking.getPayType() == 1) {//微信支付
-            Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(), siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback");
+            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 result_code = map.get("result_code");
-            if (!"SUCCESS".equals(result_code)) {
+            String return_code = map.get("return_code");
+            if (!"SUCCESS".equals(return_code)) {
                 return ResultUtil.error(map.get("return_msg"));
             }
             siteBooking.setCancelUserId(uid);

--
Gitblit v1.7.1