From 67961e8f4fdbcd83bf59f8c8bd3f8600618e3d61 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Tue, 20 Jan 2026 14:26:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/service/impl/GdSupplyDemandServiceImpl.java |   38 +++++++++++---------------------------
 1 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/service/impl/GdSupplyDemandServiceImpl.java b/drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/service/impl/GdSupplyDemandServiceImpl.java
index 6d0635b..35c9b62 100644
--- a/drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/service/impl/GdSupplyDemandServiceImpl.java
+++ b/drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/service/impl/GdSupplyDemandServiceImpl.java
@@ -59,7 +59,7 @@
 	private static final String STATUS_APPLY = "1";
 	private static final String STATUS_APPROVED = "2";
 	private static final String STATUS_REJECTED = "3";
-	
+
 	/**
 	 * 审核状态常量:0-待审核、1-审核通过、2-审核拒绝
 	 */
@@ -72,7 +72,7 @@
 
 	@Override
 	public IPage<GdSupplyDemandVO> selectGdSupplyDemandPage(IPage<GdSupplyDemandVO> page, GdSupplyDemandPageParam gdSupplyDemand) {
-		return page.setRecords(baseMapper.selectGdSupplyDemandPage(page, gdSupplyDemand, buildDeptIdList()));
+		return page.setRecords(baseMapper.selectGdSupplyDemandPage(page, gdSupplyDemand, SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()))));
 	}
 
 	@Override
@@ -85,7 +85,7 @@
 		if (Func.isEmpty(gdSupplyDemand)) {
 			throw new ServiceException("需求参数不能为空");
 		}
-		GdSupplyDemandEntity detail = baseMapper.selectGdSupplyDemandDetail(gdSupplyDemand, buildDeptIdList());
+		GdSupplyDemandEntity detail = baseMapper.selectGdSupplyDemandDetail(gdSupplyDemand, SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId())));
 		if (detail == null) {
 			throw new ServiceException("未查询到数据");
 		}
@@ -98,23 +98,23 @@
 		if (Func.isEmpty(gdSupplyDemand)) {
 			throw new ServiceException("需求参数不能为空");
 		}
-		
+
 		// 获取前端传入的需求状态
 		String demandStatus = gdSupplyDemand.getDemandStatus();
 		if (StringUtil.isBlank(demandStatus)) {
 			throw new ServiceException("需求状态不能为空");
 		}
-		
+
 		// 校验状态值有效性
 		if (!STATUS_DRAFT.equals(demandStatus) && !STATUS_APPLY.equals(demandStatus)) {
 			throw new ServiceException("需求状态值无效,仅支持 0(草稿) 或 1(申请中)");
 		}
-		
+
 		boolean isInsert = Func.isEmpty(gdSupplyDemand.getId());
 		Long userId = AuthUtil.getUserId();
 		Long deptId = Long.valueOf(AuthUtil.getDeptId());
 		gdSupplyDemand.setUpdateUser(userId);
-		
+
 		boolean saved;
 		if (isInsert) {
 			gdSupplyDemand.setCreateUser(userId);
@@ -123,18 +123,18 @@
 		} else {
 			saved = baseMapper.updateGdSupplyDemand(gdSupplyDemand) > 0;
 		}
-		
+
 		if (!saved) {
 			return false;
 		}
-		
+
 		// 仅当状态为"申请中"(1)时才创建审核记录
 		if (STATUS_APPLY.equals(demandStatus)) {
 			GdSupplyDemandEntity supplyDemand = loadSupplyDemandForAudit(gdSupplyDemand.getId());
 			GdSupplyDemandAuditEntity auditEntity = buildAuditEntity(supplyDemand, AUDIT_PENDING, null);
 			return gdSupplyDemandAuditService.saveSupplyDemandAudit(auditEntity);
 		}
-		
+
 		// 状态为"草稿"(0)时直接返回成功
 		return true;
 	}
@@ -222,27 +222,11 @@
 		}
 		GdSupplyDemandDTO query = new GdSupplyDemandDTO();
 		query.setId(demandId);
-		GdSupplyDemandEntity detail = baseMapper.selectGdSupplyDemandDetail(query, buildDeptIdList());
+		GdSupplyDemandEntity detail = baseMapper.selectGdSupplyDemandDetail(query, SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId())));
 		if (detail == null) {
 			throw new ServiceException("需求数据不存在");
 		}
 		return detail;
-	}
-
-	private List<Long> buildDeptIdList() {
-		if (AuthUtil.isAdministrator()) {
-			return null;
-		}
-		Long deptId = Long.valueOf(AuthUtil.getDeptId());
-		List<Long> deptIdList = SysCache.getDeptChildIds(deptId);
-		List<Long> result = new ArrayList<>();
-		if (Func.isNotEmpty(deptIdList)) {
-			result.addAll(deptIdList);
-		}
-		if (!result.contains(deptId)) {
-			result.add(deptId);
-		}
-		return result;
 	}
 
 	@Override

--
Gitblit v1.9.3