|
@@ -3,6 +3,7 @@ package com.persagy.ibms.data.sdk.util;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
|
|
|
|
|
|
+import com.persagy.ibms.data.sdk.service.rest.RestUtil;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
@@ -48,28 +49,25 @@ public class ExeclReadEquipStaticInfoUtil {
|
|
|
|
|
|
public static JSONObject ReadEquipStaticInfoById(String objId) throws Exception {
|
|
public static JSONObject ReadEquipStaticInfoById(String objId) throws Exception {
|
|
RepositoryImpl Repository = RepositoryContainer.instance;
|
|
RepositoryImpl Repository = RepositoryContainer.instance;
|
|
- JSONObject object = new JSONObject();
|
|
|
|
- String code = "classCode";
|
|
|
|
- // 获取此设备的对象数据
|
|
|
|
- JSONObject eqObj = Repository.id2object.get(objId);
|
|
|
|
- // 获取classCode的值
|
|
|
|
- String pointString = eqObj.getString(code);
|
|
|
|
- // 获取管理范围的classArray
|
|
|
|
- SceneDataSet zktClassArray = Repository.ZKTClassArray;
|
|
|
|
String ibmsSceneCode = null;
|
|
String ibmsSceneCode = null;
|
|
String ibmsClassCode = null;
|
|
String ibmsClassCode = null;
|
|
- String classCode = "";
|
|
|
|
- for (int i = 0; i < zktClassArray.set.size(); i++) {
|
|
|
|
- SceneDataObject classObj = zktClassArray.set.get(i);
|
|
|
|
- String codeVal = classObj.get("code").value_prim.toString();
|
|
|
|
- // 遍历查询classCode对应的ibmsSceneCode和ibmsClassCode
|
|
|
|
- if (codeVal.equals(pointString)) {
|
|
|
|
- classCode = codeVal;
|
|
|
|
- ibmsSceneCode = classObj.get("ibmsSceneCode").value_prim.toString();
|
|
|
|
- ibmsClassCode = classObj.get("ibmsClassCode").value_prim.toString();
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ JSONObject queryTarget=new JSONObject();
|
|
|
|
+ queryTarget.put("Source","rwd");
|
|
|
|
+ queryTarget.put("rwd","object");
|
|
|
|
+ queryTarget.put("objType","equipment");
|
|
|
|
+ JSONObject queryCriteria=new JSONObject();
|
|
|
|
+ queryCriteria.put("id",objId);
|
|
|
|
+ JSONObject queryParam=new JSONObject();
|
|
|
|
+ queryParam.put("QueryType","select");
|
|
|
|
+ queryParam.put("Target",queryTarget);
|
|
|
|
+ queryParam.put("Criteria",queryCriteria);
|
|
|
|
+ String queryResult= RestUtil.query(queryParam.toString());
|
|
|
|
+ JSONArray queryArr= JSONObject.parseArray(queryResult);
|
|
|
|
+ JSONObject queryObj=queryArr.getJSONObject(0);
|
|
|
|
+ ibmsSceneCode=queryObj.getString("ibmsSceneCode");
|
|
|
|
+ ibmsClassCode=queryObj.getString("ibmsClassCode");
|
|
|
|
+ String classCode=queryObj.getString("classCode");
|
|
|
|
+ JSONObject object = new JSONObject();
|
|
// 如果ibmsClassCode和ibmsSceneCode为空则返回,意味着查询失败
|
|
// 如果ibmsClassCode和ibmsSceneCode为空则返回,意味着查询失败
|
|
if (ibmsSceneCode == null && ibmsClassCode == null) {
|
|
if (ibmsSceneCode == null && ibmsClassCode == null) {
|
|
return object;
|
|
return object;
|
|
@@ -96,7 +94,7 @@ public class ExeclReadEquipStaticInfoUtil {
|
|
JSONObject obj = (JSONObject) array.get(z);
|
|
JSONObject obj = (JSONObject) array.get(z);
|
|
String codeVal = obj.get("code").toString();
|
|
String codeVal = obj.get("code").toString();
|
|
if (codeVal.equals(codeInfo)) {
|
|
if (codeVal.equals(codeInfo)) {
|
|
- obj.put("data", eqObj.get(codeInfo));
|
|
|
|
|
|
+ obj.put("data", queryObj.get(codeInfo));
|
|
obj.put("enable", row.getCell(2).getBooleanCellValue());
|
|
obj.put("enable", row.getCell(2).getBooleanCellValue());
|
|
dic.add(obj);
|
|
dic.add(obj);
|
|
break;
|
|
break;
|