Browse Source

fix : 创建空间500

lvxianyun 3 years ago
parent
commit
6cabd25f8d

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

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
+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;
@@ -71,7 +72,7 @@ public class AdmSpaceController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmSpace> createRequest) throws Exception {
+    public ObjectNode create(@RequestBody AdmCreateRequest<AdmSpace> createRequest) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
         String msg = null;
         for (AdmSpace admSpace : vos) {
@@ -85,9 +86,13 @@ public class AdmSpaceController {
         }
         if(StrUtil.isEmpty(msg)){
             vos = service.doInsertExt(AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
-            return AdmResponse.success(vos);
+            AdmResponse admResponse = AdmResponse.success(vos);
+            ObjectNode admResponseObj = JsonNodeUtils.toObjectNode(admResponse, null,null);
+            ArrayNode arrayNode = admResponseObj.putArray("entityList");
+            arrayNode.add("");
+            return admResponseObj;
         }else{
-            return AdmResponse.failure(msg);
+            return JsonNodeUtils.toObjectNode(AdmResponse.failure(msg), null,null);
         }
 
     }

+ 8 - 17
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -1,17 +1,8 @@
 package com.persagy.proxy.object.service.impl;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -31,7 +22,6 @@ import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
-import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
 import com.persagy.proxy.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
@@ -42,11 +32,12 @@ import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSpaceService;
 import com.persagy.proxy.object.service.IAdmSystemService;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * ADM 空间 实现类