1. 联调

This commit is contained in:
邱贞招 2024-06-13 17:47:25 +08:00
parent d31bfd5ebc
commit 5822ff6d51
4 changed files with 25 additions and 5 deletions
electripper-system/src/main
java/com/ruoyi/system
resources/mapper/system

View File

@ -98,6 +98,10 @@ public class EtOrder extends BaseEntity
@Excel(name = "订单总金额(元)") @Excel(name = "订单总金额(元)")
private BigDecimal totalFee; private BigDecimal totalFee;
/** 实际支付金额(元) */
@Excel(name = "实际支付金额(元)")
private BigDecimal payFee;
/** 实际结算金额(元) */ /** 实际结算金额(元) */
@TableField(exist = false) @TableField(exist = false)
private BigDecimal settlementFee; private BigDecimal settlementFee;

View File

@ -128,7 +128,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
} }
/** /**
* 根据sn号查询车辆实时信息 * 根据sn号查询车辆实时信息 真实金额 实际
* *
* @param sn 设备sn * @param sn 设备sn
* @return 设备 * @return 设备
@ -140,12 +140,20 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
if (ObjectUtil.isNull(asDevice)) { if (ObjectUtil.isNull(asDevice)) {
throw new ServiceException("设备不存在:"+ sn); throw new ServiceException("设备不存在:"+ sn);
} }
// 查询车辆上下线
if(!isOnline(sn)){
asDevice.setOnlineStatus(ServiceConstants.VEHICLE_STATUS_OFFLINE);
log.info("设备不在线:"+ sn);
}else{
asDevice.setOnlineStatus(ServiceConstants.VEHICLE_STATUS_ONLINE);
}
int i = asDeviceMapper.updateAsDevice(asDevice);
Long areaId = asDevice.getAreaId(); Long areaId = asDevice.getAreaId();
EtOperatingArea etOperatingArea; EtOperatingArea etOperatingArea;
if (ObjectUtil.isNotNull(areaId)) { if (ObjectUtil.isNotNull(areaId)) {
etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId); etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
}else{ }else{
throw new ServiceException("区域信息不存在"); throw new ServiceException("【selectAsDeviceBySn】区域信息不存在");
} }
if(ObjectUtil.isNotNull(etOperatingArea)){ if(ObjectUtil.isNotNull(etOperatingArea)){
asDevice.setAreaName(etOperatingArea.getAreaName()); asDevice.setAreaName(etOperatingArea.getAreaName());

View File

@ -715,6 +715,8 @@ public class EtOrderServiceImpl implements IEtOrderService
} }
log.info("总金额:【{}】,退款金额:【{}】", etOrder1.getTotalFee(), refundAmount); log.info("总金额:【{}】,退款金额:【{}】", etOrder1.getTotalFee(), refundAmount);
Refund refund = wxPayService.refund(etOrder1, etOrder.getReason(), refundAmount); Refund refund = wxPayService.refund(etOrder1, etOrder.getReason(), refundAmount);
//todo 更新订单的payFee = totalFee - refundAmount
/** 2.记录退款表 创建退款对象*/ /** 2.记录退款表 创建退款对象*/
EtRefund refund1= createRefund(etOrder, refundAmount, appointmentFee, dispatchFee, manageFee, ridingFee, refund,ServiceConstants.REFUND_TYPE_SYSTEM); EtRefund refund1= createRefund(etOrder, refundAmount, appointmentFee, dispatchFee, manageFee, ridingFee, refund,ServiceConstants.REFUND_TYPE_SYSTEM);
int i = etRefundService.insertEtRefund(refund1); int i = etRefundService.insertEtRefund(refund1);

View File

