From acaf6624ef2f706b8ccf442b453d802320829bd3 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 07 四月 2025 16:51:16 +0800 Subject: [PATCH] # 修改 1. 任务列表修改 2. ASN执行状态修改 3. ASN扩展字段优化 4. 确认收货扩展字段优化 --- rsf-server/src/main/java/com/vincent/rsf/server/system/utils/ExtendFieldsUtils.java | 108 +++++++++++++++++++----------------------------------- 1 files changed, 38 insertions(+), 70 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/utils/ExtendFieldsUtils.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/utils/ExtendFieldsUtils.java index 0ff555f..133b174 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/system/utils/ExtendFieldsUtils.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/utils/ExtendFieldsUtils.java @@ -8,7 +8,9 @@ import com.vincent.rsf.server.system.entity.FieldsItem; import com.vincent.rsf.server.system.service.FieldsItemService; import com.vincent.rsf.server.system.service.FieldsService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; +import org.springframework.transaction.annotation.Transactional; import java.util.*; @@ -21,75 +23,41 @@ */ public class ExtendFieldsUtils { - /** - * @author Ryan - * @description 鏄庣粏鍗曟嵁淇濆瓨鎵╁睍瀛楁 - * @param - * @return - * @time 2025/3/15 13:36 - */ - public static Boolean saveFields(Map<String, Object> params) throws Exception{ - FieldsService fieldsService = SpringUtils.getBean(FieldsService.class); - List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>() - .eq(Fields::getStatus, 1) - .eq(Fields::getFlagEnable, 1)); - List<FieldsItem> fieldsItems = new ArrayList<>(); - if (!fields.isEmpty()) { - String uuid16 = CommonUtil.randomUUID16(); - for (Fields obj : fields) { - if (!Objects.isNull(params.get(obj.getFields()))) { - FieldsItem item = new FieldsItem(); - item.setUuid(uuid16) - .setValue(params.get(obj.getFields()).toString()) - .setMatnrId(Long.parseLong(params.get("matnrId").toString())) - .setFieldsId(obj.getId()); - fieldsItems.add(item); - } - params.put("fieldsIndex", uuid16); - } - FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); - if (!fieldsItemService.saveBatch(fieldsItems)) { - throw new CoolException("鍗曟嵁鏄庣粏鎵╁睍瀛楁淇濆瓨澶辫触锛侊紒"); - } - } - return true; - } +// /** +// * @author Ryan +// * @description 鏄庣粏鍗曟嵁淇濆瓨鎵╁睍瀛楁 +// * @param +// * @return +// * @time 2025/3/15 13:36 +// */ +// @Transactional(rollbackFor = Exception.class) +// public static Boolean saveFields(Map<String, Object> params, String uuid) throws Exception{ +// FieldsService fieldsService = SpringUtils.getBean(FieldsService.class); +// List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>() +// .eq(Fields::getStatus, 1) +// .eq(Fields::getFlagEnable, 1)); +// List<FieldsItem> fieldsItems = new ArrayList<>(); +// if (!fields.isEmpty()) { +// for (Fields obj : fields) { +// if (!Objects.isNull(params.get(obj.getFields())) && StringUtils.isNotBlank(params.get(obj.getFields()).toString())) { +// FieldsItem item = new FieldsItem(); +// item.setUuid(uuid) +// .setValue(params.get(obj.getFields()).toString()) +// .setMatnrId(Long.parseLong(params.get("matnrId").toString())) +// .setFieldsId(obj.getId()); +// fieldsItems.add(item); +// } +// } +// if (fieldsItems.isEmpty()) { +// return false; +// } +// FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); +// if (!fieldsItemService.saveBatch(fieldsItems)) { +// throw new CoolException("鎵╁睍瀛楁淇濆瓨澶辫触锛侊紒"); +// } +// return true; +// } +// return false; +// } - - /** - * @author Ryan - * @description 鑾峰彇鎵╁睍瀛楁key-value鍊� - * @param - * @return - * @time 2025/3/15 15:05 - */ - public static List<Map<String, Object>> getExtendFields(List<Map<String, Object>> params) { - FieldsService fieldsService = SpringUtils.getBean(FieldsService.class); - List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>() - .eq(Fields::getStatus, 1) - .eq(Fields::getFlagEnable, 1)); - FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); - List<Map<String, Object>> result = new ArrayList<>(); - for (Map<String, Object> param : params) { - result.add(param); - if (Objects.isNull(param.get("fieldsIndex"))) { - continue; - } - List<FieldsItem> itemList = fieldsItemService - .list(new LambdaQueryWrapper<FieldsItem>() - .eq(FieldsItem::getUuid, param.get("fieldsIndex"))); - if (itemList.isEmpty()) { - continue; - } - fields.forEach(fds -> { - for (FieldsItem fieldsItem : itemList) { - if (!Objects.isNull(fieldsItem.getFieldsId()) && fieldsItem.getFieldsId().equals(fds.getId())) { - param.put(fds.getFields(), fieldsItem.getValue()); - } - } - }); - } - - return result; - } } -- Gitblit v1.9.1