From 74756c657109a4e48dd6c0b4d8959cdab89b33a9 Mon Sep 17 00:00:00 2001
From: xiebin <vip_xiaobin810@163.com>
Date: Wed, 28 Jan 2026 20:10:29 +0800
Subject: [PATCH] update-区域划分表结构调整
---
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java b/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java
index b4d4a17..386bf11 100644
--- a/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java
+++ b/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java
@@ -16,6 +16,7 @@
*/
package org.sxkj.fw.device.service.impl;
+import org.springblade.core.secure.utils.AuthUtil;
import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO;
import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO;
import org.sxkj.fw.common.GenericConverter;
@@ -37,6 +38,9 @@
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.StringUtil;
+import org.sxkj.system.cache.SysCache;
+
+import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -61,7 +65,10 @@
@Override
public IPage<FwDeviceVO> selectFwDevicePageVo(FwDevicePageParam fwDevice, Query query) {
- IPage<FwDeviceEntity> pages = selectFwDevicePage(Condition.getPage(query), GenericConverter.convert(fwDevice, FwDeviceDTO.class));
+ FwDeviceDTO fwDeviceDTO = GenericConverter.convert(fwDevice, FwDeviceDTO.class);
+ List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+ fwDeviceDTO.setDeptList(deptList);
+ IPage<FwDeviceEntity> pages = selectFwDevicePage(Condition.getPage(query), fwDeviceDTO);
IPage<FwDeviceVO> result = FwDeviceWrapper.build().pageVO(pages);
List<FwDeviceVO> records = result.getRecords();
if (records != null && !records.isEmpty()) {
@@ -79,15 +86,15 @@
}
@Override
- public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status) {
- return baseMapper.selectFwDeviceList(isAreaSelect, areaId, status);
+ public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status, Integer isTrack) {
+ return baseMapper.selectFwDeviceList(isAreaSelect, areaId, status, isTrack);
}
@Override
public List<FwDeviceExcel> exportFwDevice(Wrapper<FwDeviceEntity> queryWrapper) {
List<FwDeviceExcel> fwDeviceList = baseMapper.exportFwDevice(queryWrapper);
- //fwDeviceList.forEach(fwDevice -> {
+ // fwDeviceList.forEach(fwDevice -> {
// fwDevice.setTypeName(DictCache.getValue(DictEnum.YES_NO, FwDevice.getType()));
//});
return fwDeviceList;
@@ -95,6 +102,7 @@
/**
* 获取设备列表
+ *
* @param page
* @param fwDevice
* @return
@@ -106,39 +114,45 @@
/**
* 设备类型统计
+ *
* @return
*/
@Override
- public List<DeviceStatisticsVO> statisticalDeviceType() {
- return baseMapper.statisticalDeviceType();
+ public List<DeviceStatisticsVO> statisticalDeviceType(List<Long> deptList) {
+ return baseMapper.statisticalDeviceType(deptList);
}
/**
* 设备统计 - 按类型统计
+ *
* @return 统计数据
*/
@Override
public List<DeviceTypeStatisticsVO> getDeviceTypeStatistics() {
- return baseMapper.getDeviceTypeStatistics();
+ List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+ return baseMapper.getDeviceTypeStatistics(deptList);
}
@Override
- public List<DeviceStatisticsVO> getDeviceOutStatistics() {
- return baseMapper.getDeviceOutStatistics();
+ public List<DeviceStatisticsVO> getDeviceOutStatistics(String effectiveRangeKmIsNotNull) {
+ List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+ return baseMapper.getDeviceOutStatistics(effectiveRangeKmIsNotNull, deptList);
}
@Override
public List<DeviceStatisticsVO> getDeviceManufacturerStatistics() {
- return baseMapper.getDeviceManufacturerStatistics();
+ List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
+ return baseMapper.getDeviceManufacturerStatistics(deptList);
}
/**
* 设备属性统计
+ *
* @return
*/
@Override
- public AlarmStatisticsVO statisticalDeviceAtt() {
- return baseMapper.statisticalDeviceAtt();
+ public AlarmStatisticsVO statisticalDeviceAtt(List<Long> deptList) {
+ return baseMapper.statisticalDeviceAtt(deptList);
}
@Override
@@ -150,4 +164,24 @@
public boolean existsAreaBindByDeviceId(Long deviceId) {
return fwAreaDivideService.existsAreaByDeviceId(deviceId);
}
+
+ /**
+ * 保存或更新设备信息
+ *
+ * @param fwDeviceEntity
+ * @return
+ */
+ @Override
+ public boolean saveOrUpdateDevice(FwDeviceEntity fwDeviceEntity) {
+ if (fwDeviceEntity.getEffectiveRangeKm() == null || fwDeviceEntity.getEffectiveRangeKm().compareTo(BigDecimal.ZERO) == 0) {
+ fwDeviceEntity.setLatitude("");
+ fwDeviceEntity.setLongitude("");
+ }
+ return saveOrUpdate(fwDeviceEntity);
+ }
+
+ @Override
+ public boolean updateTrackStatusByDeviceId(Long deviceId, Integer trackStatus) {
+ return baseMapper.updateTrackStatusByDeviceId(deviceId, trackStatus) > 0;
+ }
}
--
Gitblit v1.9.3