@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="payType" column="pay_type" /> <result property="payType" column="pay_type" />
<result property="type" column="type" /> <result property="type" column="type" />
<result property="totalFee" column="total_fee" /> <result property="totalFee" column="total_fee" />
<result property="payFee" column="pay_fee" />
<result property="dispatchFee" column="dispatch_fee" /> <result property="dispatchFee" column="dispatch_fee" />
<result property="manageFee" column="manage_fee" /> <result property="manageFee" column="manage_fee" />
<result property="ridingFee" column="riding_fee" /> <result property="ridingFee" column="riding_fee" />
@ -40,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectEtOrderVo"> <sql id="selectEtOrderVo">
select order_id, area_id, order_no, out_trade_no, user_id, rule_id, select order_id, area_id, order_no, out_trade_no, user_id, rule_id,
device_mac, sn, pay_time, paid, pay_type, type, total_fee, dispatch_fee, device_mac, sn, pay_time, paid, pay_type, type, total_fee, pay_fee, dispatch_fee,
manage_fee, riding_fee, appointment_fee, mark, duration, distance, status, 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, AsText(trip_route) trip_route,trip_route_str from et_order 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 from et_order
</sql> </sql>
@ -63,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.pay_type, o.pay_type,
o.type, o.type,
COALESCE(o.total_fee, 0) AS total_fee, COALESCE(o.total_fee, 0) AS total_fee,
COALESCE(o.pay_fee, 0) AS pay_fee,
COALESCE(o.dispatch_fee, 0) AS dispatch_fee, COALESCE(o.dispatch_fee, 0) AS dispatch_fee,
COALESCE(o.manage_fee, 0) AS manage_fee, COALESCE(o.manage_fee, 0) AS manage_fee,
COALESCE(o.riding_fee, 0) AS riding_fee, COALESCE(o.riding_fee, 0) AS riding_fee,
@ -250,7 +252,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getPayFee" resultType="java.math.BigDecimal"> <select id="getPayFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(total_fee), 0) from et_order select COALESCE(SUM(pay_fee), 0) from et_order
<where> <where>
<if test="sn != null and sn != ''"> and sn = #{sn}</if> <if test="sn != null and sn != ''"> and sn = #{sn}</if>
<if test="startDateStr != null and startDateStr != ''"> <if test="startDateStr != null and startDateStr != ''">
@ -264,7 +266,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getIncome" resultType="java.math.BigDecimal"> <select id="getIncome" resultType="java.math.BigDecimal">
select COALESCE(SUM(total_fee), 0) from et_order select COALESCE(SUM(pay_fee), 0) from et_order
<where> <where>
<if test="sn != null and sn != ''"> and sn = #{sn}</if> <if test="sn != null and sn != ''"> and sn = #{sn}</if>
<if test="startDateStr != null and startDateStr != ''"> <if test="startDateStr != null and startDateStr != ''">
@ -344,6 +346,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payType != null and payType != ''">pay_type,</if> <if test="payType != null and payType != ''">pay_type,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="totalFee != null">total_fee,</if> <if test="totalFee != null">total_fee,</if>
<if test="payFee != null">pay_fee,</if>
<if test="dispatchFee != null">dispatch_fee,</if> <if test="dispatchFee != null">dispatch_fee,</if>
<if test="manageFee != null">manage_fee,</if> <if test="manageFee != null">manage_fee,</if>
<if test="ridingFee != null">riding_fee,</if> <if test="ridingFee != null">riding_fee,</if>
@ -376,6 +379,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payType != null and payType != ''">#{payType},</if> <if test="payType != null and payType != ''">#{payType},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="totalFee != null">#{totalFee},</if> <if test="totalFee != null">#{totalFee},</if>
<if test="payFee != null">#{payFee},</if>
<if test="dispatchFee != null">#{dispatchFee},</if> <if test="dispatchFee != null">#{dispatchFee},</if>
<if test="manageFee != null">#{manageFee},</if> <if test="manageFee != null">#{manageFee},</if>
<if test="ridingFee != null">#{ridingFee},</if> <if test="ridingFee != null">#{ridingFee},</if>
@ -411,6 +415,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payType != null and payType != ''">pay_type = #{payType},</if> <if test="payType != null and payType != ''">pay_type = #{payType},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="totalFee != null">total_fee = #{totalFee},</if> <if test="totalFee != null">total_fee = #{totalFee},</if>
<if test="payFee != null">pay_fee = #{payFee},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if> <if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="manageFee != null">manage_fee = #{manageFee},</if> <if test="manageFee != null">manage_fee = #{manageFee},</if>
<if test="ridingFee != null">riding_fee = #{ridingFee},</if> <if test="ridingFee != null">riding_fee = #{ridingFee},</if>
@ -446,6 +451,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payType != null and payType != ''">pay_type = #{payType},</if> <if test="payType != null and payType != ''">pay_type = #{payType},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="totalFee != null">total_fee = #{totalFee},</if> <if test="totalFee != null">total_fee = #{totalFee},</if>
<if test="payFee != null">pay_fee = #{payFee},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if> <if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="manageFee != null">manage_fee = #{manageFee},</if> <if test="manageFee != null">manage_fee = #{manageFee},</if>
<if test="ridingFee != null">riding_fee = #{ridingFee},</if> <if test="ridingFee != null">riding_fee = #{ridingFee},</if>