yucheng 3 gadi atpakaļ
vecāks
revīzija
2118f0f88a

+ 19 - 0
src/main/java/com/persagy/proxy/object/controller/AdmISpaceController.java

@@ -1,6 +1,7 @@
 package com.persagy.proxy.object.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.persagy.proxy.object.model.AdmISpace;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
@@ -49,6 +50,7 @@ public class AdmISpaceController {
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmISpace> AdmISpace) throws Exception {
         List<AdmISpace> vos = CollUtil.newArrayList(AdmISpace.getContent());
+        ensureDataInfos(vos);
         vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmISpace.class, vos);
         return AdmResponse.success(vos);
     }
@@ -74,11 +76,28 @@ public class AdmISpaceController {
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmISpace> AdmISpace) throws Exception {
         List<AdmISpace> vos = CollUtil.newArrayList(AdmISpace.getContent());
+        ensureDataInfos(vos);
         vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmISpace.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
+     * 补偿处理对象属性
+     * @param vos
+     */
+    private void ensureDataInfos(List<AdmISpace> vos) {
+        if(CollUtil.isEmpty(vos)) {
+            return;
+        }
+        for(AdmISpace vo:vos) {
+            if(StrUtil.isBlank(vo.getName())) {
+                vo.setName(vo.getLocalName());
+            }
+            vo.setClassCode(AdmISpace.OBJ_TYPE);
+        }
+    }
+
+    /**
      * 查询
      * 
      * @param request

+ 1 - 1
src/main/java/com/persagy/proxy/object/model/AdmISpace.java

@@ -70,7 +70,7 @@ public class AdmISpace {
     /** 信息点 */
     private Map<String, Object> infos;
     /** 对象类型 */
-    private String objectType;
+    private String objectType = OBJ_TYPE;
 
     /** 轮廓线 */
     private ArrayList<ArrayList<AdmPoint>> outline;