From f0bcc3aaa31f9658cbed0ef4bcc5b6de486fd903 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 26 三月 2025 12:32:19 +0800 Subject: [PATCH] 物料上级分组不显示问题修复 --- rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java | 41 ++++++++++++++++++++++------------------- 1 files changed, 22 insertions(+), 19 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..6182be3 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 @@ -80,7 +80,7 @@ * @description 鍔ㄦ�佸瓧娈祐alue淇濆瓨 * @time 2025/3/18 15:00 */ - public static void saveFields(Map<String, ?> template, String uuid) { + public static void saveFields(Map<String, ?> template, String uuid) throws Exception{ List<Fields> fields = getFieldsSta(); FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); if (fields.isEmpty()) { @@ -110,7 +110,7 @@ return fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getStatus, 1).eq(Fields::getFlagEnable, 1)); } - public static void updateFieldsValue(Map<String, Object> params) { + public static void updateFieldsValue(Map<String, Object> params) throws Exception{ List<Fields> fields = getFieldsSta(); if (fields.isEmpty()) { return; } Object fieldsIndex = params.get("fieldsIndex"); @@ -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