Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
a9e3726a
Commit
a9e3726a
authored
Apr 17, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面信息流分析、页面使用习惯分析功能修改
parent
b0f1c775
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
173 additions
and
16 deletions
+173
-16
portal-manager/doc/api.md
portal-manager/doc/api.md
+69
-4
portal-manager/src/main/java/com/mortals/xhx/module/page/model/pdu/PageCensusPdu.java
.../com/mortals/xhx/module/page/model/pdu/PageCensusPdu.java
+11
-0
portal-manager/src/main/java/com/mortals/xhx/module/page/model/vo/PageAccessVo.java
...va/com/mortals/xhx/module/page/model/vo/PageAccessVo.java
+9
-4
portal-manager/src/main/java/com/mortals/xhx/module/page/service/impl/PageAccessServiceImpl.java
...s/xhx/module/page/service/impl/PageAccessServiceImpl.java
+66
-3
portal-manager/src/main/java/com/mortals/xhx/module/page/service/impl/PageEventServiceImpl.java
...ls/xhx/module/page/service/impl/PageEventServiceImpl.java
+8
-4
portal-manager/src/main/resources/sqlmap/module/page/PageAccessMapperExt.xml
...main/resources/sqlmap/module/page/PageAccessMapperExt.xml
+4
-1
portal-manager/src/main/resources/sqlmap/module/page/PageEventMapperExt.xml
.../main/resources/sqlmap/module/page/PageEventMapperExt.xml
+6
-0
No files found.
portal-manager/doc/api.md
View file @
a9e3726a
...
@@ -5542,8 +5542,10 @@ dateTimeStart|String|是|结束时间
...
@@ -5542,8 +5542,10 @@ dateTimeStart|String|是|结束时间
```
```
{
{
"productId":1,
"productId":1,
"dateTimeStart":"2023-04-10",
"dateTimeStart":"2023-04-15",
"dateTimeEnd":"2023-05-11"
"dateTimeEnd":"2023-04-15",
"particleType":1,
"isRatio":1
}
}
```
```
...
@@ -5555,6 +5557,7 @@ code|Integer|结果码(-1.失败,1.成功)
...
@@ -5555,6 +5557,7 @@ code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
msg|String|消息
data|array|数据对象
data|array|数据对象
 
productId|long|产品id
 
productId|long|产品id
 
dateStr|String|分组时间
 
productName|String|产品名称
 
productName|String|产品名称
 
firstCode|String|一级场景code
 
firstCode|String|一级场景code
 
firstName|String|一级场景name
 
firstName|String|一级场景name
...
@@ -5566,6 +5569,8 @@ data|array|数据对象
...
@@ -5566,6 +5569,8 @@ data|array|数据对象
 
fourthName|String|四级场景name
 
fourthName|String|四级场景name
 
accessCount|int|访问次数,打开次数
 
accessCount|int|访问次数,打开次数
 
pageDepth|int|访问页面数
 
pageDepth|int|访问页面数
 
accessRatio|int|访问次数增量
 
