|  |  | 
 |  |  |      * @description 动态字段value保存 | 
 |  |  |      * @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()) { | 
 |  |  | 
 |  |  |         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"); | 
 
 |  |  | 
 |  |  |     @OperationLog("Update 物料信息表") | 
 |  |  |     @PostMapping("/matnr/update") | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public R update(@RequestBody Map<String, Object> params) { | 
 |  |  |     public R update(@RequestBody Map<String, Object> params) throws Exception { | 
 |  |  |         Matnr matnr = JSONObject.parseObject(JSONObject.toJSONString(params), Matnr.class); | 
 |  |  |         if (Objects.isNull(matnr.getCode())) { | 
 |  |  |             throw new CoolException("编码不能为空!!"); | 
 
 |  |  | 
 |  |  |                 String uuid = CommonUtil.randomUUID16(); | 
 |  |  |                 matnr.setFieldsIndex(uuid); | 
 |  |  |                 //保存物料扩展属性值 | 
 |  |  |                 FieldsUtils.saveFields(template, uuid); | 
 |  |  |                 try { | 
 |  |  |                     FieldsUtils.saveFields(template, uuid); | 
 |  |  |                 } catch (Exception e) { | 
 |  |  |                     throw new RuntimeException(e); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             matnrs.add(matnr); | 
 |  |  |         }); | 
 |  |  | 
 |  |  |          */ | 
 |  |  |         String uuid16 = CommonUtil.randomUUID16(); | 
 |  |  |         if (!FieldsUtils.getFieldsSta().isEmpty()) { | 
 |  |  |             FieldsUtils.saveFields(matnr, uuid16); | 
 |  |  |             matnr1.setFieldsIndex(uuid16); | 
 |  |  |             Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); | 
 |  |  |             try { | 
 |  |  |                 FieldsUtils.saveFields(extendFields, uuid16); | 
 |  |  |                 matnr1.setFieldsIndex(uuid16); | 
 |  |  |             } catch (Exception ex) { | 
 |  |  |                 log.error(ex.toString()); | 
 |  |  |                 throw new CoolException("动态字段保存失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (!this.saveOrUpdate(matnr1)) { | 
 |  |  |             return R.error("Save Fail"); |