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 | 74 +++++++++++++++++++++++++------------ 1 files changed, 50 insertions(+), 24 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..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; + /** * 获取场地预约日期数据 @@ -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(";"); @@ -360,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 { @@ -368,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("优惠券已被核销"); } @@ -389,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"); @@ -434,7 +428,6 @@ siteBooking.setState(1); siteBooking.setInsertTime(new Date()); - // 2.0 siteBooking.setNextName(reservationSite.getNextName()); siteBooking.setIsHalf(reservationSite.getIsHalf()); siteBooking.setHalfName(reservationSite.getHalfName()); @@ -443,7 +436,6 @@ if (reservationSite.getPayType() == 1) {//微信支付 ResultUtil resultUtil = weChatPaymentSite(payMoney, siteBooking); - return resultUtil; } if (reservationSite.getPayType() == 2) {//支付宝支付 @@ -470,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 @@ -500,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)) { @@ -510,7 +503,7 @@ siteBookingService.updateById(siteBooking); break; } - if ("USERPAYING".equals(s)) { + if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) { num++; } } @@ -524,7 +517,7 @@ return weixinpay; } - + private String smid = "2088330203191220";//平台支付宝商户号 /** * 课程支付宝支付 * @@ -535,7 +528,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 +581,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)) { @@ -662,7 +683,6 @@ } if (siteBooking.getStatus() == 0) { -// return ResultUtil.error("请先进行支付"); siteBooking.setStatus(5); siteBookingService.updateById(siteBooking); AppUser appUser = appUserClient.queryAppUser(siteBooking.getAppUserId()); @@ -679,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); @@ -894,4 +915,9 @@ return siteMapper.changeState(siteIds, type); } + + @Override + public String getSMIDByOperatorId(Integer id) { + return siteMapper.getSMIDByOperatorId(id); + } } -- Gitblit v1.7.1