From aa925d851857f50eff0556411366690d9a78a0e5 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 27 十一月 2023 17:30:26 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai

---
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java |  328 +++++++++++++++++++++++++++---------------------------
 1 files changed, 164 insertions(+), 164 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 da5ad28..c35c64a 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
@@ -71,21 +71,19 @@
     private TBackRecordService backRecordService;
 
 
-
-
-
     /**
      * 获取场地列表
+     *
      * @param querySiteList
      * @return
      * @throws Exception
      */
     @Override
     public List<QuerySiteListVo> querySiteList(QuerySiteList querySiteList) throws Exception {
-        querySiteList.setPageNum((querySiteList.getPageNum() - 1) *querySiteList.getPageSize());
+        querySiteList.setPageNum((querySiteList.getPageNum() - 1) * querySiteList.getPageSize());
         List<QuerySiteListVo> querySiteListVos = this.baseMapper.querySiteList(querySiteList);
         for (QuerySiteListVo querySiteListVo : querySiteListVos) {
-            if(ToolUtil.isEmpty(querySiteList.getLon())){
+            if (ToolUtil.isEmpty(querySiteList.getLon())) {
                 querySiteListVo.setDistance(0D);
                 continue;
             }
@@ -99,6 +97,7 @@
 
     /**
      * 获取场地详情
+     *
      * @param id
      * @return
      * @throws Exception
@@ -125,7 +124,7 @@
 
 
         querySiteInfoVo.setCashPriceOne(site.getCashPriceOne());
-        if(site.getPlayPaiCoinOne()!=null){
+        if (site.getPlayPaiCoinOne() != null) {
             querySiteInfoVo.setPlayPaiCoinOne(site.getPlayPaiCoinOne().intValue());
         }
 
@@ -145,7 +144,7 @@
         }
         querySiteInfoVo.setHalfName(halfName);
         querySiteInfoVo.setNextName(nextName);
-        if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){
+        if (ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)) {
             Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat());
             double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             querySiteInfoVo.setDistance(wgs84);
@@ -156,36 +155,33 @@
     }
 
 
-
-
-
     @Autowired
     private ISiteBookingService iSiteBookingService;
     @Autowired
     private ISiteService siteService;
+
     /**
      * 获取场地预约日期数据
+     *
      * @param id
      * @param day
      * @return
      * @throws Exception
      */
     @Override
-    public List<QuerySiteTimes> querySiteTimes(Integer id, String day,String halfName,String siteName) throws Exception {
+    public List<QuerySiteTimes> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception {
 
-        System.out.println("=======date======"+day);
+        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));
+        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));
+        if (siteName == null || siteName.equals("")) {
+            siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).like("times", day));
         }
 
 
-        System.out.println("=======siteBookings======"+siteBookings);
+        System.out.println("=======siteBookings======" + siteBookings);
         for (SiteBooking siteBooking : siteBookings) {
 
 
@@ -196,15 +192,15 @@
                     String convertedValue = s.substring(11);
                     strings.add(convertedValue);
                 }
