|
@@ -1,6 +1,9 @@
|
|
|
package com.welampiot.service;
|
|
|
|
|
|
+import com.welampiot.configuration.BroadcastConfig;
|
|
|
+import com.welampiot.configuration.ScreenConfig;
|
|
|
import com.welampiot.service.UserService;
|
|
|
+import com.welampiot.utils.*;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -8,22 +11,63 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
+import java.io.IOException;
|
|
|
import java.sql.Connection;
|
|
|
import java.sql.SQLException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.zip.CRC32;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest
|
|
|
public class UserServiceTest {
|
|
|
@Autowired
|
|
|
private DataSource dataSource;
|
|
|
-// @Autowired
|
|
|
-// private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private ToolUtils toolUtils;
|
|
|
+ @Autowired
|
|
|
+ private SystemConfigService systemConfigService;
|
|
|
+ @Autowired
|
|
|
+ private VideoGbInfoService videoGbInfoService;
|
|
|
|
|
|
@Test
|
|
|
- public void testConnection() throws SQLException {
|
|
|
- System.out.println(dataSource.getClass());
|
|
|
- Connection connection = dataSource.getConnection();
|
|
|
- System.out.println(connection);
|
|
|
- connection.close();
|
|
|
+ public void testConnection() throws SQLException, IOException {
|
|
|
+ long l = System.currentTimeMillis() - (24L * 3600 * 30*1000);
|
|
|
+ Date date = new Date(l);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String createTime = simpleDateFormat.format(date);
|
|
|
+ System.out.println(createTime);
|
|
|
+
|
|
|
+// String taiLongToken = BroadcastUtil.sendBroadcastShiBang(BroadcastConfig.shiBangHost+"/php/setterminal.php",);
|
|
|
+ System.out.println(VideoUtil.getGbAddressByDevId("1235653435",videoGbInfoService));
|
|
|
+// String cmd = "0110DF0901025F";
|
|
|
+//
|
|
|
+// String crc = toolUtils.getCRC(cmd);
|
|
|
+// System.out.println(crc);
|
|
|
+// List<String> titleList = Arrays.asList("姓名", "性别", "年龄");
|
|
|
+// List<List<String>> contentList = new ArrayList<>();
|
|
|
+// contentList.add(Arrays.asList("张三","男","30"));
|
|
|
+// contentList.add(Arrays.asList("李四","女","20"));
|
|
|
+// String s = ExcelUtil.outExcel(titleList, contentList);
|
|
|
+// System.out.println(s);
|
|
|
+// byte[] bytes = toolUtils.hexString2Bytes("0001");
|
|
|
+// String cmd = " ";
|
|
|
+//
|
|
|
+// CRC32 crc32 = new CRC32();
|
|
|
+// crc32.update(toolUtils.hexString2Bytes(cmd));
|
|
|
+// System.out.println(crc32.getValue());
|
|
|
+// System.out.println(Integer.toHexString((int) crc32.getValue()));
|
|
|
+
|
|
|
+// int length = cmd.length()/2;
|
|
|
+// int sum = 0;
|
|
|
+// for (int i = 0; i < length; i++) {
|
|
|
+// System.out.println(Integer.parseInt(cmd.substring(i*2,i*2+2),16));
|
|
|
+// sum += Integer.parseInt(cmd.substring(i*2,i*2+2),16);
|
|
|
+// }
|
|
|
+// System.out.println(sum);
|
|
|
+// System.out.println(dataSource.getClass());
|
|
|
+// Connection connection = dataSource.getConnection();
|
|
|
+// System.out.println(connection);
|
|
|
+// connection.close();
|
|
|
}
|
|
|
}
|