From a27be22b8e8f4d0eb48f560303041c8a961202a9 Mon Sep 17 00:00:00 2001
From: yangyang
Date: 星期五, 21 三月 2025 12:49:56 +0800
Subject: [PATCH] #新增 1. 新增库位分区绑定

---
 rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java b/rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java
index 7b53065..0f7f8ae 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java
@@ -118,23 +118,26 @@
             String index = fieldsIndex.toString();
             FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class);
             for (Fields field : fields) {
-                if (!Objects.isNull(params.get(field.getFields()))) {
-                    FieldsItem indexItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>()
-                            .eq(FieldsItem::getUuid, index)
-                            .eq(FieldsItem::getFieldsId, field.getId()));
-                    //濡傛灉瀛愯〃涓虹┖锛屾墽琛屾彃鍏ユ搷浣滐紝鍚﹀垯灏辨墽琛屼慨鏀规搷浣�
-                    if (Objects.isNull(indexItem)) {
-                        FieldsItem item = new FieldsItem();
-                        item.setUuid(index)
-                                .setFieldsId(field.getId())
-                                .setValue(params.get(field.getFields()).toString());
-                        if (fieldsItemService.save(item)) {
-                            throw new CoolException("鎵╁睍瀛楁淇敼澶辫触锛侊紒");
-                        }
-                    } else {
-                        indexItem.setValue(params.get(field.getFields()).toString());
-                        if (fieldsItemService.updateById(indexItem)) {
-                            throw new CoolException("鎵╁睍瀛楁淇敼澶辫触锛侊紒");
+                Map<String, String> extendFields = (Map<String, String>) params.get("extendFields");
+                if (!Objects.isNull(extendFields)) {
+                    if (!Objects.isNull(extendFields.get(field.getFields()))) {
+                        FieldsItem indexItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>()
+                                .eq(FieldsItem::getUuid, index)
+                                .eq(FieldsItem::getFieldsId, field.getId()));
+                        //濡傛灉瀛愯〃涓虹┖锛屾墽琛屾彃鍏ユ搷浣滐紝鍚﹀垯灏辨墽琛屼慨鏀规搷浣�
+                        if (Objects.isNull(indexItem)) {
+                            FieldsItem item = new FieldsItem();
+                            item.setUuid(index)
+                                    .setFieldsId(field.getId())
+                                    .setValue(extendFields.get(field.getFields()).toString());
+                            if (!fieldsItemService.save(item)) {
+                                throw new CoolException("鎵╁睍瀛楁淇敼澶辫触锛侊紒");
+                            }
+                        } else {
+                            indexItem.setValue(extendFields.get(field.getFields()).toString());
+                            if (!fieldsItemService.updateById(indexItem)) {
+                                throw new CoolException("鎵╁睍瀛楁淇敼澶辫触锛侊紒");
+                            }
                         }
                     }
                 }

--
Gitblit v1.9.1