吉安感知网项目-后端
rain
2026-01-28 54898304203f3ea0c132899dca4341dc182d13de
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,7 @@
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;
@@ -63,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()) {
@@ -89,7 +94,7 @@
   @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;
@@ -97,6 +102,7 @@
   /**
    * 获取设备列表
    *
    * @param page
    * @param fwDevice
    * @return
@@ -108,39 +114,46 @@
   /**
    * 设备类型统计
    *
    * @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(String effectiveRangeKmIsNotNull) {
      return baseMapper.getDeviceOutStatistics(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()));
      deptList.addAll(deptList);
      return baseMapper.getDeviceManufacturerStatistics(deptList);
   }
   /**
    * 设备属性统计
    *
    * @return
    */
   @Override
   public AlarmStatisticsVO statisticalDeviceAtt() {
      return baseMapper.statisticalDeviceAtt();
   public AlarmStatisticsVO statisticalDeviceAtt(List<Long> deptList) {
      return baseMapper.statisticalDeviceAtt(deptList);
   }
   @Override
@@ -155,12 +168,13 @@
   /**
    * 保存或更新设备信息
    *
    * @param fwDeviceEntity
    * @return
    */
   @Override
   public boolean saveOrUpdateDevice(FwDeviceEntity fwDeviceEntity) {
      if (fwDeviceEntity.getEffectiveRangeKm() == null || fwDeviceEntity.getEffectiveRangeKm().compareTo(BigDecimal.ZERO) == 0 ) {
      if (fwDeviceEntity.getEffectiveRangeKm() == null || fwDeviceEntity.getEffectiveRangeKm().compareTo(BigDecimal.ZERO) == 0) {
         fwDeviceEntity.setLatitude("");
         fwDeviceEntity.setLongitude("");
      }