Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
a0191e8b
Commit
a0191e8b
authored
Mar 15, 2022
by
伍思炜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c4f8324a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
service-manager/src/main/java/com/winsun/controller/ImgController.java
+26
-9
service-manager/src/main/java/com/winsun/controller/StudentCardVerifyController.java
+3
-0
No files found.
service-manager/src/main/java/com/winsun/controller/ImgController.java
View file @
a0191e8b
package
com
.
winsun
.
controller
;
import
com.winsun.auth.core.annotion.Permission
;
import
com.winsun.auth.core.base.controller.BaseController
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.auth.core.shiro.ShiroUser
;
import
com.winsun.constant.FilePath
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.net.util.Base64
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* @Author xuede
...
...
@@ -18,14 +27,24 @@ import java.io.FileInputStream;
*/
@Slf4j
@RestController
public
class
ImgController
{
public
class
ImgController
extends
BaseController
{
/**
* 服务器访问路径
*/
private
static
String
pathPre
=
"/vdb/springboot/school_center/manager/"
;
//menuname = "图片路径" 只支持jpeg 和 png
@Permission
(
menuname
=
"图片查询"
,
value
=
"/images/**"
,
produces
={
MediaType
.
IMAGE_JPEG_VALUE
,
MediaType
.
IMAGE_PNG_VALUE
})
public
byte
[]
getbackground
(
HttpServletRequest
request
)
{
byte
[]
bytes
={};
request
.
getServletPath
();
String
imgurl
=
FilePath
.
BACKGROUNDIMG
.
getValue
()+
"/"
+
request
.
getServletPath
();
@Permission
(
menuname
=
"图片查询"
,
value
=
"/images"
,
method
=
RequestMethod
.
POST
,
produces
={
MediaType
.
IMAGE_JPEG_VALUE
,
MediaType
.
IMAGE_PNG_VALUE
})
public
ResponseData
<
String
>
getbackground
(
String
url
)
{
ShiroUser
shiroUser
=
getShiroUser
();
if
(!
shiroUser
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
,
"系统管理员"
,
"县分管理员(订单)"
,
"合伙人"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
System
.
out
.
println
(
url
);
url
.
replace
(
"manager/ciop"
,
""
);
byte
[]
bytes
=
new
byte
[
10
];
String
imgurl
=
pathPre
+
FilePath
.
BACKGROUNDIMG
.
getValue
()+
"/"
+
url
;
imgurl
=
imgurl
.
replace
(
"//"
,
"/"
);
File
file
=
new
File
(
imgurl
);
...
...
@@ -33,8 +52,6 @@ public class ImgController {
try
{
inputStream
=
new
FileInputStream
(
file
);
bytes
=
new
byte
[
0
];
bytes
=
new
byte
[
inputStream
.
available
()];
if
(
inputStream
!=
null
)
{
...
...
@@ -51,6 +68,6 @@ public class ImgController {
}
catch
(
Exception
e
){}
}
}
return
bytes
;
return
ResponseData
.
success
(
Base64
.
encodeBase64String
(
bytes
))
;
}
}
service-manager/src/main/java/com/winsun/controller/StudentCardVerifyController.java
View file @
a0191e8b
...
...
@@ -253,6 +253,9 @@ public class StudentCardVerifyController extends BaseController {
@RequestParam
(
name
=
"pageNo"
)
int
pageNo
,
@RequestParam
(
name
=
"pageSize"
)
int
pageSize
)
{
ShiroUser
user
=
getShiroUser
();
if
(!
user
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
,
"系统管理员"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
Page
<
StudentCard
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
Wrapper
<
StudentCard
>
studentCardWrapper
=
new
EntityWrapper
<>();
...
...
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