diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java index 32875ac..32b4dc2 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java @@ -76,27 +76,23 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { if (CollUtil.isEmpty(result.getRecords())) { return TableDataInfo.build(result); } - List itemIdList = result.getRecords().stream() - .map(vo -> vo.getItemId()) - .distinct() - .collect(Collectors.toList()); - List roomIdList = result.getRecords().stream() - .map(vo -> vo.getChargeId()) - .distinct() - .collect(Collectors.toList()); - List costItemsVoList = costItemsMapper.selectVoByIds(itemIdList); - List roomVoList = roomMapper.selectVoByIds(roomIdList); + + List costItemsVoList = costItemsMapper.selectVoList(); + List roomVoList = roomMapper.selectVoList(); List costPayFeeAuditVoList = new ArrayList<>(); result.getRecords().stream().forEach(s -> { - CostItemsVo costItemsVo = costItemsVoList.stream() - .filter(vo -> vo.getId() != null && vo.getId().equals(s.getItemId())).findFirst().orElse(null); - s.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeItem() : null); - s.setCostType(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getCostType() : null); - s.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeCycle() : null); - TbRoomVo tbRoomVo = roomVoList.stream() - .filter(vo -> vo.getId() != null && vo.getId().equals(s.getChargeId())).findFirst().orElse(null); - s.setRoomNumber(ObjectUtil.isNotEmpty(tbRoomVo) ? tbRoomVo.getRoomNumber() : null); - + if (CollUtil.isNotEmpty(costItemsVoList)) { + CostItemsVo costItemsVo = costItemsVoList.stream() + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getItemId())).findFirst().orElse(null); + s.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeItem() : null); + s.setCostType(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getCostType() : null); + s.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeCycle() : null); + } + if (CollUtil.isNotEmpty(roomVoList)) { + TbRoomVo tbRoomVo = roomVoList.stream() + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getChargeId())).findFirst().orElse(null); + s.setRoomNumber(ObjectUtil.isNotEmpty(tbRoomVo) ? tbRoomVo.getRoomNumber() : null); + } costPayFeeAuditVoList.add(s); }); Page costPayFeeAuditVoPage = new Page() diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java index 9ae00ba..521d268 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java @@ -59,12 +59,12 @@ public class MeetBookingServiceImpl implements IMeetBookingService { MeetBookingDetailVo meetBookingDetailVo = BeanUtil.copyProperties(meetBookingVo, MeetBookingDetailVo.class); MeetVo meetVo = meetMapper.selectVoById(meetBookingDetailVo.getMeetId()); String locationName = roomMapper.queryRoomName(Long.valueOf(meetVo.getLocation())); - meetBookingDetailVo.setLocationName(locationName); + meetBookingDetailVo.setLocationName(ObjectUtil.isNotEmpty(locationName)?locationName:null); ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(Long.valueOf(meetBookingVo.getPerson())); - meetBookingDetailVo.setPersonName(residentPersonVo.getUserName()); + meetBookingDetailVo.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getUserName():null); meetBookingDetailVo.setPhone(residentPersonVo.getPhone()); ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(Long.valueOf(meetBookingVo.getUnit())); - meetBookingDetailVo.setUnitName(residentUnitVo.getName()); + meetBookingDetailVo.setUnitName(ObjectUtil.isNotEmpty(residentPersonVo)?residentUnitVo.getName():null); return meetBookingDetailVo; } @@ -121,25 +121,21 @@ public class MeetBookingServiceImpl implements IMeetBookingService { } List meetBookingAppointmentVoList = MapstructUtils.convert(meetBookings, MeetBookingAppointmentVo.class); SimpleDateFormat df = new SimpleDateFormat("HH"); - List units = meetBookingAppointmentVoList.stream() - .map(vo -> vo.getUnit()) - .distinct() - .collect(Collectors.toList()); - List persons = meetBookingAppointmentVoList.stream() - .map(vo -> vo.getPerson()) - .distinct() - .collect(Collectors.toList()); - List residentUnitVolist = residentUnitMapper.selectVoByIds(units); - List residentPersonsVolist = residentPersonMapper.selectVoByIds(persons); + List residentUnitVolist = residentUnitMapper.selectVoList(); + List residentPersonsVolist = residentPersonMapper.selectVoList(); meetBookingAppointmentVoList.stream().forEach( s -> { - ResidentUnitVo residentUnitVo = residentUnitVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); - s.setUnitName(residentUnitVo.getName()); - ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); - s.setPersonName(residentPersonVo.getUserName()); - s.setPhone(residentPersonVo.getPhone()); + if (CollUtil.isNotEmpty(residentUnitVolist)) { + ResidentUnitVo residentUnitVo = residentUnitVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); + s.setUnitName(residentUnitVo.getName()); + } + if (CollUtil.isNotEmpty(residentPersonsVolist)) { + ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); + s.setPersonName(residentPersonVo.getUserName()); + s.setPhone(residentPersonVo.getPhone()); + } String str = df.format(s.getScheduledStarttime()); int a = Integer.parseInt(str); s.setSlots(a <= 12 ? "上午" : "下午"); @@ -184,23 +180,19 @@ public class MeetBookingServiceImpl implements IMeetBookingService { String[] weekStr = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; List meetBookingWeekList = new ArrayList<>(); SimpleDateFormat df = new SimpleDateFormat("HH"); - List units = meetBookingVoList.stream() - .map(vo -> vo.getUnit()) - .distinct() - .collect(Collectors.toList()); - List persons = meetBookingVoList.stream() - .map(vo -> vo.getPerson()) - .distinct() - .collect(Collectors.toList()); - List residentUnitVolist = residentUnitMapper.selectVoByIds(units); - List residentPersonsVolist = residentPersonMapper.selectVoByIds(persons); + List residentUnitVolist = residentUnitMapper.selectVoList(); + List residentPersonsVolist = residentPersonMapper.selectVoList(); meetBookingWeekVoList.stream().forEach(s -> { - ResidentUnitVo residentUnitVo = residentUnitVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); - s.setUnitName(residentUnitVo.getName()); - ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); - s.setPersonName(residentPersonVo.getUserName()); + if (CollUtil.isNotEmpty(residentUnitVolist)) { + ResidentUnitVo residentUnitVo = residentUnitVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); + s.setUnitName(residentUnitVo.getName()); + } + if (CollUtil.isNotEmpty(residentPersonsVolist)) { + ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); + s.setPersonName(residentPersonVo.getUserName()); + } //设置指定的Date对象不设置默认返回当天的星期 calendar.setTime(s.getScheduledStarttime()); //获取当前时间的星期