From 3ae46f2a59f9d4e751f78d8dc1a896ceba5ca495 Mon Sep 17 00:00:00 2001
From: rain <1679827795@qq.com>
Date: Fri, 09 Jan 2026 15:13:40 +0800
Subject: [PATCH] 区域管理模块
---
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java b/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java
index 4ab5ffd..5e2f51a 100644
--- a/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwPoliceStationServiceImpl.java
+++ b/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;
@@ -78,19 +79,37 @@
private void fillCreateFields(FwPoliceStationEntity fwPoliceStation) {
Long userId = AuthUtil.getUserId();
- Long deptId = Long.valueOf(AuthUtil.getDeptId());
+ 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());
}
--
Gitblit v1.9.3