|
|
@@ -569,4 +569,75 @@
|
|
|
AND tpsi.id = #{stationId}
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 查询用户当前正在充电中的订单实时费用 -->
|
|
|
+ <resultMap id="AppletChargingCostResultMap" type="com.zsElectric.boot.business.model.vo.applet.AppletChargingCostVO">
|
|
|
+ <result property="chargeOrderNo" column="charge_order_no"/>
|
|
|
+ <result property="stationName" column="station_name"/>
|
|
|
+ <result property="connectorName" column="connector_name"/>
|
|
|
+ <result property="orderStatus" column="order_status"/>
|
|
|
+ <result property="orderStatusDesc" column="order_status_desc"/>
|
|
|
+ <result property="chargingDuration" column="charging_duration"/>
|
|
|
+ <result property="chargingDurationDesc" column="charging_duration_desc"/>
|
|
|
+ <result property="totalPower" column="total_power"/>
|
|
|
+ <result property="elecMoney" column="elec_money"/>
|
|
|
+ <result property="serviceMoney" column="service_money"/>
|
|
|
+ <result property="totalMoney" column="total_money"/>
|
|
|
+ <result property="soc" column="soc"/>
|
|
|
+ <result property="current" column="current"/>
|
|
|
+ <result property="voltage" column="voltage"/>
|
|
|
+ <result property="power" column="power"/>
|
|
|
+ <result property="startTime" column="start_time"/>
|
|
|
+ <result property="lastUpdateTime" column="last_update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectCurrentChargingCost" resultMap="AppletChargingCostResultMap">
|
|
|
+ SELECT
|
|
|
+ coi.charge_order_no,
|
|
|
+ tpsi.station_name,
|
|
|
+ tpci.connector_name,
|
|
|
+ tcs.start_charge_seq_stat AS order_status,
|
|
|
+ CASE tcs.start_charge_seq_stat
|
|
|
+ WHEN 1 THEN '启动中'
|
|
|
+ WHEN 2 THEN '充电中'
|
|
|
+ WHEN 3 THEN '停止中'
|
|
|
+ WHEN 4 THEN '已结束'
|
|
|
+ WHEN 5 THEN '未知'
|
|
|
+ ELSE '未知'
|
|
|
+ END AS order_status_desc,
|
|
|
+ TIMESTAMPDIFF(SECOND, tcs.start_time, tcs.end_time) AS charging_duration,
|
|
|
+ CONCAT(
|
|
|
+ LPAD(FLOOR(TIMESTAMPDIFF(SECOND, tcs.start_time, tcs.end_time) / 3600), 2, '0'), ':',
|
|
|
+ LPAD(FLOOR((TIMESTAMPDIFF(SECOND, tcs.start_time, tcs.end_time) % 3600) / 60), 2, '0'), ':',
|
|
|
+ LPAD(TIMESTAMPDIFF(SECOND, tcs.start_time, tcs.end_time) % 60, 2, '0')
|
|
|
+ ) AS charging_duration_desc,
|
|
|
+ IFNULL(tcs.total_power, 0) AS total_power,
|
|
|
+ IFNULL(tcs.elec_money, 0) AS elec_money,
|
|
|
+ IFNULL(tcs.service_money, 0) AS service_money,
|
|
|
+ IFNULL(tcs.total_money, 0) AS total_money,
|
|
|
+ tcs.soc,
|
|
|
+ COALESCE(tcs.current_a, tcs.current_b, tcs.current_c) AS current,
|
|
|
+ COALESCE(tcs.voltage_a, tcs.voltage_b, tcs.voltage_c) AS voltage,
|
|
|
+ ROUND(
|
|
|
+ COALESCE(tcs.voltage_a, tcs.voltage_b, tcs.voltage_c) *
|
|
|
+ COALESCE(tcs.current_a, tcs.current_b, tcs.current_c) / 1000,
|
|
|
+ 2
|
|
|
+ ) AS power,
|
|
|
+ DATE_FORMAT(tcs.start_time, '%Y-%m-%d %H:%i:%s') AS start_time,
|
|
|
+ DATE_FORMAT(tcs.update_time, '%Y-%m-%d %H:%i:%s') AS last_update_time
|
|
|
+ FROM c_charge_order_info coi
|
|
|
+ INNER JOIN third_party_charge_status tcs
|
|
|
+ ON coi.charge_order_no = tcs.start_charge_seq
|
|
|
+ INNER JOIN third_party_connector_info tpci
|
|
|
+ ON tcs.connector_id = tpci.connector_id
|
|
|
+ AND tpci.is_deleted = 0
|
|
|
+ INNER JOIN third_party_station_info tpsi
|
|
|
+ ON tpci.station_id = tpsi.station_id
|
|
|
+ AND tpsi.is_deleted = 0
|
|
|
+ WHERE coi.user_id = #{userId}
|
|
|
+ AND coi.status = 1
|
|
|
+ AND coi.is_deleted = 0
|
|
|
+ ORDER BY tcs.update_time DESC
|
|
|
+ LIMIT 1
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|