|  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.YwBuildingMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.YwContractRoomMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.YwRoomMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.YwWorkorderMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.YwFloorStatusDataVO; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.YwRoomContractDataVO; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.YwRoomStatusDataVO; | 
|---|
|  |  |  | import com.doumee.service.business.YwRoomService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 运维房源信息表Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private YwContractRoomMapper ywContractRoomMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private YwContractMapper ywContractMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private YwWorkorderMapper ywWorkorderMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private YwFloorMapper ywFloorMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(YwRoom model) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public YwRoom findById(Integer id) { | 
|---|
|  |  |  | return ywRoomMapper.selectById(id); | 
|---|
|  |  |  | MPJLambdaWrapper<YwRoom> queryWrapper = new MPJLambdaWrapper<>(); | 
|---|
|  |  |  | queryWrapper.selectAll(YwRoom.class ) | 
|---|
|  |  |  | .selectAs(YwProject::getName,YwRoom::getProjectName) | 
|---|
|  |  |  | .selectAs(YwFloor::getName,YwRoom::getFloorName) | 
|---|
|  |  |  | .select(" ifnull( ( select case when y1.status = 3 then now() BETWEEN y1.START_DATE and y1.BT_DATE else now() BETWEEN y1.START_DATE and y1.END_DATE END  " + | 
|---|
|  |  |  | "from yw_contract y1 left join yw_contract_room y2 on y1.id = y2.CONTRACT_ID and y2.TYPE = 0  " + | 
|---|
|  |  |  | "where y1.`STATUS` <> 4  and y2.room_id = t.id order by y1.create_date desc  limit 1  ) ,0) ",YwRoom::getLeaseStatus) | 
|---|
|  |  |  | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) | 
|---|
|  |  |  | .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId) | 
|---|
|  |  |  | .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) | 
|---|
|  |  |  | .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor) | 
|---|
|  |  |  | .eq(YwRoom::getId,id) | 
|---|
|  |  |  | .last(" limit 1 ") | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | YwRoom ywRoom = ywRoomMapper.selectJoinOne(YwRoom.class,queryWrapper); | 
|---|
|  |  |  | return ywRoom; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | .selectAs(YwProject::getName,YwRoom::getProjectName) | 
|---|
|  |  |  | .selectAs(YwFloor::getName,YwRoom::getFloorName) | 
|---|
|  |  |  | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) | 
|---|
|  |  |  | .select(" select case when y1.status = 3 then now() BETWEEN y1.START_DATE and y1.BT_DATE else now() BETWEEN y1.START_DATE and y1.END_DATE END  " + | 
|---|
|  |  |  | .select(" ifnull( ( select case when y1.status = 3 then now() BETWEEN y1.START_DATE and y1.BT_DATE else now() BETWEEN y1.START_DATE and y1.END_DATE END  " + | 
|---|
|  |  |  | "from yw_contract y1 left join yw_contract_room y2 on y1.id = y2.CONTRACT_ID and y2.TYPE = 0  " + | 
|---|
|  |  |  | "where y1.`STATUS` <> 4  and y2.room_id = t.id order by y1.create_date desc  limit 1   ",YwRoom::getLeaseStatus) | 
|---|
|  |  |  | "where y1.`STATUS` <> 4  and y2.room_id = t.id order by y1.create_date desc  limit 1  ) ,0) ",YwRoom::getLeaseStatus) | 
|---|
|  |  |  | .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId) | 
|---|
|  |  |  | .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) | 
|---|
|  |  |  | .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor); | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<YwRoom> wrapper = new QueryWrapper<>(ywRoom); | 
|---|
|  |  |  | return ywRoomMapper.selectCount(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<YwFloorStatusDataVO>  getRoomStatusList(YwRoom model){ | 
|---|
|  |  |  | if(Objects.isNull(model) | 
|---|
|  |  |  | || (Objects.isNull(model.getBuildingId()) && Objects.isNull(model.getFloor()))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<YwFloorStatusDataVO> ywFloorStatusDataVOList = new ArrayList<>(); | 
|---|
|  |  |  | List<YwFloor> ywFloorList = ywFloorMapper.selectList(new QueryWrapper<YwFloor>().lambda() | 
|---|
|  |  |  | .eq(YwFloor::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getBuildingId()),YwFloor::getBuildingId,model.getBuildingId()) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getFloor()),YwFloor::getId,model.getFloor()) | 
|---|
|  |  |  | .orderByAsc(YwFloor::getFloor) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | List<YwRoom> ywRoomList = ywRoomMapper.selectList(new QueryWrapper<YwRoom>().lambda() | 
|---|
|  |  |  | .eq(YwRoom::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(YwRoom::getIsInvestment,Constants.ONE) | 
|---|
|  |  |  | .eq(YwRoom::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getBuildingId()),YwRoom::getBuildingId,model.getBuildingId()) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getFloor()),YwRoom::getFloor,model.getFloor()) | 
|---|
|  |  |  | .orderByAsc(YwRoom::getSortnum) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | List<YwRoomStatusDataVO> roomStatusDataList = new ArrayList<>(); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywRoomList)){ | 
|---|
|  |  |  | for (YwRoom ywRoom:ywRoomList) { | 
|---|
|  |  |  | YwRoomStatusDataVO roomStatusDataVO = new YwRoomStatusDataVO(); | 
|---|
|  |  |  | roomStatusDataVO.setFloorId(ywRoom.getFloor()); | 
|---|
|  |  |  | roomStatusDataVO.setRoomId(ywRoom.getId()); | 
|---|
|  |  |  | roomStatusDataVO.setRoomCode(ywRoom.getRoomNum()); | 
|---|
|  |  |  | roomStatusDataVO.setRoomRentArea(ywRoom.getRentArea()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<YwContract> roomContractList =   ywContractMapper.selectJoinList(YwContract.class,new MPJLambdaWrapper<YwContract>() | 
|---|
|  |  |  | .selectAll(YwContract.class) | 
|---|
|  |  |  | .selectAs(YwCustomer::getName,YwContract::getRenterName) | 
|---|
|  |  |  | .leftJoin(YwContractRoom.class,YwContractRoom::getContractId,YwContract::getId) | 
|---|
|  |  |  | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId) | 
|---|
|  |  |  | .eq(YwContract::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .le(YwContract::getStartDate, DateUtil.getCurrDateTime()) | 
|---|
|  |  |  | .ge(YwContract::getEndDate, DateUtil.getCurrDateTime()) | 
|---|
|  |  |  | .eq(YwContractRoom::getType,Constants.ZERO) | 
|---|
|  |  |  | .eq(YwContractRoom::getRoomId,ywRoom.getId()) | 
|---|
|  |  |  | .orderByDesc(YwContract::getStartDate) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(roomContractList)){ | 
|---|
|  |  |  | roomStatusDataVO.setRoomStatus(Constants.ZERO); | 
|---|
|  |  |  | roomStatusDataVO.setFreeDayAmount(Constants.ZERO); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | YwContract ywContract = roomContractList.get(Constants.ZERO); | 
|---|
|  |  |  | //合同状态 0待执行 1执行中 2已到期 3退租中 4已退租 | 
|---|
|  |  |  | //待执行/执行中/退租中 均属于已出租 根据具体到期时间判断是否处于即将到期 90天 | 
|---|
|  |  |  | if(Constants.equalsInteger(ywContract.getStatus(),Constants.ZERO)||Constants.equalsInteger(ywContract.getStatus(),Constants.ONE)|| | 
|---|
|  |  |  | Constants.equalsInteger(ywContract.getStatus(),Constants.THREE)){ | 
|---|
|  |  |  | roomStatusDataVO.setRoomStatus(Constants.ONE); | 
|---|
|  |  |  | roomStatusDataVO.setCustomerName(ywContract.getRenterName()); | 
|---|
|  |  |  | if(Constants.equalsInteger(ywContract.getStatus(),Constants.THREE)){ | 
|---|
|  |  |  | if(Objects.nonNull(ywContract.getBtDate()) && DateUtil.getBetweenDays(DateUtil.getFomartDate(ywContract.getBtDate(),"yyyy-MM-dd"),DateUtil.getFomartDate(new Date(),"yyyy-MM-dd"))<=90){ | 
|---|
|  |  |  | roomStatusDataVO.setRoomStatus(Constants.TWO); | 
|---|
|  |  |  | roomStatusDataVO.setOverData(ywContract.getBtDate()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | System.out.println(DateUtil.daysBetweenDates(ywContract.getEndDate(),new Date())); | 
|---|
|  |  |  | if(Objects.nonNull(ywContract.getEndDate()) | 
|---|
|  |  |  | && | 
|---|
|  |  |  | DateUtil.daysBetweenDates(ywContract.getEndDate(),new Date())<=90){ | 
|---|
|  |  |  | roomStatusDataVO.setRoomStatus(Constants.TWO); | 
|---|
|  |  |  | roomStatusDataVO.setOverData(ywContract.getEndDate()); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | roomStatusDataVO.setOverData(ywContract.getEndDate()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | roomStatusDataVO.setRoomStatus(Constants.ZERO); | 
|---|
|  |  |  | //已退租 计算退租时间 | 
|---|
|  |  |  | if(Objects.nonNull(ywContract.getBtDate())){ | 
|---|
|  |  |  | //查询退租日期和当前日期相差天数 | 
|---|
|  |  |  | Integer btDays = DateUtil.daysBetweenDates(new Date(),ywContract.getBtDate()); | 
|---|
|  |  |  | if(btDays>=Constants.ZERO){ | 
|---|
|  |  |  | roomStatusDataVO.setFreeDayAmount(btDays); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | roomStatusDataList.add(roomStatusDataVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (YwFloor ywFloor:ywFloorList) { | 
|---|
|  |  |  | YwFloorStatusDataVO ywFloorStatusDataVO = new YwFloorStatusDataVO(); | 
|---|
|  |  |  | ywFloorStatusDataVO.setFloorName(ywFloor.getName()); | 
|---|
|  |  |  | ywFloorStatusDataVO.setFloorId(ywFloor.getId()); | 
|---|
|  |  |  | ywFloorStatusDataVO.setFloorArea(BigDecimal.ZERO); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(roomStatusDataList)){ | 
|---|
|  |  |  | List<YwRoomStatusDataVO> floorRoomList = roomStatusDataList.stream().filter(i->Objects.nonNull(i.getFloorId())&&Constants.equalsInteger(i.getFloorId(),ywFloor.getId())).collect(Collectors.toList()); | 
|---|
|  |  |  | ywFloorStatusDataVO.setYwRoomStatusDataVOList(floorRoomList); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(floorRoomList)){ | 
|---|
|  |  |  | ywFloorStatusDataVO.setFloorArea(floorRoomList.stream().filter(i->Objects.nonNull(i.getRoomRentArea())).map(i->i.getRoomRentArea()).reduce(BigDecimal.ZERO,BigDecimal::add)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ywFloorStatusDataVOList.add(ywFloorStatusDataVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ywFloorStatusDataVOList; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public YwRoomContractDataVO getRoomContract(YwRoom model){ | 
|---|
|  |  |  | if(Objects.isNull(model) | 
|---|
|  |  |  | || (Objects.isNull(model.getBuildingId()) && Objects.isNull(model.getProjectId()))){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | YwRoomContractDataVO ywRoomContractDataVO = new YwRoomContractDataVO(); | 
|---|
|  |  |  | ywRoomContractDataVO.setInvestmentRoomAmount(Constants.ZERO); | 
|---|
|  |  |  | ywRoomContractDataVO.setInvestmentArea(BigDecimal.ZERO); | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseContractAmount(Constants.ZERO); | 
|---|
|  |  |  | ywRoomContractDataVO.setLeasePrice(BigDecimal.ZERO); | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseArea(BigDecimal.ZERO); | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseRoomAmount(Constants.ZERO); | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseDayPrice(BigDecimal.ZERO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<YwRoom> ywRoomList = ywRoomMapper.selectList(new QueryWrapper<YwRoom>().lambda() | 
|---|
|  |  |  | .eq(YwRoom::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(YwRoom::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(YwRoom::getIsInvestment,Constants.ONE) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getBuildingId()),YwRoom::getBuildingId,model.getBuildingId()) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getProjectId()),YwRoom::getProjectId,model.getProjectId()) | 
|---|
|  |  |  | .orderByAsc(YwRoom::getSortnum) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywRoomList)){ | 
|---|
|  |  |  | return ywRoomContractDataVO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ywRoomContractDataVO.setInvestmentRoomAmount(ywRoomList.size()); | 
|---|
|  |  |  | ywRoomContractDataVO.setInvestmentArea(ywRoomList.stream().filter(i->Objects.nonNull(i.getRentArea())).map(i->i.getRentArea()).reduce(BigDecimal.ZERO,BigDecimal::add)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<YwContract> roomContractList =   ywContractMapper.selectJoinList(YwContract.class,new MPJLambdaWrapper<YwContract>() | 
|---|
|  |  |  | .selectAll(YwContract.class) | 
|---|
|  |  |  | .select(" ( select  ifnull(sum(yr.RENT_AREA),0)  from yw_contract_room y left join yw_room yr on y.room_id = yr.id  where y.type = 0 and y.CONTRACT_ID = t.id ) " , YwContract::getTotalArea) | 
|---|
|  |  |  | .select(" ( select  ifnull(sum(y.TOTLE_FEE),0)  from yw_contract_bill y   where y.CONTRACT_ID = t.id and y.type = 0 and y.COST_TYPE=0 and y.BILL_TYPE = 0  ) " , YwContract::getTotalFee) | 
|---|
|  |  |  | .eq(YwContract::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .in(YwContract::getStatus,Constants.ONE,Constants.TWO,Constants.THREE) | 
|---|
|  |  |  | .apply(Objects.nonNull(model.getBuildingId()), | 
|---|
|  |  |  | " t.id in ( select y.CONTRACT_ID from yw_contract_room y left join yw_room yr on y.room_id = yr.id  where y.type = 0 and  yr.BUILDING_ID = "+model.getBuildingId()+" ) ") | 
|---|
|  |  |  | .apply(Objects.nonNull(model.getProjectId()), | 
|---|
|  |  |  | " t.id in ( select y.CONTRACT_ID from yw_contract_room y left join yw_room yr on y.room_id = yr.id  where y.type = 0 and  yr.PROJECT_ID = "+model.getProjectId()+" ) ") | 
|---|
|  |  |  | .orderByDesc(YwContract::getStartDate) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(roomContractList)){ | 
|---|
|  |  |  | return ywRoomContractDataVO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //处理租赁单价 根据  合同租赁总额 /  (租赁时长 * 租赁面积) | 
|---|
|  |  |  | for (YwContract ywContract:roomContractList) { | 
|---|
|  |  |  | long contractDayAmount = DateUtil.daysBetweenDates(ywContract.getEndDate() | 
|---|
|  |  |  | ,ywContract.getStartDate()); | 
|---|
|  |  |  | if(Objects.nonNull(contractDayAmount) && Objects.nonNull(ywContract.getTotalArea()) && Objects.nonNull(ywContract.getTotalFee())){ | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseDayPrice( | 
|---|
|  |  |  | ywRoomContractDataVO.getLeaseDayPrice().add( | 
|---|
|  |  |  | ywContract.getTotalFee().divide((ywContract.getTotalArea().multiply(new BigDecimal(Long.toString(contractDayAmount)))),2,BigDecimal.ROUND_HALF_UP) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseContractAmount(roomContractList.size()); | 
|---|
|  |  |  | if(Objects.nonNull(ywRoomContractDataVO.getLeaseDayPrice())&&ywRoomContractDataVO.getLeaseDayPrice().compareTo(BigDecimal.ZERO)>Constants.ZERO){ | 
|---|
|  |  |  | ywRoomContractDataVO.setLeasePrice( | 
|---|
|  |  |  | ywRoomContractDataVO.getLeaseDayPrice().divide(new BigDecimal(Integer.toString(ywRoomContractDataVO.getLeaseContractAmount())),2,BigDecimal.ROUND_HALF_UP)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Integer> contractId = roomContractList.stream().map(i->i.getId()).collect(Collectors.toList()); | 
|---|
|  |  |  | List<YwRoom> ywLeaseRoomList = ywRoomMapper.selectJoinList(YwRoom.class,new MPJLambdaWrapper<YwRoom>() | 
|---|
|  |  |  | .selectAll(YwRoom.class) | 
|---|
|  |  |  | .leftJoin(YwContractRoom.class,YwContractRoom::getRoomId,YwRoom::getId) | 
|---|
|  |  |  | .eq(YwRoom::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .eq(YwRoom::getIsInvestment,Constants.ONE) | 
|---|
|  |  |  | .eq(YwRoom::getStatus,Constants.ZERO) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getBuildingId()),YwRoom::getBuildingId,model.getBuildingId()) | 
|---|
|  |  |  | .eq(Objects.nonNull(model.getProjectId()),YwRoom::getProjectId,model.getProjectId()) | 
|---|
|  |  |  | .in(YwContractRoom::getContractId,contractId) | 
|---|
|  |  |  | .orderByAsc(YwRoom::getSortnum) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywLeaseRoomList)){ | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseArea( | 
|---|
|  |  |  | ywLeaseRoomList.stream().filter(i->Objects.nonNull(i.getRentArea())).map(i->i.getRentArea()).reduce(BigDecimal.ZERO,BigDecimal::add) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | ywRoomContractDataVO.setLeaseRoomAmount(ywLeaseRoomList.size()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ywRoomContractDataVO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|