diff --git a/urbanLifelineServ/.vscode/launch.json b/urbanLifelineServ/.vscode/launch.json
index 665994fe..0fc9038e 100644
--- a/urbanLifelineServ/.vscode/launch.json
+++ b/urbanLifelineServ/.vscode/launch.json
@@ -160,11 +160,11 @@
},
{
"type": "java",
- "name": "Agent (8190)",
+ "name": "AI (8190)",
"request": "launch",
- "mainClass": "org.xyzh.agent.AgentApp",
- "projectName": "agent",
- "cwd": "${workspaceFolder}/agent",
+ "mainClass": "org.xyzh.ai.AiApp",
+ "projectName": "ai",
+ "cwd": "${workspaceFolder}/ai",
"args": [
"--spring.profiles.active=dev"
],
@@ -200,9 +200,9 @@
// "Message (8185)",
// "Bidding (8186)",
// "Platform (8187)",
- // "Workcase (8188)",
+ "Workcase (8188)",
// "Crontab (8189)",
- // "Agent (8190)"
+ "AI (8190)"
],
"stopAll": true,
"presentation": {
diff --git a/urbanLifelineServ/ai/pom.xml b/urbanLifelineServ/ai/pom.xml
index 9dddd762..215d1d7c 100644
--- a/urbanLifelineServ/ai/pom.xml
+++ b/urbanLifelineServ/ai/pom.xml
@@ -56,6 +56,12 @@
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
org.apache.dubbo
@@ -64,6 +70,12 @@
org.mybatis.spring.boot
mybatis-spring-boot-starter
+
+
+ ch.qos.logback
+ logback-classic
+
+
com.baomidou
diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/AgentApp.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/AiApp.java
similarity index 63%
rename from urbanLifelineServ/ai/src/main/java/org/xyzh/ai/AgentApp.java
rename to urbanLifelineServ/ai/src/main/java/org/xyzh/ai/AiApp.java
index 2854e8b2..91f4ff78 100644
--- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/AgentApp.java
+++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/AiApp.java
@@ -10,15 +10,15 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableDubbo // 启用 Dubbo 服务
@ComponentScan(basePackages = {
- "org.xyzh.agent", // 当前agent模块
+ "org.xyzh.ai", // 当前ai模块
"org.xyzh.common" // 公共模块
})
-public class AgentApp {
- private static final Logger logger = LoggerFactory.getLogger(AgentApp.class);
+public class AiApp {
+ private static final Logger logger = LoggerFactory.getLogger(AiApp.class);
public static void main(String[] args) {
- logger.info("======================== AgentApp 启动中 =========================");
- SpringApplication.run(AgentApp.class, args);
- logger.info("======================== AgentApp 启动成功 =========================");
+ logger.info("======================== AI服务启动中 =========================");
+ SpringApplication.run(AiApp.class, args);
+ logger.info("======================== AI服务启动完成 =========================");
}
}
\ No newline at end of file
diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/config/DifyConfig.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/config/DifyConfig.java
index 60adc60d..74b4daa4 100644
--- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/config/DifyConfig.java
+++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/config/DifyConfig.java
@@ -3,7 +3,8 @@ package org.xyzh.ai.config;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.context.annotation.Configuration;
import org.xyzh.api.system.service.SysConfigService;
@@ -21,7 +22,7 @@ import jakarta.annotation.PostConstruct;
@Configuration
public class DifyConfig {
- @Autowired
+ @DubboReference(version = "1.0.0", group = "system", timeout = 30000, retries = 0)
private SysConfigService sysConfigService;
/**
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 31230884..af1a0c73 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,11 +1,11 @@
package org.xyzh.ai.controller;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import org.xyzh.ai.service.impl.AgentServiceImpl;
+import org.xyzh.api.ai.service.AgentService;
import org.xyzh.api.ai.dto.TbAgent;
import org.xyzh.common.core.domain.ResultDomain;
import org.xyzh.common.core.page.PageRequest;
@@ -30,8 +30,8 @@ import java.util.Arrays;
@RequestMapping("/ai/agent")
public class AgentController {
- @Autowired
- private AgentServiceImpl agentService;
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 3000, retries = 0, scope = "local")
+ private AgentService agentService;
/**
* @description 创建智能体
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 0e028785..9ec826e0 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.springframework.beans.factory.annotation.Autowired;
+import org.apache.dubbo.config.annotation.DubboReference;
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 {
- @Autowired
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local")
private AgentChatService chatService;
- @Autowired
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local")
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 e2639211..aa74b770 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,14 +7,14 @@ import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import org.xyzh.ai.service.impl.DifyProxyServiceImpl;
-import org.xyzh.ai.service.impl.KnowledgeServiceImpl;
+import org.xyzh.api.ai.service.DifyProxyService;
+import org.xyzh.api.ai.service.KnowledgeService;
import org.xyzh.api.ai.dto.TbKnowledge;
import org.xyzh.api.ai.dto.TbKnowledgeFile;
import org.xyzh.common.core.domain.ResultDomain;
@@ -40,11 +40,11 @@ import java.util.Map;
public class KnowledgeController {
private static final Logger logger = LoggerFactory.getLogger(KnowledgeController.class);
- @Autowired
- private KnowledgeServiceImpl knowledgeService;
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local")
+ private KnowledgeService knowledgeService;
- @Autowired
- private DifyProxyServiceImpl difyProxyService;
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local")
+ private DifyProxyService difyProxyService;
// ====================== 知识库管理 ======================
@@ -183,7 +183,7 @@ public class KnowledgeController {
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:upload')")
- @PostMapping(name = "/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ @PostMapping(value = "/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResultDomain uploadToKnowledge(
@RequestParam("file") @NotNull MultipartFile file,
@RequestParam("knowledgeId") @NotBlank String knowledgeId,
@@ -201,7 +201,7 @@ public class KnowledgeController {
* @since 2025-12-18
*/
@PreAuthorize("@ss.hasPermission('ai:knowledge:file:upload')")
- @PostMapping(name = "/file/batch-upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ @PostMapping(value = "/file/batch-upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResultDomain batchUploadToKnowledge(
@RequestParam("files") @NotEmpty List files,
@RequestParam("knowledgeId") @NotBlank String knowledgeId,
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 e2c26434..2a38ae0c 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,5 +1,6 @@
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;
@@ -12,6 +13,7 @@ import org.xyzh.ai.client.dto.DocumentUploadRequest;
import org.xyzh.ai.client.dto.DocumentUploadResponse;
import org.xyzh.api.ai.dto.TbAgent;
import org.xyzh.api.ai.service.AIFileUploadService;
+import org.xyzh.api.ai.service.AgentService;
import org.xyzh.common.auth.utils.LoginUtil;
import org.xyzh.common.core.domain.ResultDomain;
@@ -33,8 +35,8 @@ public class AIFileUploadServiceImpl implements AIFileUploadService {
@Autowired
private DifyApiClient difyApiClient;
- @Autowired
- private AgentServiceImpl agentService;
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, retries = 0, scope = "local")
+ 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 1f5eb180..fb28044b 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
@@ -58,7 +58,7 @@ public class AgentChatServiceImpl implements AgentChatService {
@Autowired
private TbChatMessageMapper chatMessageMapper;
- @DubboReference
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 3000, retries = 0, scope = "local")
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 71aa6a5a..90a753e9 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
@@ -54,7 +54,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)
+ @DubboReference(version = "1.0.0", group = "ai", timeout = 30000, scope = "local")
private AIFileUploadService aiFileUploadService;
// ================================= 知识库管理 =================================
diff --git a/urbanLifelineServ/ai/src/main/resources/application-dev.yml b/urbanLifelineServ/ai/src/main/resources/application-dev.yml
new file mode 100644
index 00000000..9fee300e
--- /dev/null
+++ b/urbanLifelineServ/ai/src/main/resources/application-dev.yml
@@ -0,0 +1,85 @@
+# ================== Server ==================
+server:
+ port: 8090
+ # servlet:
+ # context-path: /urban-lifeline/agent
+
+# ================== Auth ====================
+auth:
+ enabled: true
+ gateway-mode: true
+ whitelist:
+ - /swagger-ui/**
+ - /swagger-ui.html
+ - /v3/api-docs/**
+ - /webjars/**
+ - /favicon.ico
+ - /error
+ - /actuator/health
+ - /actuator/info
+ - /ai/chat/* # AI对话,有非系统用户对话的接口,无登录状态
+
+security:
+ aes:
+ # AES-256 密钥(Base64编码,必须与所有服务保持一致)
+ # 警告:这是开发环境密钥,生产环境请使用密钥管理系统
+ secret-key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=
+
+# ================== Spring ==================
+spring:
+ application:
+ name: ai-service
+
+ # ================== Spring Cloud Nacos ==================
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848
+ namespace: dev
+ group: DEFAULT_GROUP
+
+ # ================== DataSource ==================
+ datasource:
+ url: jdbc:postgresql://127.0.0.1:5432/urban_lifeline
+ username: postgres
+ password: postgres
+ driver-class-name: org.postgresql.Driver
+
+ # ================== Redis ==================
+ data:
+ redis:
+ host: 127.0.0.1
+ port: 6379
+ database: 0
+ # password: ""
+
+# ================== SpringDoc ==================
+springdoc:
+ api-docs:
+ enabled: true
+ path: /v3/api-docs
+ swagger-ui:
+ enabled: true
+ path: /swagger-ui.html
+ group-configs:
+ - group: 'default'
+ display-name: 'AI代理服务 API'
+ paths-to-match: '/**'
+
+# ================== Dubbo + Nacos ==================
+dubbo:
+ application:
+ name: urban-lifeline-agent
+ qos-enable: false
+ protocol:
+ name: dubbo
+ port: -1
+ registry:
+ address: nacos://127.0.0.1:8848
+ scan:
+ base-packages: org.xyzh.ai.service.impl
+
+# ================== MyBatis ==================
+mybatis-plus:
+ mapper-locations: classpath:mapper/**/*.xml
+ type-aliases-package: org.xyzh.common.dto, org.xyzh.api
diff --git a/urbanLifelineServ/ai/src/main/resources/application.yml b/urbanLifelineServ/ai/src/main/resources/application.yml
index 212e8d8c..8ed46709 100644
--- a/urbanLifelineServ/ai/src/main/resources/application.yml
+++ b/urbanLifelineServ/ai/src/main/resources/application.yml
@@ -21,12 +21,14 @@ auth:
security:
aes:
- secret-key: 1234567890qwer
+ # AES-256 密钥(Base64编码,必须与所有服务保持一致)
+ # 警告:这是开发环境密钥,生产环境请使用密钥管理系统
+ secret-key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=
# ================== Spring ==================
spring:
application:
- name: agent-service
+ name: ai-service
# ================== Spring Cloud Nacos ==================
cloud:
@@ -75,7 +77,7 @@ dubbo:
registry:
address: nacos://127.0.0.1:8848
scan:
- base-packages: org.xyzh.agent.service.impl
+ base-packages: org.xyzh.ai.service.impl
# ================== MyBatis ==================
mybatis-plus:
diff --git a/urbanLifelineServ/ai/src/main/resources/log4j2.xml b/urbanLifelineServ/ai/src/main/resources/log4j2.xml
index 8d14e720..0ee5d0ef 100644
--- a/urbanLifelineServ/ai/src/main/resources/log4j2.xml
+++ b/urbanLifelineServ/ai/src/main/resources/log4j2.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/urbanLifelineServ/file/src/main/java/org/xyzh/file/controller/FileController.java b/urbanLifelineServ/file/src/main/java/org/xyzh/file/controller/FileController.java
new file mode 100644
index 00000000..bedd430a
--- /dev/null
+++ b/urbanLifelineServ/file/src/main/java/org/xyzh/file/controller/FileController.java
@@ -0,0 +1,118 @@
+package org.xyzh.file.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.xyzh.api.file.dto.TbSysFileDTO;
+import org.xyzh.api.file.service.FileService;
+import org.xyzh.common.core.domain.ResultDomain;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+
+/**
+ * @description 文件管理控制器
+ * @filename FileController.java
+ * @author yslg
+ * @copyright xyzh
+ * @since 2025-12-19
+ */
+@Tag(name = "文件管理")
+@RestController
+@RequestMapping("/file")
+public class FileController {
+
+ @Autowired
+ private FileService fileService;
+
+ // ========================= 文件上传 =========================
+
+ @Operation(summary = "上传文件")
+ @PostMapping("/upload")
+ public ResultDomain uploadFile(
+ @RequestParam("file") MultipartFile file,
+ @RequestParam(value = "module", required = false) String module,
+ @RequestParam(value = "businessId", required = false) String businessId) {
+ return fileService.uploadFile(file, module, businessId);
+ }
+
+ @Operation(summary = "批量上传文件")
+ @PostMapping("/upload/batch")
+ public ResultDomain batchUploadFiles(
+ @RequestParam("files") MultipartFile[] files,
+ @RequestParam(value = "module", required = false) String module,
+ @RequestParam(value = "businessId", required = false) String businessId,
+ @RequestParam(value = "uploader", required = false) String uploader) {
+ return fileService.batchUploadFiles(files, module, businessId, uploader);
+ }
+
+ @Operation(summary = "上传临时文件")
+ @PostMapping("/upload/temp")
+ public ResultDomain saveTempFile(
+ @RequestParam("file") MultipartFile file,
+ @RequestParam(value = "module", required = false) String module,
+ @RequestParam(value = "businessId", required = false) String businessId) {
+ return fileService.saveTempFile(file, module, businessId);
+ }
+
+ @Operation(summary = "上传新版本文件")
+ @PostMapping("/upload/version")
+ public ResultDomain uploadFileVersion(
+ @RequestParam("file") MultipartFile file,
+ @RequestParam(value = "module", required = false) String module,
+ @RequestParam(value = "businessId", required = false) String businessId,
+ @RequestParam("fileRootId") String fileRootId) {
+ return fileService.uploadFileVersion(file, module, businessId, fileRootId);
+ }
+
+ // ========================= 文件查询 =========================
+
+ @Operation(summary = "获取文件信息")
+ @GetMapping("/{fileId}")
+ public ResultDomain getFileById(@PathVariable String fileId) {
+ return fileService.getFileById(fileId);
+ }
+
+ // ========================= 文件下载 =========================
+
+ @Operation(summary = "下载文件")
+ @GetMapping("/download/{fileId}")
+ public ResponseEntity downloadFile(@PathVariable String fileId) {
+ ResultDomain result = fileService.downloadFile(fileId);
+ if (!result.getSuccess() || result.getData() == null) {
+ return ResponseEntity.notFound().build();
+ }
+
+ ResultDomain fileInfo = fileService.getFileById(fileId);
+ String filename = fileInfo.getData() != null ? fileInfo.getData().getName() : "download";
+
+ return ResponseEntity.ok()
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"")
+ .contentType(MediaType.APPLICATION_OCTET_STREAM)
+ .body(result.getData());
+ }
+
+ // ========================= 文件删除 =========================
+
+ @Operation(summary = "删除文件")
+ @DeleteMapping("/{fileId}")
+ public ResultDomain deleteFile(@PathVariable String fileId) {
+ return fileService.deleteFile(fileId);
+ }
+
+ @Operation(summary = "批量删除文件")
+ @DeleteMapping("/batch")
+ public ResultDomain batchDeleteFiles(@RequestParam("fileIds") String[] fileIds) {
+ return fileService.batchDeleteFiles(fileIds);
+ }
+
+}
diff --git a/urbanLifelineServ/file/src/main/resources/application.yml b/urbanLifelineServ/file/src/main/resources/application.yml
index dbcf13db..8f62f8e2 100644
--- a/urbanLifelineServ/file/src/main/resources/application.yml
+++ b/urbanLifelineServ/file/src/main/resources/application.yml
@@ -20,7 +20,9 @@ urban-lifeline:
security:
aes:
- secret-key: 1234567890qwer
+ # AES-256 密钥(Base64编码,必须与所有服务保持一致)
+ # 警告:这是开发环境密钥,生产环境请使用密钥管理系统
+ secret-key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=
# ================== Spring ==================
spring:
diff --git a/urbanLifelineServ/gateway/src/main/resources/application.yml b/urbanLifelineServ/gateway/src/main/resources/application.yml
index 9eedd5df..a5e865cd 100644
--- a/urbanLifelineServ/gateway/src/main/resources/application.yml
+++ b/urbanLifelineServ/gateway/src/main/resources/application.yml
@@ -108,11 +108,11 @@ spring:
filters:
- StripPrefix=1
- # ==================== AI Agent 服务路由 ====================
- - id: agent-service
- uri: lb://agent-service
+ # ==================== AI 服务路由 ====================
+ - id: ai-service
+ uri: lb://ai-service
predicates:
- - Path=/urban-lifeline/agent/**
+ - Path=/urban-lifeline/ai/**
filters:
- StripPrefix=1
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 971d1496..5db42104 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
@@ -26,7 +26,7 @@ public class DeptRoleController {
private static final Logger logger = LoggerFactory.getLogger(DeptRoleController.class);
- @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0)
+ @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local")
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 d16ad6cd..5f017c09 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
@@ -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)
+ @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local")
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 e030db65..11c3edf4 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
@@ -25,7 +25,7 @@ public class PermissionController {
private static final Logger logger = LoggerFactory.getLogger(PermissionController.class);
- @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0)
+ @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local")
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 c5dc17ac..2e49c096 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
@@ -24,7 +24,7 @@ public class SysConfigController {
private static final Logger logger = LoggerFactory.getLogger(SysConfigController.class);
- @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0)
+ @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local")
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 cc796867..0b2a9769 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
@@ -26,7 +26,7 @@ public class UserController {
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
- @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0)
+ @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local")
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 28e63940..c6c1d490 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
@@ -23,7 +23,7 @@ public class ViewController {
private static final Logger logger = LoggerFactory.getLogger(ViewController.class);
- @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0)
+ @DubboReference(version = "1.0.0", group = "system", timeout = 3000, retries = 0, scope = "local")
private ViewService viewService;
// ================= 视图相关接口 =================
diff --git a/urbanLifelineServ/system/src/main/resources/mapper/user/TbSysUserMapper.xml b/urbanLifelineServ/system/src/main/resources/mapper/user/TbSysUserMapper.xml
index 4b4113ea..8bd41c58 100644
--- a/urbanLifelineServ/system/src/main/resources/mapper/user/TbSysUserMapper.xml
+++ b/urbanLifelineServ/system/src/main/resources/mapper/user/TbSysUserMapper.xml
@@ -8,7 +8,7 @@
-
+
@@ -27,7 +27,7 @@
-
+
@@ -79,7 +79,7 @@
#{password},
#{email},
- #{phone, typeHandler=org.xyzh.common.utils.crypto.EncryptedStringTypeHandler},
+ #{phone, typeHandler=org.xyzh.common.jdbc.handler.EncryptedStringTypeHandler},
#{wechatId},
#{createTime},
#{updateTime},
@@ -103,7 +103,7 @@
email = #{email},
- phone = #{phone, typeHandler=org.xyzh.common.utils.crypto.EncryptedStringTypeHandler},
+ phone = #{phone, typeHandler=org.xyzh.common.jdbc.handler.EncryptedStringTypeHandler},
wechat_id = #{wechatId},
diff --git a/urbanLifelineServ/workcase/pom.xml b/urbanLifelineServ/workcase/pom.xml
index dc66cf6c..532f0911 100644
--- a/urbanLifelineServ/workcase/pom.xml
+++ b/urbanLifelineServ/workcase/pom.xml
@@ -42,6 +42,10 @@
org.xyzh.common
common-exception
+
+ org.xyzh.common
+ common-jdbc
+
org.xyzh.common
common-wechat
@@ -62,6 +66,11 @@
com.baomidou
mybatis-plus-boot-starter
+
+ org.postgresql
+ postgresql
+ runtime
+
\ No newline at end of file
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 8e9b21ac..14bb1de7 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
@@ -43,7 +43,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
@RequestMapping("/workcase/chat")
public class WorkcaseChatContorller {
- @DubboReference(version = "1.0.0", group = "workcase", check = false)
+ @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local")
private WorkcaseChatService workcaseChatService;
@Autowired
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 91046f84..c19db0f9 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
@@ -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)
+ @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local")
private WorkcaseService workcaseService;
// ========================= 工单管理 =========================
diff --git a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/handler/WorkcaseKefuHandler.java b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/handler/WorkcaseKefuHandler.java
index 42720d35..d45c76ab 100644
--- a/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/handler/WorkcaseKefuHandler.java
+++ b/urbanLifelineServ/workcase/src/main/java/org/xyzh/workcase/handler/WorkcaseKefuHandler.java
@@ -29,10 +29,10 @@ public class WorkcaseKefuHandler implements KefuMessageHandler {
@Autowired
private KefuMessageService kefuMessageService;
- @DubboReference(version = "1.0.0", group = "workcase", check = false)
+ @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local")
private WorkcaseService workcaseService;
- @DubboReference(version = "1.0.0", group = "workcase", check = false)
+ @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local")
private WorkcaseChatService workcaseChatService;
@Override
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 f7e18e02..3ec02133 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
@@ -38,7 +38,7 @@ public class WorkcaseServiceImpl implements WorkcaseService {
@Autowired
private TbWorkcaseDeviceMapper workcaseDeviceMapper;
- @DubboReference(version = "1.0.0", group = "workcase", check = false)
+ @DubboReference(version = "1.0.0", group = "workcase", check = false, scope = "local")
private WorkcaseChatService workcaseChatService;
// ====================== 工单管理 ======================
diff --git a/urbanLifelineServ/workcase/src/main/resources/application-dev.yml b/urbanLifelineServ/workcase/src/main/resources/application-dev.yml
new file mode 100644
index 00000000..6e703674
--- /dev/null
+++ b/urbanLifelineServ/workcase/src/main/resources/application-dev.yml
@@ -0,0 +1,88 @@
+# ================== Server ==================
+server:
+ port: 8088
+ # servlet:
+ # context-path: /urban-lifeline/workcase
+
+# ================== Auth ====================
+auth:
+ enabled: true
+ gate-way: true
+ whitelist:
+ - /swagger-ui/**
+ - /swagger-ui.html
+ - /v3/api-docs/**
+ - /webjars/**
+ - /favicon.ico
+ - /error
+ - /actuator/health
+ - /actuator/info
+ # 微信客服回调接口(无需鉴权)
+ - /workcase/chat/kefu/callback
+ # CRM回调接口(无需鉴权,但需签名验证)
+ - /workcase/receive/crm
+
+security:
+ aes:
+ # AES-256 密钥(Base64编码,必须与所有服务保持一致)
+ # 警告:这是开发环境密钥,生产环境请使用密钥管理系统
+ secret-key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=
+
+# ================== Spring ==================
+spring:
+ application:
+ name: workcase-service
+
+ # ================== Spring Cloud Nacos ==================
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848
+ namespace: dev
+ group: DEFAULT_GROUP
+
+ # ================== DataSource ==================
+ datasource:
+ url: jdbc:postgresql://127.0.0.1:5432/urban_lifeline
+ username: postgres
+ password: postgres
+ driver-class-name: org.postgresql.Driver
+
+ # ================== Redis ==================
+ data:
+ redis:
+ host: 127.0.0.1
+ port: 6379
+ database: 0
+ # password: ""
+
+# ================== SpringDoc ==================
+springdoc:
+ api-docs:
+ enabled: true
+ path: /v3/api-docs
+ swagger-ui:
+ enabled: true
+ path: /swagger-ui.html
+ group-configs:
+ - group: 'default'
+ display-name: '工单服务 API'
+ paths-to-match: '/**'
+
+# ================== Dubbo + Nacos ==================
+dubbo:
+ application:
+ name: urban-lifeline-workcase
+ qos-enable: false
+ protocol:
+ name: dubbo
+ port: -1
+ registry:
+ address: nacos://127.0.0.1:8848
+ scan:
+ base-packages: org.xyzh.workcase.service.impl
+
+# ================== MyBatis ==================
+mybatis-plus:
+ mapper-locations: classpath:mapper/**/*.xml
+ type-aliases-package: org.xyzh.common.dto, org.xyzh.api
diff --git a/urbanLifelineServ/workcase/src/main/resources/application.yml b/urbanLifelineServ/workcase/src/main/resources/application.yml
index 8638f91a..97538871 100644
--- a/urbanLifelineServ/workcase/src/main/resources/application.yml
+++ b/urbanLifelineServ/workcase/src/main/resources/application.yml
@@ -24,7 +24,9 @@ auth:
security:
aes:
- secret-key: 1234567890qwer
+ # AES-256 密钥(Base64编码,必须与所有服务保持一致)
+ # 警告:这是开发环境密钥,生产环境请使用密钥管理系统
+ secret-key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=
# ================== Spring ==================
spring: