From 1b81b84edaeea9b200c622e4a34c49b4b1aaac92 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 06 三月 2025 15:28:19 +0800 Subject: [PATCH] 修改bug和漏洞修复 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 53 ++++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 20 ++ ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java | 364 ++++++++++++++++++++++---------------------- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 2 5 files changed, 240 insertions(+), 201 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index f102abb..f269681 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -2266,4 +2266,6 @@ return chargingOrderService.getNotPaymentChargingOrder(); } + + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index e50aeb3..9910897 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -648,21 +648,19 @@ long times = rechargeAmount1.divide(s_total_amount, 0, RoundingMode.DOWN).longValue(); if(times > m){ //充电时间跨度两个计费策略,需要继续对下一个策略进行计算 - serviceCharge = s_server_amount.multiply(new BigDecimal(m)); + serviceCharge = serviceCharge.add(s_server_amount.multiply(new BigDecimal(m))); rechargeAmount1 = rechargeAmount1.subtract(s_total_amount.multiply(new BigDecimal(m))); - if(null != discount){ - discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); - } nowTimeMillis = null; }else{ - serviceCharge = s_server_amount.multiply(new BigDecimal(times)); - if(null != discount){ - discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); - } + serviceCharge = serviceCharge.add(s_server_amount.multiply(new BigDecimal(times))); break; } } } + if(null != discount){ + discountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(discount)); + } + if(discountAmount.compareTo(BigDecimal.ZERO) >= 0){ //计算会员最大优惠金额 TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); @@ -673,9 +671,12 @@ } } discountAmount = discountAmount.setScale(4, RoundingMode.HALF_EVEN); + if(discountAmount.compareTo(BigDecimal.ZERO) >= 0){ + data.setChargeNum(data.getChargeNum() - 1); + appUserVipDetailClient.updateAppUserVipDetail(data); + } } } - //机子上显示的金额为用户充值的金额+会员折扣金额 BigDecimal account_balance = chargingOrder.getRechargeAmount().add(discountAmount).setScale(4, RoundingMode.HALF_EVEN); @@ -924,6 +925,18 @@ BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100)); chargingOrderRefund.setRefundFee(refund_fee); chargingOrderRefundService.updateById(chargingOrderRefund); + //回退会员折扣次数 + if(chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO) > 0){ + TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); + getAppUserVipDetail.setVipId(appUser.getVipId()); + TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); + if(null != data){ + data.setChargeNum(data.getChargeNum() + 1); + appUserVipDetailClient.updateAppUserVipDetail(data); + } + } } } if(2 == rechargePaymentType){ @@ -935,6 +948,19 @@ RefundResp resp = aliPaymentClient.refund(dto).getData(); if(null != resp){ chargingOrderRefundService.save(chargingOrderRefund); + //回退会员折扣次数 + if(chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO) > 0){ + TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); + getAppUserVipDetail.setVipId(appUser.getVipId()); + TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); + if(null != data){ + data.setChargeNum(data.getChargeNum() + 1); + appUserVipDetailClient.updateAppUserVipDetail(data); + } + } + try { Thread.sleep(1000); } catch (InterruptedException e) { @@ -2075,10 +2101,10 @@ if(null == chargingOrder){ return R.ok(); } -// Integer status = chargingOrder.getStatus(); -// if(status == 5){ -// return R.ok(); -// } + Integer status = chargingOrder.getStatus(); + if(status == 5){ + return R.ok(); + } //如果使用优惠券需要判断优惠券是否满足使用条件 //根据实际的充电金额计算退款金额 退回费用=(原金额/总金额)*(总金额-实际充电金额) @@ -3728,7 +3754,6 @@ chargingOrder.setStatus(2); chargingOrder.setPayTime(LocalDateTime.now()); chargingOrder.setChargeAmount(chargingOrder.getRechargeAmount()); - chargingOrder.setVipDiscountAmount(BigDecimal.ZERO); this.save(chargingOrder); Integer accountingStrategyId = tChargingGun.getAccountingStrategyId(); diff --git a/ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java b/ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java index cd8aa3b..e7c089c 100644 --- a/ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java +++ b/ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java @@ -1,182 +1,182 @@ -//package com.ruoyi.order; -// -//import com.alibaba.fastjson2.JSON; -//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -//import com.ruoyi.account.api.feignClient.*; -//import com.ruoyi.account.api.model.TAppUserCar; -//import com.ruoyi.chargingPile.api.feignClient.*; -//import com.ruoyi.chargingPile.api.model.Site; -//import com.ruoyi.chargingPile.api.model.TChargingGun; -//import com.ruoyi.chargingPile.api.model.TChargingPile; -//import com.ruoyi.common.core.web.domain.AjaxResult; -//import com.ruoyi.common.redis.service.RedisService; -//import com.ruoyi.common.security.service.TokenService; -//import com.ruoyi.integration.api.feignClient.*; -//import com.ruoyi.integration.api.model.ChargingHandshake; -//import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; -//import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient; -//import com.ruoyi.order.api.model.TChargingOrder; -//import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; -//import com.ruoyi.order.api.vo.AccountingStrategyDetailOrderVo; -//import com.ruoyi.order.api.vo.ChargingOrderInfoVO; -//import com.ruoyi.order.api.vo.TransactionRecordMessageVO; -//import com.ruoyi.order.dto.ChargingDetails; -//import com.ruoyi.order.dto.MyChargingOrderInfo; -//import com.ruoyi.order.mapper.TSettlementConfirmMapper; -//import com.ruoyi.order.service.*; -//import com.ruoyi.order.vo.EndOfChargePageInfo; -//import com.ruoyi.other.api.feignClient.IntegralRuleClient; -//import com.ruoyi.other.api.feignClient.UserTagClient; -//import com.ruoyi.other.api.feignClient.VipClient; -//import com.ruoyi.payment.api.feignClient.AliPaymentClient; -//import com.ruoyi.payment.api.feignClient.WxPaymentClient; -//import org.junit.jupiter.api.Test; -//import org.springframework.boot.test.context.SpringBootTest; -// -//import javax.annotation.Resource; -//import java.io.PrintWriter; -//import java.math.BigDecimal; -//import java.util.*; -// -//@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiOrderApplication.class) -//public class RuoYiOrderApplicationTests { -// -// @Resource -// private TChargingOrderService chargingOrderService; -// -// @Resource -// private ChargingGunClient chargingGunClient; -// @Resource -// private TSettlementConfirmMapper tSettlementConfirmMapper; -// -// @Resource -// private SiteClient siteClient; -// -// @Resource -// private AppUserCarClient appUserCarClient; -// @Resource -// private AppUserClient appUserClient; -// -// @Resource -// private ChargingPileClient chargingPileClient; -// -// @Resource -// private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; -// -// @Resource -// private TokenService tokenService; -// -// @Resource -// private WxPaymentClient wxPaymentClient; -// -// @Resource -// private AliPaymentClient aliPaymentClient; -// -// @Resource -// private AppCouponClient appCouponClient; -// -// @Resource -// private AppUserVipDetailClient appUserVipDetailClient; -// -// @Resource -// private RedisService redisService; -// -// @Resource -// private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; -// -// @Resource -// private ChargingHandshakeClient chargingHandshakeClient; -// -// @Resource -// private SendMessageClient sendMessageClient; -// -// @Resource -// private TOrderEvaluateService orderEvaluateService; -// -// @Resource -// private AccountingStrategyDetailClient accountingStrategyDetailClient; -// -// @Resource -// private AccountingStrategyDetailOrderClient accountingStrategyDetailOrderClient; -// -// @Resource -// private AccountingStrategyClient accountingStrategyClient; -// -// @Resource -// private PlatformStartChargingReplyClient platformStartChargingReplyClient; -// -// @Resource -// private TChargingOrderRefundService chargingOrderRefundService; -// -// @Resource -// private PlatformStopChargingReplyClient platformStopChargingReplyClient; -// -// @Resource -// private AccountingStrategyOrderService accountingStrategyOrderService; -// -// @Resource -// private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; -// -// @Resource -// private InviteUserClient inviteUserClient; -// -// @Resource -// private AppUserIntegralChangeClient appUserIntegralChangeClient; -// -// @Resource -// private IntegralRuleClient integralRuleClient; -// -// @Resource -// private VipClient vipClient; -// -// @Resource -// private UserTagClient userTagClient; -// -// @Resource -// private AppUserTagClient appUserTagClient; -// -// @Resource -// private SecurityDetectionClient securityDetectionClient; -// -// -// @Test -// public void test(){ -// TransactionRecordMessageVO vo = JSON.parseObject("{\n" + -// "\t\"charging_gun_code\": \"01\",\n" + -// "\t\"charging_pile_code\": \"2024123100001005\",\n" + -// "\t\"end_time\": \"2025-03-04 00:00:43.00\",\n" + -// "\t\"flat_amount2\": 0.000000,\n" + -// "\t\"flat_amount4\": 0.000000,\n" + -// "\t\"flat_amount6\": 2.350000,\n" + -// "\t\"flat_charge2\": 0.000000,\n" + -// "\t\"flat_charge4\": 0.000000,\n" + -// "\t\"flat_charge6\": 1.989000,\n" + -// "\t\"loss_peak_charge3\": 0,\n" + -// "\t\"loss_peak_charge5\": 0,\n" + -// "\t\"loss_total_electricity\": 0,\n" + -// "\t\"loss_valley_charge1\": 0,\n" + -// "\t\"loss_valley_charge7\": 0,\n" + -// "\t\"payment_amount\": 27.320000,\n" + -// "\t\"peak_amount3\": 0.000000,\n" + -// "\t\"peak_amount5\": 0.000000,\n" + -// "\t\"peak_charge3\": 0.000000,\n" + -// "\t\"peak_charge5\": 0.000000,\n" + -// "\t\"physical_card_number\": \"1234567812345678\",\n" + -// "\t\"result\": \"{\\\"service_id\\\":\\\"transaction_record\\\",\\\"transaction_serial_number\\\":\\\"CD38820250303225620557\\\",\\\"charging_pile_code\\\":\\\"2024123100001005\\\",\\\"charging_gun_code\\\":\\\"01\\\",\\\"start_time\\\":\\\"2025-03-03 22:56:18.00\\\",\\\"end_time\\\":\\\"2025-03-04 00:00:43.00\\\",\\\"valley_charge1\\\":\\\"0.066000\\\",\\\"loss_valley_charge1\\\":\\\"0\\\",\\\"valley_amount1\\\":\\\"0.040000\\\",\\\"flat_charge2\\\":\\\"0.000000\\\",\\\"loss_flat_charg2\\\":\\\"0\\\",\\\"flat_amount2\\\":\\\"0.000000\\\",\\\"peak_charge3\\\":\\\"0.000000\\\",\\\"loss_peak_charge3\\\":\\\"0\\\",\\\"peak_amount3\\\":\\\"0.000000\\\",\\\"flat_charge4\\\":\\\"0.000000\\\",\\\"loss_flat_charg4\\\":\\\"0\\\",\\\"flat_amount4\\\":\\\"0.000000\\\",\\\"peak_charge5\\\":\\\"0.000000\\\",\\\"loss_peak_charge5\\\":\\\"0\\\",\\\"peak_amount5\\\":\\\"0.000000\\\",\\\"flat_charge6\\\":\\\"1.989000\\\",\\\"loss_flat_charg6\\\":\\\"0\\\",\\\"flat_amount6\\\":\\\"2.350000\\\",\\\"valley_charge7\\\":\\\"33.103000\\\",\\\"loss_valley_charge7\\\":\\\"0\\\",\\\"valley_amount7\\\":\\\"24.910000\\\",\\\"total_electricity\\\":\\\"35.158001\\\",\\\"loss_total_electricity\\\":\\\"0\\\",\\\"payment_amount\\\":\\\"27.320000\\\",\\\"trade_date\\\":\\\"0\\\",\\\"stop_reason\\\":\\\"1\\\",\\\"physical_card_number\\\":\\\"1234567812345678\\\"}\",\n" + -// "\t\"retryTimes\": 0,\n" + -// "\t\"sendTime\": 1741017648977,\n" + -// "\t\"serviceId\": \"transaction_record\",\n" + -// "\t\"source\": \"\",\n" + -// "\t\"start_time\": \"2025-03-03 22:56:18.00\",\n" + -// "\t\"stop_reason\": 1,\n" + -// "\t\"total_electricity\": 35.158001,\n" + -// "\t\"trade_date\": \"0\",\n" + -// "\t\"transaction_serial_number\": \"CD38820250303225620557\",\n" + -// "\t\"valley_amount1\": 0.040000,\n" + -// "\t\"valley_amount7\": 24.910000,\n" + -// "\t\"valley_charge1\": 0.066000,\n" + -// "\t\"valley_charge7\": 33.103000\n" + -// "}", TransactionRecordMessageVO.class); -// chargingOrderService.endChargeBillingCharge(vo); -// } -//} +package com.ruoyi.order; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.account.api.feignClient.*; +import com.ruoyi.account.api.model.TAppUserCar; +import com.ruoyi.chargingPile.api.feignClient.*; +import com.ruoyi.chargingPile.api.model.Site; +import com.ruoyi.chargingPile.api.model.TChargingGun; +import com.ruoyi.chargingPile.api.model.TChargingPile; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.redis.service.RedisService; +import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.integration.api.feignClient.*; +import com.ruoyi.integration.api.model.ChargingHandshake; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; +import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient; +import com.ruoyi.order.api.model.TChargingOrder; +import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; +import com.ruoyi.order.api.vo.AccountingStrategyDetailOrderVo; +import com.ruoyi.order.api.vo.ChargingOrderInfoVO; +import com.ruoyi.order.api.vo.TransactionRecordMessageVO; +import com.ruoyi.order.dto.ChargingDetails; +import com.ruoyi.order.dto.MyChargingOrderInfo; +import com.ruoyi.order.mapper.TSettlementConfirmMapper; +import com.ruoyi.order.service.*; +import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.other.api.feignClient.IntegralRuleClient; +import com.ruoyi.other.api.feignClient.UserTagClient; +import com.ruoyi.other.api.feignClient.VipClient; +import com.ruoyi.payment.api.feignClient.AliPaymentClient; +import com.ruoyi.payment.api.feignClient.WxPaymentClient; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import javax.annotation.Resource; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.*; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiOrderApplication.class) +public class RuoYiOrderApplicationTests { + + @Resource + private TChargingOrderService chargingOrderService; + + @Resource + private ChargingGunClient chargingGunClient; + @Resource + private TSettlementConfirmMapper tSettlementConfirmMapper; + + @Resource + private SiteClient siteClient; + + @Resource + private AppUserCarClient appUserCarClient; + @Resource + private AppUserClient appUserClient; + + @Resource + private ChargingPileClient chargingPileClient; + + @Resource + private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; + + @Resource + private TokenService tokenService; + + @Resource + private WxPaymentClient wxPaymentClient; + + @Resource + private AliPaymentClient aliPaymentClient; + + @Resource + private AppCouponClient appCouponClient; + + @Resource + private AppUserVipDetailClient appUserVipDetailClient; + + @Resource + private RedisService redisService; + + @Resource + private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; + + @Resource + private ChargingHandshakeClient chargingHandshakeClient; + + @Resource + private SendMessageClient sendMessageClient; + + @Resource + private TOrderEvaluateService orderEvaluateService; + + @Resource + private AccountingStrategyDetailClient accountingStrategyDetailClient; + + @Resource + private AccountingStrategyDetailOrderClient accountingStrategyDetailOrderClient; + + @Resource + private AccountingStrategyClient accountingStrategyClient; + + @Resource + private PlatformStartChargingReplyClient platformStartChargingReplyClient; + + @Resource + private TChargingOrderRefundService chargingOrderRefundService; + + @Resource + private PlatformStopChargingReplyClient platformStopChargingReplyClient; + + @Resource + private AccountingStrategyOrderService accountingStrategyOrderService; + + @Resource + private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService; + + @Resource + private InviteUserClient inviteUserClient; + + @Resource + private AppUserIntegralChangeClient appUserIntegralChangeClient; + + @Resource + private IntegralRuleClient integralRuleClient; + + @Resource + private VipClient vipClient; + + @Resource + private UserTagClient userTagClient; + + @Resource + private AppUserTagClient appUserTagClient; + + @Resource + private SecurityDetectionClient securityDetectionClient; + + + @Test + public void test(){ + TransactionRecordMessageVO vo = JSON.parseObject("{\n" + + "\t\"charging_gun_code\": \"01\",\n" + + "\t\"charging_pile_code\": \"2024123100001005\",\n" + + "\t\"end_time\": \"2025-03-04 00:00:43.00\",\n" + + "\t\"flat_amount2\": 0.000000,\n" + + "\t\"flat_amount4\": 0.000000,\n" + + "\t\"flat_amount6\": 2.350000,\n" + + "\t\"flat_charge2\": 0.000000,\n" + + "\t\"flat_charge4\": 0.000000,\n" + + "\t\"flat_charge6\": 1.989000,\n" + + "\t\"loss_peak_charge3\": 0,\n" + + "\t\"loss_peak_charge5\": 0,\n" + + "\t\"loss_total_electricity\": 0,\n" + + "\t\"loss_valley_charge1\": 0,\n" + + "\t\"loss_valley_charge7\": 0,\n" + + "\t\"payment_amount\": 27.320000,\n" + + "\t\"peak_amount3\": 0.000000,\n" + + "\t\"peak_amount5\": 0.000000,\n" + + "\t\"peak_charge3\": 0.000000,\n" + + "\t\"peak_charge5\": 0.000000,\n" + + "\t\"physical_card_number\": \"1234567812345678\",\n" + + "\t\"result\": \"{\\\"service_id\\\":\\\"transaction_record\\\",\\\"transaction_serial_number\\\":\\\"CD38820250303225620557\\\",\\\"charging_pile_code\\\":\\\"2024123100001005\\\",\\\"charging_gun_code\\\":\\\"01\\\",\\\"start_time\\\":\\\"2025-03-03 22:56:18.00\\\",\\\"end_time\\\":\\\"2025-03-04 00:00:43.00\\\",\\\"valley_charge1\\\":\\\"0.066000\\\",\\\"loss_valley_charge1\\\":\\\"0\\\",\\\"valley_amount1\\\":\\\"0.040000\\\",\\\"flat_charge2\\\":\\\"0.000000\\\",\\\"loss_flat_charg2\\\":\\\"0\\\",\\\"flat_amount2\\\":\\\"0.000000\\\",\\\"peak_charge3\\\":\\\"0.000000\\\",\\\"loss_peak_charge3\\\":\\\"0\\\",\\\"peak_amount3\\\":\\\"0.000000\\\",\\\"flat_charge4\\\":\\\"0.000000\\\",\\\"loss_flat_charg4\\\":\\\"0\\\",\\\"flat_amount4\\\":\\\"0.000000\\\",\\\"peak_charge5\\\":\\\"0.000000\\\",\\\"loss_peak_charge5\\\":\\\"0\\\",\\\"peak_amount5\\\":\\\"0.000000\\\",\\\"flat_charge6\\\":\\\"1.989000\\\",\\\"loss_flat_charg6\\\":\\\"0\\\",\\\"flat_amount6\\\":\\\"2.350000\\\",\\\"valley_charge7\\\":\\\"33.103000\\\",\\\"loss_valley_charge7\\\":\\\"0\\\",\\\"valley_amount7\\\":\\\"24.910000\\\",\\\"total_electricity\\\":\\\"35.158001\\\",\\\"loss_total_electricity\\\":\\\"0\\\",\\\"payment_amount\\\":\\\"27.320000\\\",\\\"trade_date\\\":\\\"0\\\",\\\"stop_reason\\\":\\\"1\\\",\\\"physical_card_number\\\":\\\"1234567812345678\\\"}\",\n" + + "\t\"retryTimes\": 0,\n" + + "\t\"sendTime\": 1741017648977,\n" + + "\t\"serviceId\": \"transaction_record\",\n" + + "\t\"source\": \"\",\n" + + "\t\"start_time\": \"2025-03-03 22:56:18.00\",\n" + + "\t\"stop_reason\": 1,\n" + + "\t\"total_electricity\": 35.158001,\n" + + "\t\"trade_date\": \"0\",\n" + + "\t\"transaction_serial_number\": \"CD38820250303225620557\",\n" + + "\t\"valley_amount1\": 0.040000,\n" + + "\t\"valley_amount7\": 24.910000,\n" + + "\t\"valley_charge1\": 0.066000,\n" + + "\t\"valley_charge7\": 33.103000\n" + + "}", TransactionRecordMessageVO.class); + chargingOrderService.endChargeBillingCharge(vo); + } +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java index 27ccbfa..e6d49d2 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java @@ -344,17 +344,29 @@ @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) @GetMapping("/vipInfo/pay") public Object vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, - @RequestParam("payType") Integer payType - ) { - + @RequestParam("payType") Integer payType) { + + LocalDateTime now = LocalDateTime.now(); TVip byId = vipService.getById(vipId); if (byId==null){ return R.ok("当前会员不存在,请刷新后重试。"); } + if(byId.getReveal() == 0){ + return R.ok("无效的会员"); + } + if(1 == buyType && byId.getMonthlyCardDiscountReveal() == 0){ + return R.ok("无效的会员"); + } + if(2 == buyType && byId.getSeasonCardDiscountReveal() == 0){ + return R.ok("无效的会员"); + } + if(3 == buyType && byId.getAnnualCardReveal() == 0){ + return R.ok("无效的会员"); + } + BigDecimal payMoney = BigDecimal.ZERO; BigDecimal discountMoney = BigDecimal.ZERO; BigDecimal discount = BigDecimal.ZERO; - LocalDateTime now = LocalDateTime.now(); switch (buyType){ case 1: if (byId.getMonthlyCardDiscountStart()!=null&&(now.isAfter(byId.getMonthlyCardDiscountStart())&&now.isBefore(byId.getMonthlyCardDiscountEnd()))){ diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java index ef7f4b5..47fb78a 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java @@ -124,7 +124,7 @@ paymentOrder.setAmount(shopOrder.getPaymentAmount()); paymentOrder.setOpenId(user.getWxOpenid()); paymentOrder.setDescription("购买会员"); - return AjaxResult.success(wxPaymentClient.orderPay(paymentOrder).getData()); + return AjaxResult.success(wxPaymentClient.orderPay(paymentOrder).getData()); }else { AliPaymentReq req = new AliPaymentReq(); req.setOutTradeNo(shopOrder.getCode()); -- Gitblit v1.7.1