You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

630 lines
29 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.charge.task.dao.EquipmentChargeOrderDOMapper">
<resultMap id="BaseResultMap" type="com.charge.task.model.EquipmentChargeOrderDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="company_id" jdbcType="BIGINT" property="companyId" />
<result column="station_id" jdbcType="BIGINT" property="stationId" />
<result column="equipment_id" jdbcType="BIGINT" property="equipmentId" />
<result column="connector_id" jdbcType="BIGINT" property="connectorId" />
<result column="user_card_no" jdbcType="VARCHAR" property="userCardNo" />
<result column="state" jdbcType="TINYINT" property="state" />
<result column="operate_state" jdbcType="TINYINT" property="operateState" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="order_type" jdbcType="TINYINT" property="orderType" />
<result column="order_time" jdbcType="TIMESTAMP" property="orderTime" />
<result column="charge_begin_time" jdbcType="TIMESTAMP" property="chargeBeginTime" />
<result column="charge_end_time" jdbcType="TIMESTAMP" property="chargeEndTime" />
<result column="charge_begin_degree" jdbcType="DOUBLE" property="chargeBeginDegree" />
<result column="charge_end_degree" jdbcType="DOUBLE" property="chargeEndDegree" />
<result column="charge_degree" jdbcType="DOUBLE" property="chargeDegree" />
<result column="charge_ah" jdbcType="DOUBLE" property="chargeAh" />
<result column="charge_times_degree" jdbcType="VARCHAR" property="chargeTimesDegree" />
<result column="charge_begin_soc" jdbcType="INTEGER" property="chargeBeginSoc" />
<result column="charge_end_soc" jdbcType="INTEGER" property="chargeEndSoc" />
<result column="charge_cur_soc" jdbcType="INTEGER" property="chargeCurSoc" />
<result column="charge_duration" jdbcType="INTEGER" property="chargeDuration" />
<result column="charge_settle_type" jdbcType="TINYINT" property="chargeSettleType" />
<result column="charge_unit_price" jdbcType="DECIMAL" property="chargeUnitPrice" />
<result column="charge_unit_cost" jdbcType="DECIMAL" property="chargeUnitCost" />
<result column="charge_unit_service_fee" jdbcType="DECIMAL" property="chargeUnitServiceFee" />
<result column="receivable_electric_fee" jdbcType="DECIMAL" property="receivableElectricFee" />
<result column="receivable_service_fee" jdbcType="DECIMAL" property="receivableServiceFee" />
<result column="receivable_total_fee" jdbcType="DECIMAL" property="receivableTotalFee" />
<result column="charge_elecfee_amount" jdbcType="DECIMAL" property="chargeElecfeeAmount" />
<result column="charge_elecfee_cost_amount" jdbcType="DECIMAL" property="chargeElecfeeCostAmount" />
<result column="charge_service_amount" jdbcType="DECIMAL" property="chargeServiceAmount" />
<result column="actual_pay_amount" jdbcType="DECIMAL" property="actualPayAmount" />
<result column="activity_total_fee" jdbcType="BIGINT" property="activityTotalFee" />
<result column="company_activity_id" jdbcType="BIGINT" property="companyActivityId" />
<result column="company_activity_name" jdbcType="VARCHAR" property="companyActivityName" />
<result column="company_activity_total_fee" jdbcType="DECIMAL" property="companyActivityTotalFee" />
<result column="company_activity_service_fee" jdbcType="DECIMAL" property="companyActivityServiceFee" />
<result column="company_activity_electric_fee" jdbcType="DECIMAL" property="companyActivityElectricFee" />
<result column="subsidy_degree" jdbcType="DECIMAL" property="subsidyDegree" />
<result column="subsidy_fee" jdbcType="DECIMAL" property="subsidyFee" />
<result column="coupon_total_amount" jdbcType="DECIMAL" property="couponTotalAmount" />
<result column="coupon_service_total_amount" jdbcType="DECIMAL" property="couponServiceTotalAmount" />
<result column="coupon_elecfee_total_amount" jdbcType="DECIMAL" property="couponElecfeeTotalAmount" />
<result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo" />
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
<result column="pay_method" jdbcType="TINYINT" property="payMethod" />
<result column="pay_status" jdbcType="TINYINT" property="payStatus" />
<result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
<result column="platform_order_no" jdbcType="VARCHAR" property="platformOrderNo" />
<result column="user_coupon_id" jdbcType="BIGINT" property="userCouponId" />
<result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
<result column="coupon_type" jdbcType="TINYINT" property="couponType" />
<result column="coupon_amount" jdbcType="DECIMAL" property="couponAmount" />
<result column="elecfee_coupon_amount" jdbcType="DECIMAL" property="elecfeeCouponAmount" />
<result column="servicefee_coupon_amount" jdbcType="DECIMAL" property="servicefeeCouponAmount" />
<result column="invoice_id" jdbcType="BIGINT" property="invoiceId" />
<result column="invoice_fee" jdbcType="DECIMAL" property="invoiceFee" />
<result column="ticket_status" jdbcType="TINYINT" property="ticketStatus" />
<result column="activity_electric_fee" jdbcType="DECIMAL" property="activityElectricFee" />
<result column="activity_service_fee" jdbcType="DECIMAL" property="activityServiceFee" />
<result column="charge_plate_no" jdbcType="VARCHAR" property="chargePlateNo" />
<result column="charge_vin" jdbcType="VARCHAR" property="chargeVin" />
<result column="charge_strategy" jdbcType="VARCHAR" property="chargeStrategy" />
<result column="charge_strategy_param" jdbcType="VARCHAR" property="chargeStrategyParam" />
<result column="operator_id" jdbcType="BIGINT" property="operatorId" />
<result column="operator_income" jdbcType="DECIMAL" property="operatorIncome" />
<result column="plat_service_fee" jdbcType="DECIMAL" property="platServiceFee" />
<result column="charge_discount_type" jdbcType="TINYINT" property="chargeDiscountType" />
<result column="settle_electric_fee" jdbcType="DECIMAL" property="settleElectricFee" />
<result column="settle_service_fee" jdbcType="DECIMAL" property="settleServiceFee" />
<result column="settle_fee" jdbcType="DECIMAL" property="settleFee" />
<result column="settle_method" jdbcType="TINYINT" property="settleMethod" />
<result column="settle_coupon_amount" jdbcType="DECIMAL" property="settleCouponAmount" />
<result column="settle_coupon_electric_fee" jdbcType="DECIMAL" property="settleCouponElectricFee" />
<result column="settle_coupon_service_fee" jdbcType="DECIMAL" property="settleCouponServiceFee" />
<result column="settle_status" jdbcType="TINYINT" property="settleStatus" />
<result column="cancel_type" jdbcType="INTEGER" property="cancelType" />
<result column="cancel_code" jdbcType="INTEGER" property="cancelCode" />
<result column="cancel_msg" jdbcType="VARCHAR" property="cancelMsg" />
<result column="cancel_time" jdbcType="TIMESTAMP" property="cancelTime" />
<result column="finish_type" jdbcType="INTEGER" property="finishType" />
<result column="finish_code" jdbcType="INTEGER" property="finishCode" />
<result column="finish_msg" jdbcType="VARCHAR" property="finishMsg" />
<result column="finish_time" jdbcType="TIMESTAMP" property="finishTime" />
<result column="boot_mode" jdbcType="TINYINT" property="bootMode" />
<result column="settlement_type" jdbcType="TINYINT" property="settlementType" />
<result column="is_parking_coupon" jdbcType="TINYINT" property="isParkingCoupon" />
<result column="control_source" jdbcType="VARCHAR" property="controlSource" />
<result column="exception_flag" jdbcType="TINYINT" property="exceptionFlag" />
<result column="report_time" jdbcType="TIMESTAMP" property="reportTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="equipment_sn" jdbcType="VARCHAR" property="equipmentSn" />
<result column="equipment_no" jdbcType="VARCHAR" property="equipmentNo" />
<result column="special_channel_order_source" jdbcType="TINYINT" property="specialChannelOrderSource" />
</resultMap>
<!--查询超时订单 状态 0,1-->
<!--<select id="queryTimeOutOrderToStateOneAndTwo" resultMap="BaseResultMap">-->
<!--SELECT-->
<!--eco.*-->
<!--FROM-->
<!--t_equipment_charge_order eco-->
<!--WHERE-->
<!--eco.state BETWEEN 0 AND 1-->
<!--<![CDATA[ AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(eco.order_time) > 120 ]]>-->
<!--</select>-->
<select id="queryTimeOutOrderToStateOneAndTwo" parameterType="String" resultMap="BaseResultMap">
SELECT
eco.*
FROM
t_equipment_charge_order eco
WHERE
eco.state BETWEEN 0 AND 1
<![CDATA[ AND eco.order_time < #{time} ]]>
</select>
<!--查询超时订单 状态为2的-->
<!-- <select id="queryTimeOutOrderToStateTwo" resultMap="BaseResultMap">
SELECT
eco.*
FROM
t_equipment_charge_order eco
WHERE
eco.state = 2
<![CDATA[ AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(eco.charge_begin_time) > 86400 ]]>
</select>-->
<select id="queryTimeOutOrderToStateTwo" parameterType="String" resultMap="BaseResultMap">
SELECT
eco.*
FROM
t_equipment_charge_order eco
WHERE
eco.state = 2
<![CDATA[AND eco.order_time < #{time} ]]>
</select>
<!--查询超时订单 状态为2的 并且充电开始时间或者结束时间为空-->
<!--<select id="queryTimeOutToChargeTimeIsNull" resultMap="BaseResultMap">-->
<!--SELECT-->
<!--eco.*-->
<!--FROM-->
<!--t_equipment_charge_order eco-->
<!--WHERE-->
<!--eco.state = 2-->
<!--AND eco.charge_begin_time IS NULL-->
<!--<![CDATA[ AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(eco.order_time) > 180 ]]>-->
<!--</select>-->
<select id="queryTimeOutToChargeTimeIsNull" parameterType="String" resultMap="BaseResultMap">
SELECT
eco.*
FROM
t_equipment_charge_order eco
WHERE
eco.state = 2
AND eco.charge_begin_time IS NULL
<![CDATA[ AND eco.order_time < #{time} ]]>
</select>
<!--查询(互通互联)在充电中订单号-->
<select id="queryPlatformChargeingOrderNo" parameterType="String" resultType="String">
SELECT
eco.order_no
FROM
t_equipment_charge_order eco
LEFT JOIN t_platform p ON p.platform_to_user_id = eco.user_id
WHERE
p.platform_code = #{platformCode}
AND eco.state BETWEEN 1 AND 2
</select>
<!--查询政府平台(互通互联)在充电中订单号-->
<select id="queryPlatformtPtChargeingOrderNo" parameterType="String" resultType="String">
SELECT
eco.order_no
FROM
t_equipment_charge_order eco
LEFT JOIN t_equipment e ON e.id = eco.equipment_id
LEFT JOIN t_platform_open_station pos ON pos.platform_open_stationid = e.station_id
LEFT JOIN t_platform p ON p.id = pos.platform_id
WHERE
p.platform_code = #{platformCode}
AND eco.state BETWEEN 1 AND 2
</select>
<!--查询未保存到推送给第三方平台订单表中的订单 进行二次推送-->
<select id="selectNoPushOneMorePush" parameterType="String" resultType="String">
SELECT
oco.equipment_charge_orderno AS needPushOrderNo
FROM
t_openapi_charge_order oco
LEFT JOIN t_openapi_notify_order_info onri ON oco.equipment_charge_orderno = onri.order_no
LEFT JOIN t_equipment_charge_order eco on eco.order_no = oco.equipment_charge_orderno
LEFT JOIN t_platform p ON p.platform_to_user_id = eco.user_id
WHERE
<![CDATA[ DATE_FORMAT(eco.create_time, '%Y-%m-%d %H:%i:%s') >= '2019-06-25 00:00:00' ]]>
AND onri.order_no IS NULL
AND p.platform_code = #{platformCode}
AND eco.state = 3
</select>
<select id="queryOpenapiNeedOrderInfoByOrderNo" parameterType="String" resultMap="startChargeResultBO">
SELECT
eco.state,
DATE_FORMAT(eco.charge_begin_time, '%Y-%m-%d %H:%i:%s')AS charge_begin_time,
DATE_FORMAT(eco.charge_end_time, '%Y-%m-%d %H:%i:%s')AS charge_end_time,
IFNULL(eco.charge_degree,0)AS charge_degree,
eco.charge_elecfee_amount,
eco.charge_service_amount,
IFNULL(eco.actual_pay_amount,0)AS actual_pay_amount,
c.connector_no,
c.connector_sn,
oco.openapi_charge_orderno,
oco.operatorcode,
e.equipment_sn,
(CASE
WHEN COUNT(ecod.id) = 0 THEN 1
ELSE
COUNT(ecod.id) END
) AS sumPeriod,
DATE_FORMAT(eco.create_time, '%Y-%m-%d %H:%i:%s')AS create_time,
eco.charge_begin_degree,
eco.charge_end_degree,
eco.charge_vin
FROM
t_equipment_charge_order eco
LEFT JOIN t_openapi_charge_order oco ON eco.order_no = oco.equipment_charge_orderno
LEFT JOIN t_connector c ON eco.connector_id = c.id
LEFT JOIN t_equipment e ON eco.equipment_id = e.id
LEFT JOIN t_equipment_charge_order_detail ecod ON ecod.order_no = eco.order_no
WHERE
eco.order_no = #{orderNo}
</select>
<resultMap id="startChargeResultBO" type="com.charge.task.model.StartChargeResultBO">
<result column="state" jdbcType="INTEGER" property="startChargeSeqStat" />
<result column="charge_begin_time" jdbcType="VARCHAR" property="beginTime" />
<result column="charge_end_time" jdbcType="VARCHAR" property="endTime" />
<result column="connector_sn" jdbcType="VARCHAR" property="connectorID" />
<result column="openapi_charge_orderno" jdbcType="VARCHAR" property="openApiChargeOrderno" />
<result column="operatorcode" jdbcType="VARCHAR" property="operatorCode" />
<result column="equipment_sn" jdbcType="VARCHAR" property="equipmentSn" />
<result column="connector_no" jdbcType="VARCHAR" property="connectorNo" />
<result column="charge_degree" jdbcType="DOUBLE" property="chargeDegree" />
<result column="charge_elecfee_amount" jdbcType="DOUBLE" property="chargeElecfeeAmount" />
<result column="charge_service_amount" jdbcType="DOUBLE" property="chargeServiceAmount" />
<result column="actual_pay_amount" jdbcType="DOUBLE" property="actualPayAmount" />
<result column="sumPeriod" jdbcType="INTEGER" property="sumPeriod" />
<result column="create_time" jdbcType="VARCHAR" property="startTime" />
<result column="charge_degree" jdbcType="DOUBLE" property="chargeDegree" />
<result column="charge_begin_degree" jdbcType="DOUBLE" property="chargeBeginDegree" />
<result column="charge_end_degree" jdbcType="DOUBLE" property="chargeEndDegree" />
<result column="charge_vin" jdbcType="VARCHAR" property="chargeVin" />
</resultMap>
<!--曹操-->
<select id="caoCaoNotifyOrderInfoByOrderNo" parameterType="String" resultMap="notifyOrderInfoByorderNo">
SELECT
eco.order_no AS orderId,
e.equipment_sn AS stubId,
oco.openapi_charge_orderno AS outOrderId,
oco.driver_id AS driverId,
eco.charge_begin_time AS timeStart,
eco.charge_end_time AS timeEnd,
IFNULL(ROUND(eco.charge_duration,2),0.00) AS timeCharge,
IFNULL(ROUND(eco.actual_pay_amount, 2),0.00) AS feeTotal,
e.equipment_type AS chargeType,
IFNULL(ROUND(eco.charge_degree, 2),0.00) AS power,
c.current AS ratedCurrent,
IFNULL(eco.charge_cur_soc,0) AS soc,
eco.state AS status,
( CASE
WHEN eco.state = 3 THEN
eco.finish_msg
WHEN eco.state = 4 THEN
eco.cancel_msg
WHEN eco.state = 99 THEN
eco.finish_msg
END
)AS endInfo,
r.region_code AS cityCode,
COUNT(ecod.id)AS sumPeriod
FROM
t_equipment_charge_order eco
LEFT JOIN t_openapi_charge_order oco ON eco.order_no = oco.equipment_charge_orderno
LEFT JOIN t_equipment_charge_order_detail ecod ON ecod.order_no = eco.order_no
LEFT JOIN t_connector c ON eco.connector_id = c.id
LEFT JOIN t_equipment e ON eco.equipment_id = e.id
LEFT JOIN t_station s ON s.id = e.station_id
LEFT JOIN t_region r ON r.id = s.region_id
WHERE
eco.order_no = #{orderNo}
</select>
<resultMap id="notifyOrderInfoByorderNo" type="com.charge.task.model.CaoCaoNotify">
<result column="orderId" jdbcType="VARCHAR" property="orderId" />
<result column="stubId" jdbcType="VARCHAR" property="stubId" />
<result column="outOrderId" jdbcType="VARCHAR" property="outOrderId" />
<result column="driverId" jdbcType="VARCHAR" property="driverId" />
<result column="timeStart" jdbcType="VARCHAR" property="timeStart" />
<result column="timeEnd" jdbcType="VARCHAR" property="timeEnd" />
<result column="timeCharge" jdbcType="INTEGER" property="timeCharge" />
<result column="feeTotal" jdbcType="DOUBLE" property="feeTotal" />
<result column="chargeType" jdbcType="INTEGER" property="chargeType" />
<result column="power" jdbcType="DOUBLE" property="power" />
<result column="ratedCurrent" jdbcType="INTEGER" property="ratedCurrent" />
<result column="soc" jdbcType="INTEGER" property="soc" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="endInfo" jdbcType="VARCHAR" property="endInfo" />
<result column="cityCode" jdbcType="VARCHAR" property="cityCode" />
<result column="sumPeriod" jdbcType="INTEGER" property="sumPeriod" />
</resultMap>
<select id="queryHangUpOrder" resultMap="BaseResultMap">
SELECT
o.*
FROM
t_equipment_charge_order o left join t_station s on o.station_id = s.id
WHERE o.state = 5 and s.is_hlht &lt;> 1
<if test="startDate != null">
AND o.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND o.create_time &lt;= #{endDate}
</if>
ORDER BY o.id DESC
</select>
<select id="queryHangUpReverseOrder" resultMap="BaseResultMap">
SELECT
o.*
FROM
t_equipment_charge_order o left join t_station s on o.station_id = s.id
WHERE o.state = 5 and s.is_hlht = 1
<if test="startDate != null">
AND o.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND o.create_time &lt;= #{endDate}
</if>
ORDER BY o.id DESC
</select>
<select id="queryAbnormalOrder" resultMap="BaseResultMap">
SELECT
u.*
FROM
t_equipment_charge_order u
WHERE state = 3 and pay_status = 0 and u.order_no not in (select order_no from t_equipment_charge_order_detail where order_no is not null)
and u.order_no in (select order_id from t_account_water) and create_time >= '2022-04-25 00:00:00'
</select>
<select id="queryOrderNoToRedis" resultType="com.charge.task.model.RedisOrderNo">
SELECT
eco.order_no AS orderNo
FROM
`t_equipment_charge_order` eco
WHERE
eco.`report_time` >= '2021-06-24 00:00:00'
AND eco.`report_time` &lt;= '2021-12-31 23:59:59'
AND eco.`state` = 3
AND eco.station_id IN (2,4,10,34,37,38,44,42,47,46,48,83,84,85)
</select>
<select id="getWaterCountByOrderNo" resultType="java.lang.Integer">
select count(*) from t_account_water where order_id = #{orderNo} and type = 1
</select>
<select id="queryChargeOrderByOrderNo" resultMap="BaseResultMap" >
SELECT
eco.*
FROM
t_equipment_charge_order eco
WHERE
eco.order_no = #{orderNo}
ORDER BY
eco.id DESC
LIMIT 0,1
</select>
<select id="getRefreshPriceRule" resultType="com.charge.task.dto.PriceRuleDetailDTO" >
select
eq.`equipment_sn` as equipmentSn,
tept.start_time as startTime,
tept.end_time as endTime,
tept.total_fee as totalPrice
from `t_equipment` eq
left join t_equipment_pricing_rule ter on eq.id = ter.`equipment_id`
left join t_equipment_pricing_rule_time tept on ter.id= tept. equipment_pricing_rule_id
where tept.id is not null ORDER BY eq.`id`
</select>
<select id="queryChargeTimesDegree" resultType="java.lang.String">
SELECT
charge_times_degree
FROM
t_equipment_charge_order eco
WHERE
eco.station_id = #{stationId}
AND eco.state = 3
AND eco.charge_begin_time >= #{startTime}
AND eco.charge_begin_time &lt;= #{endTime}
AND eco.charge_degree > 0
</select>
<select id="queryStationChargeTime" resultType="com.charge.task.model.TimeDegreeDTO">
SELECT
eco.station_id stationId
, eco.company_id AS companyId,
eco.charge_degree chargeDegree,
eco.charge_times_degree as chargeTimesDegree,
eco.charge_begin_time as chargeBeginTime,
eco.charge_end_time as chargeEndTime
FROM t_equipment_charge_order eco
LEFT JOIN t_station s on eco.station_id = s.id
WHERE
eco.state= 3
AND s.is_hlht = 0
AND (
(eco.charge_begin_time BETWEEN #{beginTimeMin} AND #{beginTimeMax})
and (eco.charge_end_time BETWEEN #{endTimeMin} AND #{endTimeMax})
)
and eco.`charge_degree` > 0
</select>
<update id="editeOrderState">
update t_equipment_charge_order
set state=#{state},cancel_type=3,cancel_code=5,cancel_time=#{cancelTime},
cancel_msg=#{msg}
where order_no=#{orderNo}
</update>
<update id="setPatchStateByOrderNo">
UPDATE t_equipment_charge_order
SET state = 6
WHERE
order_no = #{orderNo}
</update>
<select id="queryCompanyRouteChargeToTimeFlag" resultType="com.charge.task.dto.CompanyRouteChargeTimeFlagDTO">
SELECT
co.company_name AS companyName,
eco.company_id AS companyId,
eco.station_id AS stationId,
s.station_name AS stationName,
sum( ecod.charge_degree ) AS chargeDegree,
sum( ecod.service_fee ) AS serviceFee,
sum( ecod.electric_fee ) AS electricFee,
sum((ecod.service_fee + ecod.electric_fee )) AS totalFee,
ecod.time_flag AS timeFlag,
DATE_FORMAT(ecod.charge_startr_time, '%Y-%m-%d' ) AS timeDay,
DATE_FORMAT(ecod.charge_startr_time, '%Y-%m' ) AS timeMonth,
c.car_bus_path AS carBusPath
FROM
t_equipment_charge_order eco
LEFT JOIN t_equipment_charge_order_detail ecod ON eco.order_no = ecod.order_no
LEFT JOIN t_station s ON eco.station_id = s.id
LEFT JOIN t_car c ON c.car_vin = eco.charge_vin
LEFT JOIN t_company co ON co.id = eco.company_id
WHERE
eco.state = 3
AND s.is_hlht = 0
AND eco.order_type = 3
AND eco.charge_settle_type = 2
AND c.car_type = 1
AND c.car_business = 1
AND ecod.time_flag = #{timeFlag}
AND ecod.charge_startr_time BETWEEN #{startTime} AND #{endTime}
GROUP BY
ecod.time_flag,
eco.station_id,
eco.company_id,
c.car_bus_path
</select>
<select id="queryCompanyRouteChargeToTimeInterval" resultType="com.charge.task.dto.CompanyRouteChargeTimeFlagDTO">
SELECT
co.company_name AS companyName,
eco.company_id AS companyId,
eco.station_id AS stationId,
s.station_name AS stationName,
sum( ecod.charge_degree ) AS chargeDegree,
sum( ecod.service_fee ) AS serviceFee,
sum( ecod.electric_fee ) AS electricFee,
sum((ecod.service_fee + ecod.electric_fee )) AS totalFee,
DATE_FORMAT( ecod.charge_startr_time, '%Y-%m-%d' ) AS timeDay,
DATE_FORMAT( ecod.charge_startr_time, '%H' ) AS timeHour,
c.car_bus_path AS carBusPath
FROM
t_equipment_charge_order eco
LEFT JOIN t_equipment_charge_order_detail ecod ON eco.order_no = ecod.order_no
LEFT JOIN t_station s ON eco.station_id = s.id
LEFT JOIN t_car c ON c.car_vin = eco.charge_vin
LEFT JOIN t_company co ON co.id = eco.company_id
WHERE
eco.state = 3
AND s.is_hlht = 0
AND eco.order_type = 3
AND eco.charge_settle_type = 2
AND c.car_type = 1
AND c.car_business = 1
AND ecod.charge_startr_time BETWEEN #{startTime} AND #{endTime}
GROUP BY
eco.station_id,
eco.company_id,
c.car_bus_path,
DATE_FORMAT( ecod.charge_startr_time, '%H')
</select>
<select id="getChannelOrder" resultType="com.charge.task.model.EquipmentChargeOrderDO">
select id,
order_no as orderNo,
station_id as stationId
from t_equipment_charge_order eco
where state = 3
and order_type = 4
and pay_status = 2
and eco.charge_begin_time >= #{startDate}
and eco.charge_begin_time &lt;= #{endDate}
</select>
<select id="getOrderByDate" resultMap="BaseResultMap">
select eco.*,eq.equipment_sn,eq.equipment_no
from t_equipment_charge_order eco
left JOIN t_equipment eq on eq.id = eco.equipment_id
LEFT JOIN t_station s ON s.id = eco.station_id
where state = 3
and eco.charge_begin_time >= #{startDate}
and eco.charge_begin_time &lt;= #{endDate}
<if test="operatorIdList !=null">
AND s.`operator_id` IN
<foreach close=")" collection="operatorIdList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
order by id asc
Limit #{limit} offset #{offset}
</select>
<resultMap id="OperatorHlhtConfigMap" type="com.charge.task.model.OperatorHlhtConfigDO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="operator_sn" property="operatorSn" jdbcType="VARCHAR"/>
<result column="company_name" property="companyName" jdbcType="VARCHAR"/>
<result column="contact_name" property="contactName" jdbcType="VARCHAR"/>
<result column="contact_phone" property="contactPhone" jdbcType="VARCHAR"/>
<result column="operator_secret" property="operatorSecret" jdbcType="VARCHAR"/>
<result column="data_secret" property="dataSecret" jdbcType="VARCHAR"/>
<result column="data_secret_iv" property="dataSecretIv" jdbcType="VARCHAR"/>
<result column="sig_secret" property="sigSecret" jdbcType="VARCHAR"/>
<result column="url_address" property="urlAddress" jdbcType="VARCHAR"/>
<result column="monitor_platform_code" property="monitorPlatformCode" jdbcType="VARCHAR"/>
<result column="monitor_operator_secret" property="monitorOperatorSecret" jdbcType="VARCHAR"/>
<result column="monitor_data_secret" property="monitorDataSecret" jdbcType="VARCHAR"/>
<result column="monitor_data_secret_iv" property="monitorDataSecretIv" jdbcType="VARCHAR"/>
<result column="monitor_sig_secret" property="monitorSigSecret" jdbcType="VARCHAR"/>
<result column="company_user_id" property="companyUserId" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="TINYINT"/>
<result column="settle_type" property="settleType" jdbcType="TINYINT"/>
<result column="service_fee_discount" property="serviceFeeDiscount" jdbcType="DECIMAL"/>
<result column="status" property="status" jdbcType="TINYINT"/>
<result column="open_station" property="openStation" jdbcType="VARCHAR"/>
<result column="is_client" property="isClient" jdbcType="TINYINT"/>
<result column="is_monitor" property="isMonitor" jdbcType="TINYINT"/>
<result column="is_check_order" property="isCheckOrder" jdbcType="TINYINT"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
</resultMap>
<select id="queryOperatorHlhtConfigByOpenStation" resultMap="OperatorHlhtConfigMap">
SELECT
*
FROM
`t_operator_hlht_config`
WHERE
FIND_IN_SET( #{stationId}, open_station )
AND is_monitor = 1
AND status =0
</select>
<select id="queryProvincialOpenStation" resultType="java.lang.Integer">
SELECT
count( * )
FROM
`t_operator_hlht_config`
WHERE
FIND_IN_SET( #{stationId}, open_station )
AND STATUS = 0
AND is_monitor_upgrade = 1
</select>
<select id="getReverseFinishTime" resultType="java.lang.String">
select value from t_biz_parameter
where state = 1
and code = #{code} order by id desc limit 1
</select>
<select id="selectCountByDate" resultType="java.lang.Long">
select count(1)
from t_equipment_charge_order eco
LEFT JOIN t_station s ON s.id = eco.station_id
where state = 3
and eco.charge_begin_time >= #{beginTime}
and eco.charge_begin_time &lt;= #{endTime}
<if test="operatorIdList !=null">
AND s.`operator_id` IN
<foreach close=")" collection="operatorIdList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="queryInSettlementOrder" resultMap="BaseResultMap">
SELECT
o.*
FROM
t_equipment_charge_order o left join t_station s on o.station_id = s.id
WHERE o.state = 7 and o.pay_status <![CDATA[<>]]> 2 and s.is_hlht <![CDATA[<>]]> 1
<if test="time != null">
AND o.report_time <![CDATA[<=]]> #{time}
</if>
ORDER BY o.id DESC
</select>
</mapper>