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
7eb7d224
Commit
7eb7d224
authored
Feb 11, 2018
by
gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改频次认证
parent
3ab18d62
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
45 deletions
+114
-45
SendToWeixin.java
...ain/java/com/legalPersonMonitor/monitor/SendToWeixin.java
+2
-3
ServiceStateMonitoring.java
...om/legalPersonMonitor/monitor/ServiceStateMonitoring.java
+14
-18
FormatBytesUtil.java
...in/java/com/legalPersonMonitor/utils/FormatBytesUtil.java
+49
-8
test.java
src/main/java/com/test/test.java
+44
-12
applicationContext.xml
src/main/resources/applicationContext.xml
+5
-4
No files found.
src/main/java/com/legalPersonMonitor/monitor/SendToWeixin.java
View file @
7eb7d224
...
...
@@ -16,9 +16,8 @@ import java.util.Date;
* Created by gaoxiang on 2018/1/22.
*/
public
class
SendToWeixin
{
private
static
String
startTime
=
"1517895000000"
;
// private static String startTime="1517722200000";
private
static
String
endTime
=
""
;
private
static
String
startTime
=
"1503123818000"
;
private
static
String
endTime
=
"1517305049000"
;
public
static
void
sendToWeixinMain
(){
endTime
=
FormatBytesUtil
.
getTimestamp
();
...
...
src/main/java/com/legalPersonMonitor/monitor/ServiceStateMonitoring.java
View file @
7eb7d224
...
...
@@ -76,10 +76,8 @@ public class ServiceStateMonitoring {
String
authFrequencyStr
=
""
;
JSONArray
authFrequencyList
=
null
;
String
str
=
"法人代理在"
;
Object
key1
=
""
;
Object
key2
=
""
;
Object
value
=
""
;
int
count
=
1
;
String
key
=
""
;
String
value
=
""
;
int
i
=
1
;
try
{
authFrequencyStr
=
HttpClientPool
.
getRequest
(
"http://121.22.111.251:9003/legalPerson/v1.0/authFreqStats?startTime="
+
startTime
+
"&endTime="
+
endTime
+
"&customerNumber=gtyx01&units=Hour"
);
...
...
@@ -87,30 +85,28 @@ public class ServiceStateMonitoring {
}
catch
(
IOException
e
)
{
return
"法人代理频次请求失败"
;
}
value
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
0
)).
get
(
"count"
)).
toString
();
if
(
authFrequencyList
.
size
()==
1
&&
value
.
equals
(
"0"
)){
str
=
"<div>"
+
str
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内没有认证"
+
"</div>"
;
return
str
;
}
if
(
authFrequencyList
.
size
()==
1
){
value
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
0
)).
get
(
"count"
)
);
str
=
"<div>"
+
str
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
key
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
0
)).
get
(
"time"
)).
toString
(
);
str
=
"<div>"
+
str
+
key
+
"时至"
+
FormatBytesUtil
.
dateAddOneHour
(
key
)+
"时 时间段内认证"
+
value
+
"</div>"
;
return
str
;
}
i
=
authFrequencyList
.
size
();
for
(
int
j
=
0
;
j
<
authFrequencyList
.
size
();
j
++){
key
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
j
)).
get
(
"time"
)).
toString
();
value
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
j
)).
get
(
"count"
)).
toString
();
if
(
i
==
authFrequencyList
.
size
()){
key1
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
count
)).
get
(
"time"
));
value
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
count
-
1
)).
get
(
"count"
));
str
=
"<div>"
+
str
+
FormatBytesUtil
.
stampToDate
(
startTime
)+
"时至"
+
key1
+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
str
=
"<div>"
+
str
+
key
+
"时至"
+
FormatBytesUtil
.
dateAddOneHour
(
key
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
i
--;
count
++;
}
else
if
(
i
!=
1
){
key2
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
count
)).
get
(
"time"
));
value
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
count
-
1
)).
get
(
"count"
));
str
=
str
+
"<div>在"
+
key1
+
"时至"
+
key2
+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
key1
=
key2
;
count
++;
str
=
str
+
"<div>在"
+
key
+
"时至"
+
FormatBytesUtil
.
dateAddOneHour
(
key
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
i
--;
}
else
{
value
=
(
JSONObject
.
fromObject
(
authFrequencyList
.
get
(
count
-
1
)).
get
(
"count"
));
str
=
str
+
"<div>在"
+
key1
+
"时至"
+
FormatBytesUtil
.
stampToDate
(
endTime
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
count
++;
str
=
str
+
"<div>在"
+
key
+
"时至"
+
FormatBytesUtil
.
dateAddOneHour
(
key
)+
"时 时间段内认证"
+
value
+
"次"
+
"</div>"
;
break
;
}
}
...
...
src/main/java/com/legalPersonMonitor/utils/FormatBytesUtil.java
View file @
7eb7d224
package
com
.
legalPersonMonitor
.
utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
...
...
@@ -52,6 +53,18 @@ public class FormatBytesUtil {
return
bytes
;
}
/**
* 时间戳
*
* @return
*/
public
static
String
getTimestamp
()
{
long
i
=
(
System
.
currentTimeMillis
());
String
time
=
String
.
valueOf
(
i
);
return
time
;
}
/**
* 时间戳转换为时间
* @param s
...
...
@@ -66,15 +79,43 @@ public class FormatBytesUtil {
return
res
;
}
/**
* 时间戳
*
* @return 13位时间戳
* 将时间做加一小时处理
*/
public
static
String
getTimestamp
()
{
long
i
=
(
System
.
currentTimeMillis
());
String
time
=
String
.
valueOf
(
i
);
return
time
;
public
static
String
dateAddOneHour
(
String
s
)
{
String
res
;
Long
timeStamp
;
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
Date
date
=
null
;
try
{
date
=
simpleDateFormat
.
parse
(
s
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
long
ts
=
date
.
getTime
();
res
=
String
.
valueOf
(
ts
);
timeStamp
=
Long
.
parseLong
(
res
);
timeStamp
=
timeStamp
+
3600000
;
res
=
String
.
valueOf
(
timeStamp
);
long
lt
=
new
Long
(
res
);
date
=
new
Date
(
lt
);
res
=
simpleDateFormat
.
format
(
date
);
return
res
;
}
/**
* 将时间转换为时间戳
*/
public
static
String
dateToStamp
(
String
s
)
{
String
res
;
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
Date
date
=
null
;
try
{
date
=
simpleDateFormat
.
parse
(
s
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
long
ts
=
date
.
getTime
();
res
=
String
.
valueOf
(
ts
);
return
res
;
}
/**
...
...
src/main/java/com/test/test.java
View file @
7eb7d224
package
com
.
test
;
import
com.legalPersonMonitor.auth.Authentication
;
import
com.legalPersonMonitor.config.ParameterConfig
;
import
com.legalPersonMonitor.connections.HttpClientPool
;
import
com.legalPersonMonitor.connections.SocketSender
;
import
com.legalPersonMonitor.data.AuthApplyRetainBean
;
import
com.legalPersonMonitor.data.AuthRequestBean
;
import
com.legalPersonMonitor.data.AuthResponseBean
;
import
com.legalPersonMonitor.connections.SendRequset
;
import
com.legalPersonMonitor.data.AccessTokenRequset
;
import
com.legalPersonMonitor.data.AccessTokenResponse
;
import
com.legalPersonMonitor.data.WxResponseBean
;
import
com.legalPersonMonitor.monitor.ServiceStateMonitoring
;
import
com.legalPersonMonitor.utils.FormatBytesUtil
;
import
net.sf.json.JSONObject
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by gaoxiang on 2018/1/22.
*/
public
class
test
{
private
static
String
startTime
=
"1503123818000"
;
private
static
String
endTime
=
"1517305049000"
;
public
static
void
main
(
String
[]
args
){
String
authFrequencyStr
=
ServiceStateMonitoring
.
auth
Count
(
"1517443200000"
,
"15177024
00000"
);
String
authFrequencyStr
=
ServiceStateMonitoring
.
auth
Frequency
(
"1478793600000"
,
"14788296
00000"
);
System
.
out
.
println
(
authFrequencyStr
);
//
// String aa="2018-02-09 16:18:35";
// if(aa.substring(12,16).equals("2018-02-09 16:18")){
// System.out.println(111);
// }
// System.out.println( aa.substring(14,16));
// Object s = FormatBytesUtil.dateAddOneHour("2018-02-09 16");
// System.out.println(s);
// Object s1 = FormatBytesUtil.stampToDate("1518163200000");
// System.out.println(s1);
//
// Object s2 = FormatBytesUtil.dateToStamp("2018-02-09 17");
// System.out.println("222 "+s2);
/*微信推送频率*/
// 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);
// String sendjson="{ \"touser\": \"@all\", \"toparty\": \" \", \"totag\": \" \", \"msgtype\": \"mpnews\", \"agentid\": "+1000003+", "
// + "\"mpnews\": { \"articles\":[ "
// + "{ \"title\": \""+"身份认证监控系统"+"\", "
// + "\"thumb_media_id\": \""+"2_VLquGGm4PEhhG-vG5_9SEfdLvNrvNPbdLH6DrZqieHHH5LqXbfqvLWljvcgGvF4"+"\", "
// + "\"author\": \"\", "
// + "\"content_source_url\": \"\", "
// + "\"content\": \"<div > "+authFrequencyStr+" </div>"
// + "\"digest\": \""+"\", "
// + "\"show_cover_pic\": \"1\" } ] }, "
// + "\"safe\":0}";
// WxResponseBean wx=sr.sendTextMessage(asresponse, sendjson);
}
}
src/main/resources/applicationContext.xml
View file @
7eb7d224
...
...
@@ -10,10 +10,10 @@
<bean
id=
"checkXMLInput"
class=
"com.legalPersonMonitor.monitor.SendToWeixin"
/>
<task:scheduled-tasks>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
3
0 8 ? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
3
0 11 ? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
30 13
? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
30 16
? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
0
0 8 ? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
0
0 11 ? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
00 14
? * *"
/>
<task:scheduled
ref=
"checkXMLInput"
method=
"sendToWeixinMain"
cron=
"0
00 17
? * *"
/>
</task:scheduled-tasks>
</beans>
\ No newline at end of file
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