Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
LegalPersonMonitor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiachenqi
LegalPersonMonitor
Commits
bc2cd7ab
Commit
bc2cd7ab
authored
Feb 09, 2018
by
gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
频次认证
parent
9ad12350
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
HttpClientPool.java
...va/com/legalPersonMonitor/connections/HttpClientPool.java
+15
-0
FormatBytesUtil.java
...in/java/com/legalPersonMonitor/utils/FormatBytesUtil.java
+17
-0
test.java
src/main/java/com/test/test.java
+3
-0
No files found.
src/main/java/com/legalPersonMonitor/connections/HttpClientPool.java
View file @
bc2cd7ab
...
@@ -3,6 +3,7 @@ package com.legalPersonMonitor.connections;
...
@@ -3,6 +3,7 @@ package com.legalPersonMonitor.connections;
import
org.apache.http.*
;
import
org.apache.http.*
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.CloseableHttpClient
;
...
@@ -40,5 +41,19 @@ public class HttpClientPool {
...
@@ -40,5 +41,19 @@ public class HttpClientPool {
}
}
public
static
String
getRequest
(
String
url
)
throws
IOException
{
CloseableHttpClient
hc
=
HttpClients
.
createDefault
();
HttpGet
httpget
=
new
HttpGet
(
url
);
CloseableHttpResponse
response
;
try
{
response
=
hc
.
execute
(
httpget
);
HttpEntity
et
=
response
.
getEntity
();
return
EntityUtils
.
toString
(
et
);
}
catch
(
IOException
e
)
{
throw
e
;
}
}
}
}
src/main/java/com/legalPersonMonitor/utils/FormatBytesUtil.java
View file @
bc2cd7ab
package
com
.
legalPersonMonitor
.
utils
;
package
com
.
legalPersonMonitor
.
utils
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
FormatBytesUtil
{
public
class
FormatBytesUtil
{
/**
/**
* 将byte数组转换为short类型
* 将byte数组转换为short类型
...
@@ -49,6 +52,19 @@ public class FormatBytesUtil {
...
@@ -49,6 +52,19 @@ public class FormatBytesUtil {
return
bytes
;
return
bytes
;
}
}
/**
* 时间戳转换为时间
* @param s
* @return
*/
public
static
String
stampToDate
(
String
s
){
String
res
;
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
long
lt
=
new
Long
(
s
);
Date
date
=
new
Date
(
lt
);
res
=
simpleDateFormat
.
format
(
date
);
return
res
;
}
/**
/**
* 时间戳
* 时间戳
*
*
...
@@ -59,6 +75,7 @@ public class FormatBytesUtil {
...
@@ -59,6 +75,7 @@ public class FormatBytesUtil {
// byte[] time = getBytesOfInt(i);
// byte[] time = getBytesOfInt(i);
// return time;
// return time;
// }
// }
public
static
String
getTimestamp
()
{
public
static
String
getTimestamp
()
{
long
i
=
(
System
.
currentTimeMillis
());
long
i
=
(
System
.
currentTimeMillis
());
String
time
=
String
.
valueOf
(
i
);
String
time
=
String
.
valueOf
(
i
);
...
...
src/main/java/com/test/test.java
View file @
bc2cd7ab
...
@@ -7,6 +7,7 @@ import com.legalPersonMonitor.connections.SocketSender;
...
@@ -7,6 +7,7 @@ import com.legalPersonMonitor.connections.SocketSender;
import
com.legalPersonMonitor.data.AuthApplyRetainBean
;
import
com.legalPersonMonitor.data.AuthApplyRetainBean
;
import
com.legalPersonMonitor.data.AuthRequestBean
;
import
com.legalPersonMonitor.data.AuthRequestBean
;
import
com.legalPersonMonitor.data.AuthResponseBean
;
import
com.legalPersonMonitor.data.AuthResponseBean
;
import
com.legalPersonMonitor.monitor.ServiceStateMonitoring
;
import
com.legalPersonMonitor.utils.FormatBytesUtil
;
import
com.legalPersonMonitor.utils.FormatBytesUtil
;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
...
@@ -19,6 +20,8 @@ import java.util.Map;
...
@@ -19,6 +20,8 @@ import java.util.Map;
*/
*/
public
class
test
{
public
class
test
{
public
static
void
main
(
String
[]
args
){
public
static
void
main
(
String
[]
args
){
String
authFrequencyStr
=
ServiceStateMonitoring
.
authFrequency
(
"1517443200000"
,
"1517702400000"
);
System
.
out
.
println
(
authFrequencyStr
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment