From fd8c8f8facc58ce1d2dd45b738e8316172c99a85 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期二, 01 四月 2025 12:53:01 +0800 Subject: [PATCH] 1. 质检明细接口修改 2. 任务列表生成修改 --- rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java | 43 +++++++++++++++++++++---------------------- 1 files changed, 21 insertions(+), 22 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..ea9f543 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,30 +118,29 @@ 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("鎵╁睍瀛楁淇敼澶辫触锛侊紒"); + 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("鎵╁睍瀛楁淇敼澶辫触锛侊紒"); + } } } - } } } else { - String uuid16 = CommonUtil.randomUUID16(); - saveFields(params, uuid16); + saveFields(params, params.get("index").toString()); } } } -- Gitblit v1.9.1