java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml
@@ -1,19 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="feeServiceDaoImpl">
    <!-- 保存费用信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessFeeInfo" parameterType="Map">
        insert into business_pay_fee(
        amount,operate,income_obj_id,fee_type_cd,start_time,end_time,community_id,b_id,fee_id,user_id,payer_obj_id,fee_flag,state,config_id,payer_obj_type,batch_id
        ) values (
        #{amount},#{operate},#{incomeObjId},#{feeTypeCd},#{startTime},#{endTime},#{communityId},#{bId},#{feeId},#{userId},#{payerObjId},
        #{feeFlag},#{state},#{configId},#{payerObjType},#{batchId}
        )
        insert into business_pay_fee(amount, operate, income_obj_id, fee_type_cd, start_time, end_time, community_id,
                                     b_id, fee_id, user_id, payer_obj_id, fee_flag, state, config_id, payer_obj_type,
                                     batch_id)
        values (#{amount}, #{operate}, #{incomeObjId}, #{feeTypeCd}, #{startTime}, #{endTime}, #{communityId}, #{bId},
                #{feeId}, #{userId}, #{payerObjId},
                #{feeFlag}, #{state}, #{configId}, #{payerObjType}, #{batchId})
    </insert>
    <!-- 查询费用信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessFeeInfo" parameterType="Map" resultType="Map">
@@ -66,9 +64,7 @@
        <if test="payerObjType !=null and payerObjType != ''">
            and t.payer_obj_type = #{payerObjType}
        </if>
    </select>
    <!-- 保存费用信息至 instance表中 add by wuxw 2018-07-03 -->
    <insert id="saveFeeInfoInstance" parameterType="Map">
@@ -115,13 +111,10 @@
        <if test="configId !=null and configId != ''">
            and t.config_id= #{configId}
        </if>
        <if test="payerObjType !=null and payerObjType != ''">
            and t.payer_obj_type = #{payerObjType}
        </if>
    </insert>
    <!-- 查询费用信息 add by wuxw 2018-07-03 -->
    <select id="getFeeInfo" parameterType="Map" resultType="Map">
@@ -136,10 +129,12 @@
        configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle,td4.name
        billTypeName,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees curDegrees,mw.pre_degrees
        preDegrees,
        mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,pfa1.`value` maxEndTime,mw.price
        mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,pfa1.`value`
        maxEndTime,mw.price
        mwPrice,
        pfa2.`value` ownerName,t.batch_id,t.batch_id batchId,
        pfc.pay_online payOnline,pfc.scale,pfc.decimal_place decimalPlace,pfc.units,pfc.prepayment_period prepaymentPeriod,
        pfc.pay_online payOnline,pfc.scale,pfc.decimal_place decimalPlace,pfc.units,pfc.prepayment_period
        prepaymentPeriod,
        pfrb.rule_id ruleId,pfrb.month_cycle monthCycle
        from pay_fee t
        INNER join pay_fee_config pfc on t.config_id = pfc.config_id and
@@ -156,7 +151,8 @@
        LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
        left join import_fee_detail ifd on t.fee_id = ifd.fee_id and ifd.status_cd = '0' and t.fee_flag = '2006012'
        LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
        LEFT JOIN pay_fee_rule_bill pfrb on t.fee_id = pfrb.fee_id and pfrb.status_cd = '0' and pfrb.community_id = t.community_id
        LEFT JOIN pay_fee_rule_bill pfrb on t.fee_id = pfrb.fee_id and pfrb.status_cd = '0' and pfrb.community_id =
        t.community_id
        <if test="ownerId != null and ownerId != ''">
            LEFT JOIN pay_fee_attrs pfao on t.fee_id = pfao.fee_id and pfao.spec_cd = '390007' and pfao.status_cd = '0'
        </if>
@@ -237,12 +233,11 @@
        <if test="curYear !=null and curYear != ''">
            and DATE_FORMAT(t.end_time,'%Y') = #{curYear}
        </if>
        order by t.payer_obj_id,pfc.fee_name,t.end_time desc
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 修改费用信息 add by wuxw 2018-07-03 -->
    <update id="updateFeeInfoInstance" parameterType="Map">
@@ -287,7 +282,6 @@
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
        </if>
    </update>
    <!-- 查询费用数量 add by wuxw 2018-07-03 -->
@@ -382,9 +376,7 @@
        <if test="curYear !=null and curYear != ''">
            and DATE_FORMAT(t.end_time,'%Y') = #{curYear}
        </if>
    </select>
    <!-- 查询账期 -->
    <select id="queryBills" parameterType="Map" resultType="Map">
@@ -473,7 +465,6 @@
            and t.cur_bill = #{curBill}
        </if>
    </select>
    <!-- 查询账期 -->
    <select id="queryBillOweFees" parameterType="Map" resultType="Map">
@@ -586,32 +577,35 @@
        </if>
    </select>
    <insert id="insertBillOweFees" parameterType="Map">
        INSERT INTO bill_owe_fee
        (`owe_id`, `bill_id`, `fee_id`, `bill_amount_owed`, `amount_owed`, `fee_end_time`, `owner_id`, `owner_name`,
        `owner_tel`, `payer_obj_name`, `payer_obj_type`, `community_id`, `state`,deadline_time)
         `owner_tel`, `payer_obj_name`, `payer_obj_type`, `community_id`, `state`, deadline_time)
        VALUES (#{oweId}, #{billId}, #{feeId}, #{billAmountOwed}, #{amountOwed}, #{feeEndTime}, #{ownerId},
        #{ownerName},
        #{ownerTel}, #{payerObjName}, #{payerObjType}, #{communityId}, #{state},#{deadlineTime})
                #{ownerName},
                #{ownerTel}, #{payerObjName}, #{payerObjType}, #{communityId}, #{state}, #{deadlineTime})
    </insert>
    <update id="updateBillOweFees" parameterType="Map">
        update bill_owe_fee t set t.state = #{state} where t.fee_id = #{feeId} and t.community_id=#{communityId}
        and t.bill_id=#{billId}
        update bill_owe_fee t
        set t.state = #{state}
        where t.fee_id = #{feeId}
          and t.community_id = #{communityId}
          and t.bill_id = #{billId}
    </update>
    <insert id="insertBill" parameterType="Map">
        INSERT INTO bill (`bill_id`, `bill_name`, `receivable`, `receipts`, `bill_time`, `community_id`, `config_id`,
        `remark`, `cur_bill`, `cur_receivable`)
                          `remark`, `cur_bill`, `cur_receivable`)
        VALUES (#{billId}, #{billName}, #{receivable}, #{receipts}, #{billTime}, #{communityId}, #{configId},
        #{remark}, #{curBill}, #{curReceivable})
                #{remark}, #{curBill}, #{curReceivable})
    </insert>
    <update id="updateBill" parameterType="Map">
        update bill set cur_bill= 'F' where config_id = #{configId}
        update bill
        set cur_bill= 'F'
        where config_id = #{configId}
    </update>
    <!-- 查询费用数量 add by wuxw 2018-07-03 -->
    <select id="queryFeeByAttrCount" parameterType="Map" resultType="Map">
@@ -688,9 +682,7 @@
        <if test="payerObjType !=null and payerObjType != ''">
            and t.payer_obj_type = #{payerObjType}
        </if>
    </select>
    <!-- 查询费用信息 add by wuxw 2018-07-03 -->
    <select id="queryFeeByAttr" parameterType="Map" resultType="Map">
@@ -776,7 +768,6 @@
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 批量插入费用 -->
@@ -789,7 +780,6 @@
            '-1',#{item.feeId},#{item.userId},#{item.payerObjId},#{item.feeFlag},#{item.state},#{item.configId},#{item.payerObjType},#{item.batchId})
        </foreach>
    </insert>
    <select id="computeBillOweFeeCount" parameterType="Map" resultType="Map">
        select count(1) count
@@ -835,7 +825,6 @@
        </if>
    </select>
    <select id="computeEveryOweFeeCount" parameterType="Map" resultType="Map">
        select count(1) count
        from pay_fee pf
@@ -878,13 +867,12 @@
        </if>
    </select>
    <!-- 根据批次删除费用 add by wuxw 2018-07-03 -->
    <update id="deleteFeesByBatch" parameterType="Map">
        update pay_fee t set t.status_cd = '1'
        where 1=1
        and t.batch_id= #{batchId}
        and t.community_id= #{communityId}
        update pay_fee t
        set t.status_cd = '1'
        where 1 = 1
          and t.batch_id = #{batchId}
          and t.community_id = #{communityId}
    </update>
</mapper>