Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
曲欣亮
sentinel
Commits
42e4ee18
Commit
42e4ee18
authored
Jan 17, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
25180b48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
2 deletions
+26
-2
LogService.java
src/main/java/com/egolm/film/api/service/LogService.java
+2
-0
LogServiceImpl.java
.../java/com/egolm/film/api/service/impl/LogServiceImpl.java
+16
-0
Fc_review.java
src/main/java/com/egolm/film/bean/Fc_review.java
+1
-1
ExceptionHandler.java
src/main/java/com/egolm/film/config/ExceptionHandler.java
+7
-1
No files found.
src/main/java/com/egolm/film/api/service/LogService.java
View file @
42e4ee18
...
...
@@ -8,5 +8,7 @@ import com.egolm.common.jdbc.Page;
public
interface
LogService
{
List
<
Map
<
String
,
Object
>>
queryLogList
(
String
type
,
String
username
,
Page
page
);
void
saveErrorLog
(
Throwable
ex
);
}
src/main/java/com/egolm/film/api/service/impl/LogServiceImpl.java
View file @
42e4ee18
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -10,6 +11,7 @@ import com.egolm.common.StringUtil;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.LogService
;
import
com.egolm.film.bean.Fc_error
;
import
com.egolm.film.util.SqlWhere
;
@Service
...
...
@@ -26,4 +28,18 @@ public class LogServiceImpl implements LogService {
return
jdbcTemplate
.
limit
(
sql
,
page
,
where
.
getObjectArray
());
}
@Override
public
void
saveErrorLog
(
Throwable
ex
)
{
StringBuffer
stack
=
new
StringBuffer
();
stack
.
append
(
ex
.
getMessage
()).
append
(
"\n"
);
StackTraceElement
[]
elms
=
ex
.
getStackTrace
();
for
(
StackTraceElement
elm
:
elms
)
{
stack
.
append
(
elm
.
getClassName
()
+
"."
+
elm
.
getMethodName
()
+
"("
+
elm
.
getFileName
()
+
" "
+
elm
.
getLineNumber
()
+
")"
).
append
(
"\n"
);
}
Fc_error
error
=
new
Fc_error
();
error
.
setError
(
stack
.
toString
());
error
.
setCreate_time
(
new
Date
());
jdbcTemplate
.
save
(
error
);
}
}
src/main/java/com/egolm/film/bean/Fc_review.java
View file @
42e4ee18
...
...
@@ -29,7 +29,7 @@ public class Fc_review implements java.io.Serializable {
@Column
(
columnDefinition
=
"int(11) COMMENT '评委分配状态 0未分配评委 1已分配评委评选中'"
)
private
Integer
allot_state
;
@Column
(
columnDefinition
=
"int(11) COMMENT '审片结论 1通过 2否决 3参赛 4参赛备选 5参展'"
)
@Column
(
columnDefinition
=
"int(11) COMMENT '审片结论
0未评选
1通过 2否决 3参赛 4参赛备选 5参展'"
)
private
Integer
review_state
;
@Column
(
columnDefinition
=
"int(11) COMMENT '评选状态 0未评选 1有争议 2管理员分配 3审片完成'"
)
...
...
src/main/java/com/egolm/film/config/ExceptionHandler.java
View file @
42e4ee18
...
...
@@ -4,21 +4,27 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.view.json.MappingJackson2JsonView
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.film.api.service.LogService
;
@Component
public
class
ExceptionHandler
implements
HandlerExceptionResolver
{
private
static
final
Logger
logger
=
Logger
.
getLogger
(
ExceptionHandler
.
class
);
@Autowired
LogService
logService
;
@Override
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
boolean
displayInLog
=
true
;
logService
.
saveErrorLog
(
ex
);
ModelAndView
mav
=
new
ModelAndView
(
new
MappingJackson2JsonView
());
try
{
response
.
setContentType
(
"application/json"
);
...
...
@@ -30,7 +36,7 @@ public class ExceptionHandler implements HandlerExceptionResolver {
logger
.
debug
(
ex
.
getMessage
());
}
}
else
{
mav
.
addAllObjects
(
Rjx
.
jsonErr
().
setMessage
(
"未处理异常
["
+
ex
.
getClass
().
getName
()
+
":"
+
ex
.
getMessage
()
+
"]
"
));
mav
.
addAllObjects
(
Rjx
.
jsonErr
().
setMessage
(
"未处理异常"
));
}
}
catch
(
Exception
e
)
{
mav
.
addAllObjects
(
Rjx
.
jsonErr
().
setMessage
(
"异常处理失败"
));
...
...
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