From e90cad2ab9284e62ebcbe86e5dc3bf441aee2695 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Thu, 27 Jun 2024 15:56:12 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 2 +- .../java/com/ruoyi/system/mapper/EtOrderMapper.java | 5 +++++ .../system/service/impl/AsDeviceServiceImpl.java | 4 +--- .../system/service/impl/CallbackServiceImpl.java | 12 ++++++++---- .../main/resources/mapper/system/EtOrderMapper.xml | 13 +++++++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/electripper-admin/src/main/resources/application.yml b/electripper-admin/src/main/resources/application.yml index b866895..484e775 100644 --- a/electripper-admin/src/main/resources/application.yml +++ b/electripper-admin/src/main/resources/application.yml @@ -230,7 +230,7 @@ geo: key: 834f1f029671d84272554528311ff0f1 et: # 手续费 4/1000 千分之几 - handlingCharge: 4 + handlingCharge: 5.4 verifyUrl: https://zidv2.market.alicloudapi.com/idcheck/Post appcode: 32b6c6445b1a42ed862dd4202392c47d repairAdmin: wx diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java index d9bfe2b..42d0e65 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java @@ -216,6 +216,11 @@ public interface EtOrderMapper */ EtOrder selectLatestOrder(EtOrder etOrder); + /** + * 最近一笔订单 + */ + List selectLatestOrderList(EtOrder etOrder); + /** * 预约未完成订单处理 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index e8eacee..2b237f5 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -172,10 +172,8 @@ public class AsDeviceServiceImpl extends ServiceImpl i } //正在进行中的订单 EtOrder order = new EtOrder(); - order.setType(ServiceConstants.ORDER_TYPE_RIDING); - order.setStatus(ServiceConstants.ORDER_STATUS_RIDING); order.setSn(asDevice.getSn()); - List etOrders = etOrderMapper.selectEtOrderList(order); + List etOrders = etOrderMapper.selectLatestOrderList(order); asDevice.setEtOrders(etOrders); return asDevice; } 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 27c21cf..abc7778 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 @@ -468,6 +468,11 @@ public class CallbackServiceImpl implements CallbackService { capitalFlow.setType(type); capitalFlow.setBusType(busType); capitalFlow.setAmount(order.getPayFee()); + logger.info("【微信支付回调--保存资金流水记录】 获取到配置手续费==============handlingCharge=====================:"+handlingCharge); + BigDecimal bigDecimal = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP); + logger.info("【微信支付回调--保存资金流水记录】 转换后手续费==============bigDecimal=====================:"+bigDecimal); + BigDecimal multiply = bigDecimal.multiply(order.getTotalFee()); + logger.info("【微信支付回调--保存资金流水记录】 计算出的手续费==============multiply=====================:"+multiply); if(busType.equals(ServiceConstants.ORDER_TYPE_DEPOSIT) || busType.equals(ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND)){ capitalFlow.setOperatorDividend(BigDecimal.ZERO); capitalFlow.setPartnerDividend(BigDecimal.ZERO); @@ -494,19 +499,18 @@ public class CallbackServiceImpl implements CallbackService { if(type.equals(ServiceConstants.FLOW_TYPE_INCOME)){ capitalFlow.setPartnerDividend(partnerDividend); capitalFlow.setOperatorDividend(operatorDividend); - capitalFlow.setOperatorBalance(sysDept.getBalance().add(operatorDividend)); + capitalFlow.setOperatorBalance(sysDept.getBalance().add(operatorDividend).subtract(multiply)); deptService.changeDeptBalance(operatorDividend,sysDept.getDeptId()); logger.info("【微信支付回调--保存资金流水记录】 ==============收入=====================:"); }else{ capitalFlow.setPartnerDividend(partnerDividend.negate()); capitalFlow.setOperatorDividend(operatorDividend.negate()); - capitalFlow.setOperatorBalance(sysDept.getBalance().subtract(operatorDividend)); + capitalFlow.setOperatorBalance(sysDept.getBalance().subtract(operatorDividend).subtract(multiply)); deptService.changeDeptBalance(operatorDividend.negate(),sysDept.getDeptId()); logger.info("【微信支付回调--保存资金流水记录】 ==============支出=====================:"); } } - BigDecimal bigDecimal = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP); - capitalFlow.setHandlingCharge(bigDecimal.multiply(order.getTotalFee()));//手续费 + capitalFlow.setHandlingCharge(multiply);//手续费 capitalFlow.setPayType(ServiceConstants.PAY_TYPE_WX); capitalFlow.setCreateTime(DateUtils.getNowDate()); logger.info("【微信支付回调】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow)); diff --git a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml index 87d43e0..02f3148 100644 --- a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml @@ -379,11 +379,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM et_order and user_id = #{userId} + and sn = #{sn} and type = 1 ORDER BY create_time DESC LIMIT 1 + +