Răsfoiți Sursa

Merge branch 'master' of http://116.63.33.55/git/read_opc

FinalYu 2 ani în urmă
părinte
comite
75dded15c5

+ 0 - 1
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/DataSourceServiceImpl.java

@@ -10,7 +10,6 @@ import com.example.opc_common.enums.ResultEnum;
 import com.example.opc_common.exception.CustomException;
 import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.ConstantStr;
-import com.example.opc_common.util.JavaTypeUtil;
 import com.example.opc_common.util.Result;
 import com.example.opc_da.dao.DataSourceDao;
 import com.example.opc_da.dao.ItemGroupDao;

+ 6 - 3
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/util/OpcDaUtil.java

@@ -103,6 +103,9 @@ public class OpcDaUtil {
                         dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.SCADA.getValue())) {
                     List<JSONObject> jsonObjectList = generWinccTree(server);
                     return Result.ok(jsonObjectList);
+                }else if(dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.PAS300.getValue())){
+                    List<JSONObject> jsonObjectList = generPAS300Tree(server);
+                    return Result.ok(jsonObjectList);
                 } else {
                     throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前未适配此种驱动类型");
                 }
@@ -196,12 +199,12 @@ public class OpcDaUtil {
             return null;
         }
         Collection<Leaf> leaves = browse.getLeaves();
-        List<String> leafNameList = new ArrayList<>();
         if (Blank.isNotEmpty(leaves)) {
             for (Leaf leaf : leaves) {
-                leafNameList.add(leaf.getName());
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("label", leaf.getName());
+                jsonList.add(jsonObject);
             }
-            Collections.reverse(leafNameList);
         }
         return jsonList;
     }