diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java index 7b2d07dd..68807310 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java @@ -1184,6 +1184,15 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { if (proId == null || !unsettledProjectIds.contains(proId)) { iterator.remove(); + continue; + } + // 根据工程去机具协议表查询关联协议数据 + List agreementIdList = mapper.getAgreementId(info.getProId()); + // 根据工程去材料站协议表查询关联协议数据 + List storageAgreementIdList = mapper.getStorageAgreementId(info.getProId()); + // 如果获取的协议数据为空,则移除该行数据 + if (CollectionUtils.isEmpty(agreementIdList) && CollectionUtils.isEmpty(storageAgreementIdList)) { + iterator.remove(); } } } @@ -1217,10 +1226,33 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo = new MaterialRetainedEquipmentInfo(); materialRetainedEquipmentInfo.setTeamName("站内库存"); List teamList = materialMachineMapper.getTeamList(bean); + if (CollectionUtils.isNotEmpty(teamList)) { + // 使用Stream过滤并收集符合条件的元素 + teamList = teamList.stream() + .filter(this::hasRelatedAgreements) + .collect(Collectors.toList()); + } teamList.add(0, materialRetainedEquipmentInfo); return teamList; } + /** + * 判断当前信息是否关联了协议 + * @param info + * @return + */ + private boolean hasRelatedAgreements(MaterialRetainedEquipmentInfo info) { + // 查询机具协议表关联数据 + List agreementIdList = mapper.getJiJuBzAgreementId(info); + if (CollectionUtils.isNotEmpty(agreementIdList)) { + return true; + } + + // 查询材料站协议表关联数据 + List storageAgreementIdList = mapper.getClzAgreementId(info); + return CollectionUtils.isNotEmpty(storageAgreementIdList); + } + /** * 获取分包单位下拉选 * @param bean diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java index 9fb66b52..59cc6a3a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java @@ -12,6 +12,7 @@ import com.bonus.material.clz.domain.BmTeam; import com.bonus.material.clz.domain.direct.ClzDirectApplyDetails; import com.bonus.material.clz.domain.direct.ClzDirectApplyInfo; import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo; +import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo; import com.bonus.material.common.domain.dto.SelectDto; import com.bonus.material.common.domain.vo.AgreementVo; import com.bonus.material.common.domain.vo.SelectVo; @@ -384,4 +385,32 @@ public interface SelectMapper { BackApplyInfo selectCheckPerson(BackApplyDetails details); BackApplyDetails selectSignUrlByUserId(int userId); + + /** + * 获取机具协议id + * @param proId + * @return + */ + List getAgreementId(String proId); + + /** + * 根据工程去材料站协议表查询关联协议数据 + * @param proId + * @return + */ + List getStorageAgreementId(String proId); + + /** + * 根据班组去机具协议表查询关联协议数据 + * @param info + * @return + */ + List getJiJuBzAgreementId(MaterialRetainedEquipmentInfo info); + + /** + * 根据班组去材料站协议表查询关联协议数据 + * @param info + * @return + */ + List getClzAgreementId(MaterialRetainedEquipmentInfo info); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index ed796f57..fa664a16 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -1694,7 +1694,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + +