From 5d5cd3ad979a0b85ab8c7034dcad1663fdcf71be Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 01 Dec 2023 14:18:53 +0800
Subject: [PATCH] 文章通过范围查询

---
 src/main/java/org/springblade/modules/house/service/impl/HouseRentalServiceImpl.java |   73 ++++++++++++++++++++++++++++++++++--
 1 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/springblade/modules/house/service/impl/HouseRentalServiceImpl.java b/src/main/java/org/springblade/modules/house/service/impl/HouseRentalServiceImpl.java
index 71195c3..1e02036 100644
--- a/src/main/java/org/springblade/modules/house/service/impl/HouseRentalServiceImpl.java
+++ b/src/main/java/org/springblade/modules/house/service/impl/HouseRentalServiceImpl.java
@@ -19,14 +19,17 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.modules.grid.service.IGridService;
 import org.springblade.modules.house.entity.HouseRentalEntity;
 import org.springblade.modules.house.entity.HouseTenantEntity;
 import org.springblade.modules.house.service.IHouseTenantService;
+import org.springblade.modules.house.vo.HouseRentalStatistics;
+import org.springblade.modules.house.vo.HouseRentalTenantVO;
 import org.springblade.modules.house.vo.HouseRentalVO;
 import org.springblade.modules.house.mapper.HouseRentalMapper;
 import org.springblade.modules.house.service.IHouseRentalService;
-import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.modules.house.vo.HouseTenantVO;
+import org.springblade.modules.house.excel.HouseRentalExcel;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -34,7 +37,6 @@
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -50,6 +52,9 @@
 	@Autowired
 	private IHouseTenantService houseTenantService;
 
+	@Autowired
+	private IGridService gridService;
+
 	/**
 	 * 自定义分页查询
 	 * @param page
@@ -57,8 +62,20 @@
 	 * @return
 	 */
 	@Override
-	public IPage<HouseRentalVO> selectHouseRentalPage(IPage<HouseRentalVO> page, HouseRentalVO houseRental) {
-		return page.setRecords(baseMapper.selectHouseRentalPage(page, houseRental));
+	public IPage<HouseRentalTenantVO> selectHouseRentalPage(IPage<HouseRentalTenantVO> page, HouseRentalTenantVO houseRental) {
+		List<String> list = new ArrayList<>();
+		if (null!=houseRental.getRoleName() && !houseRental.getRoleName().equals("")){
+			if (houseRental.getRoleName().equals("网格员")){
+				// 查询对应的房屋地址code
+				list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId());
+			}
+		}
+		if (null!=houseRental.getAuditStatus()){
+			if (houseRental.getAuditStatus()==0){
+				houseRental.setAuditStatus(2);
+			}
+		}
+		return page.setRecords(baseMapper.selectHouseRentalPage(page, houseRental,list));
 	}
 
 	/**
@@ -188,4 +205,52 @@
 		// 返回
 		return update && addFlag && updateFlag && removeFlag;
 	}
+
+	/**
+	 * 获取统计数据
+	 * @return
+	 */
+	@Override
+	public Object getStatistics(HouseRentalTenantVO houseRental) {
+		List<String> list = new ArrayList<>();
+		if (null!=houseRental.getRoleName() && !houseRental.getRoleName().equals("")){
+			if (houseRental.getRoleName().equals("网格员")){
+				// 查询对应的房屋地址code
+				list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId());
+			}
+		}
+		// 查询
+		List<HouseRentalStatistics> statistics = baseMapper.getStatistics(houseRental,list);
+		// 返回
+		return statistics;
+	}
+
+	/**
+	 * 出租屋 确认
+	 * @param houseRental
+	 * @return
+	 */
+	@Override
+	public Boolean confirmHouseRental(HouseRentalVO houseRental) {
+		// 修改状态
+		houseRental.setUpdateTime(new Date());
+		// 修改
+		return updateById(houseRental);
+	}
+
+	/**
+	 * 导出租赁信息
+	 * @param houseRentalVO
+	 * @return
+	 */
+	@Override
+	public List<HouseRentalExcel> export(HouseRentalTenantVO houseRentalVO) {
+		List<HouseRentalExcel> houseRentalExcels = baseMapper.export(houseRentalVO);
+		return houseRentalExcels;
+	}
+
+	@Override
+	public Integer getStatisticsCount(HouseRentalTenantVO houseRental) {
+		return baseMapper.getStatisticsCount(AuthUtil.getUserId());
+	}
 }

--
Gitblit v1.9.3