|
@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+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;
|
|
@@ -39,7 +41,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.json.JsonObject;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import javax.ws.rs.QueryParam;
|
|
@@ -191,9 +192,13 @@ public class AdmSystemController {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@PostMapping("/link-equip")
|
|
|
- public AdmCreateResponse createRelateEquip(@RequestBody JsonObject createRequest, @QueryParam("projectId") String projectId) throws Exception {
|
|
|
- String sysId = createRequest.get("sysId").toString();
|
|
|
- List<String> equipIdList = (List<String>)createRequest.get("equipIdList");
|
|
|
+ public AdmCreateResponse createRelateEquip(@RequestBody JSONObject createRequest, @QueryParam("projectId") String projectId) throws Exception {
|
|
|
+ String sysId = createRequest.getString("sysId");
|
|
|
+ List<String> equipIdList = new ArrayList<>();
|
|
|
+ if (StrUtil.isNotBlank(createRequest.getString("equipIdList"))
|
|
|
+ && createRequest.getString("equipIdList").startsWith(StrUtil.BRACKET_START)){
|
|
|
+ equipIdList = JSONArray.parseArray(createRequest.getString("equipIdList"),String.class);
|
|
|
+ }
|
|
|
List<ObjectNode> relations = new ArrayList<>(equipIdList.size());
|
|
|
equipIdList.stream().forEach(euipId -> {
|
|
|
ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
|