|
@@ -219,6 +219,16 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getNoOpenAmountCountByDay" resultType="java.lang.Integer">
|
|
|
+ select count(1) as num
|
|
|
+ from sc_device scd
|
|
|
+ left join pay_amount_waterusedamount_day amount on amount.watermeter_id = scd.id
|
|
|
+ and amount.read_date =DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day) ,'%Y%m%d')
|
|
|
+ where scd.status =1 and amount.id is null
|
|
|
+ <if test="customerId!= null" >and scd.customer_id = #{customerId} </if>
|
|
|
+ <if test="siteId!= null" > and scd.site_id = #{siteId} </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getAllAmountRecord" resultType="com.bz.smart_city.dto.pay.AmountWaterUsedAmountDto">
|
|
|
select amount.id,
|
|
|
amount.lastreading,
|
|
@@ -391,6 +401,64 @@
|
|
|
limit 500
|
|
|
</insert>
|
|
|
|
|
|
+ <insert id ="createdNoOpenAmountByDay" useGeneratedKeys="false">
|
|
|
+ INSERT INTO pay_amount_waterusedamount_day (
|
|
|
+ customerandmeterrela_id,
|
|
|
+ office_id,
|
|
|
+ lastreading,
|
|
|
+ lastrecorddate,
|
|
|
+ metercode,
|
|
|
+ watermeter_id,
|
|
|
+ payamount,
|
|
|
+ reading,
|
|
|
+ recorddate,
|
|
|
+ amount,
|
|
|
+ waterproperty_id,
|
|
|
+ account_id,
|
|
|
+ create_by,
|
|
|
+ create_date,
|
|
|
+ update_by,
|
|
|
+ update_date,
|
|
|
+ remarks,
|
|
|
+ del_flag,
|
|
|
+ site_id,
|
|
|
+ customer_id,
|
|
|
+ read_date,
|
|
|
+ debt
|
|
|
+ ) SELECT
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ c.metercode,
|
|
|
+ c.id,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ 1,
|
|
|
+ NOW(),
|
|
|
+ 1,
|
|
|
+ now(),
|
|
|
+ '每天抄表计划',
|
|
|
+ 0,
|
|
|
+ c.site_id,
|
|
|
+ c.customer_id,
|
|
|
+ DATE_FORMAT( DATE_SUB( now(), INTERVAL 1 DAY ), '%Y%m%d' ),
|
|
|
+ NULL
|
|
|
+ FROM
|
|
|
+ sc_device c
|
|
|
+ LEFT JOIN pay_amount_waterusedamount_day amount ON amount.watermeter_id = c.id
|
|
|
+ AND amount.read_date = DATE_FORMAT( DATE_SUB( now(), INTERVAL 1 DAY ), '%Y%m%d' )
|
|
|
+ WHERE
|
|
|
+ amount.id IS NULL
|
|
|
+ <if test="customerId!= null" >AND c.customer_id = #{customerId}</if>
|
|
|
+ <if test="siteId!= null" > and c.site_id = #{siteId} </if>
|
|
|
+ limit 500
|
|
|
+ </insert>
|
|
|
+
|
|
|
<resultMap id="MeterReadRecordResultMap" type="com.bz.smart_city.dto.pay.MeterReadRecordDto">
|
|
|
<result column="device_id" property="deviceId" />
|
|
|
<result column="read_time" property="readTime" />
|
|
@@ -467,6 +535,25 @@
|
|
|
<if test="siteId!= null" > and rela.site_id = #{siteId} </if>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getNoOpenAmountRecordByDay" resultType="com.bz.smart_city.entity.pay.AmountWaterUsedAmountByDay">
|
|
|
+ select amount.id,
|
|
|
+ amount.lastreading,
|
|
|
+ amount.lastrecorddate,
|
|
|
+ rela.calculateway,
|
|
|
+ rela.fixedamount,
|
|
|
+ amount.watermeter_id watermeterId,
|
|
|
+ amount.recorddate,
|
|
|
+ rela.id customerandmeterrelaId,
|
|
|
+ amount.waterproperty_id waterpropertyId,
|
|
|
+ rela.account_id as accountId
|
|
|
+ from pay_amount_waterusedamount_day amount
|
|
|
+ left join pay_base_customerandmeterrela rela on rela.id= amount.customerandmeterrela_id
|
|
|
+ where amount.read_date =DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day) ,'%Y%m%d')
|
|
|
+ and rela.id is null
|
|
|
+ <if test="customerId!= null" > and amount.customer_id =#{customerId}</if>
|
|
|
+ <if test="siteId!= null" > and amount.site_id = #{siteId} </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getWaterMeterIdByDay" resultType="java.math.BigInteger">
|
|
|
select
|
|
|
amount.watermeter_id
|
|
@@ -477,6 +564,17 @@
|
|
|
<if test="siteId!= null" > and amount.site_id = #{siteId} </if>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getNoOpenWaterMeterIdByDay" resultType="java.math.BigInteger">
|
|
|
+ select scd.id
|
|
|
+ from sc_device scd
|
|
|
+ left join pay_amount_waterusedamount_day amount on amount.watermeter_id = scd.id
|
|
|
+ and amount.read_date =DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day) ,'%Y%m%d')
|
|
|
+ left join pay_base_customerandmeterrela pba on pba.watermeter_id = scd.id
|
|
|
+ where scd.status =1 and amount.reading is null and pba.id is null
|
|
|
+ <if test="customerId!= null" >and scd.customer_id = #{customerId} </if>
|
|
|
+ <if test="siteId!= null" > and scd.site_id = #{siteId} </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getCustIdAndSiteId" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
|
|
|
select
|
|
|
c.customer_id customerId,
|
|
@@ -487,6 +585,16 @@
|
|
|
group by c.customer_id, c.site_id
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getCustIdAndSiteIdByDevice" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
|
|
|
+ select
|
|
|
+ c.customer_id customerId,
|
|
|
+ c.site_id siteId
|
|
|
+ from sc_device c
|
|
|
+ where c.status =1
|
|
|
+ and c.customer_id is not null and c.site_id is not null
|
|
|
+ group by c.customer_id, c.site_id
|
|
|
+ </select>
|
|
|
+
|
|
|
<resultMap id="ReplaceMeterMap" type="com.bz.smart_city.dto.pay.ReplaceMeterDto">
|
|
|
|
|
|
</resultMap>
|