机具费用推送修改

This commit is contained in:
hongchao 2025-10-20 11:29:41 +08:00
parent 4f1d529512
commit c6d84fa4f5
1 changed files with 64 additions and 11 deletions

View File

@ -49,18 +49,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.pro_name AS projectName, bu.unit_name AS unitName,cpm.id as taskId, bp.pro_name AS projectName, bu.unit_name AS unitName,cpm.id as taskId,
ROUND( ROUND(
SUM(ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.REPAIR_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 )), 2 SUM(ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.REPAIR_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 )), 2
) AS money ) AS money,
a.pushStatus AS pushStatus,
a.pushRemark AS pushRemark
FROM FROM
project_month_costs pmc project_month_costs pmc
LEFT JOIN calc_project_month cpm on pmc.task_id = cpm.id LEFT JOIN calc_project_month cpm on pmc.task_id = cpm.id
LEFT JOIN bm_agreement_info bma ON pmc.AGREEMENT_ID = bma.agreement_id LEFT JOIN bm_agreement_info bma ON pmc.AGREEMENT_ID = bma.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id
LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id
LEFT JOIN (
SELECT
pmi.agreementId,pmi.id,pmi.push_status as pushStatus,
pmi.push_remark as pushRemark
FROM calc_project_month cpm
LEFT JOIN project_month_info pmi ON pmi.taskId = cpm.id
WHERE cpm.`MONTH` = #{month} GROUP BY pmi.agreementId
UNION
SELECT
bma.agreement_id AS agreementId,
sad.id,sad.push_status as pushStatus,
sad.push_remark as pushRemark
FROM
slt_agreement_details sad
left join slt_agreement_apply saa on sad.apply_id = saa.id
LEFT JOIN bm_agreement_info bma ON bma.agreement_id = saa.agreement_id
WHERE LEFT(saa.create_time,7) = #{month} AND sad.slt_type = 2
GROUP BY bma.agreement_id
UNION
SELECT
bma.agreement_id AS agreementId,
sad.id,sad.push_status as pushStatus,
sad.push_remark as pushRemark
FROM
slt_agreement_details sad
left join slt_agreement_apply saa on sad.apply_id = saa.id
LEFT JOIN bm_agreement_info bma ON bma.agreement_id = saa.agreement_id
WHERE LEFT(saa.create_time,7) = #{month} AND sad.slt_type = 3 and sad.is_charge = 1
GROUP BY bma.agreement_id
UNION
SELECT
bma.agreement_id AS agreementId,
sad.id,sad.push_status as pushStatus,
sad.push_remark as pushRemark
FROM
slt_agreement_details sad
left join slt_agreement_apply saa on sad.apply_id = saa.id
LEFT JOIN bm_agreement_info bma ON bma.agreement_id = saa.agreement_id
WHERE LEFT(saa.create_time,7) = #{month} AND sad.slt_type = 4 and sad.is_charge = 1
GROUP BY bma.agreement_id
) a ON
pmc.AGREEMENT_ID = a.agreementId
WHERE WHERE
pmc.type = 1 and pmc.type = 1 and
( pmc.LEASE_MONEY > 0 OR pmc.LOST_MONEY > 0 OR pmc.REPAIR_MONEY > 0 OR pmc.SCRAP_MONEY > 0 ) ( pmc.LEASE_MONEY > 0 OR pmc.LOST_MONEY > 0 OR pmc.REPAIR_MONEY > 0 OR pmc.SCRAP_MONEY > 0 )
<if test="checkStatus != null"> <if test="pushStatus != null">
AND pmc.check_status = #{checkStatus} AND a.pushStatus = #{pushStatus}
</if> </if>
<if test="agreementCode != null and agreementCode != ''"> <if test="agreementCode != null and agreementCode != ''">
AND bma.agreement_code LIKE CONCAT('%',#{agreementCode},'%') AND bma.agreement_code LIKE CONCAT('%',#{agreementCode},'%')
@ -83,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY GROUP BY
pmc.AGREEMENT_ID, pmc.TYPE pmc.AGREEMENT_ID, pmc.TYPE
order by a.pushStatus,bma.agreement_code
</select> </select>
<insert id="insertCalcMonthRecord" parameterType="com.bonus.material.push.domain.IwsCostPushBean" useGeneratedKeys="true" keyProperty="taskId"> <insert id="insertCalcMonthRecord" parameterType="com.bonus.material.push.domain.IwsCostPushBean" useGeneratedKeys="true" keyProperty="taskId">
@ -526,7 +576,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach collection="agreementIds" item="item" open="(" close=")" separator=","> <foreach collection="agreementIds" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
<if test="type != null"> <if test="type != null and (type == 3 or type ==4)">
and sad.slt_type = #{type} and sad.is_charge = 1
</if>
<if test="type != null and (type == 1 or type ==2)">
and sad.slt_type = #{type} and sad.slt_type = #{type}
</if> </if>
<if test="settlementType != null"> <if test="settlementType != null">