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/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
new file mode 100644
index 0000000..e937ba4
--- /dev/null
+++ b/src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
@@ -0,0 +1,25 @@
+package com.ruoyi.production.service.impl;
+
+import com.ruoyi.production.bean.dto.UserAccountDto;
+import com.ruoyi.production.bean.dto.UserProductionAccountingDto;
+import com.ruoyi.production.mapper.ProductionAccountMapper;
+import com.ruoyi.production.service.SalesLedgerProductionAccountingService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+@Service
+@RequiredArgsConstructor
+public class SalesLedgerProductionAccountingServiceImpl implements SalesLedgerProductionAccountingService {
+
+    private final ProductionAccountMapper productionAccountMapper;
+
+    @Override
+    public UserAccountDto getByUserId(UserProductionAccountingDto dto) {
+        // 鎸夌敤鎴锋煡璇㈢敓浜ф牳绠椾俊鎭�
+        if (dto == null || dto.getUserId() == null || dto.getDate() == null || dto.getDate().trim().isEmpty()) {
+            return new UserAccountDto();
+        }
+        UserAccountDto result = productionAccountMapper.selectUserAccount(dto.getUserId(), dto.getDate());
+        return result == null ? new UserAccountDto() : result;
+    }
+}

--
Gitblit v1.9.3