| | |
| | | model.setStatus(Constants.ZERO); |
| | | model.setEditDate(model.getCreateDate()); |
| | | model.setEditor(model.getCreator()); |
| | | model.setLeaseNowStatus(Constants.ZERO); |
| | | ywRoomMapper.insert(model); |
| | | return model.getId(); |
| | | } |
| | |
| | | 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) |
| | | // .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) |
| | | .select(" ifnull( ( case when t.IS_INVESTMENT = 0 then 2 else t.LEASE_NOW_STATUS end ) ,0) ",YwRoom::getLeaseStatus) |
| | | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) |
| | |
| | | .selectAs(YwProject::getName,YwRoom::getProjectName) |
| | | .selectAs(YwFloor::getName,YwRoom::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) |
| | | .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) |
| | | // .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) |
| | | .select(" ifnull( ( case when t.IS_INVESTMENT = 0 then 2 else t.LEASE_NOW_STATUS end ) ,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.orderByAsc(YwRoom::getRoomNum); |
| | | IPage<YwRoom> iPage = ywRoomMapper.selectJoinPage(page,YwRoom.class, queryWrapper); |
| | | for (YwRoom ywRoom:iPage.getRecords()) { |
| | | if(Constants.equalsInteger(ywRoom.getIsInvestment(),Constants.ZERO)){ |
| | | ywRoom.setLeaseStatus(Constants.TWO); |
| | | } |
| | | } |
| | | // for (YwRoom ywRoom:iPage.getRecords()) { |
| | | // if(Constants.equalsInteger(ywRoom.getIsInvestment(),Constants.ZERO)){ |
| | | // ywRoom.setLeaseStatus(Constants.TWO); |
| | | // } |
| | | // } |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | |
| | | .eq(YwContractRoom::getType,Constants.ZERO) |
| | | .eq(YwContractRoom::getRoomId,ywRoom.getId()) |
| | | .orderByDesc(YwContract::getStartDate) |
| | | .orderByDesc(YwContract::getId) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(roomContractList)){ |
| | | roomStatusDataVO.setRoomStatus(Constants.ZERO); |
| | | roomStatusDataVO.setFreeDayAmount(Constants.ZERO); |
| | | //查询是否有已退租合同 |
| | | List<YwContract> roomRentContractList = 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) |
| | | .eq(YwContract::getStatus,Constants.FOUR) |
| | | .eq(YwContractRoom::getType,Constants.ZERO) |
| | | .eq(YwContractRoom::getRoomId,ywRoom.getId()) |
| | | .orderByDesc(YwContract::getStartDate) |
| | | .orderByDesc(YwContract::getId) |
| | | ); |
| | | if(CollectionUtils.isEmpty(roomRentContractList)){ |
| | | roomStatusDataVO.setFreeDayAmount(Constants.ZERO); |
| | | }else{ |
| | | YwContract ywContract = roomRentContractList.get(Constants.ZERO); |
| | | //查询退租日期和当前日期相差天数 |
| | | Integer btDays = DateUtil.daysBetweenDates(new Date(),ywContract.getBtDate()); |
| | | if(btDays>=Constants.ZERO){ |
| | | roomStatusDataVO.setFreeDayAmount(btDays); |
| | | } |
| | | } |
| | | |
| | | }else{ |
| | | YwContract ywContract = roomContractList.get(Constants.ZERO); |
| | | //合同状态 0待执行 1执行中 2已到期 3退租中 4已退租 |
| | |
| | | .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) |
| | | .in(YwContract::getStatus,Constants.ZERO,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()), |
| | |
| | | .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) |
| | | .last(" group by t.id " + |
| | | "ORDER BY t.sortnum ASC ") |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywLeaseRoomList)){ |
| | | ywRoomContractDataVO.setLeaseArea( |