结算限制

This commit is contained in:
hongchao 2025-09-10 09:28:20 +08:00
parent 4118bc1358
commit 1a354c7b97
3 changed files with 23 additions and 1 deletions

View File

@ -142,9 +142,10 @@ 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);
// 删除 null 对象 // 删除 null 对象
list.removeIf(Objects::isNull); list.removeIf(Objects::isNull);
list.removeIf(info -> info.getSltStatus() != null && info.getSltStatus().equals("2"));
// 遍历列表设置默认值 // 遍历列表设置默认值
list.forEach(obj -> { list.forEach(obj -> {
if (obj.getIsSlt() == null) { obj.setIsSlt("0");} if (obj.getIsSlt() == null) { obj.setIsSlt("0");}
@ -634,6 +635,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
if (agreementId == null || agreementId <= 0) { if (agreementId == null || agreementId <= 0) {
throw new ServiceException("协议id错误"); throw new ServiceException("协议id错误");
} }
int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId); int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId);
if (sltInfoVo.getAgreementIds().length <= 1) { if (sltInfoVo.getAgreementIds().length <= 1) {
// 如果不是批量提交已结算的费用类型就直接提示已结算 // 如果不是批量提交已结算的费用类型就直接提示已结算
@ -654,6 +658,12 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
SltAgreementInfo info = new SltAgreementInfo(); SltAgreementInfo info = new SltAgreementInfo();
info.setAgreementId(agreementId); info.setAgreementId(agreementId);
//获取该协议下的所有维修任务
List<TmTask> repairList = taskMapper.getTaskIdByAgreementId(info);
if(repairList != null && !repairList.isEmpty()){
throw new ServiceException("结算中存在维修和报废未完成的任务,无法结算!");
}
// 获取各项成本并累加 // 获取各项成本并累加
totalCost = totalCost.add(getLeaseList(info).stream() totalCost = totalCost.add(getLeaseList(info).stream()
.map(SltAgreementInfo::getCosts) .map(SltAgreementInfo::getCosts)

View File

@ -181,4 +181,6 @@ public interface TmTaskMapper {
* @return * @return
*/ */
List<RepairApplyDetails> selectBackApplyInfoById(BackApplyInfo backApplyInfo); List<RepairApplyDetails> selectBackApplyInfoById(BackApplyInfo backApplyInfo);
List<TmTask> getTaskIdByAgreementId(SltAgreementInfo info);
} }

View File

@ -270,4 +270,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE WHERE
back_id = #{id} back_id = #{id}
</select> </select>
<select id="getTaskIdByAgreementId" resultType="com.bonus.material.task.domain.TmTask">
select
tt.task_id as taskId,
tt.task_type as taskType,
tt.task_status as taskStatus
from tm_task tt
left join tm_task_agreement tta on tta.task_id = tt.task_id
where tta.agreement_id = #{agreementId} and tt.task_type = 4 and tt.task_status != 1
</select>
</mapper> </mapper>