Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
szsy
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
szsy
Commits
b5d1f668
提交
b5d1f668
authored
2月 07, 2021
作者:
renjianyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
4e7482b6
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
91 行增加
和
2 行删除
+91
-2
DataLogController.java
.../com/zrqx/statistics/bg/controller/DataLogController.java
+7
-0
DataLogService.java
...n/java/com/zrqx/statistics/bg/service/DataLogService.java
+7
-0
DataLogServiceImpl.java
...va/com/zrqx/statistics/bg/service/DataLogServiceImpl.java
+16
-0
HttpUtils.java
.../main/java/com/zrqx/statistics/utils/baidu/HttpUtils.java
+60
-1
BaiduConfig.java
...a/com/zrqx/statistics/utils/baidu/config/BaiduConfig.java
+1
-1
没有找到文件。
app/statistics/src/main/java/com/zrqx/statistics/bg/controller/DataLogController.java
浏览文件 @
b5d1f668
...
@@ -39,6 +39,13 @@ public class DataLogController {
...
@@ -39,6 +39,13 @@ public class DataLogController {
public
CallBack
<
JSONObject
>
getTrend
(
QueryTrendForm
form
)
{
public
CallBack
<
JSONObject
>
getTrend
(
QueryTrendForm
form
)
{
return
CallBack
.
success
(
service
.
loadTrend
(
form
));
return
CallBack
.
success
(
service
.
loadTrend
(
form
));
}
}
//---------------行为分析------------------
@ApiOperation
(
"行为-趋势分析"
)
@PostMapping
(
"/behaviorApp"
)
public
CallBack
<
JSONObject
>
getTrendApp
(
QueryTrendForm
form
)
{
return
CallBack
.
success
(
service
.
loadTrendApp
(
form
));
}
@ApiOperation
(
"来源分析"
)
@ApiOperation
(
"来源分析"
)
@PostMapping
(
"/source"
)
@PostMapping
(
"/source"
)
public
CallBack
<
JSONObject
>
getSource
(
QuerySourceForm
form
)
{
public
CallBack
<
JSONObject
>
getSource
(
QuerySourceForm
form
)
{
...
...
app/statistics/src/main/java/com/zrqx/statistics/bg/service/DataLogService.java
浏览文件 @
b5d1f668
...
@@ -78,6 +78,13 @@ public interface DataLogService extends BaseService<DataLog, String> {
...
@@ -78,6 +78,13 @@ public interface DataLogService extends BaseService<DataLog, String> {
*/
*/
JSONObject
loadTrend
(
QueryTrendForm
form
);
JSONObject
loadTrend
(
QueryTrendForm
form
);
/**
/**
* 获取行为分析趋势分析
* @return
* @author rjy
* @date: 2021年02月07日 下午4:05:03
*/
JSONObject
loadTrendApp
(
QueryTrendForm
form
);
/**
* 获取来源分析
* 获取来源分析
* @param form
* @param form
* @return
* @return
...
...
app/statistics/src/main/java/com/zrqx/statistics/bg/service/DataLogServiceImpl.java
浏览文件 @
b5d1f668
...
@@ -744,4 +744,20 @@ public class DataLogServiceImpl extends BaseServiceImpl<DataLog, String> impleme
...
@@ -744,4 +744,20 @@ public class DataLogServiceImpl extends BaseServiceImpl<DataLog, String> impleme
return
objBody
;
return
objBody
;
}
}
@Override
public
JSONObject
loadTrendApp
(
QueryTrendForm
form
)
{
JSONObject
obj
=
null
;
try
{
String
param
=
"access_token="
+
BaiduConfig
.
TOKEN
+
"&key="
+
BaiduConfig
.
SITEID
+
"&method=visit/page/a&start-date="
+
form
.
getStart_date
()+
"&end-date="
+
form
.
getEnd_date
()+
"&metrics=pv_count,pv_ratio"
;
String
s
=
HttpUtils
.
sendGet
(
BaiduConfig
.
API_URL
,
param
);
obj
=
JSON
.
parseObject
(
s
);
//log.info(objBody.toJSONString());
}
catch
(
Exception
e
)
{
log
.
error
(
"获取来源分析结果失败"
,
e
);
}
return
obj
;
}
}
}
app/statistics/src/main/java/com/zrqx/statistics/utils/baidu/HttpUtils.java
浏览文件 @
b5d1f668
package
com
.
zrqx
.
statistics
.
utils
.
baidu
;
package
com
.
zrqx
.
statistics
.
utils
.
baidu
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.security.KeyManagementException
;
import
java.security.KeyManagementException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.security.cert.X509Certificate
;
import
java.util.List
;
import
java.util.Map
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.HttpsURLConnection
;
import
javax.net.ssl.HttpsURLConnection
;
...
@@ -111,5 +116,59 @@ public class HttpUtils {
...
@@ -111,5 +116,59 @@ public class HttpUtils {
}
}
}
}
/**
* java模拟get请求
* @param out_trade_no
* @return
* @throws Exception
* @author ray
* @date: 2018年8月24日 下午3:25:34
*/
public
static
String
sendGet
(
String
url
,
String
param
)
{
String
result
=
""
;
BufferedReader
in
=
null
;
try
{
String
urlNameString
=
url
+
"?"
+
param
;
URL
realUrl
=
new
URL
(
urlNameString
);
// 打开和URL之间的连接
URLConnection
connection
=
realUrl
.
openConnection
();
// 设置通用的请求属性
connection
.
setRequestProperty
(
"accept"
,
"*/*"
);
connection
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
connection
.
setRequestProperty
(
"user-agent"
,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"
);
//设置连接主机超时
connection
.
setConnectTimeout
(
30000
);
// 建立实际的连接
connection
.
connect
();
// 获取所有响应头字段
Map
<
String
,
List
<
String
>>
map
=
connection
.
getHeaderFields
();
// 遍历所有的响应头字段
for
(
String
key
:
map
.
keySet
())
{
System
.
out
.
println
(
key
+
"--->"
+
map
.
get
(
key
));
}
// 定义 BufferedReader输入流来读取URL的响应
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
+=
line
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送GET请求出现异常!"
+
e
);
e
.
printStackTrace
();
}
// 使用finally块来关闭输入流
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
return
result
;
}
}
}
app/statistics/src/main/java/com/zrqx/statistics/utils/baidu/config/BaiduConfig.java
浏览文件 @
b5d1f668
...
@@ -5,7 +5,7 @@ public class BaiduConfig {
...
@@ -5,7 +5,7 @@ public class BaiduConfig {
public
static
final
String
ACCOUNT
=
"shiyoushe"
;
public
static
final
String
ACCOUNT
=
"shiyoushe"
;
public
static
final
String
PASSWORD
=
"cnpc6452CNPC"
;
public
static
final
String
PASSWORD
=
"cnpc6452CNPC"
;
//移动端 token
public
static
final
String
TOKEN
=
"121.6780a420b308a69d3b2b709771f05f39.Y3TQ7_B-ul_K9A6LNsadJz7j68g7K-IJo2dhY_-.g7hXsw"
;
public
static
final
String
TOKEN
=
"121.6780a420b308a69d3b2b709771f05f39.Y3TQ7_B-ul_K9A6LNsadJz7j68g7K-IJo2dhY_-.g7hXsw"
;
public
static
final
String
SITEID
=
"9c6665dfc6"
;
public
static
final
String
SITEID
=
"9c6665dfc6"
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论