diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java index 3ae632ba..72a34dab 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java @@ -226,7 +226,7 @@ public class ClzSltAgreementInfoController extends BaseController { if(materialReturnTime == null){ materialReturnTime = DateTime.now(); } - String teamExitTime = bean.getActualExitTime(); + String teamExitTime = date; if (teamExitTime == null) { teamExitTime = DateTime.now().toString("yyyy-MM-dd"); } @@ -617,16 +617,16 @@ public class ClzSltAgreementInfoController extends BaseController { Date teamExitTime = simulateTeamExitTime(); - for (MaterialSltAgreementInfo bean : returnedList) { - // 只处理已退还的物资 - if (bean.getEndTime() != null) { - long overdueDays = calculateOverdueDays(bean.getEndTime(), teamExitTime); - if (overdueDays >= 16) { - // 超期16天以上计为丢失 - overdueList.add(bean); - } - } - } +// for (MaterialSltAgreementInfo bean : returnedList) { +// // 只处理已退还的物资 +// if (bean.getEndTime() != null) { +// long overdueDays = calculateOverdueDays(bean.getEndTime(), teamExitTime); +// if (overdueDays >= 16) { +// // 超期16天以上计为丢失 +// overdueList.add(bean); +// } +// } +// } return overdueList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java index 8fb42a74..075de9e8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java @@ -757,16 +757,16 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic Date teamExitTime = simulateTeamExitTime(); - for (MaterialSltAgreementInfo bean : returnedList) { - // 只处理已退还的物资 - if (bean.getEndTime() != null) { - long overdueDays = calculateOverdueDays(bean.getEndTime(), teamExitTime); - if (overdueDays >= 16) { - // 超期16天以上计为丢失 - overdueList.add(bean); - } - } - } +// for (MaterialSltAgreementInfo bean : returnedList) { +// // 只处理已退还的物资 +// if (bean.getEndTime() != null) { +// long overdueDays = calculateOverdueDays(bean.getEndTime(), teamExitTime); +// if (overdueDays >= 16) { +// // 超期16天以上计为丢失 +// overdueList.add(bean); +// } +// } +// } return overdueList; } @@ -813,7 +813,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic if(materialReturnTime == null){ materialReturnTime = DateTime.now(); } - String teamExitTime = bean.getActualExitTime(); + String teamExitTime = date; if (teamExitTime == null) { teamExitTime = DateTime.now().toString("yyyy-MM-dd"); } @@ -826,7 +826,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic } // 计算超期天数 long overdueDays = calculateOverdueDays(materialReturnTime, exitTime); - if(overdueDays < 8 ){ + if(overdueDays <= 7 ){ bean.setOverDay(0L); }else{ bean.setOverDay(overdueDays-7); 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/ClzAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml index f112217b..02b9d2f4 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml @@ -203,7 +203,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.end_time is null and sai.is_slt=1 + where sai.agreement_id = #{agreementId} and sai.status =0 and sai.is_slt=1 ) res GROUP BY res.typeId,res.startTime,res.endTime @@ -407,7 +407,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join bm_unit bu on bai.unit_id = bu.unit_id WHERE bu.unit_name IS NOT NULL - AND bai.project_id = #{proId} + AND bai.project_id = #{proId} and bu.type_id = 1731 GROUP BY bu.unit_id 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" + + + + + + + +