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
9f339b91
Commit
9f339b91
authored
Dec 24, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
1cd645d1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
5 deletions
+46
-5
WebUtilController.java
.../java/com/egolm/film/api/web/admin/WebUtilController.java
+46
-5
No files found.
src/main/java/com/egolm/film/api/web/admin/WebUtilController.java
View file @
9f339b91
package
com
.
egolm
.
film
.
api
.
web
.
admin
;
package
com
.
egolm
.
film
.
api
.
web
.
admin
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -11,6 +12,10 @@ import org.springframework.stereotype.Controller;
...
@@ -11,6 +12,10 @@ import org.springframework.stereotype.Controller;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition
;
import
org.springframework.web.servlet.mvc.method.RequestMappingInfo
;
import
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.Util
;
import
com.egolm.common.Util
;
...
@@ -19,6 +24,7 @@ import com.egolm.common.jdbc.JdbcTemplate;
...
@@ -19,6 +24,7 @@ import com.egolm.common.jdbc.JdbcTemplate;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.ReviewService
;
import
com.egolm.film.api.service.ReviewService
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_admin
;
import
com.egolm.film.bean.Fc_logs_ext
;
import
com.egolm.film.bean.Fc_member_film
;
import
com.egolm.film.bean.Fc_member_film
;
import
com.egolm.film.bean.Fc_member_film_enroll
;
import
com.egolm.film.bean.Fc_member_film_enroll
;
import
com.egolm.film.config.XRException
;
import
com.egolm.film.config.XRException
;
...
@@ -42,6 +48,19 @@ public class WebUtilController {
...
@@ -42,6 +48,19 @@ public class WebUtilController {
@Autowired
@Autowired
AdminTokenService
tokenService
;
AdminTokenService
tokenService
;
@Autowired
private
RequestMappingHandlerMapping
requestMappingHandlerMapping
;
@ResponseBody
@PostMapping
(
"verifyAuth"
)
@ApiOperation
(
"校验权限"
)
public
void
verifyAuth
()
{
Fc_admin
admin
=
(
Fc_admin
)
tokenService
.
getTokenObj
();
if
(!
admin
.
getUsername
().
equals
(
"admin"
))
{
throw
new
XRException
(
"权限错误"
);
}
}
@ResponseBody
@ResponseBody
@PostMapping
(
"tryNextRound"
)
@PostMapping
(
"tryNextRound"
)
@ApiOperation
(
"尝试进入下一轮评选"
)
@ApiOperation
(
"尝试进入下一轮评选"
)
...
@@ -129,10 +148,32 @@ public class WebUtilController {
...
@@ -129,10 +148,32 @@ public class WebUtilController {
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
();
}
}
private
void
verifyAuth
()
{
@ResponseBody
Fc_admin
admin
=
(
Fc_admin
)
tokenService
.
getTokenObj
();
@PostMapping
(
"initLogExt"
)
if
(!
admin
.
getUsername
().
equals
(
"admin"
))
{
@ApiOperation
(
"初始化日志扩展表"
)
throw
new
XRException
(
"权限错误"
);
public
Object
initLogExt
()
{
}
this
.
verifyAuth
();
List
<
Object
>
list
=
new
ArrayList
<
Object
>();
Map
<
RequestMappingInfo
,
HandlerMethod
>
map
=
requestMappingHandlerMapping
.
getHandlerMethods
();
for
(
Map
.
Entry
<
RequestMappingInfo
,
HandlerMethod
>
m
:
map
.
entrySet
())
{
RequestMappingInfo
info
=
m
.
getKey
();
HandlerMethod
handlerMethod
=
m
.
getValue
();
PatternsRequestCondition
p
=
info
.
getPatternsCondition
();
Method
method
=
handlerMethod
.
getMethod
();
if
(
method
.
isAnnotationPresent
(
ApiOperation
.
class
))
{
ApiOperation
apiOperation
=
method
.
getAnnotation
(
ApiOperation
.
class
);
String
value
=
apiOperation
.
value
();
for
(
String
url
:
p
.
getPatterns
())
{
Fc_logs_ext
logsExt
=
new
Fc_logs_ext
();
logsExt
.
setExt
(
value
);
logsExt
.
setPath
(
url
);
list
.
add
(
logsExt
);
}
}
}
jdbcTemplate
.
executeUpdate
(
"delete from fc_logs_ext"
);
jdbcTemplate
.
batchSave
(
list
);
return
Rjx
.
jsonOk
();
}
}
}
}
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