From 4a1b01e3fec152a78e3bb2cb0283d8739874177e Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Mon, 9 Sep 2024 08:43:13 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/system/domain/EtOrder.java | 18 +++++++++++++++ .../service/impl/CallbackServiceImpl.java | 15 +++++++++++- .../mapper/system/EtCapitalFlowMapper.xml | 4 ++-- .../resources/mapper/system/EtOrderMapper.xml | 23 +++++++++++++++---- 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java index 5d88c55..f1b0518 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java @@ -304,4 +304,22 @@ public class EtOrder extends BaseEntity @Excel(name = "封顶金额") private BigDecimal cappedAmount; + /** 手续费 */ + @Excel(name = "手续费") + private BigDecimal handlingCharge; + + /** 平台服务费 */ + @Excel(name = "平台服务费") + private BigDecimal platformServiceFee; + + /** 运营商分账(到账金额) */ + @Excel(name = "运营商分账(到账金额)") + private BigDecimal operatorDividend; + + /** 成本 */ + @Excel(name = "成本") + @TableField(exist = false) + private BigDecimal cost; + + } 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 10ed840..a001322 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 @@ -230,6 +230,11 @@ public class CallbackServiceImpl implements CallbackService { asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE); // 新增资金流水记录 EtCapitalFlow capitalFlow = capitalFlowRecords(order, ServiceConstants.FLOW_TYPE_INCOME, ServiceConstants.ORDER_TYPE_RIDING, ServiceConstants.OWNER_TYPE_OPERATOR, null, ServiceConstants.PAY_TYPE_WX); + logger.info("=================【骑行支付回调-新增资金流水记录后】=================={}",JSON.toJSON(capitalFlow)); + order.setHandlingCharge(capitalFlow.getHandlingCharge()); + order.setPlatformServiceFee(capitalFlow.getPlatformServiceFee()); + order.setOperatorDividend(capitalFlow.getOperatorDividend()); + order.setCost(getCost(order.getPayFee())); // 发起分账 // BigDecimal dividendAmount= order.getPayFee().subtract(capitalFlow.getHandlingCharge()).subtract(capitalFlow.getPlatformServiceFee());//分账金额(订单实际支付金额-平台服务费-支付手续费) // logger.info("=================【微信支付回调】分账金额=================={}",dividendAmount); @@ -277,7 +282,7 @@ public class CallbackServiceImpl implements CallbackService { throw new ServiceException("【微信支付回调】更新车辆状态失败"); } } - logger.info("=================【微信支付回调】开始更新订单信息=================="); + logger.info("=================【微信支付回调】开始更新订单信息=================={}",JSON.toJSON(order)); int updateEtOrder = orderService.updateEtOrder(order); if(updateEtOrder==0){ logger.error("【微信支付回调】更新订单信息失败"); @@ -296,6 +301,14 @@ public class CallbackServiceImpl implements CallbackService { } } + private BigDecimal getCost(BigDecimal payFee) { + // todo 获取到微信的成本 + BigDecimal bigDecimal = new BigDecimal(0.54).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; + } + private void couponSuccessHandle(EtOrder order) { logger.info("【微信支付回调】优惠券支付-------------1"); /** diff --git a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml index 17825e4..b634bdb 100644 --- a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml @@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select - COALESCE(SUM(platform_service_fee), 0) AS net_fee + COALESCE(SUM(f.platform_service_fee), 0) AS net_fee from et_capital_flow f LEFT JOIN et_order o on o.order_no = f.order_no where f.area_id != 14 and f.type = 1 diff --git a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml index 25f89a8..0122e44 100644 --- a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml @@ -56,6 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -65,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, appointment_start_time, appointment_end_time,appointment_timeout, unlock_time,return_time, rule_end_time, return_type, AsText(trip_route) trip_route,trip_route_str,cycle,deposit_deduction,video_url, upload_time,deduction_amount,audio_files,used_sn,change_reason,locking,auto_refund_deposit,free_ride_time, - rental_unit,riding_rule,riding_rule_json,charging_cycle,charging_cycle_value,capped_amount from et_order + rental_unit,riding_rule,riding_rule_json,charging_cycle,charging_cycle_value,capped_amount,handling_charge, platform_service_fee, operator_dividend from et_order @@ -74,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" manage_fee, riding_fee, appointment_fee, mark, duration, distance, status, create_time, appointment_start_time, appointment_end_time,appointment_timeout, unlock_time,return_time, rule_end_time, return_type, cycle,deposit_deduction,video_url,upload_time,deduction_amount,audio_files,used_sn,change_reason,locking,auto_refund_deposit,free_ride_time, - rental_unit,riding_rule,riding_rule_json,charging_cycle,charging_cycle_value,capped_amountfrom et_order + rental_unit,riding_rule,riding_rule_json,charging_cycle,charging_cycle_value,capped_amount,handling_charge, platform_service_fee, operator_dividend from et_order