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
9d1609e6
Commit
9d1609e6
authored
Feb 09, 2018
by
gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改频次认证
parent
f5210fb7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
13 deletions
+113
-13
SendToWeixin.java
...ain/java/com/legalPersonMonitor/monitor/SendToWeixin.java
+31
-7
ServiceStateMonitoring.java
...om/legalPersonMonitor/monitor/ServiceStateMonitoring.java
+80
-4
SignatureServerStatusMonitoring.java
...ersonMonitor/monitor/SignatureServerStatusMonitoring.java
+2
-2
No files found.
src/main/java/com/legalPersonMonitor/monitor/SendToWeixin.java
View file @
9d1609e6
package
com
.
legalPersonMonitor
.
monitor
;
import
com.legalPersonMonitor.connections.HttpClientPool
;
import
com.legalPersonMonitor.connections.SendRequset
;
import
com.legalPersonMonitor.data.AccessTokenRequset
;
import
com.legalPersonMonitor.data.AccessTokenResponse
;
import
com.legalPersonMonitor.data.WxResponseBean
;
import
com.legalPersonMonitor.utils.FormatBytesUtil
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* Created by gaoxiang on 2018/1/22.
*/
public
class
SendToWeixin
{
public
void
test
(){
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!!!!!!!!!"
);
}
private
static
String
startTime
=
"1517895000000"
;
// private static String startTime="1517722200000";
private
static
String
endTime
=
""
;
public
void
sendToWeixinMain
(){
String
msgServiceState
=
"0X4F模式下的服务状态监控"
+
ServiceStateMonitoring
.
serviceStateMonitoringServer
()+
" "
;
String
msgTrustedPlatformStatus
=
"0X4F模式下的可信平台状态监控"
+
new
TrustedPlatformStatusMonitoring
().
trustedPlatformStatusMonitoringServer
()+
" "
;
String
msgSignatureServerStatus
=
"签名服务器状态监控"
+
new
SignatureServerStatusMonitoring
().
signatureServerStatusMonitoringServer
();
endTime
=
FormatBytesUtil
.
getTimestamp
();
String
msgServiceState
=
"0X4F模式下的法人代理返回结果:"
+
ServiceStateMonitoring
.
serviceStateMonitoringServer
();
String
msgTrustedPlatformStatus
=
"0X4F模式下的可信平台返回结果:"
+
new
TrustedPlatformStatusMonitoring
().
trustedPlatformStatusMonitoringServer
();
String
msgSignatureServerStatus
=
"签名服务器状态监控:"
+
new
SignatureServerStatusMonitoring
().
signatureServerStatusMonitoringServer
();
String
correctRateQueryStr
=
ServiceStateMonitoring
.
correctRateQuery
(
startTime
,
endTime
);
String
authCountStr
=
ServiceStateMonitoring
.
authCount
(
startTime
,
endTime
);
String
authFrequencyStr
=
ServiceStateMonitoring
.
authFrequency
(
startTime
,
endTime
);
startTime
=
endTime
;
SendRequset
sr
=
new
SendRequset
();
AccessTokenRequset
atrequset
=
new
AccessTokenRequset
(
"https://qyapi.weixin.qq.com/cgi-bin/gettoken"
,
"wx4244612882ba3018"
,
"5dqLUQ9S3CjhFfKXsmgl4Q9PogJEG6qieoyr4AEw1UI"
);
AccessTokenResponse
asresponse
=
sr
.
getAccessToken
(
atrequset
);
...
...
@@ -25,10 +38,21 @@ public class SendToWeixin {
+
"\"thumb_media_id\": \""
+
"2_VLquGGm4PEhhG-vG5_9SEfdLvNrvNPbdLH6DrZqieHHH5LqXbfqvLWljvcgGvF4"
+
"\", "
+
"\"author\": \"\", "
+
"\"content_source_url\": \"\", "
+
"\"content\": \""
+
msgServiceState
+
msgTrustedPlatformStatus
+
msgSignatureServerStatus
+
"\", "
+
"\"content\": \"<div > "
+
msgServiceState
+
" </div>"
+
"<br>"
+
"<div > "
+
correctRateQueryStr
+
" </div>"
+
"<br>"
+
"<div > "
+
authCountStr
+
" </div>"
+
"<br>"
+
"<div > "
+
authFrequencyStr
+
" </div>"
+
"<br>"
+
"<div > "
+
msgTrustedPlatformStatus
+
" </div>"
+
"<br>"
+
"<div > "
+
msgSignatureServerStatus
+
" </div>\", "
+
"\"digest\": \""
+
"\", "
+
"\"show_cover_pic\": \"1\" } ] }, "
+
"\"safe\":0}"
;
WxResponseBean
wx
=
sr
.
sendTextMessage
(
asresponse
,
sendjson
);
}
}
src/main/java/com/legalPersonMonitor/monitor/ServiceStateMonitoring.java
View file @
9d1609e6
...
...
@@ -3,10 +3,13 @@ package com.legalPersonMonitor.monitor;
import
com.legalPersonMonitor.config.ParameterConfig
;
import
com.legalPersonMonitor.connections.HttpClientPool
;
import
com.legalPersonMonitor.data.*
;
import
com.legalPersonMonitor.utils.FormatBytesUtil
;
import
net.sf.json.JSONObject
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* Created by gaoxiang on 2018/1/22.
...
...
@@ -37,13 +40,86 @@ public class ServiceStateMonitoring {
}
msgDescription
=
authResponseBean
.
getAuthResult
();
}
catch
(
Exception
e
){
msgDescription
=
"
服务状态
监控超时错误"
;
msgDescription
=
"
法人代理
监控超时错误"
;
}
return
msgDescription
;
}
/**
* 正确率查询
*/
public
static
String
correctRateQuery
(
String
startTime
,
String
endTime
){
String
correctRateQueryStr
=
""
;
try
{
correctRateQueryStr
=
HttpClientPool
.
getRequest
(
"http://121.22.111.251:9002/legalPerson/v1.0/authSucStats?startTime="
+
startTime
+
"&endTime="
+
endTime
+
"&customer=gtyx01"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
JSONObject
correctRateQueryStrJson
=
JSONObject
.
fromObject
(
correctRateQueryStr
);
String
str
=
"法人代理在"
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时 至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内认证认证成功率是"
+
correctRateQueryStrJson
.
get
(
"correctRate"
);
return
str
;
}
public
static
String
authCount
(
String
startTime
,
String
endTime
){
String
authCountStr
=
""
;
try
{
authCountStr
=
HttpClientPool
.
getRequest
(
"http://121.22.111.251:9002/legalPerson/v1.0/authQtyStats?startTime="
+
startTime
+
"&endTime="
+
endTime
+
"&customer=gtyx01"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
JSONObject
correctRateQueryStrJson
=
JSONObject
.
fromObject
(
authCountStr
);
String
str
=
"法人代理在"
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时 至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内认证总计"
+
correctRateQueryStrJson
.
get
(
"quantity"
)+
"次"
;
return
str
;
}
public
static
String
authFrequency
(
String
startTime
,
String
endTime
){
String
authFrequencyStr
=
""
;
String
str
=
"法人代理在"
;
String
key1
=
""
;
String
key2
=
""
;
String
value
=
""
;
int
count
=
1
;
int
i
=
1
;
try
{
authFrequencyStr
=
HttpClientPool
.
getRequest
(
"http://121.22.111.251:9002/legalPerson/v1.0/authFreqStats?startTime="
+
startTime
+
"&endTime="
+
endTime
+
"&customerNumber=gtyx01&units=Hour"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
JSONObject
correctRateQueryStrJson
=
JSONObject
.
fromObject
(
authFrequencyStr
);
Iterator
iterator
=
correctRateQueryStrJson
.
keys
();
Iterator
iterator1
=
correctRateQueryStrJson
.
keys
();
List
<
String
>
listKey
=
new
ArrayList
();
while
(
iterator1
.
hasNext
()){
listKey
.
add
((
String
)
iterator1
.
next
());
}
i
=
correctRateQueryStrJson
.
size
();
if
(
listKey
.
size
()==
1
){
value
=
correctRateQueryStrJson
.
getString
(
listKey
.
get
(
count
-
1
));
str
=
"<div>"
+
str
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
return
str
;
}
while
(
iterator
.
hasNext
()){
if
(
i
==
correctRateQueryStrJson
.
size
()){
key1
=
listKey
.
get
(
count
);
value
=
correctRateQueryStrJson
.
getString
(
listKey
.
get
(
count
-
1
));
str
=
"<div>"
+
str
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时至"
+
key1
+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
i
--;
count
++;
}
else
if
(
i
!=
1
){
key2
=
listKey
.
get
(
count
);
value
=
correctRateQueryStrJson
.
getString
(
listKey
.
get
(
count
-
1
));
str
=
str
+
"<div>在"
+
key1
+
"时至"
+
key2
+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
key1
=
key2
;
count
++;
i
--;
}
else
{
value
=
correctRateQueryStrJson
.
getString
(
listKey
.
get
(
count
-
1
));
str
=
str
+
"<div>在"
+
key1
+
"时至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
count
++;
break
;
}
}
return
str
;
}
}
src/main/java/com/legalPersonMonitor/monitor/SignatureServerStatusMonitoring.java
View file @
9d1609e6
...
...
@@ -21,9 +21,9 @@ public class SignatureServerStatusMonitoring {
try
{
boolean
aa
=
oldVerificationImpl
.
signCheck
(
VERIFICANTION_BYTE
);
if
(
aa
)
{
msgDescription
=
"
签名服务器
正常运行"
;
msgDescription
=
"正常运行"
;
}
else
{
msgDescription
=
"
签名服务器
出错"
;
msgDescription
=
"出错"
;
}
}
catch
(
Exception
e
){
msgDescription
=
"连接超时"
;
...
...
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