From 9b6e9599737c4feaa435e3e29cd0476f197f8cc3 Mon Sep 17 00:00:00 2001 From: wangys <3401275564@qq.com> Date: Sat, 20 Dec 2025 13:33:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/postgres/sql/createTableFile.sql | 16 +-- .../xyzh/ai/controller/AgentController.java | 4 +- .../xyzh/ai/controller/ChatController.java | 6 +- .../ai/controller/KnowledgeController.java | 8 +- .../service/impl/AIFileUploadServiceImpl.java | 3 +- .../ai/service/impl/AgentChatServiceImpl.java | 3 +- .../ai/service/impl/KnowledgeServiceImpl.java | 14 +- .../xyzh/api/file/service/FileService.java | 13 ++ .../file/service/impl/FileServiceImpl.java | 68 ++++++++++ .../system/controller/DeptRoleController.java | 3 +- .../system/controller/GuestController.java | 4 +- .../controller/PermissionController.java | 3 +- .../controller/SysConfigController.java | 3 +- .../system/controller/UserController.java | 3 +- .../system/controller/ViewController.java | 3 +- .../controller/WorkcaseChatContorller.java | 3 +- .../controller/WorkcaseController.java | 4 +- .../workcase/service/WorkcaseServiceImpl.java | 3 +- .../src/components/fileupload/FileUpload.vue | 9 +- .../views/admin/knowledge/KnowLedgeView.vue | 126 +++++++----------- 20 files changed, 180 insertions(+), 119 deletions(-) diff --git a/urbanLifelineServ/.bin/database/postgres/sql/createTableFile.sql b/urbanLifelineServ/.bin/database/postgres/sql/createTableFile.sql index 28d46ebb..dc85a220 100644 --- a/urbanLifelineServ/.bin/database/postgres/sql/createTableFile.sql +++ b/urbanLifelineServ/.bin/database/postgres/sql/createTableFile.sql @@ -11,7 +11,7 @@ CREATE TABLE file.tb_sys_file ( create_time TIMESTAMPTZ NOT NULL DEFAULT now(), -- 创建时间 update_time TIMESTAMPTZ DEFAULT NULL, -- 更新时间 delete_time TIMESTAMPTZ DEFAULT NULL, -- 删除时间 - deleted INTEGER NOT NULL DEFAULT 0, -- 是否已删除(0-未删除,1-已删除) + deleted BOOLEAN NOT NULL DEFAULT false, -- 是否已删除(false-未删除,true-已删除) -- TbSysFileDTO 特有字段 file_id VARCHAR(50) NOT NULL, -- 文件ID (主键) @@ -48,7 +48,7 @@ COMMENT ON COLUMN file.tb_sys_file.remark IS '备注'; COMMENT ON COLUMN file.tb_sys_file.create_time IS '创建时间'; COMMENT ON COLUMN file.tb_sys_file.update_time IS '更新时间'; COMMENT ON COLUMN file.tb_sys_file.delete_time IS '删除时间'; -COMMENT ON COLUMN file.tb_sys_file.deleted IS '是否已删除(0-未删除,1-已删除)'; +COMMENT ON COLUMN file.tb_sys_file.deleted IS '是否已删除(false-未删除,true-已删除)'; -- TbSysFileDTO 特有字段注释 COMMENT ON COLUMN file.tb_sys_file.file_id IS '文件ID (主键)'; @@ -71,9 +71,9 @@ COMMENT ON COLUMN file.tb_sys_file.md5_hash IS '文件MD5值'; COMMENT ON COLUMN file.tb_sys_file.extension IS '文件扩展名'; -- 文件表索引 -CREATE INDEX idx_file_module_business ON file.tb_sys_file(module, business_id) WHERE deleted = 0; -CREATE INDEX idx_file_uploader ON file.tb_sys_file(uploader) WHERE deleted = 0; -CREATE INDEX idx_file_bucket ON file.tb_sys_file(bucket_name) WHERE deleted = 0; -CREATE INDEX idx_file_status ON file.tb_sys_file(status) WHERE deleted = 0; -CREATE INDEX idx_file_create_time ON file.tb_sys_file(create_time) WHERE deleted = 0; -CREATE INDEX idx_file_md5 ON file.tb_sys_file(md5_hash) WHERE deleted = 0; \ No newline at end of file +-- CREATE INDEX idx_file_module_business ON file.tb_sys_file(module, business_id) WHERE deleted = false; +-- CREATE INDEX idx_file_uploader ON file.tb_sys_file(uploader) WHERE deleted = false; +-- CREATE INDEX idx_file_bucket ON file.tb_sys_file(bucket_name) WHERE deleted = false; +-- CREATE INDEX idx_file_status ON file.tb_sys_file(status) WHERE deleted = false; +-- CREATE INDEX idx_file_create_time ON file.tb_sys_file(create_time) WHERE deleted = false; +-- CREATE INDEX idx_file_md5 ON file.tb_sys_file(md5_hash) WHERE deleted = false; \ No newline at end of file diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/AgentController.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/AgentController.java index 88363b36..2eac5640 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/AgentController.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/AgentController.java @@ -1,7 +1,7 @@ package org.xyzh.ai.controller; import lombok.extern.slf4j.Slf4j; -import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -30,7 +30,7 @@ import java.util.Arrays; @RequestMapping("/ai/agent") public class AgentController { - @DubboReference(version = "1.0.0", group = "ai", timeout = 3000, retries = 0, scope = "local") + @Autowired private AgentService agentService; /** diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/ChatController.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/ChatController.java index 9ec826e0..0e028785 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/ChatController.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/ChatController.java @@ -2,7 +2,7 @@ package org.xyzh.ai.controller; import jakarta.validation.constraints.NotNull; import lombok.extern.slf4j.Slf4j; -import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -38,10 +38,10 @@ import java.util.Map; @RequestMapping("/ai/chat") public class ChatController { - @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local") + @Autowired private AgentChatService chatService; - @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local") + @Autowired private AIFileUploadService fileUploadService; // ====================== 会话管理 ====================== diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/KnowledgeController.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/KnowledgeController.java index 39c0b2de..9d09bb61 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/KnowledgeController.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/controller/KnowledgeController.java @@ -7,7 +7,9 @@ import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.apache.dubbo.config.annotation.DubboReference; +import jakarta.annotation.Resource; + +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -40,10 +42,10 @@ import java.util.Map; public class KnowledgeController { private static final Logger logger = LoggerFactory.getLogger(KnowledgeController.class); - @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local") + @Autowired private KnowledgeService knowledgeService; - @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local") + @Autowired private DifyProxyService difyProxyService; // ====================== 知识库管理 ====================== diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AIFileUploadServiceImpl.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AIFileUploadServiceImpl.java index 2a38ae0c..ffa8c874 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AIFileUploadServiceImpl.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AIFileUploadServiceImpl.java @@ -1,6 +1,5 @@ package org.xyzh.ai.service.impl; -import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,7 +34,7 @@ public class AIFileUploadServiceImpl implements AIFileUploadService { @Autowired private DifyApiClient difyApiClient; - @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local") + @Autowired private AgentService agentService; // ============================ 对话文件管理 ============================ diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java index 3adf2696..f47d4746 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java @@ -2,7 +2,6 @@ package org.xyzh.ai.service.impl; import com.alibaba.fastjson2.JSONObject; -import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +57,7 @@ public class AgentChatServiceImpl implements AgentChatService { @Autowired private TbChatMessageMapper chatMessageMapper; - @DubboReference(version = "1.0.0", group = "ai", timeout = 3000, retries = 0, scope = "local") + @Autowired private AgentService agentService; @Autowired diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/KnowledgeServiceImpl.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/KnowledgeServiceImpl.java index 51a8f232..cd791b30 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/KnowledgeServiceImpl.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/KnowledgeServiceImpl.java @@ -55,7 +55,7 @@ public class KnowledgeServiceImpl implements KnowledgeService { @DubboReference(version = "1.0.0", group = "file", timeout = 30000) private FileService fileService; - @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, scope = "local") + @Autowired private AIFileUploadService aiFileUploadService; // ================================= 知识库管理 ================================= @@ -464,8 +464,16 @@ public class KnowledgeServiceImpl implements KnowledgeService { return ResultDomain.failure("知识库未关联Dify"); } - // 3. 调用FileService上传到minio - ResultDomain fileResult = fileService.uploadFile(file, "knowledge", knowledgeId); + // 3. 调用FileService上传到minio(使用字节数组方式,支持跨模块Dubbo调用) + byte[] fileBytes; + try { + fileBytes = file.getBytes(); + } catch (Exception e) { + logger.error("读取文件字节失败", e); + return ResultDomain.failure("读取文件失败: " + e.getMessage()); + } + ResultDomain fileResult = fileService.uploadFileBytes( + fileBytes, file.getOriginalFilename(), file.getContentType(), "knowledge", knowledgeId); if (!fileResult.getSuccess() || fileResult.getData() == null) { return ResultDomain.failure("上传文件到存储服务失败: " + fileResult.getMessage()); } diff --git a/urbanLifelineServ/apis/api-file/src/main/java/org/xyzh/api/file/service/FileService.java b/urbanLifelineServ/apis/api-file/src/main/java/org/xyzh/api/file/service/FileService.java index d5a9783f..b7d613bd 100644 --- a/urbanLifelineServ/apis/api-file/src/main/java/org/xyzh/api/file/service/FileService.java +++ b/urbanLifelineServ/apis/api-file/src/main/java/org/xyzh/api/file/service/FileService.java @@ -95,4 +95,17 @@ public interface FileService { */ ResultDomain uploadFileVersion(MultipartFile file, String module, String businessId, String fileRootId); + /** + * @description 通过字节数组上传文件(用于跨模块 Dubbo 调用) + * @param fileBytes 文件字节数组 + * @param fileName 文件名 + * @param contentType 文件类型 + * @param module 所属模块 + * @param businessId 业务ID + * @return ResultDomain 上传结果 + * @author yslg + * @since 2025-12-20 + */ + ResultDomain uploadFileBytes(byte[] fileBytes, String fileName, String contentType, String module, String businessId); + } diff --git a/urbanLifelineServ/file/src/main/java/org/xyzh/file/service/impl/FileServiceImpl.java b/urbanLifelineServ/file/src/main/java/org/xyzh/file/service/impl/FileServiceImpl.java index 6f8a1a10..195ed4ad 100644 --- a/urbanLifelineServ/file/src/main/java/org/xyzh/file/service/impl/FileServiceImpl.java +++ b/urbanLifelineServ/file/src/main/java/org/xyzh/file/service/impl/FileServiceImpl.java @@ -374,6 +374,74 @@ public class FileServiceImpl implements FileService { return ResultDomain.failure("文件上传失败: " + e.getMessage()); } } + + @Override + public ResultDomain uploadFileBytes(byte[] fileBytes, String fileName, String contentType, String module, String businessId) { + try { + if (fileBytes == null || fileBytes.length == 0) { + return ResultDomain.failure("文件不能为空"); + } + + // 生成文件信息 + String extension = getFileExtension(fileName); + long size = fileBytes.length; + + // 生成唯一的对象名称 + String objectName = generateObjectName(fileName, module); + + // 计算文件MD5 + String md5Hash = calculateMD5(fileBytes); + + // 上传到MinIO + String bucketName = minioConfig.getBucketName(); + java.io.ByteArrayInputStream inputStream = new java.io.ByteArrayInputStream(fileBytes); + boolean uploadSuccess = minioUtil.uploadFile( + bucketName, + objectName, + inputStream, + size, + contentType + ); + + if (!uploadSuccess) { + return ResultDomain.failure("文件上传到MinIO失败"); + } + + // 生成文件URL + String fileUrl = minioConfig.getEndpoint() + "/" + bucketName + "/" + objectName; + + // 创建文件DTO + TbSysFileDTO fileDTO = new TbSysFileDTO(); + fileDTO.setOptsn(UUID.randomUUID().toString()); + fileDTO.setFileId(UUID.randomUUID().toString().replace("-", "")); + fileDTO.setName(fileName); + fileDTO.setPath(objectName); + fileDTO.setUrl(fileUrl); + fileDTO.setSize(size); + fileDTO.setMimeType(contentType); + fileDTO.setExtension(extension); + fileDTO.setMd5Hash(md5Hash); + fileDTO.setModule(module); + fileDTO.setBusinessId(businessId); + fileDTO.setVersion(1); + fileDTO.setFileRootId(fileDTO.getFileId()); + fileDTO.setCreateTime(new java.util.Date()); + + // 保存到数据库 + int result = fileMapper.insertFile(fileDTO); + if (result <= 0) { + minioUtil.deleteFile(bucketName, objectName); + return ResultDomain.failure("文件信息保存失败"); + } + + logger.info("字节数组文件上传成功: {}", fileName); + return ResultDomain.success("文件上传成功", fileDTO); + + } catch (Exception e) { + logger.error("字节数组文件上传失败", e); + return ResultDomain.failure("文件上传失败: " + e.getMessage()); + } + } /** * 生成唯一的对象名称 diff --git a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/DeptRoleController.java b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/DeptRoleController.java index 57c56e07..033deaee 100644 --- a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/DeptRoleController.java +++ b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/DeptRoleController.java @@ -1,6 +1,5 @@ package org.xyzh.system.controller; -import org.apache.dubbo.config.annotation.DubboReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +25,7 @@ public class DeptRoleController { private static final Logger logger = LoggerFactory.getLogger(DeptRoleController.class); - @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local") + @Autowired private DeptRoleService deptRoleService; // ================= 部门角色相关接口 ================= diff --git a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/GuestController.java b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/GuestController.java index 5f017c09..26238193 100644 --- a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/GuestController.java +++ b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/GuestController.java @@ -2,7 +2,7 @@ package org.xyzh.system.controller; import java.util.Arrays; -import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -32,7 +32,7 @@ import jakarta.validation.constraints.NotNull; @RequestMapping("/system/guest") public class GuestController { - @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local") + @Autowired private GuestService guestService; diff --git a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/PermissionController.java b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/PermissionController.java index 1932f601..d106678d 100644 --- a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/PermissionController.java +++ b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/PermissionController.java @@ -1,6 +1,5 @@ package org.xyzh.system.controller; -import org.apache.dubbo.config.annotation.DubboReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,7 +24,7 @@ public class PermissionController { private static final Logger logger = LoggerFactory.getLogger(PermissionController.class); - @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local") + @Autowired private ModulePermissionService modulePermissionService; // ================= 模块相关接口 ================= diff --git a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/SysConfigController.java b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/SysConfigController.java index dd33a4e4..d9bcc0b8 100644 --- a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/SysConfigController.java +++ b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/SysConfigController.java @@ -1,6 +1,5 @@ package org.xyzh.system.controller; -import org.apache.dubbo.config.annotation.DubboReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -24,7 +23,7 @@ public class SysConfigController { private static final Logger logger = LoggerFactory.getLogger(SysConfigController.class); - @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local") + @Autowired private SysConfigService sysConfigService; // ================= 系统配置相关接口 ================= diff --git a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/UserController.java b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/UserController.java index b2830d1e..4a8b3c34 100644 --- a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/UserController.java +++ b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/UserController.java @@ -1,6 +1,5 @@ package org.xyzh.system.controller; -import org.apache.dubbo.config.annotation.DubboReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +25,7 @@ public class UserController { private static final Logger logger = LoggerFactory.getLogger(UserController.class); - @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local") + @Autowired private SysUserService sysUserService; // ================= 用户相关接口 ================= diff --git a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/ViewController.java b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/ViewController.java index 20874211..3fdf8dc6 100644 --- a/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/ViewController.java +++ b/urbanLifelineServ/system/src/main/java/org/xyzh/system/controller/ViewController.java @@ -1,6 +1,5 @@ package org.xyzh.system.controller; -import org.apache.dubbo.config.annotation.DubboReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -23,7 +22,7 @@ public class ViewController { private static final Logger logger = LoggerFactory.getLogger(ViewController.class); - @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local") + @Autowired private ViewService viewService; // ================= 视图相关接口 ================= diff --git a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseChatContorller.java b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseChatContorller.java index 4b4f924a..5cb92846 100644 --- a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseChatContorller.java +++ b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseChatContorller.java @@ -1,6 +1,5 @@ package org.xyzh.workcase.controller; -import org.apache.dubbo.config.annotation.DubboReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -42,7 +41,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; @RequestMapping("/workcase/chat") public class WorkcaseChatContorller { - @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local") + @Autowired private WorkcaseChatService workcaseChatService; // ========================= AI对话管理 ========================= diff --git a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseController.java b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseController.java index c19db0f9..55694a2b 100644 --- a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseController.java +++ b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/controller/WorkcaseController.java @@ -1,6 +1,6 @@ package org.xyzh.workcase.controller; -import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; @RequestMapping("/workcase") public class WorkcaseController { - @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local") + @Autowired private WorkcaseService workcaseService; // ========================= 工单管理 ========================= diff --git a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/service/WorkcaseServiceImpl.java b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/service/WorkcaseServiceImpl.java index 3ec02133..1b7ec28e 100644 --- a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/service/WorkcaseServiceImpl.java +++ b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/service/WorkcaseServiceImpl.java @@ -2,7 +2,6 @@ package org.xyzh.workcase.service; import java.util.List; -import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,7 +37,7 @@ public class WorkcaseServiceImpl implements WorkcaseService { @Autowired private TbWorkcaseDeviceMapper workcaseDeviceMapper; - @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local") + @Autowired private WorkcaseChatService workcaseChatService; // ====================== 工单管理 ====================== diff --git a/urbanLifelineWeb/packages/shared/src/components/fileupload/FileUpload.vue b/urbanLifelineWeb/packages/shared/src/components/fileupload/FileUpload.vue index 0e1e9a1f..4234a277 100644 --- a/urbanLifelineWeb/packages/shared/src/components/fileupload/FileUpload.vue +++ b/urbanLifelineWeb/packages/shared/src/components/fileupload/FileUpload.vue @@ -169,6 +169,8 @@ interface Props { maxCount?: number title?: string buttonText?: string + // 是否自动上传,默认 true,设为 false 时需要手动调用 uploadFiles + autoUpload?: boolean // 自定义上传函数,如果提供则使用外部实现,否则使用默认上传逻辑 customUpload?: (files: File[]) => Promise } @@ -181,6 +183,7 @@ const props = withDefaults(defineProps(), { maxCount: 10, title: '文件上传', buttonText: '上传文件', + autoUpload: true, customUpload: undefined }) @@ -234,7 +237,7 @@ const handleDrop = (event: DragEvent) => { addFiles(Array.from(files)) // cover模式和content模式下拖拽文件后立即上传 - if (props.mode === 'cover' || props.mode === 'content') { + if (props.autoUpload && (props.mode === 'cover' || props.mode === 'content')) { uploadFiles() } } @@ -321,8 +324,8 @@ const handleFileSelect = (event: Event) => { // 清空 input,允许重复选择同一文件 target.value = '' - // cover模式和content模式下选择文件后立即上传 - if (props.mode === 'cover' || props.mode === 'content') { + // cover模式和content模式下,如果 autoUpload 为 true 则立即上传 + if (props.autoUpload && (props.mode === 'cover' || props.mode === 'content')) { uploadFiles() } } diff --git a/urbanLifelineWeb/packages/workcase/src/views/admin/knowledge/KnowLedgeView.vue b/urbanLifelineWeb/packages/workcase/src/views/admin/knowledge/KnowLedgeView.vue index 51b52504..9d65d940 100644 --- a/urbanLifelineWeb/packages/workcase/src/views/admin/knowledge/KnowLedgeView.vue +++ b/urbanLifelineWeb/packages/workcase/src/views/admin/knowledge/KnowLedgeView.vue @@ -1,7 +1,7 @@