浏览代码

fix bug:只读模式下设备台账中无法看到部件数

lijie 3 年之前
父节点
当前提交
c72de2d5d6
共有 1 个文件被更改,包括 11 次插入6 次删除
  1. 11 6
      src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java

+ 11 - 6
src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java

@@ -148,15 +148,20 @@ public class AdmReportEquipController {
         if(JSONUtil.isNull(criteria)){
             return AdmResponse.failure("请求参数错误");
         }
-        JsonNode euipId = criteria.get("id");
+        final String KEY="id";
+        if (!criteria.has(KEY)
+                || !criteria.get(KEY).isTextual()){
+            return AdmResponse.success();
+        }
         RequestData requestData = new RequestData();
-        requestData.setEquipmentId(String.valueOf(euipId));
-        List result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null,requestData);
-        if(CollUtil.isNotEmpty(result)){
-            return AdmResponse.success(result);
-        }else{
+        requestData.setEquipmentId(criteria.get(KEY).asText());
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(context.getGroupCode(),
+                context.getProjectId(), context.getAppId(),null,requestData);
+        if(CollUtil.isEmpty(result)){
             return AdmResponse.success();
         }
+        return AdmResponse.success(result);
     }