From f3cd4b8e3d29aeaac5d6577bb8fdcf038e269ce3 Mon Sep 17 00:00:00 2001 From: Angel <1050374295@qq.com> Date: Mon, 22 Jan 2024 20:37:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=B9=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BigScreenController.java | 95 +++++++++++-------- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java b/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java index 1e2fa1b..234aafb 100644 --- a/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java +++ b/gather-app/src/main/java/com/ruoyi/business/controller/BigScreenController.java @@ -7,10 +7,12 @@ import com.ruoyi.business.domain.vo.*; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.utils.NumKit; -import com.ruoyi.common.utils.StringKit; +import com.ruoyi.business.controller.utils.NumKit; +import com.ruoyi.business.controller.utils.StringKit; +import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.database.domain.*; +import com.ruoyi.database.domain.dto.MetaRealEstateInfoDTO; import com.ruoyi.database.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -19,10 +21,7 @@ import lombok.RequiredArgsConstructor; import org.apache.ibatis.annotations.Param; import org.springframework.web.bind.annotation.*; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -95,6 +94,29 @@ public class BigScreenController extends BaseController { } } + @PostMapping("/boundary") + @ApiOperation("边界列表") + public TableDataInfo list( + @RequestParam("startLongitude") Double startLongitude, + @RequestParam("endLongitude") Double endLongitude, + @RequestParam("startLatitude") Double startLatitude, + @RequestParam("endLatitude") Double endLatitude) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.between("longitude", startLongitude, endLongitude) + .between("latitude", startLatitude, endLatitude); + List list = realEstateInfoService.list(queryWrapper); + int count = realEstateInfoService.count(queryWrapper); + List resultList = new ArrayList<>(); + for (MetaRealEstateInfo info : list) { + MetaRealEstateInfoDTO dto = new MetaRealEstateInfoDTO(); + org.springframework.beans.BeanUtils.copyProperties(info, dto); + String concatenatedAddress = info.getRealEstateBriefAddress() + info.getBuildingName() + "幢"; + dto.setConcatenatedAddress(concatenatedAddress); + resultList.add(dto); + } + TableDataInfo dataTable = getDataTable(resultList); + return dataTable; + } @GetMapping @ApiOperation("常驻人员列表") @@ -277,7 +299,7 @@ public class BigScreenController extends BaseController { @PostMapping("/realTimeAlarmSituation") @ApiOperation("实时警情") - public AjaxResult realTimeAlarmSituation(@ApiParam @Param("时间") @RequestParam String time) { + public AjaxResult realTimeAlarmSituation(@ApiParam @Param("时间") @RequestParam String time) { try { if (0 == NumKit.checkInt(time)) { time = "30"; @@ -310,7 +332,7 @@ public class BigScreenController extends BaseController { @PostMapping("/buildingInformation") @ApiOperation("楼栋信息") - public AjaxResult overviewResources(@ApiParam("楼栋地址") @RequestParam String para) { + public AjaxResult overviewResources(@ApiParam("楼栋地址") @RequestParam String para) { try { para = para.substring(0, para.indexOf("号")); MetaRealEstateInfo estateInfo = new MetaRealEstateInfo(); @@ -344,42 +366,42 @@ public class BigScreenController extends BaseController { @PostMapping("/buildRealEstate") @ApiOperation("楼栋信息:实有房屋统计") - public AjaxResult buildRealEstate(@ApiParam("楼栋地址") @RequestParam String para) { + public AjaxResult buildRealEstate(@ApiParam("楼栋地址") @RequestParam String para) { try { int index = para.lastIndexOf("幢"); String buildName = null; if (index != -1) { for (int i = index - 1; i >= 0; i--) { // 从特定字符位置-1开始向前遍历 if (Pattern.matches("\\d", String.valueOf(para.charAt(i)))) {// 检查字符是否为数字 - buildName = para.substring(i,index);// 返回有数字的字符串 + buildName = para.substring(i, index);// 返回有数字的字符串 } - if (!Pattern.matches("\\d", String.valueOf(para.charAt(i)))){ + if (!Pattern.matches("\\d", String.valueOf(para.charAt(i)))) { break; } } int index1 = para.lastIndexOf(buildName); - if (index1 != -1 ){ - para = para.substring(0,index1); + if (index1 != -1) { + para = para.substring(0, index1); } } QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("real_estate_brief_address",para); - queryWrapper.eq("building_name",buildName); + queryWrapper.eq("real_estate_brief_address", para); + queryWrapper.eq("building_name", buildName); int a = realEstateInfoService.count(queryWrapper); List list = realEstateInfoService.list(queryWrapper); int spCount = 0; int kzCount = 0; - for (MetaRealEstateInfo metaRealEstateInfo : list){ + for (MetaRealEstateInfo metaRealEstateInfo : list) { int index1 = metaRealEstateInfo.getRealEstateAddress().indexOf("商铺"); - if (index1 != -1){ + if (index1 != -1) { spCount++; } Integer count = actualUserInfoService.lambdaQuery().eq(MetaActualUserInfo::getHabitationAddress, metaRealEstateInfo.getRealEstateAddress()).count(); - if (count == 0){ + if (count == 0) { kzCount++; } } - int zzCount = a-spCount; + int zzCount = a - spCount; //todo 目前都是写死的 BuildInformationVo buildInformationVo = new BuildInformationVo(); buildInformationVo.setCount(StringKit.toString(a)); @@ -403,29 +425,29 @@ public class BigScreenController extends BaseController { @PostMapping("/buildRealActual") @ApiOperation("楼栋信息:实有人口统计") - public AjaxResult buildRealActual(@ApiParam("楼栋地址") @RequestParam String para) { + public AjaxResult buildRealActual(@ApiParam("楼栋地址") @RequestParam String para) { try { int index = para.lastIndexOf("幢"); String buildName = null; if (index != -1) { for (int i = index - 1; i >= 0; i--) { // 从特定字符位置-1开始向前遍历 if (Pattern.matches("\\d", String.valueOf(para.charAt(i)))) {// 检查字符是否为数字 - buildName = para.substring(i,index);// 返回有数字的字符串 + buildName = para.substring(i, index);// 返回有数字的字符串 } - if (!Pattern.matches("\\d", String.valueOf(para.charAt(i)))){ + if (!Pattern.matches("\\d", String.valueOf(para.charAt(i)))) { break; } } int index1 = para.lastIndexOf(buildName); - if (index1 != -1 ){ - para = para.substring(0,index1); + if (index1 != -1) { + para = para.substring(0, index1); } } // 创建查询条件,使用模糊查询 QueryWrapper queryWrapperEstate = new QueryWrapper<>(); // queryWrapperEstate.like("real_estate_address", para); // 你需要替换成实际的模糊查询条件 queryWrapperEstate.eq("real_estate_brief_address", para); - queryWrapperEstate.eq("building_name",buildName); + queryWrapperEstate.eq("building_name", buildName); // 执行查询 List realEstateInfos = realEstateInfoService.list(queryWrapperEstate); @@ -491,7 +513,7 @@ public class BigScreenController extends BaseController { @PostMapping("/buildStructure") @ApiOperation("楼栋信息:房屋结构") public AjaxResult buildStructure( - @ApiParam(value = "楼栋地址" ) @RequestParam String para, + @ApiParam(value = "楼栋地址") @RequestParam String para, @ApiParam(value = "单元") @RequestParam String unit) { try { //获取到房屋数据的实际地址 @@ -501,21 +523,21 @@ public class BigScreenController extends BaseController { if (index != -1) { for (int i = index - 1; i >= 0; i--) { // 从特定字符位置-1开始向前遍历 if (Pattern.matches("\\d", String.valueOf(para.charAt(i)))) {// 检查字符是否为数字 - buildName = para.substring(i,index);// 返回有数字的字符串 + buildName = para.substring(i, index);// 返回有数字的字符串 } - if (!Pattern.matches("\\d", String.valueOf(para.charAt(i)))){ + if (!Pattern.matches("\\d", String.valueOf(para.charAt(i)))) { break; } } int index1 = para.lastIndexOf(buildName); - if (index1 != -1 ){ - para = para.substring(0,index1); + if (index1 != -1) { + para = para.substring(0, index1); } } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("real_estate_brief_address", para); // queryWrapper.like("real_estate_address", para); - queryWrapper.eq("building_name",buildName); + queryWrapper.eq("building_name", buildName); queryWrapper.eq("unit_name", unit); List estateInfoList = realEstateInfoService.list(queryWrapper); @@ -541,16 +563,14 @@ public class BigScreenController extends BaseController { entryMap.put("homeName", info.getHomeName()); entryMap.put("address", info.getRealEstateAddress()); Integer count = actualUserInfoService.lambdaQuery().eq(MetaActualUserInfo::getHabitationAddress, info.getRealEstateAddress()).count(); - if (count == 0){ - entryMap.put("type","空置"); + if (count == 0) { + entryMap.put("type", "空置"); } return entryMap; }, Collectors.toList() ) )); - - return AjaxResult.success(resultMap); } catch (Exception e) { logger.info(StringKit.toString(e)); @@ -560,7 +580,7 @@ public class BigScreenController extends BaseController { @PostMapping("/buildInformation") @ApiOperation("楼栋信息:户室信息") - public AjaxResult buildInformation(@ApiParam("楼栋地址") @RequestParam String para) { + public AjaxResult buildInformation(@ApiParam("楼栋地址") @RequestParam String para) { try { QueryWrapper addQueryWrapper = new QueryWrapper<>(); @@ -579,7 +599,7 @@ public class BigScreenController extends BaseController { //网格 没有 homeInfoVo.setGrid(""); homeInfoVo.setType("住宅"); - if (para.contains("商铺")){ + if (para.contains("商铺")) { homeInfoVo.setType("商铺"); } @@ -672,5 +692,4 @@ public class BigScreenController extends BaseController { } - }