Jelajahi Sumber

获取通道

Newspaper 2 tahun lalu
induk
melakukan
34d00de34c

+ 3 - 0
huimv-farm-video/src/main/java/com/huimv/video/dhicc/test/constant/Constant.java

@@ -320,4 +320,7 @@ public class Constant {
 
     //
     public static final String  GET_CAR_RECORD = "/evo-apigw/ipms/carcapture/find/conditions/?{urls}";
+
+    //Channel
+    public static final String Hn_Channel ="/evo-apigw/evo-brm/1.2.0/device/channel/page?pageNum=1&pageSize=250&searchKey=&sortType=ASC&unitType=1&isOnline=&showChildNodeData=1&ownerCode=001";
 }

+ 31 - 0
huimv-farm-video/src/test/java/com/huimv/video/dhicc/service/ClientAllEventServiceImplTest.java

@@ -2,8 +2,18 @@ package com.huimv.video.dhicc.service;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.huimv.video.dhicc.entity.IccChannel;
+import com.huimv.video.dhicc.entity.Vo.IccChannelVo;
+import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
+import com.huimv.video.dhicc.test.request.ChannelRequest.ChannelRequestHn;
+
+import com.alibaba.fastjson.JSONArray;
 import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 /**
  * @Project : huimv.shiwan
@@ -15,6 +25,10 @@ import org.springframework.boot.test.context.SpringBootTest;
  **/
 @SpringBootTest
 public class ClientAllEventServiceImplTest {
+    @Autowired
+    private OauthConfigBaseInfo02 oauthConfigBaseInfo02;
+    @Autowired
+    private IIccChannelService iIccChannelService;
 
     @Test
     public void testPasrse(){
@@ -31,4 +45,21 @@ public class ClientAllEventServiceImplTest {
 //        System.out.println("dataJo>>"+dataJo);
 
     }
+    @Test
+    public void testChannel(){
+        String remark = "22";
+        ChannelRequestHn channelRequest = new ChannelRequestHn(oauthConfigBaseInfo02);
+        JSONObject jsonObject = JSON.parseObject(channelRequest.doAction());
+        String data = jsonObject.get("data").toString();
+        JSONArray jsonValues = (JSONArray) JSON.parseObject(data).get("pageData");
+        List<IccChannelVo> iccChannelVos = jsonValues.toJavaList(IccChannelVo.class);
+        for (IccChannelVo iccChannelVo : iccChannelVos) {
+            IccChannel iccChannel = new IccChannel();
+            iccChannel.setChannelId(iccChannelVo.getChannelCode());
+            iccChannel.setChannelName(iccChannelVo.getChannelName());
+            iccChannel.setRemark(remark);
+            iIccChannelService.save(iccChannel);
+            System.out.println(iccChannelVo);
+        }
+    }
 }