chengf
2026-03-11 b88a288f4f787b509463678e3cd9ccfa3f37014b
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml
@@ -136,7 +136,7 @@
        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,
        pfrb.rule_id ruleId,pfrb.month_cycle monthCycle
        pfrb.rule_id ruleId,pfrb.month_cycle monthCycle,t.is_contract_fee isContractFee,t.contract_fee contractFee
        from pay_fee t
        INNER join pay_fee_config pfc on t.config_id = pfc.config_id and
        pfc.status_cd = '0'
@@ -168,6 +168,9 @@
        <if test="incomeObjId !=null and incomeObjId != ''">
            and t.income_obj_id= #{incomeObjId}
        </if>
          <if test="feeName != null and feeName != ''">
              and pfc.fee_name = #{feeName}
          </if>
        <if test="feeTypeCd !=null and feeTypeCd != ''">
            and t.fee_type_cd= #{feeTypeCd}
        </if>
@@ -193,7 +196,7 @@
            and t.end_time &gt; #{nowDate}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
            and t.community_id in (#{communityId},'9999')
            and pfc.community_id in (#{communityId},'9999')
        </if>
        <if test="bId !=null and bId != ''">
@@ -202,8 +205,11 @@
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
        </if>
        <if test="useFeeName !=null and useFeeName != ''">
            and pfc.fee_name like '%${useFeeName}%'
        </if>
        <if test="payerObjId !=null and payerObjId != ''">
            and t.payer_obj_id= #{payerObjId}
            and (t.payer_obj_id= #{payerObjId} or t.contract_fee = #{payerObjId})
        </if>
        <if test="payerObjIds != null and payerObjIds.length > 0">
            and t.payer_obj_id in
@@ -234,6 +240,15 @@
        </if>
        <if test="curYear !=null and curYear != ''">
            and DATE_FORMAT(t.end_time,'%Y') = #{curYear}
        </if>
        <if test="contractFee != null">
            and t.contract_fee = ${contractFee}
        </if>
        <if test="useStart != null">
            and t.end_time &lt;= #{useStart}
        </if>
        <if test="useEnd != null">
            and DATE_ADD(STR_TO_DATE(pfa1.`value`, '%Y-%m-%d 23:59:59.%f'), INTERVAL 2 DAY) >= #{useEnd}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
@@ -267,12 +282,24 @@
        <if test="endTime != null">
            and STR_TO_DATE(pfa1.`value`, '%Y-%m-%d %H:%i:%s.%f') = #{endTime}
        </if>
        <if test="community_id != null and community_id != ''">  <!-- 修正原条件中的变量错误 -->
        <if test="communityId != null and communityId != ''">  <!-- 修正原条件中的变量错误 -->
            and t.community_id = #{communityId}
            and pfc.community_id in (#{communityId}, '9999')
        </if>
        <if test="payerObjId != null and payerObjId != ''">  <!-- 修正原条件中的变量错误 -->
            and t.payer_obj_id = #{payerObjId}
        </if>
        <if test="isContractFee != null">
            and t.is_contract_fee = #{isContractFee}
        </if>
        <if test="isContractFee == null">
            and t.is_contract_fee IS NULL
        </if>
        <if test="contractFee != null">
            and t.contract_fee = ${contractFee}
        </if>
        <if test="feeName != null">
            and pfc.fee_name = ${feeName}
        </if>
    </select>
@@ -315,12 +342,18 @@
        <if test="feeFlag !=null and feeFlag != ''">
            , t.fee_flag= #{feeFlag}
        </if>
        <if test="isContractFee !=null and isContractFee != ''">
            , t.is_contract_fee = #{isContractFee}
        </if>
        where 1=1
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
        </if>
        <if test="contractFee != null">
            and t.contract_fee = ${contractFee}
        </if>
    </update>
@@ -383,6 +416,7 @@
            and t.community_id= #{communityId}
            and pfc.community_id in (#{communityId},'9999')
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
@@ -412,6 +446,9 @@
        </if>
        <if test="deductFrom !=null and deductFrom != ''">
            and pfc.deduct_from = #{deductFrom}
        </if>
        <if test="contractFee != null">
            and t.contract_fee = ${contractFee}
        </if>
        <if test="curYear !=null and curYear != ''">
            and DATE_FORMAT(t.end_time,'%Y') = #{curYear}
@@ -722,6 +759,9 @@
        <if test="payerObjType !=null and payerObjType != ''">
            and t.payer_obj_type = #{payerObjType}
        </if>
        <if test="contractFee != null">
            and t.contract_fee = ${contractFee}
        </if>
    </select>
    <!-- 查询费用信息 add by wuxw 2018-07-03 -->
@@ -813,12 +853,20 @@
    <!-- 批量插入费用 -->
    <insert id="insertFees" parameterType="Map">
        insert into pay_fee (amount,status_cd,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)
        insert into pay_fee (amount,status_cd,income_obj_id,fee_type_cd,secondary_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,is_contract_fee,contract_fee,create_time)
        VALUES
        <foreach collection="payFeePos" item="item" separator=",">
            (#{item.amount},'0',#{item.incomeObjId},#{item.feeTypeCd},#{item.startTime},#{item.endTime},#{item.communityId},
            '-1',#{item.feeId},#{item.userId},#{item.payerObjId},#{item.feeFlag},#{item.state},#{item.configId},#{item.payerObjType},#{item.batchId})
            (#{item.amount},'0',#{item.incomeObjId},#{item.feeTypeCd},#{item.secondaryFeeTypeCd},#{item.startTime},#{item.endTime},#{item.communityId},
            '-1',#{item.feeId},#{item.userId},#{item.payerObjId},#{item.feeFlag},#{item.state},#{item.configId},#{item.payerObjType},#{item.batchId},#{item.isContractFee},#{item.contractFee}
            <if test="item.createTime != null and item.createTime != ''">
                ,#{item.createTime}
            </if>
            <if test="item.createTime == null or item.createTime == ''">
                ,now()
            </if>
            )
        </foreach>
    </insert>
@@ -916,4 +964,8 @@
          and t.batch_id = #{batchId}
          and t.community_id = #{communityId}
    </update>
    <select id="countValidPayFeeByConfigId" parameterType="Map" resultType="Map">
        select count(1) count from pay_fee where config_id = #{configId} and state != 2009001
    </select>
</mapper>