|
@@ -1,16 +1,20 @@
|
|
|
package com.persagy.dmp.digital.client;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.persagy.dmp.basic.dto.RequestData;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
+import com.persagy.dmp.basic.utils.JsonNodeUtils;
|
|
|
+import com.persagy.dmp.common.constant.CommonConstant;
|
|
|
import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
import com.persagy.dmp.common.utils.ResultHelper;
|
|
|
import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
@@ -109,6 +113,34 @@ public class DigitalObjectFacade {
|
|
|
return client.query(groupCode, projectId, appId, userId, criteria);
|
|
|
}
|
|
|
/**
|
|
|
+ * 查询物理世界对象
|
|
|
+ * @param groupCode: 集团编码
|
|
|
+ * @param projectId: 项目ID
|
|
|
+ * @param appId: 应用ID
|
|
|
+ * @param userId: 用户ID
|
|
|
+ * @param criteria: 请求参数
|
|
|
+ * @return 原样查询结果
|
|
|
+ */
|
|
|
+ public static CommonResult<List<ObjectDigital>> queryObject(String groupCode, String projectId, String appId,
|
|
|
+ String userId, Object criteria) {
|
|
|
+ CommonResult<List<ObjectNode>> commonResult = client.query(groupCode, projectId, appId, userId, criteria);
|
|
|
+ if (!CommonConstant.QUERY_SUCCESS.equals(commonResult.getResult())){
|
|
|
+ return ResultHelper.failure(commonResult.getResult(),commonResult.getMessage());
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(commonResult.getData())){
|
|
|
+ // 数据为空或者只查询数量
|
|
|
+ return ResultHelper.multi(new ArrayList<>(),commonResult.getCount());
|
|
|
+ }
|
|
|
+ // 转换为对象
|
|
|
+ List<ObjectNode> resultData = commonResult.getData();
|
|
|
+ ArrayNode arrayNode = JsonNodeUtils.toArrayNode(resultData, ObjectDigital.EXTRA_COLUMN, null);
|
|
|
+ if(null==arrayNode){
|
|
|
+ // 数据为空或者只查询数量
|
|
|
+ return ResultHelper.multi(new ArrayList<>(),commonResult.getCount());
|
|
|
+ }
|
|
|
+ return ResultHelper.multi(JsonNodeUtils.toEntity(arrayNode,ObjectDigital.class,ObjectDigital.EXTRA_COLUMN),commonResult.getCount());
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 新增物理世界对象-单个新增
|
|
|
* @param groupCode: 集团编码
|
|
|
* @param projectId: 项目ID
|