From ac07f8eb085374d43777eacb144d2660b5445e26 Mon Sep 17 00:00:00 2001
From: rain <1679827795@qq.com>
Date: Wed, 21 Jan 2026 15:53:27 +0800
Subject: [PATCH] 处理Vo,Dto继承entity问题

---
 drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/service/impl/GdSupplyDemandServiceImpl.java |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 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 35c9b62..496e671 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
@@ -22,6 +22,7 @@
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springframework.stereotype.Service;
@@ -41,6 +42,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 供需需求信息表 服务实现类
@@ -94,13 +96,14 @@
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean submitSupplyDemand(GdSupplyDemandEntity gdSupplyDemand) {
+	public boolean submitSupplyDemand(GdSupplyDemandDTO gdSupplyDemand) {
 		if (Func.isEmpty(gdSupplyDemand)) {
 			throw new ServiceException("需求参数不能为空");
 		}
+		GdSupplyDemandEntity supplyDemand = Objects.requireNonNull(BeanUtil.copy(gdSupplyDemand, GdSupplyDemandEntity.class));
 
 		// 获取前端传入的需求状态
-		String demandStatus = gdSupplyDemand.getDemandStatus();
+		String demandStatus = supplyDemand.getDemandStatus();
 		if (StringUtil.isBlank(demandStatus)) {
 			throw new ServiceException("需求状态不能为空");
 		}
@@ -110,18 +113,18 @@
 			throw new ServiceException("需求状态值无效,仅支持 0(草稿) 或 1(申请中)");
 		}
 
-		boolean isInsert = Func.isEmpty(gdSupplyDemand.getId());
+		boolean isInsert = Func.isEmpty(supplyDemand.getId());
 		Long userId = AuthUtil.getUserId();
 		Long deptId = Long.valueOf(AuthUtil.getDeptId());
-		gdSupplyDemand.setUpdateUser(userId);
+		supplyDemand.setUpdateUser(userId);
 
 		boolean saved;
 		if (isInsert) {
-			gdSupplyDemand.setCreateUser(userId);
-			gdSupplyDemand.setCreateDept(deptId);
-			saved = baseMapper.insertGdSupplyDemand(gdSupplyDemand) > 0;
+			supplyDemand.setCreateUser(userId);
+			supplyDemand.setCreateDept(deptId);
+			saved = baseMapper.insertGdSupplyDemand(supplyDemand) > 0;
 		} else {
-			saved = baseMapper.updateGdSupplyDemand(gdSupplyDemand) > 0;
+			saved = baseMapper.updateGdSupplyDemand(supplyDemand) > 0;
 		}
 
 		if (!saved) {
@@ -130,8 +133,8 @@
 
 		// 仅当状态为"申请中"(1)时才创建审核记录
 		if (STATUS_APPLY.equals(demandStatus)) {
-			GdSupplyDemandEntity supplyDemand = loadSupplyDemandForAudit(gdSupplyDemand.getId());
-			GdSupplyDemandAuditEntity auditEntity = buildAuditEntity(supplyDemand, AUDIT_PENDING, null);
+			GdSupplyDemandEntity auditDemand = loadSupplyDemandForAudit(supplyDemand.getId());
+			GdSupplyDemandAuditEntity auditEntity = buildAuditEntity(auditDemand, AUDIT_PENDING, null);
 			return gdSupplyDemandAuditService.saveSupplyDemandAudit(auditEntity);
 		}
 

--
Gitblit v1.9.3