吉安感知网项目-后端
xiebin
2026-01-30 b3edfcbd0267cf66d4a908d47dbe5d97533dcb33
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java
@@ -17,6 +17,7 @@
package org.sxkj.fw.area.service.impl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.sxkj.common.utils.HeaderUtils;
import org.sxkj.fw.area.entity.FwPoliceStationEntity;
import org.sxkj.fw.area.vo.FwPoliceStationVO;
@@ -44,6 +45,11 @@
      return page.setRecords(baseMapper.selectFwPoliceStationPage(page, fwPoliceStation));
   }
   @Override
   public List<FwPoliceStationVO> selectFwPoliceStationList() {
      return baseMapper.selectFwPoliceStationList();
   }
   @Override
   public List<FwPoliceStationExcel> exportFwPoliceStation(Wrapper<FwPoliceStationEntity> queryWrapper) {
@@ -52,6 +58,12 @@
      //   fwPoliceStation.setTypeName(DictCache.getValue(DictEnum.YES_NO, FwPoliceStation.getType()));
      //});
      return fwPoliceStationList;
   }
   @Override
   public List<FwPoliceStationVO> selectByPolygons(List<String> polygons) {
      // 仅做空间过滤,具体坐标规则由 SQL 处理
      return baseMapper.selectByPolygons(polygons);
   }
   @Override
@@ -77,20 +89,39 @@
   }
   private void fillCreateFields(FwPoliceStationEntity fwPoliceStation) {
      // 创建/更新基础审计字段统一设置
      Long userId = AuthUtil.getUserId();
      Long deptId = Long.valueOf(AuthUtil.getDeptId());
      String areaCode = HeaderUtils.getAreaCode();
      String deptIdStr = AuthUtil.getDeptId();
      Long deptId = null;
      if (StringUtil.isNotBlank(deptIdStr)) {
         try {
            deptId = Long.valueOf(deptIdStr);
         } catch (NumberFormatException ignored) {
            deptId = null;
         }
      }
//      String areaCode = HeaderUtils.getAreaCode();
//      if (StringUtil.isBlank(areaCode)) {
//         areaCode = fwPoliceStation.getAreaCode();
//      }
      Date now = new Date();
      fwPoliceStation.setCreateUser(userId);
      fwPoliceStation.setUpdateUser(userId);
      fwPoliceStation.setCreateDept(deptId);
      fwPoliceStation.setAreaCode(areaCode);
      if (deptId != null) {
         fwPoliceStation.setCreateDept(deptId);
      }
//      if (StringUtil.isNotBlank(areaCode)) {
//         fwPoliceStation.setAreaCode(areaCode);
//      }
      fwPoliceStation.setCreateTime(now);
      fwPoliceStation.setUpdateTime(now);
   }
   private void fillUpdateFields(FwPoliceStationEntity fwPoliceStation) {
      fwPoliceStation.setUpdateUser(AuthUtil.getUserId());
      Long userId = AuthUtil.getUserId();
      if (userId != null) {
         fwPoliceStation.setUpdateUser(userId);
      }
      fwPoliceStation.setUpdateTime(new Date());
   }