From c04afebf9cebfd65bf55c2395e732f36f558d208 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 28 Jan 2026 10:30:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java |   82 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 80 insertions(+), 2 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 bd5174c..8637255 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
@@ -18,18 +18,31 @@
 
 import org.sxkj.fw.cockpit.vo.AlarmStatisticsVO;
 import org.sxkj.fw.cockpit.vo.DeviceStatisticsVO;
+import org.sxkj.fw.common.GenericConverter;
 import org.sxkj.fw.device.dto.FwDeviceDTO;
 import org.sxkj.fw.device.entity.FwDeviceEntity;
+import org.sxkj.fw.device.param.FwDevicePageParam;
 import org.sxkj.fw.device.vo.CockpitFwDeviceVO;
+import org.sxkj.fw.device.vo.DeviceTypeStatisticsVO;
 import org.sxkj.fw.device.vo.FwDeviceVO;
 import org.sxkj.fw.device.excel.FwDeviceExcel;
 import org.sxkj.fw.device.mapper.FwDeviceMapper;
 import org.sxkj.fw.device.service.IFwDeviceService;
+import org.sxkj.fw.area.service.IFwAreaDivideService;
+import org.sxkj.fw.device.wrapper.FwDeviceWrapper;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.StringUtil;
+
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import javax.annotation.Resource;
 
 /**
  * 设备表 服务实现类
@@ -40,14 +53,36 @@
 @Service
 public class FwDeviceServiceImpl extends BaseServiceImpl<FwDeviceMapper, FwDeviceEntity> implements IFwDeviceService {
 
+	@Resource
+	private IFwAreaDivideService fwAreaDivideService;
+
 	@Override
 	public IPage<FwDeviceEntity> selectFwDevicePage(IPage<FwDeviceEntity> page, FwDeviceDTO fwDevice) {
 		return page.setRecords(baseMapper.selectFwDevicePage(page, fwDevice));
 	}
 
 	@Override
-	public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId) {
-		return baseMapper.selectFwDeviceList(isAreaSelect, areaId);
+	public IPage<FwDeviceVO> selectFwDevicePageVo(FwDevicePageParam fwDevice, Query query) {
+		IPage<FwDeviceEntity> pages = selectFwDevicePage(Condition.getPage(query), GenericConverter.convert(fwDevice, FwDeviceDTO.class));
+		IPage<FwDeviceVO> result = FwDeviceWrapper.build().pageVO(pages);
+		List<FwDeviceVO> records = result.getRecords();
+		if (records != null && !records.isEmpty()) {
+			List<Long> deviceIds = records.stream()
+				.map(FwDeviceVO::getId)
+				.filter(id -> id != null)
+				.collect(Collectors.toList());
+			Map<Long, String> sceneNameMap = selectSceneNameByDeviceIds(deviceIds);
+			for (FwDeviceVO record : records) {
+				String sceneName = sceneNameMap.get(record.getId());
+				record.setSceneName(StringUtil.isBlank(sceneName) ? "/" : sceneName);
+			}
+		}
+		return result;
+	}
+
+	@Override
+	public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status, Integer isTrack) {
+		return baseMapper.selectFwDeviceList(isAreaSelect, areaId, status, isTrack);
 	}
 
 
@@ -81,6 +116,25 @@
 	}
 
 	/**
+	 * 设备统计 - 按类型统计
+	 * @return 统计数据
+	 */
+	@Override
+	public List<DeviceTypeStatisticsVO> getDeviceTypeStatistics() {
+		return baseMapper.getDeviceTypeStatistics();
+	}
+
+	@Override
+	public List<DeviceStatisticsVO> getDeviceOutStatistics(String effectiveRangeKmIsNotNull) {
+		return baseMapper.getDeviceOutStatistics(effectiveRangeKmIsNotNull);
+	}
+
+	@Override
+	public List<DeviceStatisticsVO> getDeviceManufacturerStatistics() {
+		return baseMapper.getDeviceManufacturerStatistics();
+	}
+
+	/**
 	 * 设备属性统计
 	 * @return
 	 */
@@ -88,4 +142,28 @@
 	public AlarmStatisticsVO statisticalDeviceAtt() {
 		return baseMapper.statisticalDeviceAtt();
 	}
+
+	@Override
+	public Map<Long, String> selectSceneNameByDeviceIds(List<Long> deviceIds) {
+		return fwAreaDivideService.selectSceneNameByDeviceIds(deviceIds);
+	}
+
+	@Override
+	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);
+	}
 }

--
Gitblit v1.9.3