| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | @Override |
| | | public YwProject findById(Integer id) { |
| | | return ywProjectMapper.selectById(id); |
| | | YwProject ywProject = ywProjectMapper.selectById(id); |
| | | if(Objects.isNull(ywProject)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Objects.nonNull(ywProject.getAreaId())){ |
| | | Areas a = areasService.findById(ywProject.getAreaId(),Constants.TWO); |
| | | if(a != null){ |
| | | ywProject.setAreaName(a.getName()); |
| | | ywProject.setCityId(a.getCityId()); |
| | | ywProject.setCityName(a.getCityName()); |
| | | ywProject.setProvinceId(a.getProvinceId()); |
| | | ywProject.setProvinceName(a.getProvinceName()); |
| | | } |
| | | } |
| | | return ywProject; |
| | | } |
| | | |
| | | @Override |
| | |
| | | projectDataVOList.add(projectDataVO); |
| | | } |
| | | |
| | | List<YwRoom> ywRoomList = ywRoomMapper.selectList(new QueryWrapper<YwRoom>().lambda() |
| | | List<YwRoom> ywRoomList = ywRoomMapper.selectJoinList(YwRoom.class,new MPJLambdaWrapper<YwRoom>() |
| | | .selectAll(YwRoom.class) |
| | | .select(" ifnull( ( case when t.IS_INVESTMENT = 0 then 2 else t.LEASE_NOW_STATUS end ) ,0) ",YwRoom::getLeaseStatus) |
| | | .eq(YwRoom::getIsdeleted,Constants.ZERO) |
| | | .eq(YwRoom::getStatus,Constants.ZERO) |
| | | .eq(YwRoom::getIsInvestment,Constants.ONE) |
| | | .eq(Objects.nonNull(dataDTO.getProjectId()),YwRoom::getProjectId,dataDTO.getProjectId()) |
| | | .apply(Objects.nonNull(dataDTO)&&Objects.nonNull(dataDTO.getStartDate())&&Objects.nonNull(dataDTO.getEndDate())," id not in (" + |
| | | " SELECT y2.room_id FROM yw_contract y1 left join yw_contract_room y2 on y1.id = y2.contract_id where 1 = 1 and y1.`STATUS` in( 0,1,2) " + |
| | |
| | | " ) ") |
| | | .apply(Objects.nonNull(dataDTO)&&Objects.nonNull(dataDTO.getStartDate())&&Objects.nonNull(dataDTO.getEndDate())," id not in (" + |
| | | " SELECT y2.room_id FROM yw_contract y1 left join yw_contract_room y2 on y1.id = y2.contract_id where 1 = 1 and y1.`STATUS` = 3 " + |
| | | " and y1.START_DATE < '"+dataDTO.getEndDate()+" 00:00:00' and y1.BT_DATE > '"+ dataDTO.getStartDate() +" 00:00:00' " + |
| | | " and y1.START_DATE < '"+dataDTO.getEndDate()+" 00:00:00' and y1.BT_DATE >= '"+ dataDTO.getStartDate() +" 00:00:00' " + |
| | | " ) ") |
| | | .orderByAsc(YwRoom::getSortnum) |
| | | .orderByAsc(YwRoom::getRoomNum) |
| | | ); |
| | | |
| | | for (YwRoom data:ywRoomList) { |
| | | ProjectDataVO projectDataVO = new ProjectDataVO(); |
| | | BeanUtils.copyProperties(data,projectDataVO); |
| | | projectDataVO.setName(data.getCode() + " " + data.getArea().setScale(2, BigDecimal.ROUND_HALF_UP) +"㎡"); |
| | | projectDataVO.setName(data.getRoomNum()); |
| | | projectDataVO.setArea(data.getRentArea().setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | projectDataVO.setPId(data.getFloor()); |
| | | projectDataVO.setLv(Constants.THREE); |
| | | projectDataVO.setLeaseStatus(data.getLeaseStatus()); |
| | | projectDataVOList.add(projectDataVO); |
| | | } |
| | | |
| | | ProjectTree treeBuild = new ProjectTree(projectDataVOList); |
| | | projectDataVOList = treeBuild.buildTree(); |
| | | return projectDataVOList; |
| | | |
| | | } |
| | | |
| | | |