| | |
| | | ifnull(t2.refund_amount, 0) as refundAmount |
| | | from t_charging_order t1 |
| | | left join t_charging_order_refund t2 on t1.id = t2.charging_order_id |
| | | where t1.del_flag = 0 and t1.status = 5 and t1.recharge_payment_status = 2 |
| | | where t1.del_flag = 0 and t1.recharge_payment_status = 2 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="chargingOrderNolimit" resultType="map"> |
| | | select |
| | | sum(charging_capacity) as total, |
| | | sum(charging_duration) as `time`, |
| | | sum(electric_price) as electronicMoney, |
| | | sum(income) as paymentMoney, |
| | | sum(service_price) as serviceMoney |
| | | from t_charging_order_summary_data |
| | | where charging_order_id in ( |
| | | select t1.id |
| | | from t_charging_order t1 |
| | | where 1=1 |
| | | sum(aa.electricity) as total, |
| | | sum(aa.charging_time) as `time`, |
| | | sum(aa.charging_amount) as paymentMoney, |
| | | sum(aa.period_electric_price) as electronicMoney, |
| | | sum(aa.period_service_price) as serviceMoney |
| | | from ( |
| | | select |
| | | ifnull(a.electricity, 0) as electricity, |
| | | UNIX_TIMESTAMP(ifnull(a.end_time, now())) - UNIX_TIMESTAMP(ifnull(a.start_time, now())) as charging_time, |
| | | ifnull(a.recharge_amount - b.refund_amount, 0) as charging_amount, |
| | | ifnull(c.period_electric_price, 0) as period_electric_price, |
| | | ifnull(c.period_service_price, 0) as period_service_price |
| | | from t_charging_order a |
| | | left join (select charging_order_id, sum(refund_amount) as refund_amount from t_charging_order_refund where refund_status = 2 group by charging_order_id) b on (a.id = b.charging_order_id) |
| | | left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price from t_charging_order_accounting_strategy group by charging_order_id) c on (a.id = c.charging_order_id) |
| | | where a.del_flag = 0 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | and a.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0"> |
| | | and t1.app_user_id in |
| | | and a.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.siteIds and req.siteIds.size()>0"> |
| | | and t1.site_id in |
| | | and a.site_id in |
| | | <foreach collection="req.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.orderType != null "> |
| | | and t1.order_type = #{req.orderType} |
| | | and a.order_type = #{req.orderType} |
| | | </if> |
| | | <if test="req.status != null "> |
| | | and t1.status = #{req.status} |
| | | and a.status = #{req.status} |
| | | </if> |
| | | <if test="req.orderSource != null and req.orderSource == 1 "> |
| | | and (t1.order_source = 0 or t1.order_source = 1 ) |
| | | and (a.order_source = 0 or a.order_source = 1 ) |
| | | </if> |
| | | <if test="req.orderSource != null and req.orderSource == 2 "> |
| | | and t1.tripartite_platform_name = 'KuaiDian' |
| | | and a.tripartite_platform_name = 'KuaiDian' |
| | | </if> |
| | | <if test="req.orderSource != null and req.orderSource == 3 "> |
| | | and t1.tripartite_platform_name = 'XinDianTu' |
| | | and a.tripartite_platform_name = 'XinDianTu' |
| | | </if> |
| | | <if test="req.siteId != null "> |
| | | and t1.site_id = #{req.siteId} |
| | | and a.site_id = #{req.siteId} |
| | | </if> |
| | | <if test="req.pileId != null "> |
| | | and t1.charging_pile_id = #{req.pileId} |
| | | and a.charging_pile_id = #{req.pileId} |
| | | </if> |
| | | <if test="req.gunId != null "> |
| | | and t1.charging_gun_id = #{req.gunId} |
| | | and a.charging_gun_id = #{req.gunId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.pay_time between #{startTime1} and #{startTime2}) |
| | | and (a.start_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | <if test="endTime1 != null and endTime1!=''"> |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | | and (a.end_time between #{endTime1} and #{endTime2}) |
| | | </if> |
| | | and t1.del_flag = 0 |
| | | ) |
| | | ) as aa |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="countOrdersByDate" resultType="com.ruoyi.order.vo.OrderCountByDate"> |
| | | SELECT DATE_FORMAT(create_time, '%m/%d') AS `date`, COUNT(*) AS `count` |
| | | FROM t_charging_order |