-            }else {
-                if (halfName==null){
+            } else {
+                if (halfName == null) {
                     for (String s : split) {
                         String convertedValue = s.substring(11);
                         strings.add(convertedValue);
                     }
                 }
 
-                if (siteBooking.getHalfName().equals(halfName)){
+                if (siteBooking.getHalfName().equals(halfName)) {
                     for (String s : split) {
                         String convertedValue = s.substring(11);
                         strings.add(convertedValue);
@@ -213,24 +209,24 @@
                 }
             }
         }
-        System.out.println("======strings======="+strings);
+        System.out.println("======strings=======" + strings);
 
 
         List<QuerySiteTimes> timeRanges = new ArrayList<>();
 
 
-        Site site =  siteService.getById(id);
-        System.out.println("================"+site);
+        Site site = siteService.getById(id);
+        System.out.println("================" + site);
         String appointmentStartTime = site.getAppointmentStartTime();
         String appointmentEndTime = site.getAppointmentEndTime();
 
         String currentTime = appointmentStartTime;
         while (currentTime.compareTo(appointmentEndTime) < 0) {
-            String nextTime=null;
-            if("智慧场地".equals(site.getTypeName())){
-                nextTime=getNextTimeOne(currentTime);
-            }else {
-                nextTime= getNextTime(currentTime);
+            String nextTime = null;
+            if ("智慧场地".equals(site.getTypeName())) {
+                nextTime = getNextTimeOne(currentTime);
+            } else {
+                nextTime = getNextTime(currentTime);
             }
 
 
@@ -245,25 +241,25 @@
 //            if (hasExceeded){
 //                orderDto.setSelectable(0);
 //            }
-            if (strings.contains(timeRange)){
+            if (strings.contains(timeRange)) {
 
                 orderDto.setSelectable(0);
-            }else {
+            } else {
 
-                String stime = day+" "+currentTime;
-                String etime = day+" "+nextTime;
+                String stime = day + " " + currentTime;
+                String etime = day + " " + nextTime;
                 orderDto.setSelectable(1);
                 // 查出lock
                 List<SiteLock> list = siteLockService.list(new LambdaQueryWrapper<SiteLock>().eq(SiteLock::getSiteId, id));
                 for (SiteLock siteLock : list) {
                     boolean stringDateBetween = DateComparisonExample.isStringDateBetween(stime + " - " + etime, siteLock.getStartTime(), siteLock.getEndTime());
-                    if(stringDateBetween){
+                    if (stringDateBetween) {
                         orderDto.setSelectable(0);
                     }
-                    if (DateComparisonExample.isStringWithinTimeRange(stime, siteLock.getStartTime(), siteLock.getEndTime())){
+                    if (DateComparisonExample.isStringWithinTimeRange(stime, siteLock.getStartTime(), siteLock.getEndTime())) {
                         orderDto.setSelectable(0);
                     }
-                    if (DateComparisonExample.isStringWithinTimeRange(etime, siteLock.getStartTime(), siteLock.getEndTime())){
+                    if (DateComparisonExample.isStringWithinTimeRange(etime, siteLock.getStartTime(), siteLock.getEndTime())) {
                         orderDto.setSelectable(0);
                     }
 
@@ -276,16 +272,12 @@
             timeRanges.add(orderDto);
             currentTime = nextTime;
         }
-        System.out.println("-------------"+timeRanges);
+        System.out.println("-------------" + timeRanges);
 
         return timeRanges;
 
 
-
     }
-
-
-
 
 
     public static String getNextTime(String currentTime) {
@@ -303,6 +295,7 @@
         return String.format("%02d:%02d", hour, minute);
 
     }
+
     public static String getNextTimeOne(String currentTime) {
 
         String[] parts = currentTime.split(":");
@@ -312,11 +305,11 @@
         if (minute == 45) {
             hour++;
             minute = 0;
-        } else if (minute == 0){
+        } else if (minute == 0) {
             minute = 15;
-        }else if (minute == 15){
+        } else if (minute == 15) {
             minute = 30;
-        }else if (minute == 30){
+        } else if (minute == 30) {
             minute = 45;
         }
 
@@ -327,6 +320,7 @@
 
     /**
      * 预约场地
+     *
      * @param reservationSite
      * @return
      * @throws Exception
@@ -340,9 +334,9 @@
         for (String s : split) {
             String day = s.split(" ")[0];
             String time = s.split(" ")[1];
-            List<QuerySiteTimes> querySiteTimes = querySiteTimes(reservationSite.getId(), day,reservationSite.getHalfName(),reservationSite.getNextName());
+            List<QuerySiteTimes> querySiteTimes = querySiteTimes(reservationSite.getId(), day, reservationSite.getHalfName(), reservationSite.getNextName());
             for (QuerySiteTimes querySiteTime : querySiteTimes) {
-                if(querySiteTime.getTime().equals(time) && querySiteTime.getSelectable() == 0){
+                if (querySiteTime.getTime().equals(time) && querySiteTime.getSelectable() == 0) {
                     return ResultUtil.error("【" + s + "】" +
                             "时间段已被使用");
                 }
@@ -351,26 +345,26 @@
 
         String s_time = split[0];
         String e_time = split[split.length - 1];
-        s_time = s_time.substring(0,s_time.lastIndexOf("-"));
+        s_time = s_time.substring(0, s_time.lastIndexOf("-"));
         String[] s1 = e_time.split(" ");
         e_time = s1[0] + " " + s1[1].split("-")[1];
         SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
         Double payMoney = 0D;
-        if(reservationSite.getPayType() == 3){
-            if(reservationSite.getIsHalf()==2){
-                payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() ;
-            }else {
+        if (reservationSite.getPayType() == 3) {
+            if (reservationSite.getIsHalf() == 2) {
+                payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
+            } else {
                 payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
-            if(appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0){
+            if (appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0) {
 
-                return new ResultUtil(3,"玩湃币不足");
+                return new ResultUtil(3, "玩湃币不足");
             }
-        }else{
-            if(reservationSite.getIsHalf()==2){
-            payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue() ;
-            }else {
+        } else {
+            if (reservationSite.getIsHalf() == 2) {
+                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();
 
             }
@@ -378,42 +372,42 @@
 
         //校验优惠券
         Long couponId = reservationSite.getCouponId();
-        if (couponId!=null && couponId != 0){
+        if (couponId != null && couponId != 0) {
 
-        if(null != couponId && reservationSite.getPayType() != 3){
-            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(reservationSite.getCouponId(),uid));
+            if (null != couponId && reservationSite.getPayType() != 3) {
+                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(reservationSite.getCouponId(), uid));
 
 
-            if(userCoupon!=null && userCoupon.getStatus() == 2){
-                return ResultUtil.error("优惠券已被核销");
-            }
-            Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
-            long time = coupon.getEndTime().getTime();
-            if(System.currentTimeMillis() >= time){
-                return ResultUtil.error("优惠券已过期");
-            }
-            if(userCoupon!=null && coupon.getType() == 1){//满减
+                if (userCoupon != null && userCoupon.getStatus() == 2) {
+                    return ResultUtil.error("优惠券已被核销");
+                }
+                Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
+                long time = coupon.getEndTime().getTime();
+                if (System.currentTimeMillis() >= time) {
+                    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");
-                if(payMoney.compareTo(num1) < 0){
-                    return ResultUtil.error("该优惠券无法使用");
-                }
+                    JSONObject jsonObject = JSON.parseObject(coupon.getContent());
+                    Double num1 = jsonObject.getDouble("conditionalAmount");
+                    Double num2 = jsonObject.getDouble("deductionAmount");
+                    if (payMoney.compareTo(num1) < 0) {
+                        return ResultUtil.error("该优惠券无法使用");
+                    }
 
-                payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-            }
-            if(userCoupon!=null && coupon.getType() == 2){//代金券
-                JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("conditionalAmount");
-                if(payMoney.compareTo(num1) <= 0){
-                    return ResultUtil.error("该优惠券无法使用");
+                    payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                 }
-                payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
+                if (userCoupon != null && coupon.getType() == 2) {//代金券
+                    JSONObject jsonObject = JSON.parseObject(coupon.getContent());
+                    Double num1 = jsonObject.getDouble("conditionalAmount");
+                    if (payMoney.compareTo(num1) <= 0) {
+                        return ResultUtil.error("该优惠券无法使用");
+                    }
+                    payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
+                }
+                userCoupon.setStatus(2);
+                userCouponClient.updateUserCoupon(userCoupon);
             }
-            userCoupon.setStatus(2);
-            userCouponClient.updateUserCoupon(userCoupon);
-        }
         }
 
 
@@ -445,20 +439,18 @@
         siteBookingService.save(siteBooking);
 
 
-
-
-        if(reservationSite.getPayType() == 1){//微信支付
+        if (reservationSite.getPayType() == 1) {//微信支付
             ResultUtil resultUtil = weChatPaymentSite(payMoney, siteBooking);
 
             return resultUtil;
         }
-        if(reservationSite.getPayType() == 2){//支付宝支付
+        if (reservationSite.getPayType() == 2) {//支付宝支付
             return aliPaymentSite(payMoney, siteBooking);
         }
-        if(reservationSite.getPayType() == 3){//玩湃币支付
-            if(reservationSite.getIsHalf()==2){
+        if (reservationSite.getPayType() == 3) {//玩湃币支付
+            if (reservationSite.getIsHalf() == 2) {
                 return playPaiCoinPaymentSite(appUser, Double.valueOf(site.getPlayPaiCoin()), siteBooking);
-            }else {
+            } else {
                 return playPaiCoinPaymentSite(appUser, site.getPlayPaiCoinOne(), siteBooking);
             }
         }
@@ -468,31 +460,32 @@
 
     /**
      * 课程微信支付
+     *
      * @param paymentPrice
      * @return
      * @throws Exception
      */
-    public ResultUtil weChatPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception{
+    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", "");
-        if(weixinpay.getCode() == 200){
+        if (weixinpay.getCode() == 200) {
             new Thread(new Runnable() {
                 @Override
                 public void run() {
                     try {
                         int num = 1;
                         int wait = 0;
-                        while (num <= 10){
+                        while (num <= 10) {
                             int min = 5000;
                             wait += (min * num);
                             Thread.sleep(wait);
                             SiteBooking siteBooking = siteBookingService.getById(id);
-                            if(siteBooking.getStatus() != 0){
+                            if (siteBooking.getStatus() != 0) {
                                 break;
                             }
                             ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(siteBooking.getOrderNo(), "");
-                            if(resultUtil.getCode() == 200 && siteBooking.getStatus() == 0){
+                            if (resultUtil.getCode() == 200 && siteBooking.getStatus() == 0) {
                                 /**
                                  * SUCCESS—支付成功,
                                  * REFUND—转入退款,
@@ -505,22 +498,22 @@
                                 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) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
                                     break;
                                 }
-                                if("SUCCESS".equals(s)){
+                                if ("SUCCESS".equals(s)) {
                                     siteBooking.setPayTime(new Date());
                                     siteBooking.setStatus(1);
                                     siteBooking.setPayOrderNo(transaction_id);
                                     siteBookingService.updateById(siteBooking);
                                     break;
                                 }
-                                if("USERPAYING".equals(s)){
+                                if ("USERPAYING".equals(s)) {
                                     num++;
                                 }
                             }
                         }
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }
@@ -530,35 +523,35 @@
     }
 
 
-
     /**
      * 课程支付宝支付
+     *
      * @param paymentPrice
      * @return
      * @throws Exception
      */
-    public ResultUtil aliPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception{
+    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");
-        System.out.println("预约场地----"+alipay.getCode());
-        if(alipay.getCode() == 200){
+        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){
+                        while (num <= 10) {
                             int min = 5000;
                             wait += (min * num);
                             Thread.sleep(wait);
                             SiteBooking siteBooking = siteBookingService.getById(id);
-                            if(siteBooking.getStatus() != 0){
+                            if (siteBooking.getStatus() != 0) {
                                 break;
                             }
                             AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
-                            if(resultUtil.getCode().equals("10000") && siteBooking.getStatus() == 0){
+                            if (resultUtil.getCode().equals("10000") && siteBooking.getStatus() == 0) {
                                 /**
                                  * WAIT_BUYER_PAY(交易创建,等待买家付款)、
                                  * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
@@ -569,11 +562,11 @@
 //                                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){
+                                System.out.println("ssssss" + s);
+                                if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) {
                                     break;
                                 }
-                                if("TRADE_SUCCESS".equals(s)){
+                                if ("TRADE_SUCCESS".equals(s)) {
                                     siteBooking.setPayTime(new Date());
                                     siteBooking.setStatus(1);
                                     siteBooking.setPayOrderNo(tradeNo);
@@ -581,12 +574,12 @@
                                     System.err.println("======完成支付");
                                     break;
                                 }
-                                if("WAIT_BUYER_PAY".equals(s)){
+                                if ("WAIT_BUYER_PAY".equals(s)) {
                                     num++;
                                 }
                             }
                         }
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }
@@ -598,12 +591,13 @@
 
     /**
      * 玩湃币支付
+     *
      * @param appUser
      * @param paymentPrice
      * @return
      * @throws Exception
      */
-    public ResultUtil playPaiCoinPaymentSite(AppUser appUser, Double paymentPrice, SiteBooking siteBooking) throws Exception{
+    public ResultUtil playPaiCoinPaymentSite(AppUser appUser, Double paymentPrice, SiteBooking siteBooking) throws Exception {
         Integer playPaiCoins = appUser.getPlayPaiCoins();
         appUser.setPlayPaiCoins(playPaiCoins - paymentPrice.intValue());
         appUserClient.updateAppUser(appUser);
@@ -611,13 +605,14 @@
         siteBooking.setStatus(1);
         siteBookingService.updateById(siteBooking);
         HashMap<String, String> map = new HashMap<>();
-        map.put("siteBooking",siteBooking.getId().toString());
+        map.put("siteBooking", siteBooking.getId().toString());
         return ResultUtil.success(map);
     }
 
 
     /**
      * 获取我的场地预约
+     *
      * @param uid
      * @param status
      * @param pageNo
@@ -633,11 +628,13 @@
             SiteBooking siteBooking = siteBookingService.getById(queryMySiteVo.getId());
             Site site = this.getById(siteBooking.getSiteId());
             String[] split = siteBooking.getTimes().split(";");
-            if(site!=null){
-                if (queryMySiteVo.getIsHalf()==1) {
-                    queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length);
-                }else {
+            if (site != null) {
+                if (queryMySiteVo.getIsHalf() == 1) {
                     queryMySiteVo.setPlayPaiCoin((int) (site.getPlayPaiCoinOne() * split.length));
+
+                } else {
+                    queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length);
+
                 }
             }
         }
@@ -647,6 +644,7 @@
 
     /**
      * 取消我的预约场地
+     *
      * @param id
      * @return
      * @throws Exception
@@ -657,34 +655,34 @@
 
         SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
         Date startTime = siteBooking.getStartTime();
-        if(format.format(new Date()).equals(format.format(startTime))&&siteBooking.getStatus() != 0){
+        if (format.format(new Date()).equals(format.format(startTime)) && siteBooking.getStatus() != 0) {
             return ResultUtil.error("预约当天,不能取消");
         }
 
-        if(siteBooking.getStatus() == 0){
+        if (siteBooking.getStatus() == 0) {
 //            return ResultUtil.error("请先进行支付");
             siteBooking.setStatus(5);
             siteBookingService.updateById(siteBooking);
             AppUser appUser = appUserClient.queryAppUser(siteBooking.getAppUserId());
 
-            if(null != siteBooking.getUserCouponId()&&siteBooking.getUserCouponId()!=0){
-                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),appUser.getId()));
+            if (null != siteBooking.getUserCouponId() && siteBooking.getUserCouponId() != 0) {
+                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
                 userCoupon.setStatus(1);
                 userCouponClient.updateUserCoupon(userCoupon);
             }
 
             return ResultUtil.success();
         }
-        if(siteBooking.getStatus() != 1 && siteBooking.getStatus() != 2){
+        if (siteBooking.getStatus() != 1 && siteBooking.getStatus() != 2) {
             return ResultUtil.error("不能进行取消操作");
         }
-        if(siteBooking.getPayType() == 1){//微信支付
+        if (siteBooking.getPayType() == 1) {//微信支付
             Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(), siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback");
-            if(null == map){
+            if (null == map) {
                 return ResultUtil.error("取消退款异常");
             }
             String result_code = map.get("result_code");
-            if(!"SUCCESS".equals(result_code)){
+            if (!"SUCCESS".equals(result_code)) {
                 return ResultUtil.error(map.get("return_msg"));
             }
             siteBooking.setCancelUserId(uid);
@@ -697,13 +695,13 @@
             backRecordService.save(tBackRecord);
 
         }
-        if(siteBooking.getPayType() == 2){//支付宝
+        if (siteBooking.getPayType() == 2) {//支付宝
             Map<String, String> map = payMoneyUtil.aliRefund(siteBooking.getPayOrderNo(), siteBooking.getPayMoney().toString());
-            if(null == map){
+            if (null == map) {
                 return ResultUtil.error("取消退款异常");
             }
             String code = map.get("code");
-            if(!"10000".equals(code)){
+            if (!"10000".equals(code)) {
                 return ResultUtil.error(map.get("return_msg"));
             }
             String trade_no = map.get("trade_no");
@@ -712,8 +710,8 @@
             siteBooking.setCancelTime(new Date());
             siteBooking.setRefundOrderNo(trade_no);
             siteBookingService.updateById(siteBooking);
-            if(null != siteBooking.getUserCouponId()&&siteBooking.getUserCouponId()!=0){
-                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),siteBooking.getAppUserId()));
+            if (null != siteBooking.getUserCouponId() && siteBooking.getUserCouponId() != 0) {
+                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), siteBooking.getAppUserId()));
                 userCoupon.setStatus(1);
                 userCouponClient.updateUserCoupon(userCoupon);
             }
@@ -726,7 +724,7 @@
             backRecordService.save(tBackRecord);
         }
 
-        if(siteBooking.getPayType() == 3){//玩湃币
+        if (siteBooking.getPayType() == 3) {//玩湃币
             AppUser appUser = appUserClient.queryAppUser(siteBooking.getAppUserId());
             appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + siteBooking.getPayMoney().intValue());
             appUserClient.updateAppUser(appUser);
@@ -735,8 +733,8 @@
             siteBooking.setCancelUserId(uid);
             siteBooking.setCancelTime(new Date());
             siteBookingService.updateById(siteBooking);
-            if(null != siteBooking.getUserCouponId()&&siteBooking.getUserCouponId()!=0){
-                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),appUser.getId()));
+            if (null != siteBooking.getUserCouponId() && siteBooking.getUserCouponId() != 0) {
+                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
                 userCoupon.setStatus(1);
                 userCouponClient.updateUserCoupon(userCoupon);
             }
@@ -748,6 +746,7 @@
 
     /**
      * 继续支付我预约的场地
+     *
      * @param id
      * @param payType
      * @return
@@ -756,45 +755,45 @@
     @Override
     public ResultUtil continuePaymentMySite(Integer uid, Integer id, Integer payType) throws Exception {
         SiteBooking siteBooking = siteBookingService.getById(id);
-        if(siteBooking.getStatus() != 0){
+        if (siteBooking.getStatus() != 0) {
             return ResultUtil.error("不能继续支付");
         }
         Site site = this.getById(siteBooking.getSiteId());
         AppUser appUser = appUserClient.queryAppUser(uid);
         String[] split = siteBooking.getTimes().split(";");
         Double payMoney = 0D;
-        if(payType == 3){
+        if (payType == 3) {
 //            payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-            if(appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0){
+            if (appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0) {
                 return ResultUtil.error("玩湃币不足");
             }
 
-            if(siteBooking.getIsHalf()==2){
+            if (siteBooking.getIsHalf() == 2) {
                 payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-            }else {
+            } else {
                 payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
-        }else{
-            if(siteBooking.getIsHalf()==2){
+        } else {
+            if (siteBooking.getIsHalf() == 2) {
                 payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-            }else {
+            } else {
                 payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
         }
 
         //校验优惠券
         Long couponId = siteBooking.getUserCouponId();
-        if(null != couponId && payType != 3){
-            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),appUser.getId()));
+        if (null != couponId && payType != 3) {
+            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
             Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
-            if(coupon.getType() == 1){//满减
+            if (coupon.getType() == 1) {//满减
 //                {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
                 Double num1 = jsonObject.getDouble("conditionalAmount");
                 Double num2 = jsonObject.getDouble("deductionAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
-            if(coupon.getType() == 2){//代金券
+            if (coupon.getType() == 2) {//代金券
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
                 Double num1 = jsonObject.getDouble("conditionalAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
@@ -802,8 +801,8 @@
             userCoupon.setStatus(2);
             userCouponClient.updateUserCoupon(userCoupon);
         }
-        if(null != couponId && payType == 3){
-            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),appUser.getId()));
+        if (null != couponId && payType == 3) {
+            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
             userCoupon.setStatus(1);
             userCouponClient.updateUserCoupon(userCoupon);
         }
@@ -812,17 +811,17 @@
         siteBooking.setOrderNo(sdf.format(new Date()) + UUIDUtil.getNumberRandom(3));
         siteBooking.setPayType(payType);
         siteBooking.setPayMoney(payMoney);
-        if(payType == 3){
+        if (payType == 3) {
             siteBooking.setUserCouponId(null);
         }
         siteBookingService.updateById(siteBooking);
-        if(payType == 1){//微信支付
+        if (payType == 1) {//微信支付
             return weChatPaymentSite(payMoney, siteBooking);
         }
-        if(payType == 2){//支付宝支付
+        if (payType == 2) {//支付宝支付
             return aliPaymentSite(payMoney, siteBooking);
         }
-        if(payType == 3){//玩湃币支付
+        if (payType == 3) {//玩湃币支付
             return playPaiCoinPaymentSite(appUser, payMoney, siteBooking);
         }
         return ResultUtil.success();
@@ -831,6 +830,7 @@
 
     /**
      * 获取继续支付金额
+     *
      * @param id
      * @return
      * @throws Exception
@@ -838,7 +838,7 @@
     @Override
     public ResultUtil<Map<String, Double>> queryContinuePaymentMySitePrice(Integer id) throws Exception {
         SiteBooking siteBooking = siteBookingService.getById(id);
-        if(siteBooking.getStatus() != 0){
+        if (siteBooking.getStatus() != 0) {
             return ResultUtil.error("不能继续支付");
         }
         Site site = this.getById(siteBooking.getSiteId());
@@ -847,34 +847,34 @@
         Double payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
 
 
-        if(siteBooking.getIsHalf()==2){
+        if (siteBooking.getIsHalf() == 2) {
             payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-        }else {
+        } else {
             payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
         }
 
         map.put("playPaiCoin", payMoney);
         payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
 
-        if(siteBooking.getIsHalf()==2){
+        if (siteBooking.getIsHalf() == 2) {
             payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
-        }else {
+        } else {
             payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
         }
 
         //校验优惠券
         Long couponId = siteBooking.getUserCouponId();
-        if(null != couponId&&couponId!=0){
-            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),siteBooking.getAppUserId()));
+        if (null != couponId && couponId != 0) {
+            UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), siteBooking.getAppUserId()));
             Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
-            if(coupon.getType() == 1){//满减
+            if (coupon.getType() == 1) {//满减
 //                {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
                 Double num1 = jsonObject.getDouble("conditionalAmount");
                 Double num2 = jsonObject.getDouble("deductionAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
-            if(coupon.getType() == 2){//代金券
+            if (coupon.getType() == 2) {//代金券
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
                 Double num1 = jsonObject.getDouble("conditionalAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
@@ -889,7 +889,7 @@
 
         List<Integer> siteIds = vo.getSiteIds();
         Integer type = vo.getType();
-        return siteMapper.changeState(siteIds,type);
+        return siteMapper.changeState(siteIds, type);
 
     }
 }

--
Gitblit v1.7.1