From a9a2d0f1d8d271985869dd2b26ac29217191ab51 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 10 Dec 2024 11:51:58 +0800
Subject: [PATCH] 应急空间新增字典,查询修改

---
 src/main/java/org/springblade/modules/yw/service/impl/IndParkInfoServiceImpl.java |  113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/springblade/modules/yw/service/impl/IndParkInfoServiceImpl.java b/src/main/java/org/springblade/modules/yw/service/impl/IndParkInfoServiceImpl.java
index 6ffbadf..f255a18 100644
--- a/src/main/java/org/springblade/modules/yw/service/impl/IndParkInfoServiceImpl.java
+++ b/src/main/java/org/springblade/modules/yw/service/impl/IndParkInfoServiceImpl.java
@@ -6,17 +6,16 @@
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.modules.system.entity.Region;
 import org.springblade.modules.system.service.IRegionService;
+import org.springblade.modules.yw.entity.EmergencySpaceEntity;
 import org.springblade.modules.yw.entity.IndParkInfoEntity;
+import org.springblade.modules.yw.entity.RescueTeamEntity;
 import org.springblade.modules.yw.excel.IndParkInfoExcel;
+import org.springblade.modules.yw.service.*;
 import org.springblade.modules.yw.vo.IndParkInfoVO;
 import org.springblade.modules.yw.mapper.IndParkInfoMapper;
-import org.springblade.modules.yw.service.IIndParkInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -31,6 +30,21 @@
 
 	@Autowired
 	private IRegionService regionService;
+
+	@Autowired
+	private IFirmInfoService firmInfoService;
+
+	@Autowired
+	private IRescueTeamService rescueTeamService;
+
+	@Autowired
+	private IRiskSourceService riskSourceService;
+
+	@Autowired
+	private IProTarService proTarService;
+
+	@Autowired
+	private IEmergencySpaceService emergencySpaceService;
 
 	/**
 	 * 自定义分页查询
@@ -109,4 +123,95 @@
 		}
 		return "";
 	}
+
+	/**
+	 * 园区基本信息查询(包含企业统计信息)
+	 * @param indParkInfo
+	 * @return
+	 */
+	@Override
+	public IndParkInfoVO getDetail(IndParkInfoEntity indParkInfo) {
+		// 查询详情信息
+		IndParkInfoVO indParkInfoVO = baseMapper.getDetail(indParkInfo);
+		// 查询企业的数量
+		long count = firmInfoService.count();
+		// 设置企业数量
+		indParkInfoVO.setFirmNum((int) count);
+		// 设置行政区划
+		setRegionInfo(indParkInfoVO);
+		// 设置救援人员数量
+		indParkInfoVO.setRecNum(getRecNum());
+		// 设置应急池容量
+		indParkInfoVO.setEmePool(getEmePool());
+		// 设置风险企业数量
+		indParkInfoVO.setRiskFirmNum(getRiskFirmNum());
+		// 设置保护目标数量
+		indParkInfoVO.setProTarNum(getProTarNum());
+		// 设置应急空间数量
+		indParkInfoVO.setSpaceNum(getSpaceNum());
+		// 返回
+		return indParkInfoVO;
+	}
+
+	/**
+	 * 获取应急池容量
+	 * @return
+	 */
+	private String getEmePool() {
+		return emergencySpaceService.getEmePool();
+	}
+
+	/**
+	 * 查询应急空间数量
+	 * @return
+	 */
+	private Integer getSpaceNum() {
+		QueryWrapper<EmergencySpaceEntity> wrapper = new QueryWrapper<>();
+		wrapper.eq("is_deleted",0).
+			ne("type",7)
+			.ne("type",9)
+			.ne("type",11);
+		return (int)emergencySpaceService.count(wrapper);
+	}
+
+	/**
+	 * 查询保护目标数量
+	 * @return
+	 */
+	private Integer getProTarNum() {
+		return (int)proTarService.count();
+	}
+
+	/**
+	 * 查询风险企业数量
+	 * @return
+	 */
+	private Integer getRiskFirmNum() {
+		return (int)riskSourceService.count();
+	}
+
+	/**
+	 * 获取救援人员数量
+	 * @return
+	 */
+	private Integer getRecNum() {
+		QueryWrapper<RescueTeamEntity> wrapper = new QueryWrapper<>();
+		wrapper.eq("type",1);
+		long count = rescueTeamService.count(wrapper);
+		return (int)count;
+	}
+
+	/**
+	 * 设置行政区划
+	 * @param indParkInfoVO
+	 */
+	private void setRegionInfo(IndParkInfoVO indParkInfoVO) {
+		QueryWrapper<Region> wrapper = new QueryWrapper<>();
+		wrapper.eq("ancestors","000000000000,"+indParkInfoVO.getAreaCode());
+		List<Region> list = regionService.list(wrapper);
+		if (list.size()>0){
+			Region region = list.get(0);
+			indParkInfoVO.setRegionName(region.getProvinceName()+"-"+region.getCityName());
+		}
+	}
 }

--
Gitblit v1.9.3