Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
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
常超
map-parent
Commits
a66a63fb
Commit
a66a63fb
authored
Nov 23, 2022
by
宋珺琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志导出问题、websocket问题
parent
5be8fe1d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
5 deletions
+113
-5
common/service_base/src/main/java/com/founder/servicebase/logs/controller/SkSysLogController.java
+8
-3
common/service_base/src/main/java/com/founder/servicebase/meassage/CustomBeanPostProcessor.java
+58
-0
service/publicapi/src/main/java/com/founder/publicapi/controller/SkypDesktop/SkypDesktopController.java
+2
-2
service/publicapi/src/main/resources/data/getSasp.json
+45
-0
No files found.
common/service_base/src/main/java/com/founder/servicebase/logs/controller/SkSysLogController.java
View file @
a66a63fb
...
...
@@ -126,11 +126,16 @@ public class SkSysLogController {
}
queryWrapper
.
orderByDesc
(
"createDate"
);
List
list
=
service
.
list
(
queryWrapper
);
ExportExcelUtil
<
SkService
>
exportExcelUtil
=
new
ExportExcelUtil
<>();
List
<
SkSysLog
>
list
=
service
.
list
(
queryWrapper
);
List
<
SkSysLog
>
newList
=
new
ArrayList
<>();
for
(
SkSysLog
s
:
list
)
{
s
.
setContent
(
StringUtil
.
toUTF8
(
s
.
getContent
()));
newList
.
add
(
s
);
}
ExportExcelUtil
<
SkSysLog
>
exportExcelUtil
=
new
ExportExcelUtil
<>();
String
[]
headersName
=
{
"用户id"
,
"方法名"
,
"ip"
,
"请求url"
,
"传入参数"
,
"返回参数"
,
"响应时长"
,
"访问时间"
};
String
[]
headersField
=
{
"id"
,
"method"
,
"ip"
,
"url"
,
"params"
,
"content"
,
"totaltime"
,
"createdate"
};
exportExcelUtil
.
exportExcel
(
"DataStatistics"
,
headersName
,
headersField
,
l
ist
,
response
,
"日志列表信息"
);
exportExcelUtil
.
exportExcel
(
"DataStatistics"
,
headersName
,
headersField
,
newL
ist
,
response
,
"日志列表信息"
);
}
@ApiOperation
(
value
=
"统计"
)
...
...
common/service_base/src/main/java/com/founder/servicebase/meassage/CustomBeanPostProcessor.java
0 → 100644
View file @
a66a63fb
package
com
.
founder
.
servicebase
.
meassage
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.stereotype.Component
;
import
javax.websocket.server.ServerEndpoint
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Proxy
;
import
java.util.Objects
;
/**
* @author sjq
* @vesion 1.0
* @date 2022/11/23 11:42
* @since jdk1.8
*/
@Component
public
class
CustomBeanPostProcessor
implements
BeanPostProcessor
{
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
handleServerEndPoint
(
bean
);
return
bean
;
}
private
void
handleServerEndPoint
(
Object
bean
)
{
//获取serverEndpoint
ServerEndpoint
serverEndpoint
=
AnnotationUtils
.
findAnnotation
(
bean
.
getClass
(),
ServerEndpoint
.
class
);
if
(!
Objects
.
isNull
(
serverEndpoint
))
{
//设置@ServerEndpoint注解支持继承,相当于注解@Inherited,应对动态代理导致类上的@ServerEndpoint注解丢失
InvocationHandler
h
=
Proxy
.
getInvocationHandler
(
serverEndpoint
);
try
{
Field
typeField
=
h
.
getClass
().
getDeclaredField
(
"type"
);
typeField
.
setAccessible
(
true
);
Field
annotationTypeField
=
Class
.
class
.
getDeclaredField
(
"annotationType"
);
annotationTypeField
.
setAccessible
(
true
);
Object
o
=
annotationTypeField
.
get
(
typeField
.
get
(
h
));
Field
inheritedField
=
o
.
getClass
().
getDeclaredField
(
"inherited"
);
this
.
updateFinalModifiers
(
inheritedField
);
inheritedField
.
set
(
o
,
true
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
"修改@ServerEndPoint注解失败"
);
}
}
}
private
void
updateFinalModifiers
(
Field
field
)
throws
NoSuchFieldException
,
IllegalAccessException
{
field
.
setAccessible
(
true
);
Field
modifiersField
=
Field
.
class
.
getDeclaredField
(
"modifiers"
);
modifiersField
.
setAccessible
(
true
);
modifiersField
.
setInt
(
field
,
field
.
getModifiers
()
&
~
Modifier
.
FINAL
);
}
}
\ No newline at end of file
service/publicapi/src/main/java/com/founder/publicapi/controller/SkypDesktop/SkypDesktopController.java
View file @
a66a63fb
...
...
@@ -364,7 +364,7 @@ public class SkypDesktopController {
if
(
flag
){
System
.
out
.
println
(
"++++++++++++++++++++++日程定时1111"
);
WebSocketServer
.
SendMessage
(
WebSocketServer
.
map
.
get
(
userId
),
"
:你的("
+
skSchedule
.
getBz
()+
")日程
到了,请尽快处理"
);
WebSocketServer
.
SendMessage
(
WebSocketServer
.
map
.
get
(
userId
),
"
你的("
+
skSchedule
.
getBz
()+
")日程已经
到了,请尽快处理"
);
System
.
out
.
println
(
"++++++++++++++++++++++日程定时结束"
);
}
//当前时间
...
...
@@ -379,7 +379,7 @@ public class SkypDesktopController {
Boolean
flag1
=
belongCalendar
(
Jzsj
,
date
,
kssj1
);
if
(
flag1
){
System
.
out
.
println
(
"++++++++++++++++++++++日程定时1111"
);
WebSocketServer
.
SendMessage
(
WebSocketServer
.
map
.
get
(
userId
),
"
:
你的("
+
skSchedule
.
getBz
()+
")日程快到了,请尽快处理"
);
WebSocketServer
.
SendMessage
(
WebSocketServer
.
map
.
get
(
userId
),
"你的("
+
skSchedule
.
getBz
()+
")日程快到了,请尽快处理"
);
System
.
out
.
println
(
"++++++++++++++++++++++日程定时结束"
);
}
}
...
...
service/publicapi/src/main/resources/data/getSasp.json
View file @
a66a63fb
...
...
@@ -7,6 +7,34 @@
"y"
:
"28.190399"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/5.mp4"
,
"fileName"
:
"视频1.mp4"
},{
"id"
:
"2"
,
"time"
:
"2022-03-01 10:57:08"
,
"x"
:
"113.019318"
,
"y"
:
"28.190398"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/6.avi"
,
"fileName"
:
"视频2.avi"
},{
"id"
:
"3"
,
"time"
:
"2022-03-01 10:57:08"
,
"x"
:
"113.019319"
,
"y"
:
"28.190397"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/7.wmv"
,
"fileName"
:
"视频3.wmv"
},{
"id"
:
"4"
,
"time"
:
"2022-03-01 10:57:08"
,
"x"
:
"113.019315"
,
"y"
:
"28.190395"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/5.mp4"
,
"fileName"
:
"视频4.mp4"
},{
"id"
:
"5"
,
"time"
:
"2022-03-01 10:57:08"
,
"x"
:
"113.019314"
,
"y"
:
"28.190394"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/5.mp4"
,
"fileName"
:
"视频5.mp4"
}
],
"photo"
:
[
...
...
@@ -65,6 +93,22 @@
"y"
:
"28.18789116"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/5.jpg"
,
"fileName"
:
"照片7.jpg"
},
{
"id"
:
"8"
,
"time"
:
"2022-03-01 10:57:08"
,
"x"
:
"113.02123765"
,
"y"
:
"28.18789156"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/5.jpg"
,
"fileName"
:
"照片8.jpg"
},
{
"id"
:
"9"
,
"time"
:
"2022-03-01 10:57:08"
,
"x"
:
"113.02123767"
,
"y"
:
"28.18789166"
,
"fileUrl"
:
"http://47.92.48.137:1008/images/5.jpg"
,
"fileName"
:
"照片8.jpg"
}
]
}
\ 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