| | |
| | | String index = fieldsIndex.toString(); |
| | | FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); |
| | | for (Fields field : fields) { |
| | | Map<String, String> extendFields = (Map<String, String>) params.get("extendFields"); |
| | | if (!Objects.isNull(extendFields)) { |
| | | if (!Objects.isNull(extendFields.get(field.getFields()))) { |
| | | if (!Objects.isNull(params.get(field.getFields()))) { |
| | | FieldsItem indexItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>() |
| | | .eq(FieldsItem::getUuid, index) |
| | | .eq(FieldsItem::getFieldsId, field.getId())); |
| | |
| | | FieldsItem item = new FieldsItem(); |
| | | item.setUuid(index) |
| | | .setFieldsId(field.getId()) |
| | | .setValue(extendFields.get(field.getFields()).toString()); |
| | | .setValue(params.get(field.getFields()).toString()); |
| | | if (!fieldsItemService.save(item)) { |
| | | throw new CoolException("扩展字段修改失败!!"); |
| | | } |
| | | } else { |
| | | indexItem.setValue(extendFields.get(field.getFields()).toString()); |
| | | 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()); |
| | | } |
| | | } |
| | | } |