From cb7b167593693f3a2306a0c0009df52527b9a1b5 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Fri, 27 Sep 2024 21:24:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=88=90=E6=9C=AC=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/impl/CallbackServiceImpl.java | 12 ++++++++---- .../system/service/impl/EtFeeRuleServiceImpl.java | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java index 5c09d83..a2e55a4 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java @@ -190,6 +190,9 @@ public class CallbackServiceImpl implements CallbackService { logger.info("【微信/太米支付回调】订单信息 : " + JSON.toJSONString(order)); logger.info("【微信/太米支付回调】========== orderId : " + order.getOrderId()); + Long payChannel = order.getPayChannel(); + ChannelVO channelVO = etChannelService.selectSmChannelByChannelId(payChannel); + AsUser asUser = asUserMapper.selectUserById(order.getUserId()); /** 支付回调逻辑 1. 处理预约还是开锁 电压 */ AsDevice asDevice = null; @@ -232,7 +235,7 @@ public class CallbackServiceImpl implements CallbackService { order1.setHandlingCharge(capitalFlow.getHandlingCharge()); order1.setPlatformServiceFee(capitalFlow.getPlatformServiceFee()); order1.setOperatorDividend(capitalFlow.getOperatorDividend()); - order1.setCost(getCost(order.getPayFee())); + order1.setCost(getCost(channelVO,order.getPayFee())); logger.info("=================【微信/太米支付回调】4444444=================="); }else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_APPOINTMENT)){ logger.info("【微信/太米支付回调】取消预约支付"); @@ -309,9 +312,10 @@ public class CallbackServiceImpl implements CallbackService { if(!execute)throw new ServiceException("管理员开锁失败"); } - private BigDecimal getCost(BigDecimal payFee) { - // todo 获取到微信的成本 - BigDecimal bigDecimal = new BigDecimal(0.54).divide(new BigDecimal(100), 6, BigDecimal.ROUND_HALF_UP); + private BigDecimal getCost(ChannelVO channel,BigDecimal payFee) { + // 获取到渠道成本 + BigDecimal costRate = channel.getCostRate(); + BigDecimal bigDecimal = costRate.divide(new BigDecimal(100), 6, BigDecimal.ROUND_HALF_UP); BigDecimal cost = bigDecimal.multiply(payFee).setScale(2, BigDecimal.ROUND_HALF_UP); logger.info("【保存资金流水记录--订单支付】 成本==============bigDecimal=====================:"+bigDecimal); return cost; diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java index 5439364..7258176 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java @@ -168,7 +168,7 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService public int updateEtFeeRule(EtFeeRule etFeeRule) { int i = etModelRuleMapper.deleteModelRuleByModelId(etFeeRule.getRuleId()); - if(ObjectUtil.isNotNull(etFeeRule.getAreaId())){ + if(ObjectUtil.isNotNull(etFeeRule.getModelId()) && etFeeRule.getModelId() != 0){ etModelRuleMapper.insert(EtModelRule.builder().modelId(etFeeRule.getModelId()).ruleId(etFeeRule.getRuleId()).build()); } return etFeeRuleMapper.updateEtFeeRule(etFeeRule);