Refactor lease price calculations and enforce source filtering in SQL queries
This commit is contained in:
parent
c5761ebb0d
commit
27c3f54c9f
|
|
@ -700,7 +700,7 @@ public class SltAgreementInfoController extends BaseController {
|
|||
if (null == bean.getLeasePrice()) {
|
||||
bean.setLeasePrice(BigDecimal.valueOf(0.00));
|
||||
}else{
|
||||
bean.setLeasePrice(bean.getLeasePrice().setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
bean.setLeasePrice(bean.getLeasePrice().setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
|
||||
if (null == bean.getNum()) {
|
||||
|
|
@ -712,7 +712,7 @@ public class SltAgreementInfoController extends BaseController {
|
|||
BigDecimal leasePrice = bean.getLeasePrice();
|
||||
BigDecimal num = bean.getNum();
|
||||
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
|
||||
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, RoundingMode.HALF_UP);
|
||||
if(costs!=null){
|
||||
totalCost = totalCost.add(costs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,13 +61,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectSltAgreementInfoList" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo" resultMap="SltAgreementInfoResult">
|
||||
<include refid="selectSltAgreementInfoVo"/>
|
||||
<where>
|
||||
and `source` = '1'
|
||||
<if test="agreementId != null "> and agreement_id = #{agreementId}</if>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
<if test="maId != null "> and ma_id = #{maId}</if>
|
||||
<if test="num != null "> and num = #{num}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="status != null and status != ''"> and `status` = #{status}</if>
|
||||
<if test="leaseId != null "> and lease_id = #{leaseId}</if>
|
||||
<if test="backId != null "> and back_id = #{backId}</if>
|
||||
<if test="leasePrice != null "> and lease_price = #{leasePrice}</if>
|
||||
|
|
@ -170,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
lease_id = #{record.parentId}
|
||||
and type_id = #{record.typeId}
|
||||
and source = '1'
|
||||
<if test="record.maId != null">
|
||||
AND ma_id = #{record.maId}
|
||||
</if>
|
||||
|
|
@ -202,7 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND
|
||||
ma_id IS NULL
|
||||
AND
|
||||
status = '0'
|
||||
status = '0' AND source = '1'
|
||||
<if test="publishTask != null and publishTask != ''">
|
||||
AND publish_task = #{publishTask}
|
||||
</if>
|
||||
|
|
@ -336,7 +338,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
where
|
||||
sai.agreement_id = #{agreementId}
|
||||
sai.agreement_id = #{agreementId} and sai.source = '1'
|
||||
<if test="settlementType != null and settlementType != 0">
|
||||
and mt.jiju_type = #{settlementType}
|
||||
</if>
|
||||
|
|
@ -456,7 +458,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
where sai.agreement_id = #{agreementId} and sai.status = 0
|
||||
where sai.agreement_id = #{agreementId} and sai.status = 0 and sai.source = '1'
|
||||
<if test="settlementType != null and settlementType != 0">
|
||||
and mt.jiju_type = #{settlementType}
|
||||
</if>
|
||||
|
|
@ -993,6 +995,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="settlementType != null and settlementType != 0">
|
||||
and mt.jiju_type = #{settlementType}
|
||||
</if>
|
||||
and sai.source = '1'
|
||||
</where>
|
||||
) res
|
||||
GROUP BY res.agreementId,res.typeId,res.startTime,res.endTime
|
||||
|
|
@ -1032,7 +1035,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<foreach item="item" index="index" collection="agreementIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and sai.end_time is null
|
||||
and sai.end_time is null and sai.source = '1'
|
||||
<if test="settlementType != null and settlementType != 0">
|
||||
and mt.jiju_type = #{settlementType}
|
||||
</if>
|
||||
|
|
@ -1230,6 +1233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
<where>
|
||||
sai.source = '1'
|
||||
<if test="settlementType != null and settlementType != 0">
|
||||
and mt.jiju_type = #{settlementType}
|
||||
</if>
|
||||
|
|
@ -1266,6 +1270,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
<where>
|
||||
sai.source = '1'
|
||||
<if test="settlementType != null and settlementType != 0">
|
||||
and mt.jiju_type = #{settlementType}
|
||||
</if>
|
||||
|
|
@ -1303,6 +1308,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.`level` = '3'
|
||||
<where>
|
||||
bai.status = '1'
|
||||
AND sai.source = '1'
|
||||
AND mt.jiju_type = #{sltManageType}
|
||||
<if test="agreementCode != null and agreementCode != ''">
|
||||
AND bai.agreement_code LIKE concat('%',#{agreementCode},'%')
|
||||
|
|
@ -1570,7 +1576,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SET
|
||||
sai.is_slt = '1', sai.slt_time = NOW()
|
||||
WHERE
|
||||
sai.agreement_id = #{agreementId} AND mt.jiju_type = #{settlementType}
|
||||
sai.agreement_id = #{agreementId} AND mt.jiju_type = #{settlementType} AND sai.source = '1'
|
||||
</update>
|
||||
|
||||
<update id="updateMaStatusLoseByAgreementIdType">
|
||||
|
|
@ -1581,7 +1587,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
set
|
||||
mi.ma_status = '18', mi.update_time = NOW()
|
||||
where
|
||||
sai.agreement_id = #{agreementId} AND mt.jiju_type = #{settlementType}
|
||||
sai.agreement_id = #{agreementId} AND mt.jiju_type = #{settlementType} AND sai.source = '1'
|
||||
</update>
|
||||
|
||||
<select id="getUnitAndProjectByAgreementId" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue