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