Browse Source

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

lijie 3 years ago
parent
commit
c72de2d5d6

+ 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);
     }