JAVA村里租房系统小区租售系统源码支持微信小程序 + H5
JAVA村里租房系统小区租售系统:数字化房产租赁解决方案(支持微信小程序 + H5)
在城乡一体化进程加速和数字乡村建设背景下,JAVA村里租房系统小区租售系统正成为城乡房产租赁市场数字化转型的重要技术基础设施。根据住房和城乡建设部数据显示,2023年中国乡村房屋空置率达18.5%,而城市租赁市场规模已突破2.5万亿元。这套小区租售系统源码通过数字化手段有效解决了传统乡村和小区租赁市场存在的信息不对称、管理效率低、交易风险高等结构性痛点。
从技术经济学角度分析,该系统采用SpringBoot+MyBatisPlus+MySQL的分布式架构,实现了租赁业务的高并发处理和数据一致性保障。基于Uniapp框架构建的多端用户界面,使租赁平台能够以统一的代码基座快速覆盖微信小程序、H5等移动端入口,极大提升了用户触达效率。管理后台采用Vue+ElementUI技术栈,为房产管理者提供了智能化的房源管理和数据分析支持。
行业前景方面,随着乡村振兴战略的深入实施和城乡人口流动的加速,乡村及小区房产租赁市场正朝着标准化、透明化、智能化方向发展。国家发改委研究报告指出,数字化租赁管理系统的应用可使房源出租率提升30%以上,管理成本降低35%。这套JAVA村里租房系统不仅实现了租赁流程的数字化重构,更通过位置服务和智能匹配算法为租赁平台提供了精准的房源推荐和需求预测,将成为城乡房产租赁市场规范化发展的重要技术支撑。
系统技术架构深度解析 分布式租赁服务架构设计
本系统采用基于SpringBoot的微服务架构,结合MyBatisPlus和MySQL构建高可用的租赁服务集群。以下是核心业务架构代码示例:
// 房源信息实体类
@Entity
@Table(name = "rental_property")
public class RentalProperty {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;@Column(name = "property_title", nullable = false)private String propertyTitle; // 房源标题@Column(name = "property_type")private Integer propertyType; // 房源类型:1-整租 2-合租 3-商铺@Column(name = "property_address")private String propertyAddress; // 详细地址@Column(name = "village_name")private String villageName; // 小区/村名@Column(name = "geo_location")private String geoLocation; // 地理坐标@Column(name = "area_size")private BigDecimal areaSize; // 面积@Column(name = "rental_price")private BigDecimal rentalPrice; // 租金@Column(name = "price_unit")private String priceUnit; // 价格单位@Column(name = "room_config")private String roomConfig; // 户型配置@Column(name = "facilities")private String facilities; // 配套设施@Column(name = "property_images")private String propertyImages; // 房源图片@Column(name = "owner_id")private Long ownerId; // 房东ID@Column(name = "contact_phone")private String contactPhone; // 联系电话@Column(name = "property_status")private Integer propertyStatus; // 房源状态@Column(name = "view_count")private Integer viewCount = 0; // 浏览次数@Column(name = "create_time")private LocalDateTime createTime;
}// 租赁订单实体
@Entity
@Table(name = "rental_order")
public class RentalOrder {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;@Column(name = "order_no", unique = true)private String orderNo; // 订单编号@Column(name = "property_id")private Long propertyId; // 房源ID@Column(name = "tenant_id")private Long tenantId; // 租客ID@Column(name = "owner_id")private Long ownerId; // 房东ID@Column(name = "rental_start_date")private LocalDate rentalStartDate; // 租期开始@Column(name = "rental_end_date")private LocalDate rentalEndDate; // 租期结束@Column(name = "total_amount")private BigDecimal totalAmount; // 订单总额@Column(name = "deposit_amount")private BigDecimal depositAmount; // 押金金额@Column(name = "payment_status")private Integer paymentStatus; // 支付状态@Column(name = "order_status")private Integer orderStatus; // 订单状态@Column(name = "contract_url")private String contractUrl; // 电子合同@Column(name = "create_time")private LocalDateTime createTime;
}// 智能推荐服务
@Service
public class PropertyRecommendationService {@Autowiredprivate RentalPropertyMapper propertyMapper;@Autowiredprivate UserPreferenceMapper preferenceMapper;/*** 基于用户偏好的智能房源推荐*/public List<RentalProperty> recommendProperties(Long userId, String userLocation) {// 1. 获取用户偏好UserPreference preference = preferenceMapper.selectByUserId(userId);// 2. 构建推荐查询LambdaQueryWrapper<RentalProperty> query = new LambdaQueryWrapper<>();query.eq(RentalProperty::getPropertyStatus, 1) // 可租状态.orderByDesc(RentalProperty::getCreateTime);// 3. 位置优先筛选if (userLocation != null) {query.like(RentalProperty::getPropertyAddress, userLocation);}// 4. 价格范围筛选if (preference != null && preference.getMinPrice() != null) {query.ge(RentalProperty::getRentalPrice, preference.getMinPrice());}if (preference != null && preference.getMaxPrice() != null) {query.le(RentalProperty::getRentalPrice, preference.getMaxPrice());}List<RentalProperty> candidates = propertyMapper.selectList(query);// 5. 计算推荐分数并排序return candidates.stream().map(property -> {RecommendationScore score = calculateRecommendationScore(property, preference, userLocation);return new PropertyRecommendation(property, score);}).sorted(Comparator.comparing(PropertyRecommendation::getScore).reversed()).map(PropertyRecommendation::getProperty).collect(Collectors.toList());}/*** 计算房源推荐分数*/private RecommendationScore calculateRecommendationScore(RentalProperty property, UserPreference preference,String userLocation) {RecommendationScore score = new RecommendationScore();// 位置匹配度(40%权重)score.setLocationScore(calculateLocationScore(property.getGeoLocation(), userLocation));// 价格匹配度(30%权重)score.setPriceScore(calculatePriceScore(property.getRentalPrice(), preference));// 房源质量分(20%权重)score.setQualityScore(calculateQualityScore(property));// 时效性分数(10%权重)score.setTimelinessScore(calculateTimelinessScore(property.getCreateTime()));return score;}/*** 计算位置匹配度*/private double calculateLocationScore(String propertyLocation, String userLocation) {if (userLocation == null) return 50.0; // 默认分数// 简化版位置匹配算法// 实际项目中应使用地理编码服务计算实际距离double similarity = calculateStringSimilarity(propertyLocation, userLocation);return similarity * 100;}
}// 推荐评分模型
@Data
class RecommendationScore {private double locationScore; // 位置匹配度private double priceScore; // 价格匹配度private double qualityScore; // 房源质量分private double timelinessScore; // 时效性分数public double getScore() {return locationScore * 0.4 + priceScore * 0.3 + qualityScore * 0.2 + timelinessScore * 0.1;}
}
租赁订单状态机引擎
// 租赁订单服务
@Service
@Transactional
public class RentalOrderService {@Autowiredprivate RentalOrderMapper orderMapper;@Autowiredprivate RentalPropertyMapper propertyMapper;@Autowiredprivate NotificationService notificationService;@Autowiredprivate ContractService contractService;/*** 创建租赁订单*/public RentalOrder createRentalOrder(OrderCreateDTO orderDTO) {// 1. 验证房源可用性RentalProperty property = propertyMapper.selectById(orderDTO.getPropertyId());if (property.getPropertyStatus() != 1) {throw new RentalException("房源不可租");}// 2. 创建订单记录RentalOrder order = new RentalOrder();BeanUtils.copyProperties(orderDTO, order);order.setOrderNo(generateOrderNo());order.setOrderStatus(1); // 待支付order.setPaymentStatus(1); // 待支付order.setCreateTime(LocalDateTime.now());// 3. 计算订单金额calculateOrderAmount(order, property);orderMapper.insert(order);// 4. 更新房源状态为预定中property.setPropertyStatus(2);propertyMapper.updateById(property);// 5. 发送订单创建通知notificationService.sendOrderCreatedNotification(order);return order;}/*** 支付成功回调处理*/public boolean handlePaymentSuccess(String orderNo) {RentalOrder order = getOrderByNo(orderNo);// 状态机验证if (order.getOrderStatus() != 1 || order.getPaymentStatus() != 1) {throw new RentalException("订单状态异常");}// 更新订单状态order.setOrderStatus(2); // 待签约order.setPaymentStatus(2); // 已支付orderMapper.updateById(order);// 生成电子合同String contractUrl = contractService.generateRentalContract(order);order.setContractUrl(contractUrl);orderMapper.updateById(order);// 通知房东和租客notificationService.sendPaymentSuccessNotification(order);return true;}/*** 合同签约完成*/public boolean completeContract(String orderNo) {RentalOrder order = getOrderByNo(orderNo);if (order.getOrderStatus() != 2) {throw new RentalException("订单状态异常");}// 更新订单状态order.setOrderStatus(3); // 租赁中orderMapper.updateById(order);// 更新房源状态为已出租RentalProperty property = propertyMapper.selectById(order.getPropertyId());property.setPropertyStatus(3); // 已出租propertyMapper.updateById(property);// 发送签约成功通知notificationService.sendContractSignedNotification(order);return true;}/*** 计算订单金额*/private void calculateOrderAmount(RentalOrder order, RentalProperty property) {// 计算租金总额long months = ChronoUnit.MONTHS.between(order.getRentalStartDate(), order.getRentalEndDate());BigDecimal totalRent = property.getRentalPrice().multiply(BigDecimal.valueOf(months));// 押金(通常为1-2个月租金)BigDecimal deposit = property.getRentalPrice().multiply(BigDecimal.valueOf(2));order.setTotalAmount(totalRent);order.setDepositAmount(deposit);}private String generateOrderNo() {return "RO" + System.currentTimeMillis() + RandomUtil.randomNumbers(6);}
}
用户端Uniapp实现
用户端采用Uniapp开发,支持微信小程序和H5。以下是核心房源浏览页面实现:
<template><view class="rental-app-container"><!-- 顶部搜索栏 --><view class="search-header"><view class="location-selector" @tap="chooseLocation"><image src="/static/location-icon.png" class="location-icon"></image><text class="location-text">{{ currentLocation }}</text><image src="/static/arrow-down.png" class="arrow-icon"></image></view><view class="search-box" @tap="goToSearch"><image src="/static/search-icon.png" class="search-icon"></image><text class="search-placeholder">搜索小区、村庄或房源</text></view></view><!-- 筛选条件 --><view class="filter-section"><scroll-view class="filter-scroll" scroll-x><view class="filter-item" :class="{active: filterParams.propertyType === null}" @tap="changePropertyType(null)">全部</view><view class="filter-item" :class="{active: filterParams.propertyType === 1}" @tap="changePropertyType(1)">整租</view><view class="filter-item" :class="{active: filterParams.propertyType === 2}" @tap="changePropertyType(2)">合租</view><view class="filter-item" :class="{active: filterParams.propertyType === 3}" @tap="changePropertyType(3)">商铺</view><view class="filter-item" @tap="showPriceFilter = true"><text>价格</text><image src="/static/filter-arrow.png" class="filter-arrow"></image></view><view class="filter-item" @tap="showMoreFilter = true"><text>更多</text><image src="/static/filter-arrow.png" class="filter-arrow"></image></view></scroll-view></view><!-- 房源列表 --><view class="property-list"><view v-for="property in propertyList" :key="property.id" class="property-card" @tap="viewPropertyDetail(property)"><image :src="property.mainImage" class="property-image" mode="aspectFill"></image><view class="property-badge" v-if="property.isNew"><text class="badge-text">新上</text></view><view class="property-info"><view class="property-header"><text class="property-title">{{ property.propertyTitle }}</text><text class="property-price">¥{{ property.rentalPrice }}/{{ property.priceUnit }}</text></view><view class="property-meta"><text class="meta-item">{{ property.roomConfig }}</text><text class="meta-item">{{ property.areaSize }}㎡</text><text class="meta-item">{{ property.villageName }}</text></view><view class="property-address"><image src="/static/location-small.png" class="address-icon"></image><text class="address-text">{{ property.propertyAddress }}</text></view><view class="property-footer"><view class="facility-tags"><text v-for="facility in property.facilities.slice(0, 3)" :key="facility" class="facility-tag">{{ facility }}</text><text v-if="property.facilities.length > 3" class="more-facility">+{{ property.facilities.length - 3 }}</text></view><text class="view-count">{{ property.viewCount }}人浏览</text></view></view></view></view><!-- 加载更多 --><view class="load-more" v-if="hasMore" @tap="loadMore"><text class="load-more-text">加载更多</text></view><!-- 价格筛选模态框 --><uni-popup ref="priceFilterPopup" type="bottom"><view class="filter-modal"><view class="modal-header"><text class="modal-title">价格筛选</text><text class="reset-btn" @tap="resetPriceFilter">重置</text></view><view class="price-range"><view class="range-inputs"><input class="price-input" v-model="priceFilter.minPrice" placeholder="最低价" type="number" /><text class="range-separator">-</text><input class="price-input" v-model="priceFilter.maxPrice" placeholder="最高价" type="number" /></view></view><view class="modal-actions"><button class="cancel-btn" @tap="closePriceFilter">取消</button><button class="confirm-btn" @tap="applyPriceFilter">确认</button></view></view></uni-popup><!-- 底部导航 --><view class="tabbar"><view class="tabbar-item" :class="{active: currentTab === 0}" @tap="switchTab(0)"><image :src="currentTab === 0 ? '/static/home-active.png' : '/static/home.png'" class="tab-icon"></image><text class="tab-text">首页</text></view><view class="tabbar-item" :class="{active: currentTab === 1}" @tap="switchTab(1)"><image :src="currentTab === 1 ? '/static/favorite-active.png' : '/static/favorite.png'" class="tab-icon"></image><text class="tab-text">收藏</text></view><view class="tabbar-item" :class="{active: currentTab === 2}" @tap="switchTab(2)"><image :src="currentTab === 2 ? '/static/order-active.png' : '/static/order.png'" class="tab-icon"></image><text class="tab-text">订单</text></view><view class="tabbar-item" :class="{active: currentTab === 3}" @tap="switchTab(3)"><image :src="currentTab === 3 ? '/static/profile-active.png' : '/static/profile.png'" class="tab-icon"></image><text class="tab-text">我的</text></view></view></view>
</template><script>
export default {data() {return {currentTab: 0,currentLocation: '定位中...',propertyList: [],filterParams: {propertyType: null,minPrice: null,maxPrice: null,areaSize: null},priceFilter: {minPrice: '',maxPrice: ''},showPriceFilter: false,showMoreFilter: false,pageNum: 1,pageSize: 10,hasMore: true,loading: false}},onLoad() {this.getCurrentLocation()this.loadPropertyList()},onPullDownRefresh() {this.refreshPropertyList()},onReachBottom() {this.loadMore()},methods: {// 获取当前位置async getCurrentLocation() {try {const location = await this.getUserLocation()const address = await this.reverseGeocode(location.latitude, location.longitude)this.currentLocation = address.city + address.district} catch (error) {this.currentLocation = '获取位置失败'}},// 加载房源列表async loadPropertyList() {if (this.loading) returnthis.loading = truetry {const params = {...this.filterParams,pageNum: this.pageNum,pageSize: this.pageSize}const res = await this.$http.get('/api/property/list', { params })if (res.code === 200) {if (this.pageNum === 1) {this.propertyList = res.data.list} else {this.propertyList = [...this.propertyList, ...res.data.list]}this.hasMore = res.data.hasMore}} catch (error) {uni.showToast({title: '加载失败',icon: 'none'})} finally {this.loading = falseuni.stopPullDownRefresh()}},// 刷新房源列表async refreshPropertyList() {this.pageNum = 1await this.loadPropertyList()},// 加载更多async loadMore() {if (!this.hasMore || this.loading) returnthis.pageNum++await this.loadPropertyList()},// 切换房源类型changePropertyType(type) {this.filterParams.propertyType = typethis.refreshPropertyList()},// 应用价格筛选applyPriceFilter() {this.filterParams.minPrice = this.priceFilter.minPrice ? parseInt(this.priceFilter.minPrice) : nullthis.filterParams.maxPrice = this.priceFilter.maxPrice ? parseInt(this.priceFilter.maxPrice) : nullthis.closePriceFilter()this.refreshPropertyList()},// 重置价格筛选resetPriceFilter() {this.priceFilter = {minPrice: '',maxPrice: ''}},// 关闭价格筛选closePriceFilter() {this.$refs.priceFilterPopup.close()},// 查看房源详情viewPropertyDetail(property) {uni.navigateTo({url: `/pages/property/detail?id=${property.id}`})},// 选择位置async chooseLocation() {try {const location = await uni.chooseLocation()if (location.address) {this.currentLocation = location.addressthis.refreshPropertyList()}} catch (error) {uni.showToast({title: '位置选择失败',icon: 'none'})}},// 跳转搜索页goToSearch() {uni.navigateTo({url: '/pages/search/index'})},// 切换标签页switchTab(index) {this.currentTab = index// 根据标签页加载不同数据switch (index) {case 0:this.refreshPropertyList()breakcase 1:// 加载收藏列表breakcase 2:// 加载订单列表breakcase 3:// 加载个人中心break}}}
}
</script><style scoped>
.rental-app-container {background: #f8f9fa;min-height: 100vh;padding-bottom: 120rpx;
}.search-header {display: flex;align-items: center;padding: 30rpx;background: white;
}.location-selector {display: flex;align-items: center;margin-right: 20rpx;flex-shrink: 0;
}.search-box {flex: 1;display: flex;align-items: center;background: #f5f7fa;border-radius: 50rpx;padding: 20rpx 30rpx;
}.filter-section {background: white;padding: 20rpx 30rpx;border-bottom: 1rpx solid #eee;
}.filter-scroll {white-space: nowrap;
}.filter-item {display: inline-flex;align-items: center;padding: 16rpx 32rpx;margin-right: 20rpx;background: #f5f7fa;border-radius: 40rpx;font-size: 28rpx;color: #666;
}.filter-item.active {background: #e6f7ff;color: #1890ff;
}.property-list {padding: 20rpx;
}.property-card {background: white;border-radius: 20rpx;margin-bottom: 20rpx;overflow: hidden;box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.08);position: relative;
}.property-image {width: 100%;height: 400rpx;
}.property-badge {position: absolute;top: 20rpx;left: 20rpx;background: #ff4d4f;color: white;padding: 8rpx 16rpx;border-radius: 8rpx;font-size: 24rpx;
}.property-info {padding: 30rpx;
}.property-header {display: flex;justify-content: space-between;align-items: flex-start;margin-bottom: 20rpx;
}.property-title {flex: 1;font-size: 32rpx;font-weight: bold;margin-right: 20rpx;
}.property-price {font-size: 36rpx;font-weight: bold;color: #ff4d4f;
}.property-meta {display: flex;margin-bottom: 20rpx;
}.meta-item {margin-right: 30rpx;color: #666;font-size: 26rpx;
}.tabbar {position: fixed;bottom: 0;left: 0;right: 0;background: white;display: flex;padding: 20rpx 0;border-top: 1rpx solid #eee;
}.tabbar-item {flex: 1;display: flex;flex-direction: column;align-items: center;
}.tab-icon {width: 48rpx;height: 48rpx;margin-bottom: 8rpx;
}.filter-modal {background: white;border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;padding: 40rpx;
}.modal-header {display: flex;justify-content: space-between;align-items: center;margin-bottom: 40rpx;
}.price-range {margin-bottom: 40rpx;
}.range-inputs {display: flex;align-items: center;justify-content: space-between;
}.price-input {flex: 1;background: #f5f7fa;border-radius: 12rpx;padding: 24rpx;text-align: center;
}.range-separator {margin: 0 30rpx;color: #666;
}
</style>
管理后台Vue+ElementUI实现
管理后台采用Vue+ElementUI构建,提供完善的房源和订单管理功能:
<template><div class="rental-admin-container"><!-- 数据概览 --><el-row :gutter="20" class="stats-row"><el-col :span="6"><el-card class="stats-card"><div class="stats-content"><div class="stats-number">{{ stats.totalProperties }}</div><div class="stats-label">总房源数</div></div></el-card></el-col><el-col :span="6"><el-card class="stats-card"><div class="stats-content"><div class="stats-number">{{ stats.availableProperties }}</div><div class="stats-label">可租房源</div></div></el-card></el-col><el-col :span="6"><el-card class="stats-card"><div class="stats-content"><div class="stats-number">{{ stats.todayOrders }}</div><div class="stats-label">今日订单</div></div></el-card></el-col><el-col :span="6"><el-card class="stats-card"><div class="stats-content"><div class="stats-number">{{ stats.successRate }}%</div><div class="stats-label">成交率</div></div></el-card></el-col></el-row><!-- 房源管理 --><el-card class="table-card"><template #header><div class="card-header"><span>房源管理</span><el-button type="primary" @click="addProperty">新增房源</el-button></div></template><!-- 筛选条件 --><el-form :model="queryParams" inline><el-form-item label="房源状态"><el-select v-model="queryParams.propertyStatus" placeholder="请选择状态"><el-option label="全部" value=""></el-option><el-option label="可租" value="1"></el-option><el-option label="预定中" value="2"></el-option><el-option label="已出租" value="3"></el-option><el-option label="已下架" value="4"></el-option></el-select></el-form-item><el-form-item label="房源类型"><el-select v-model="queryParams.propertyType" placeholder="请选择类型"><el-option label="全部" value=""></el-option><el-option label="整租" value="1"></el-option><el-option label="合租" value="2"></el-option><el-option label="商铺" value="3"></el-option></el-select></el-form-item><el-form-item label="创建时间"><el-date-pickerv-model="queryParams.dateRange"type="daterange"range-separator="至"start-placeholder="开始日期"end-placeholder="结束日期"></el-date-picker></el-form-item><el-form-item><el-button type="primary" @click="handleSearch">搜索</el-button><el-button @click="handleReset">重置</el-button></el-form-item></el-form><!-- 房源表格 --><el-table :data="propertyList" v-loading="loading"><el-table-column prop="id" label="ID" width="80" /><el-table-column prop="propertyTitle" label="房源标题" width="200" /><el-table-column prop="villageName" label="小区/村庄" width="150" /><el-table-column prop="propertyType" label="房源类型" width="100"><template #default="scope">{{ getPropertyTypeText(scope.row.propertyType) }}</template></el-table-column><el-table-column prop="roomConfig" label="户型" width="120" /><el-table-column prop="areaSize" label="面积" width="100"><template #default="scope">{{ scope.row.areaSize }}㎡</template></el-table-column><el-table-column prop="rentalPrice" label="租金" width="120"><template #default="scope">¥{{ scope.row.rentalPrice }}</template></el-table-column><el-table-column prop="propertyStatus" label="状态" width="100"><template #default="scope"><el-tag :type="getStatusTagType(scope.row.propertyStatus)">{{ getStatusText(scope.row.propertyStatus) }}</el-tag></template></el-table-column><el-table-column prop="viewCount" label="浏览数" width="100" /><el-table-column prop="createTime" label="创建时间" width="180" /><el-table-column label="操作" width="200" fixed="right"><template #default="scope"><el-button size="small" @click="viewPropertyDetail(scope.row)">详情</el-button><el-button size="small" @click="editProperty(scope.row)">编辑</el-button><el-button size="small" :type="scope.row.propertyStatus === 1 ? 'warning' : 'success'"@click="togglePropertyStatus(scope.row)">{{ scope.row.propertyStatus === 1 ? '下架' : '上架' }}</el-button></template></el-table-column></el-table><!-- 分页 --><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pagination.current":page-sizes="[10, 20, 50]":page-size="pagination.size"layout="total, sizes, prev, pager, next, jumper":total="pagination.total"></el-pagination></el-card><!-- 订单管理 --><el-card class="order-management-card"><template #header><span>租赁订单管理</span></template><el-table :data="orderList" v-loading="orderLoading"><el-table-column prop="orderNo" label="订单号" width="180" /><el-table-column prop="propertyTitle" label="房源" width="200" /><el-table-column prop="tenantName" label="租客" width="120" /><el-table-column prop="ownerName" label="房东" width="120" /><el-table-column prop="rentalStartDate" label="租期开始" width="120" /><el-table-column prop="rentalEndDate" label="租期结束" width="120" /><el-table-column prop="totalAmount" label="订单金额" width="120"><template #default="scope">¥{{ scope.row.totalAmount }}</template></el-table-column><el-table-column prop="orderStatus" label="订单状态" width="120"><template #default="scope"><el-tag :type="getOrderStatusTagType(scope.row.orderStatus)">{{ getOrderStatusText(scope.row.orderStatus) }}</el-tag></template></el-table-column><el-table-column prop="createTime" label="创建时间" width="180" /><el-table-column label="操作" width="150"><template #default="scope"><el-button size="small" @click="viewOrderDetail(scope.row)">详情</el-button><el-button v-if="scope.row.orderStatus === 1" size="small" type="primary"@click="processOrder(scope.row)">处理</el-button></template></el-table-column></el-table></el-card></div>
</template><script>
import { getProperties, getDashboardStats, updatePropertyStatus, getOrders } from '@/api/rental'export default {name: 'RentalAdmin',data() {return {stats: {totalProperties: 0,availableProperties: 0,todayOrders: 0,successRate: 0},propertyList: [],orderList: [],loading: false,orderLoading: false,queryParams: {propertyStatus: '',propertyType: '',dateRange: []},pagination: {current: 1,size: 10,total: 0}}},mounted() {this.loadDashboardData()this.loadPropertyList()this.loadOrderList()},methods: {async loadDashboardData() {try {const res = await getDashboardStats()if (res.code === 200) {this.stats = res.data}} catch (error) {this.$message.error('加载数据失败')}},async loadPropertyList() {this.loading = truetry {const params = {...this.queryParams,page: this.pagination.current,size: this.pagination.size}const res = await getProperties(params)if (res.code === 200) {this.propertyList = res.data.recordsthis.pagination.total = res.data.total}} catch (error) {this.$message.error('加载房源列表失败')} finally {this.loading = false}},async loadOrderList() {this.orderLoading = truetry {const res = await getOrders()if (res.code === 200) {this.orderList = res.data}} catch (error) {this.$message.error('加载订单列表失败')} finally {this.orderLoading = false}},getPropertyTypeText(type) {const map = {1: '整租',2: '合租',3: '商铺'}return map[type] || '未知'},getStatusTagType(status) {const map = {1: 'success', // 可租2: 'warning', // 预定中3: 'info', // 已出租4: 'danger' // 已下架}return map[status] || 'info'},getStatusText(status) {const map = {1: '可租',2: '预定中',3: '已出租',4: '已下架'}return map[status] || '未知'},getOrderStatusTagType(status) {const map = {1: 'warning', // 待支付2: 'primary', // 待签约3: 'success', // 租赁中4: 'info' // 已完成}return map[status] || 'info'},getOrderStatusText(status) {const map = {1: '待支付',2: '待签约',3: '租赁中',4: '已完成'}return map[status] || '未知'},// 切换房源状态async togglePropertyStatus(property) {try {const newStatus = property.propertyStatus === 1 ? 4 : 1const res = await updatePropertyStatus(property.id, newStatus)if (res.code === 200) {this.$message.success('操作成功')this.loadPropertyList()}} catch (error) {this.$message.error('操作失败')}},handleSearch() {this.pagination.current = 1this.loadPropertyList()},handleReset() {this.queryParams = {propertyStatus: '',propertyType: '',dateRange: []}this.handleSearch()},handleSizeChange(size) {this.pagination.size = sizethis.loadPropertyList()},handleCurrentChange(current) {this.pagination.current = currentthis.loadPropertyList()},addProperty() {this.$router.push('/property/add')},editProperty(property) {this.$router.push(`/property/edit/${property.id}`)},viewPropertyDetail(property) {this.$router.push(`/property/detail/${property.id}`)},viewOrderDetail(order) {this.$router.push(`/order/detail/${order.id}`)}}
}
</script><style scoped>
.rental-admin-container {padding: 20px;background: #f5f7fa;
}.stats-card {text-align: center;
}.stats-number {font-size: 32px;font-weight: bold;color: #1890ff;margin-bottom: 8px;
}.stats-label {color: #666;font-size: 14px;
}.table-card {margin-top: 20px;
}.card-header {display: flex;justify-content: space-between;align-items: center;
}.order-management-card {margin-top: 20px;
}
</style>
数据库设计核心表结构
-- 房源信息表
CREATE TABLE `rental_property` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`property_title` varchar(200) NOT NULL COMMENT '房源标题',`property_type` tinyint(1) NOT NULL COMMENT '房源类型',`property_address` varchar(255) NOT NULL COMMENT '详细地址',`village_name` varchar(100) NOT NULL COMMENT '小区/村名',`geo_location` varchar(100) NOT NULL COMMENT '地理坐标',`area_size` decimal(10,2) NOT NULL COMMENT '面积',`rental_price` decimal(15,2) NOT NULL COMMENT '租金',`price_unit` varchar(20) DEFAULT '月' COMMENT '价格单位',`room_config` varchar(50) NOT NULL COMMENT '户型配置',`facilities` json DEFAULT NULL COMMENT '配套设施',`property_images` json NOT NULL COMMENT '房源图片',`owner_id` bigint(20) NOT NULL COMMENT '房东ID',`contact_phone` varchar(20) NOT NULL COMMENT '联系电话',`property_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '房源状态',`view_count` int(11) DEFAULT '0' COMMENT '浏览次数',`create_time` datetime DEFAULT CURRENT_TIMESTAMP,`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (`id`),KEY `idx_village` (`village_name`),KEY `idx_owner` (`owner_id`),KEY `idx_status` (`property_status`),KEY `idx_price` (`rental_price`),KEY `idx_location` (`geo_location`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='房源信息表';-- 租赁订单表
CREATE TABLE `rental_order` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`order_no` varchar(32) NOT NULL COMMENT '订单编号',`property_id` bigint(20) NOT NULL COMMENT '房源ID',`tenant_id` bigint(20) NOT NULL COMMENT '租客ID',`owner_id` bigint(20) NOT NULL COMMENT '房东ID',`rental_start_date` date NOT NULL COMMENT '租期开始',`rental_end_date` date NOT NULL COMMENT '租期结束',`total_amount` decimal(15,2) NOT NULL COMMENT '订单总额',`deposit_amount` decimal(15,2) NOT NULL COMMENT '押金金额',`payment_status` tinyint(1) NOT NULL COMMENT '支付状态',`order_status` tinyint(1) NOT NULL COMMENT '订单状态',`contract_url` varchar(500) DEFAULT NULL COMMENT '电子合同',`create_time` datetime DEFAULT CURRENT_TIMESTAMP,`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (`id`),UNIQUE KEY `uk_order_no` (`order_no`),KEY `idx_property` (`property_id`),KEY `idx_tenant` (`tenant_id`),KEY `idx_owner` (`owner_id`),KEY `idx_status` (`order_status`),KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租赁订单表';-- 用户收藏表
CREATE TABLE `user_favorite` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`user_id` bigint(20) NOT NULL COMMENT '用户ID',`property_id` bigint(20) NOT NULL COMMENT '房源ID',`create_time` datetime DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`),UNIQUE KEY `uk_user_property` (`user_id`, `property_id`),KEY `idx_user` (`user_id`),KEY `idx_property` (`property_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户收藏表';-- 浏览历史表
CREATE TABLE `view_history` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`user_id` bigint(20) NOT NULL COMMENT '用户ID',`property_id` bigint(20) NOT NULL COMMENT '房源ID',`view_time` datetime DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`),KEY `idx_user` (`user_id`),KEY `idx_property` (`property_id`),KEY `idx_view_time` (`view_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='浏览历史表';
这套基于JAVA村里租房系统小区租售系统的完整解决方案,通过现代化的微服务架构和位置智能技术,为城乡房产租赁市场提供了全方位的数字化转型升级路径。系统采用SpringBoot+MyBatisPlus+MySQL构建高可用分布式服务集群,使用Uniapp框架实现微信小程序、H5多端统一的用户界面,配合Vue+ElementUI的管理后台,形成了完整的技术生态闭环。
从技术实现角度看,该系统创新性地引入了智能推荐算法、位置服务、电子合同管理等先进技术理念,确保了租赁系统在城乡复杂场景下的实用性和易用性。对于房产租赁平台而言,这套系统不仅实现了租赁流程的数字化管理,更重要的是通过数据分析和智能匹配为房源推广和用户服务提供了科学依据。
随着乡村振兴战略的深入实施和城乡融合发展的加速推进,乡村及小区房产租赁市场正在迎来重要发展机遇。这套JAVA村里租房系统小区租售系统源码以其先进的技术架构、完善的功能设计和良好的适应性,将成为城乡房产租赁市场规范化发展的重要技术支撑。未来,随着5G、物联网、人工智能等新技术的深度融合,该系统还将持续演进,为城乡房产租赁市场创新发展提供更强大的技术动力。