结算接口修改

This commit is contained in:
bonus 2025-07-21 17:44:46 +08:00
parent 204924c35d
commit 953c7dcd8f
2 changed files with 76 additions and 39 deletions

View File

@ -75,7 +75,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
public List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean) { public List<SltAgreementInfo> getSltAgreementInfo4Project(SltAgreementInfo bean) {
Long userId = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltAgreementInfo4Project(bean); List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltAgreementInfo4Project(bean);
if (CollectionUtils.isNotEmpty(list)) { /* if (CollectionUtils.isNotEmpty(list)) {
// 创建一个集合来保存需要移除的元素 // 创建一个集合来保存需要移除的元素
List<SltAgreementInfo> toRemove = new ArrayList<>(); List<SltAgreementInfo> toRemove = new ArrayList<>();
for (SltAgreementInfo info : list) { for (SltAgreementInfo info : list) {
@ -89,7 +89,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
} }
// 遍历结束后统一移除元素 // 遍历结束后统一移除元素
list.removeAll(toRemove); list.removeAll(toRemove);
} }*/
return list; return list;
} }

View File

@ -256,19 +256,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert> </insert>
<select id="getLeaseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo"> <select id="getLeaseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
select sai.id, SELECT
sai.agreement_id as agreementId, res.agreementId,
bui.unit_name as unitName, res.unitName,
bp.pro_name as projectName, res.projectName,
sai.company_id as companyId, res.companyId,
sai.type_id as typeId, res.typeId,
sai.ma_id as maId, res.typeName,
mt1.type_name as typeName, res.modelName,
mt.type_name as modelName, res.mtUnitName,
mt.unit_name as mtUnitName, res.leasePrice,
sai.lease_price as leasePrice, SUM(res.num) as num,
sai.num as num, res.startTime,
DATE(sai.start_time) as startTime, res.endTime,
res.leaseDays
FROM
(
select sai.id,
sai.agreement_id as agreementId,
bui.unit_name as unitName,
bp.pro_name as projectName,
sai.company_id as companyId,
sai.type_id as typeId,
sai.ma_id as maId,
mt1.type_name as typeName,
mt.type_name as modelName,
mt.unit_name as mtUnitName,
sai.lease_price as leasePrice,
sai.num as num,
DATE(sai.start_time) as startTime,
DATE(sai.end_time) as endTime, DATE(sai.end_time) as endTime,
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
from slt_agreement_info sai from slt_agreement_info sai
@ -278,6 +294,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt on sai.type_id = mt.type_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 left join ma_type mt1 on mt.parent_id = mt1.type_id
where sai.agreement_id = #{agreementId} where sai.agreement_id = #{agreementId}
) res
GROUP BY res.typeId,res.startTime,res.endTime
</select> </select>
<select id="getRepairDetailsList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo"> <select id="getRepairDetailsList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
@ -337,7 +355,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
left join ma_type mt on rc.type_id = mt.type_id left join ma_type mt on rc.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id left join ma_type mt1 on mt.parent_id = mt1.type_id
where rc.status in ('0','1') and rc.repair_type = '1' where rc.status in ('0','1') and rc.repair_type = '3'
<if test="taskList != null and taskList.size() > 0"> <if test="taskList != null and taskList.size() > 0">
and rc.task_id in and rc.task_id in
<foreach item="task" collection="taskList" open="(" separator="," close=")"> <foreach item="task" collection="taskList" open="(" separator="," close=")">
@ -347,28 +365,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getLoseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo"> <select id="getLoseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
select sai.id,
sai.agreement_id as agreementId, SELECT
bui.unit_name as unitName, res.agreementId,
bp.pro_name as projectName, res.unitName,
sai.company_id as companyId, res.projectName,
sai.type_id as typeId, res.companyId,
sai.ma_id as maId, res.typeId,
mt1.type_name as typeName, res.typeName,
mt.type_name as modelName, res.modelName,
mt.unit_name as mtUnitName, res.mtUnitName,
sai.buy_price as buyPrice, res.buyPrice,
sai.num as num, SUM(res.num) as num,
sai.start_time as startTime, res.startTime,
sai.end_time as endTime, res.endTime,
DATEDIFF(sai.end_time, sai.start_time) + 1 as leaseDays res.leaseDays
from slt_agreement_info sai FROM
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id (
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id select sai.id,
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id sai.agreement_id as agreementId,
left join ma_type mt on sai.type_id = mt.type_id bui.unit_name as unitName,
left join ma_type mt1 on mt.parent_id = mt1.type_id bp.pro_name as projectName,
where sai.agreement_id = #{agreementId} and sai.end_time is null sai.company_id as companyId,
sai.type_id as typeId,
sai.ma_id as maId,
mt1.type_name as typeName,
mt.type_name as modelName,
mt.unit_name as mtUnitName,
mt.buy_price as buyPrice,
sai.num as num,
sai.start_time as startTime,
sai.end_time as endTime,
DATEDIFF(sai.end_time, sai.start_time) + 1 as leaseDays
from slt_agreement_info sai
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
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.end_time is null
) res
GROUP BY res.typeId
</select> </select>
<select id="getCost" resultType="java.lang.String"> <select id="getCost" resultType="java.lang.String">
@ -701,6 +738,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type_manage mt ON mt4.type_id = mt.type_id LEFT JOIN ma_type_manage mt ON mt4.type_id = mt.type_id
WHERE WHERE
mt.user_id = #{userId} mt.user_id = #{userId}
LIMIT 1 GROUP BY sai.agreement_id
</select> </select>
</mapper> </mapper>