From 537ed054fe1d9b40b4908cf41ce8c9a6a82d0df9 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 18 三月 2024 16:04:04 +0800
Subject: [PATCH] 部分bug修改

---
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 11 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 ade018d..898316d 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;
+
 
     /**
      * 获取场地预约日期数据
@@ -174,9 +177,7 @@
         System.out.println("=======date======" + day);
         List<String> strings = new ArrayList<>();
 
-//        List<SiteBooking> siteBookings = siteClient.listBooks(id);
         List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).eq("nextName", siteName).like("times", day));
-
 
         if (siteName == null || siteName.equals("")) {
             siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).like("times", day));
@@ -329,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(";");
@@ -389,7 +389,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");
@@ -434,7 +433,6 @@
         siteBooking.setState(1);
         siteBooking.setInsertTime(new Date());
 
-        // 2.0
         siteBooking.setNextName(reservationSite.getNextName());
         siteBooking.setIsHalf(reservationSite.getIsHalf());
         siteBooking.setHalfName(reservationSite.getHalfName());
@@ -451,6 +449,9 @@
         }
         if (reservationSite.getPayType() == 3) {//玩湃币支付
             if (reservationSite.getIsHalf() == 2) {
+
+
+
                 return playPaiCoinPaymentSite(appUser, Double.valueOf(site.getPlayPaiCoin()), siteBooking);
             } else {
                 return playPaiCoinPaymentSite(appUser, site.getPlayPaiCoinOne(), siteBooking);
@@ -524,7 +525,7 @@
         return weixinpay;
     }
 
-
+    private String smid = "2088330203191220";//平台支付宝商户号
     /**
      * 课程支付宝支付
      *
@@ -535,7 +536,21 @@
     public ResultUtil aliPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception {
         String code = siteBooking.getOrderNo();
         Integer id = siteBooking.getId();
-        ResultUtil alipay = payMoneyUtil.alipay("预约场地", "预约场地", id.toString(), code, paymentPrice.toString(), "/base/site/aliPaymentSiteCallback");
+        // 判断预约的门店 属于哪个运营商
+        Integer storeId = siteBooking.getStoreId();
+        Store byId = storeService.getById(storeId);
+        Integer operatorId = byId.getOperatorId();
+        String smid1 = "";
+        if (operatorId == null ){
+            // 平台的门店
+            smid1 = smid;
+        }else if (operatorId == 0){
+            smid1 = smid;
+        }else{
+            smid1 = siteService.getSMIDByOperatorId(operatorId);
+
+        }
+        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() {
@@ -574,6 +589,20 @@
                                     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 ){
+                                        // 平台的门店
+                                    }else if (operatorId == 0){
+                                        smid1 = smid;
+                                    }else{
+                                        smid1 = siteService.getSMIDByOperatorId(operatorId);
+
+                                    }
+                                    payMoneyUtil.confirm(smid1,code,tradeNo,paymentPrice.toString());
                                     break;
                                 }
                                 if ("WAIT_BUYER_PAY".equals(s)) {
@@ -894,4 +923,9 @@
         return siteMapper.changeState(siteIds, type);
 
     }
+
+    @Override
+    public String getSMIDByOperatorId(Integer id) {
+        return siteMapper.getSMIDByOperatorId(id);
+    }
 }

--
Gitblit v1.7.1