depthRatio|int|访问页面数增量
**响应消息样例:**
**响应消息样例:**
```
```
...
@@ -5574,6 +5579,10 @@ data|array|数据对象
...
@@ -5574,6 +5579,10 @@ data|array|数据对象
{
{
"deleted": 0,
"deleted": 0,
"accessCount": 1,
"accessCount": 1,
"dateStr": "2023-04-15 21:00:00",
"timeStr": "21:00:00",
"accessRatio": 0.0,
"depthRatio": 0.0,
"productId": 1,
"productId": 1,
"productName": "导视机",
"productName": "导视机",
"firstCode": "/",
"firstCode": "/",
...
@@ -5584,13 +5593,69 @@ data|array|数据对象
...
@@ -5584,13 +5593,69 @@ data|array|数据对象
"thirdName": "--",
"thirdName": "--",
"fourthCode": "--",
"fourthCode": "--",
"fourthName": "--",
"fourthName": "--",
"pageDepth": 1
"pageDepth": 2
},
{
"deleted": 0,
"accessCount": 2,
"dateStr": "2023-04-15 21:10:00",
"timeStr": "21:10:00",
"accessRatio": -0.33,
"depthRatio": 0.0,
"productId": 1,
"productName": "导视机",
"firstCode": "/",
"firstName": "首页",
"secondCode": "/floor",
"secondName": "中心导航",
"thirdCode": "--",
"thirdName": "--",
"fourthCode": "--",
"fourthName": "--",
"pageDepth": 2
},
{
"deleted": 0,
"accessCount": 2,
"dateStr": "2023-04-15 21:20:00",
"timeStr": "21:20:00",
"accessRatio": -0.33,
"depthRatio": 0.0,
"productId": 1,
"productName": "导视机",
"firstCode": "/",
"firstName": "首页",
"secondCode": "/floor",
"secondName": "中心导航",
"thirdCode": "--",
"thirdName": "--",
"fourthCode": "--",
"fourthName": "--",
"pageDepth": 2
},
{
"deleted": 0,
"accessCount": 2,
"dateStr": "2023-04-15 21:30:00",
"timeStr": "21:30:00",
"accessRatio": -0.33,
"depthRatio": 0.0,
"productId": 1,
"productName": "导视机",
"firstCode": "/",
"firstName": "首页",
"secondCode": "/floor",
"secondName": "中心导航",
"thirdCode": "--",
"thirdName": "--",
"fourthCode": "--",
"fourthName": "--",
"pageDepth": 2
}
}
],
],
"code": 1,
"code": 1,
"msg": "查询信息流分析成功"
"msg": "查询信息流分析成功"
}
}
```
```
...
...
portal-manager/src/main/java/com/mortals/xhx/module/page/model/pdu/PageCensusPdu.java
View file @
a9e3726a
...
@@ -2,6 +2,8 @@ package com.mortals.xhx.module.page.model.pdu;
...
@@ -2,6 +2,8 @@ package com.mortals.xhx.module.page.model.pdu;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
/**
/**
* 页面统计查询
* 页面统计查询
*/
*/
...
@@ -15,4 +17,13 @@ public class PageCensusPdu {
...
@@ -15,4 +17,13 @@ public class PageCensusPdu {
private
String
dateTimeEnd
;
private
String
dateTimeEnd
;
/** 页面编码 **/
/** 页面编码 **/
private
String
pageCode
;
private
String
pageCode
;
/** 颗粒度 **/
private
Integer
particleSize
;
/** 颗粒度 **/
private
Integer
particleType
;
/** 是否开启对比 **/
private
Integer
isRatio
;
/** 业务编码 **/
private
String
businessCode
;
private
List
<
String
>
businessCodeList
;
}
}
portal-manager/src/main/java/com/mortals/xhx/module/page/model/vo/PageAccessVo.java
View file @
a9e3726a
package
com.mortals.xhx.module.page.model.vo
;
package
com.mortals.xhx.module.page.model.vo
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.page.model.PageAccessEntity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* 产品页面配置视图对象
* 产品页面配置视图对象
*
*
...
@@ -15,4 +12,12 @@ import java.util.List;
...
@@ -15,4 +12,12 @@ import java.util.List;
public
class
PageAccessVo
extends
BaseEntityLong
{
public
class
PageAccessVo
extends
BaseEntityLong
{
/** 访问次数 */
/** 访问次数 */
private
Integer
accessCount
;
private
Integer
accessCount
;
/** 统计显示日期 */
private
String
dateStr
;
/** 统计显示时间 */
private
String
timeStr
;
/** 访问人数增长度 */
private
float
accessRatio
;
/** 页面数量增长度 */
private
float
depthRatio
;
}
}
\ No newline at end of file
portal-manager/src/main/java/com/mortals/xhx/module/page/service/impl/PageAccessServiceImpl.java
View file @
a9e3726a
package
com.mortals.xhx.module.page.service.impl
;
package
com.mortals.xhx.module.page.service.impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.module.page.model.pdu.BuryPointPdu
;
import
com.mortals.xhx.module.page.model.pdu.BuryPointPdu
;
import
com.mortals.xhx.module.page.model.pdu.PageCensusPdu
;
import
com.mortals.xhx.module.page.model.pdu.PageCensusPdu
;
...
@@ -12,10 +13,10 @@ import com.mortals.xhx.module.page.dao.PageAccessDao;
...
@@ -12,10 +13,10 @@ import com.mortals.xhx.module.page.dao.PageAccessDao;
import
com.mortals.xhx.module.page.model.PageAccessEntity
;
import
com.mortals.xhx.module.page.model.PageAccessEntity
;
import
com.mortals.xhx.module.page.service.PageAccessService
;
import
com.mortals.xhx.module.page.service.PageAccessService
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.List
;
/**
/**
* PageAccessService
* PageAccessService
...
@@ -85,13 +86,75 @@ public class PageAccessServiceImpl extends AbstractCRUDServiceImpl<PageAccessDao
...
@@ -85,13 +86,75 @@ public class PageAccessServiceImpl extends AbstractCRUDServiceImpl<PageAccessDao
if
(
pdu
.
getProductId
()==
null
){
if
(
pdu
.
getProductId
()==
null
){
throw
new
AppException
(
"产品id不能为空"
);
throw
new
AppException
(
"产品id不能为空"
);
}
}
if
(
pdu
.
getParticleType
()==
null
){
pdu
.
setParticleSize
(
60
*
60
);
}
else
if
(
pdu
.
getParticleType
()==
1
){
pdu
.
setParticleSize
(
10
*
60
);
//时间间隔10分钟
}
else
if
(
pdu
.
getParticleType
()==
2
){
pdu
.
setParticleSize
(
30
*
60
);
//时间间隔30分钟
}
else
{
pdu
.
setParticleSize
(
60
*
60
);
//时间间隔1小时
}
String
lastDay
=
""
;
try
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date1
=
sdf
.
parse
(
pdu
.
getDateTimeStart
());
Date
date1
=
sdf
.
parse
(
pdu
.
getDateTimeStart
());
Date
date2
=
sdf
.
parse
(
pdu
.
getDateTimeEnd
());
Date
date2
=
sdf
.
parse
(
pdu
.
getDateTimeEnd
());
Calendar
cd
=
Calendar
.
getInstance
();
cd
.
setTime
(
date1
);
cd
.
add
(
Calendar
.
DATE
,
-
1
);
lastDay
=
sdf
.
format
(
cd
.
getTime
());
}
catch
(
ParseException
e
){
}
catch
(
ParseException
e
){
throw
new
AppException
(
"日期格式错误,应为yyyy-MM-dd"
);
throw
new
AppException
(
"日期格式错误,应为yyyy-MM-dd"
);
}
}
if
(
pdu
.
getIsRatio
()!=
null
&&
pdu
.
getIsRatio
()==
1
){
List
<
PageAccessEntity
>
todayList
=
dao
.
getInformationFlow
(
pdu
);
pdu
.
setDateTimeStart
(
lastDay
);
pdu
.
setDateTimeEnd
(
lastDay
);
List
<
PageAccessEntity
>
lastList
=
dao
.
getInformationFlow
(
pdu
);
Map
<
String
,
PageAccessEntity
>
mp
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
lastList
)){
for
(
PageAccessEntity
item:
lastList
){
String
key
=
item
.
getTimeStr
()+
"_"
+
item
.
getFirstCode
()+
"_"
+
item
.
getSecondCode
()+
"_"
+
item
.
getThirdCode
()+
"_"
+
item
.
getFourthCode
();
mp
.
put
(
key
,
item
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
todayList
)){
for
(
PageAccessEntity
item:
todayList
){
if
(
item
!=
null
)
{
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
".00"
);
String
key
=
item
.
getTimeStr
()
+
"_"
+
item
.
getFirstCode
()
+
"_"
+
item
.
getSecondCode
()
+
"_"
+
item
.
getThirdCode
()
+
"_"
+
item
.
getFourthCode
();
if
(
mp
.
containsKey
(
key
))
{
PageAccessEntity
last
=
mp
.
get
(
key
);
if
(
last
!=
null
&&
last
.
getAccessCount
()
!=
null
)
{
float
ac
=
(
float
)(
item
.
getAccessCount
()
-
last
.
getAccessCount
());
float
lc
=
(
float
)
last
.
getAccessCount
();
float
p
=
ac
/
lc
;
String
s
=
decimalFormat
.
format
(
p
);
item
.
setAccessRatio
(
Float
.
valueOf
(
s
));
}
else
{
item
.
setAccessRatio
(
Float
.
valueOf
(
"0.00"
));
}
if
(
last
!=
null
&&
last
.
getAccessCount
()
!=
null
)
{
float
ad
=
(
float
)(
item
.
getPageDepth
()
-
last
.
getPageDepth
());
float
ld
=
(
float
)
last
.
getPageDepth
();
float
pd
=
ad
/
ld
;
String
sd
=
decimalFormat
.
format
(
pd
);
item
.
setDepthRatio
(
Float
.
valueOf
(
sd
));
}
else
{
item
.
setDepthRatio
(
Float
.
valueOf
(
"0.00"
));
}
}
else
{
item
.
setAccessRatio
(
Float
.
valueOf
(
"0.00"
));
item
.
setDepthRatio
(
Float
.
valueOf
(
"0.00"
));
}
}
}
}
return
todayList
;
}
else
{
//无需对比
return
dao
.
getInformationFlow
(
pdu
);
return
dao
.
getInformationFlow
(
pdu
);
}
}
}
}
}
\ No newline at end of file
portal-manager/src/main/java/com/mortals/xhx/module/page/service/impl/PageEventServiceImpl.java
View file @
a9e3726a
...
@@ -23,10 +23,7 @@ import com.mortals.xhx.module.page.service.PageEventService;
...
@@ -23,10 +23,7 @@ import com.mortals.xhx.module.page.service.PageEventService;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* PageEventService
* PageEventService
...
@@ -205,6 +202,13 @@ public class PageEventServiceImpl extends AbstractCRUDServiceImpl<PageEventDao,
...
@@ -205,6 +202,13 @@ public class PageEventServiceImpl extends AbstractCRUDServiceImpl<PageEventDao,
if
(
pdu
.
getProductId
()==
null
){
if
(
pdu
.
getProductId
()==
null
){
throw
new
AppException
(
"产品id不能为空"
);
throw
new
AppException
(
"产品id不能为空"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
pdu
.
getBusinessCode
())){
List
<
String
>
codeList
=
new
ArrayList
<>();
for
(
String
s:
pdu
.
getBusinessCode
().
split
(
","
)){
codeList
.
add
(
s
);
}
pdu
.
setBusinessCodeList
(
codeList
);
}
try
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date1
=
sdf
.
parse
(
pdu
.
getDateTimeStart
());
Date
date1
=
sdf
.
parse
(
pdu
.
getDateTimeStart
());
...
...
portal-manager/src/main/resources/sqlmap/module/page/PageAccessMapperExt.xml
View file @
a9e3726a
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
<!-- 信息流分析 -->
<!-- 信息流分析 -->
<select
id=
"getInformationFlow"
parameterType=
"com.mortals.xhx.module.page.model.pdu.PageCensusPdu"
resultType=
"com.mortals.xhx.module.page.model.PageAccessEntity"
>
<select
id=
"getInformationFlow"
parameterType=
"com.mortals.xhx.module.page.model.pdu.PageCensusPdu"
resultType=
"com.mortals.xhx.module.page.model.PageAccessEntity"
>
SELECT
SELECT
FROM_UNIXTIME(floor(unix_timestamp(t.createTime)/(#{particleSize}))*#{particleSize},'%Y-%m-%d %k:%i:%s') AS dateStr,
FROM_UNIXTIME(floor(unix_timestamp(t.createTime)/(#{particleSize}))*#{particleSize},'%k:%i:%s') AS timeStr,
t.productId,
t.productId,
t.productName,
t.productName,
t.firstCode,
t.firstCode,
...
@@ -32,6 +34,7 @@
...
@@ -32,6 +34,7 @@
IFNULL(t.thirdCode,'--'),
IFNULL(t.thirdCode,'--'),
IFNULL(t.thirdName,'--'),
IFNULL(t.thirdName,'--'),
IFNULL(t.fourthCode,'--'),
IFNULL(t.fourthCode,'--'),
IFNULL(t.fourthName,'--')
IFNULL(t.fourthName,'--'),
FLOOR(unix_timestamp(t.createTime)/#{particleSize})
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
portal-manager/src/main/resources/sqlmap/module/page/PageEventMapperExt.xml
View file @
a9e3726a
...
@@ -97,6 +97,12 @@
...
@@ -97,6 +97,12 @@
AND t.createTime
<![CDATA[ <= ]]>
STR_TO_DATE(left(concat(#{dateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
AND t.createTime
<![CDATA[ <= ]]>
STR_TO_DATE(left(concat(#{dateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
AND t.businessCode IS NOT NULL
AND t.businessCode IS NOT NULL
AND t.businessCode !=''
AND t.businessCode !=''
<if
test=
"businessCodeList != null and businessCodeList.size() > 0"
>
AND t.businessCode in
<foreach
collection=
"businessCodeList"
open=
"("
close=
")"
index=
"index"
item=
"item"
separator=
","
>
#{item}
</foreach>
</if>
GROUP BY
GROUP BY
t.businessCode,
t.businessCode,
t.businessName
t.businessName
...
...
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