From 260dd6fe156265832544715192ce1491e9c2afd6 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 26 六月 2026 13:41:13 +0800
Subject: [PATCH] fix(stock): 解决库存管理中的重复键异常问题 - 在采购台账服务中添加净合同金额字段设置 - 在销售台账服务中添加净合同金额字段设置 - 在入库记录服务中为库存插入操作添加重复键异常处理 - 在入库记录服务中为非库存插入操作添加重复键异常处理 - 在库存服务中为库存插入操作添加重复键异常处理 - 统一处理数据库唯一键约束冲突,避免系统错误
---
src/main/java/com/ruoyi/ai/controller/XiaozhiController.java | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java b/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java
index affa347..82d088c 100644
--- a/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java
+++ b/src/main/java/com/ruoyi/ai/controller/XiaozhiController.java
@@ -29,6 +29,9 @@
import reactor.core.publisher.Flux;
import java.io.IOException;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.UUID;
@@ -39,6 +42,8 @@
public class XiaozhiController extends BaseController {
private static final String FILE_ANALYZE_MEMORY_PREFIX = "file-analyze::";
+ private static final DateTimeFormatter CURRENT_DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final ZoneId CHINA_ZONE_ID = ZoneId.of("Asia/Shanghai");
private final ApproveTodoAgent approveTodoAgent;
private final ApproveTodoIntentExecutor approveTodoIntentExecutor;
@@ -100,7 +105,7 @@
return Flux.just(noGuessResponse);
}
- return approveTodoAgent.chat(memoryId, userMessage)
+ return approveTodoAgent.chat(memoryId, userMessage, currentDateForPrompt())
.doOnComplete(() -> aiChatSessionService.refreshSessionStats(memoryId, loginUser))
.doOnError(ex -> aiChatSessionService.refreshSessionStats(memoryId, loginUser));
}
@@ -190,4 +195,8 @@
}
return false;
}
+
+ private String currentDateForPrompt() {
+ return LocalDate.now(CHINA_ZONE_ID).format(CURRENT_DATE_FMT);
+ }
}
--
Gitblit v1.9.3