Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
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
shenjunjie
brandkbs2
Commits
dfa35ea2
Commit
dfa35ea2
authored
Mar 02, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'release'
日志记录调整 See merge request
!229
parents
78990915
3200d093
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
31 deletions
+31
-31
src/main/java/com/zhiwei/brandkbs2/aop/AopLogRecord.java
+22
-19
src/main/java/com/zhiwei/brandkbs2/pojo/Behavior.java
+3
-10
src/main/java/com/zhiwei/brandkbs2/pojo/vo/BehaviorVO.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+1
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/aop/AopLogRecord.java
View file @
dfa35ea2
...
...
@@ -91,7 +91,7 @@ public class AopLogRecord {
// 接口传参信息
List
<
Map
<
String
,
Object
>>
arguments
=
getRequestArguments
(
joinPoint
);
Behavior
behavior
=
new
Behavior
(
userId
,
projectId
,
nickName
,
ipAddress
,
now
,
controller
,
method
,
backstage
,
uri
,
methodName
,
httpMethod
,
arguments
,
now
,
severAddress
,
null
,
null
,
null
);
uri
,
methodName
,
httpMethod
,
arguments
,
now
,
severAddress
,
null
);
setInfo
(
behavior
,
uri
,
joinPoint
,
methodSignature
,
arguments
,
ResponseResult
);
String
collectionName
=
behaviorDao
.
generateCollectionName
();
behaviorDao
.
insertOneWithoutId
(
behavior
,
collectionName
);
...
...
@@ -109,37 +109,40 @@ public class AopLogRecord {
* @param arguments
* @param ResponseResult
*/
private
void
setInfo
(
Behavior
behavior
,
String
uri
,
JoinPoint
joinPoint
,
MethodSignature
methodSignature
,
List
<
Map
<
String
,
Object
>>
arguments
,
ResponseResult
ResponseResult
){
String
keyword
=
null
;
String
channel
=
null
;
String
title
=
null
;
private
void
setInfo
(
Behavior
behavior
,
String
uri
,
JoinPoint
joinPoint
,
MethodSignature
methodSignature
,
List
<
Map
<
String
,
Object
>>
arguments
,
ResponseResult
ResponseResult
)
{
String
record
=
null
;
Object
[]
args
=
joinPoint
.
getArgs
();
if
(
uri
.
contains
(
"/app/search"
)
&&
!
Tools
.
isEmpty
(
args
)){
if
(
1
==
arguments
.
size
()){
if
(!(
args
[
0
]
instanceof
Integer
)
&&
!(
args
[
0
]
instanceof
String
)){
// 搜索接口关键词记录
if
(
uri
.
contains
(
"/app/search"
)
&&
!
Tools
.
isEmpty
(
args
))
{
if
(
1
==
arguments
.
size
())
{
if
(!(
args
[
0
]
instanceof
Integer
)
&&
!(
args
[
0
]
instanceof
String
))
{
JSONObject
jsonObject
=
(
JSONObject
)
JSON
.
toJSON
(
args
[
0
]);
keyw
ord
=
Objects
.
nonNull
(
jsonObject
.
get
(
"keyword"
))
?
String
.
valueOf
(
jsonObject
.
get
(
"keyword"
))
:
String
.
valueOf
(
jsonObject
.
get
(
"search"
));
rec
ord
=
Objects
.
nonNull
(
jsonObject
.
get
(
"keyword"
))
?
String
.
valueOf
(
jsonObject
.
get
(
"keyword"
))
:
String
.
valueOf
(
jsonObject
.
get
(
"search"
));
}
}
else
{
}
else
{
String
[]
parameterNames
=
methodSignature
.
getParameterNames
();
for
(
int
i
=
0
;
i
<
parameterNames
.
length
;
i
++)
{
if
(
Objects
.
equals
(
parameterNames
[
i
],
"keyword"
)){
keyw
ord
=
String
.
valueOf
(
args
[
i
]);
if
(
Objects
.
equals
(
parameterNames
[
i
],
"keyword"
))
{
rec
ord
=
String
.
valueOf
(
args
[
i
]);
}
}
}
behavior
.
setRecord
(
record
);
return
;
}
if
(
uri
.
contains
(
"/app/channel/baseInfo"
)){
// 渠道记录
if
(
uri
.
contains
(
"/app/channel/baseInfo"
))
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
ResponseResult
.
getData
());
channel
=
jsonObject
.
get
(
"platform"
)
+
"_"
+
jsonObject
.
get
(
"source"
);
record
=
Tools
.
concat
(
jsonObject
.
get
(
"platform"
),
jsonObject
.
get
(
"realSource"
),
jsonObject
.
get
(
"source"
));
behavior
.
setRecord
(
record
);
return
;
}
if
(
uri
.
contains
(
"/app/event/detail/baseInfo"
)){
// 事件标题记录
if
(
uri
.
contains
(
"/app/event/detail/baseInfo"
))
{
JSONObject
jsonObject
=
(
JSONObject
)
JSON
.
toJSON
(
ResponseResult
.
getData
());
title
=
String
.
valueOf
(
jsonObject
.
get
(
"title"
));
record
=
String
.
valueOf
(
jsonObject
.
get
(
"title"
));
behavior
.
setRecord
(
record
);
}
behavior
.
setSearchKeyword
(
keyword
);
behavior
.
setChannel
(
channel
);
behavior
.
setEventTitle
(
title
);
}
/**
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Behavior.java
View file @
dfa35ea2
...
...
@@ -73,18 +73,11 @@ public class Behavior extends AbstractBaseMongo {
* 服务器地址
*/
private
String
severAddress
;
/**
* 搜索关键词
*/
private
String
searchKeyword
;
/**
* 渠道
*/
private
String
channel
;
/**
* 事件名
* 需要的记录
*/
private
String
eventTitle
;
private
String
record
;
@Getter
public
static
class
Operation
{
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/vo/BehaviorVO.java
View file @
dfa35ea2
...
...
@@ -44,6 +44,11 @@ public class BehaviorVO {
*/
private
Integer
roleId
;
/**
* 需要的纪录
*/
private
String
record
;
public
static
BehaviorVO
createFromBehavior
(
Behavior
behavior
,
Integer
roleId
)
{
BehaviorVO
behaviorVO
=
Tools
.
convertMap
(
behavior
,
BehaviorVO
.
class
);
// 补充role
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
dfa35ea2
...
...
@@ -32,7 +32,6 @@ import com.zhiwei.brandkbs2.service.ProjectService;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -55,7 +54,6 @@ import org.elasticsearch.search.sort.SortBuilders;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
...
...
@@ -594,6 +592,7 @@ public class ChannelServiceImpl implements ChannelService {
jsonObject
.
put
(
"id"
,
channel
.
getId
());
jsonObject
.
put
(
"avatarUrl"
,
channel
.
getAvatarUrl
());
jsonObject
.
put
(
"platform"
,
channel
.
getPlatform
());
jsonObject
.
put
(
"realSource"
,
channel
.
getRealSource
());
jsonObject
.
put
(
"source"
,
channel
.
getSource
());
jsonObject
.
put
(
"emotion"
,
ChannelEmotion
.
getNameFromState
(
channel
.
getEmotion
()));
jsonObject
.
put
(
"emotionIndex"
,
BigDecimal
.
valueOf
(
channel
.
getEmotionIndex
()).
setScale
(
2
,
RoundingMode
.
UP
));
...
...
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