| | |
| | | and t1.charging_gun_id = #{req.gunId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.start_time between #{startTime1} and #{startTime2}) |
| | | and (t1.start_time between #{startTime1} and #{startTime2} |
| | | </if> |
| | | <if test="endTime1 != null and endTime1!=''"> |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | | and (t1.end_time between #{endTime1} and #{endTime2} |
| | | </if> |
| | | </select> |
| | | <select id="payOrderQuery" resultType="com.ruoyi.order.dto.PayOrderDto"> |
| | | SELECT * FROM (SELECT |
| | | id, |
| | | `code`, |
| | | 1 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | create_time, |
| | | end_time, |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_charging_order UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | | 2 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | create_time, |
| | | receiving_time as end_time, |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_shopping_order UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | | 3 as type, |
| | | title, |
| | | phone, |
| | | payment_status AS `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | create_time, |
| | | create_time as end_time, |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_vip_order UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | | 4 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount , |
| | | order_amount as payment_amount, |
| | | create_time, |
| | | out_parking_time as end_time, |
| | | out_parking_time as pay_time, |
| | | null as refund_status, |
| | | 0 as final_amount, |
| | | 0 as del_flag |
| | | FROM |
| | | charging_pile_service.t_parking_record ) o |
| | | id, |
| | | `code`, |
| | | 1 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | create_time, |
| | | end_time, |
| | | pay_time |
| | | FROM |
| | | charging_pile_order.t_charging_order UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | | 2 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | create_time, |
| | | receiving_time as end_time, |
| | | pay_time |
| | | FROM |
| | | charging_pile_order.t_shopping_order UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | | 3 as type, |
| | | title, |
| | | phone, |
| | | payment_status AS `status`, |
| | | order_amount, |
| | | payment_amount , |
| | | create_time, |
| | | create_time as end_time, |
| | | pay_time |
| | | FROM |
| | | charging_pile_order.t_vip_order UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | | 4 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount , |
| | | order_amount as payment_amount, |
| | | create_time, |
| | | out_parking_time as end_time, |
| | | out_parking_time as pay_time |
| | | FROM |
| | | charging_pile_service.t_parking_record ) o |
| | | <where> |
| | | o.del_flag = 0 |
| | | <if test="data.code != null and data.code != ''"> |
| | | AND o.code LIKE CONCAT('%',#{data.code},'%') |
| | | </if> |
| | |
| | | <if test="data.type != null"> |
| | | AND o.type = #{data.type} |
| | | </if> |
| | | |
| | | <if test="data.status != null"> |
| | | AND o.status = #{data.status} |
| | | </if> |
| | | <if test="data.createTime1 != null"> |
| | | AND o.create_time >= #{data.createTime1} |
| | | </if> |
| | |
| | | AND o.create_time <= #{data.createTime2} |
| | | </if> |
| | | </where> |
| | | ORDER BY o.create_time desc |
| | | |
| | | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | |
| | | |
| | | |
| | | </select> |
| | | <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> |
| | | select t1.* from t_charging_order t1 |
| | | where 1=1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.carIds and req.carIds.size()>0" > |
| | | and t1.app_user_car_id in |
| | | <foreach collection="req.carIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.orderType != null "> |
| | | and t1.order_type = #{req.orderType} |
| | | </if> |
| | | <if test="req.status != null "> |
| | | and t1.status = #{status} |
| | | </if> |
| | | <if test="req.status != null "> |
| | | and t1.status = #{req.status} |
| | | </if> |
| | | <if test="req.siteId != null "> |
| | | and t1.site_id = #{req.siteId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.start_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | <if test="endTime1 != null and endTime1!=''"> |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | | </if> |
| | | <select id="chargingOrderGroup" resultType="com.ruoyi.common.core.dto.ChargingOrderGroup"> |
| | | SELECT SUM(charging_capacity) ,site_id |
| | | FROM t_charging_order |
| | | GROUP BY site_id |
| | | <where> |
| | | <if test="chargingPercentProvinceDto.date1 != null"> |
| | | AND create_time >= #{chargingPercentProvinceDto.date1} |
| | | </if> |
| | | <if test="chargingPercentProvinceDto.date2 != null"> |
| | | AND create_time <= #{chargingPercentProvinceDto.date2} |
| | | </if> |
| | | <if test="chargingPercentProvinceDto.provinceCode != null"> |
| | | AND province_code = #{chargingPercentProvinceDto.provinceCode} |
| | | </if> |
| | | </where> |
| | | |
| | | |
| | | </select> |
| | | <select id="chargingList1" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> |
| | | select t1.* from t_charging_order t1 |
| | | where 1=1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.carIds and req.carIds.size()>0" > |
| | | and t1.app_user_car_id in |
| | | <foreach collection="req.carIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.orderType != null "> |
| | | and t1.order_type = #{req.orderType} |
| | | </if> |
| | | <if test="req.status != null "> |
| | | and t1.status = #{status} |
| | | </if> |
| | | <if test="req.status != null "> |
| | | and t1.status = #{req.status} |
| | | </if> |
| | | <if test="req.siteId != null "> |
| | | and t1.site_id = #{req.siteId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.start_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | <if test="endTime1 != null and endTime1!=''"> |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | | </if> |
| | | <select id="charge" resultType="com.ruoyi.order.dto.SixChargingDto"> |
| | | SELECT |
| | | DATE_FORMAT( subquery.create_time, '%m' ) AS MONTH, |
| | | SUM(electrovalence) AS electrovalence, |
| | | SUM(service_charge) AS service_charge |
| | | FROM |
| | | ( |
| | | SELECT |
| | | create_time, |
| | | electrovalence, |
| | | service_charge |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) |
| | | <if test="sixBefore != null"> |
| | | AND create_time >= #{sixBefore} |
| | | </if> |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | AND site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ) AS subquery |
| | | GROUP BY |
| | | DATE_FORMAT( subquery.create_time, '%m' ) |
| | | |
| | | |
| | | </select> |
| | | <select id="circle" resultType="com.ruoyi.order.dto.SixCircleDto"> |
| | | SELECT |
| | | site_id as siteId,SUM(payment_amount) as paymentAmount |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | AND site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="sixBefore != null"> |
| | | AND create_time >= #{sixBefore} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | site_id |
| | | |
| | | |
| | | </select> |
| | | <select id="countAll" resultType="java.util.Map"> |
| | | select sum(electrovalence),sum(service_charge),sum(commission_amount),sum(sharing_amount) |
| | | from t_charging_order |
| | | where create_time >= #{sixBefore} and del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) |
| | | </select> |
| | | <select id="getSumByType" resultType="java.util.Map"> |
| | | SELECT |
| | | type, |
| | | SUM( charging_capacity ) as charging_capacity , |
| | | SUM( period_service_price ) as period_electric_price, |
| | | SUM(period_electric_price+period_service_price) as total_amount |
| | | FROM |
| | | t_charging_order_accounting_strategy |
| | | <where> |
| | | <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> |
| | | AND charging_order_id IN |
| | | <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> |
| | | #{chargingOrderId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | type |
| | | </select> |
| | | <select id="getDateData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) and DATE(create_time) = CURDATE() |
| | | <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> |
| | | AND id IN |
| | | <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> |
| | | #{chargingOrderId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | </select> |
| | | <select id="getWeekData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) and YEARWEEK(DATE_FORMAT(create_time, '%Y-%m-%d'), 1) = YEARWEEK(NOW(), 1) |
| | | <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> |
| | | AND id IN |
| | | <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> |
| | | #{chargingOrderId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | </select> |
| | | <select id="getMonthData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) and MONTH(create_time) = MONTH(NOW()) AND YEAR(create_time) = YEAR(NOW()) |
| | | <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> |
| | | AND id IN |
| | | <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> |
| | | #{chargingOrderId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | </select> |
| | | <select id="getYearData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) and YEAR(createTime) = YEAR(NOW()) |
| | | <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> |
| | | AND id IN |
| | | <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> |
| | | #{chargingOrderId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |