Pārlūkot izejas kodu

fix bug:设计图纸中编码无法修改

lijie 3 gadi atpakaļ
vecāks
revīzija
56bc2992d7

+ 8 - 0
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -5,10 +5,13 @@ import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
+import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
 import com.persagy.proxy.adm.request.*;
@@ -131,6 +134,7 @@ public class AdmSpaceController {
         Map<String, Field> fieldMap = JsonNodeUtils.getFieldMap(AdmSpace.class);
         Map<String, Field> objFieldMap = JsonNodeUtils.getFieldMap(ObjectDigital.class);
         Set<String> fields = fieldMap.keySet();
+        ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
         for (AdmSpace space : vos) {
             Map<String, Object> infos = space.getInfos();
             if (MapUtil.isEmpty(infos)){
@@ -147,6 +151,10 @@ public class AdmSpaceController {
                     // 的判断逻辑保持一致
                     continue;
                 }
+                if (fields.contains(mapKey) && infos.get(mapKey) instanceof ArrayList){
+                    ReflectUtil.setFieldValue(space,fieldMap.get(mapKey),objectMapper.readValue(objectMapper.writeValueAsString(infos.get(mapKey)), ArrayNode.class));
+                    continue;
+                }
                 if (fields.contains(mapKey)){
                     // 如果属性值存在
                     ReflectUtil.setFieldValue(space,fieldMap.get(mapKey),infos.get(mapKey));