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
52c84058
Commit
52c84058
authored
Mar 17, 2020
by
黄森林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二维码bug修复
parent
bf89d887
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
common/src/main/java/com/winsun/utils/PicturesUtil.java
+7
-4
service-manager/src/main/java/com/winsun/controller/QRCodeController.java
+2
-1
No files found.
common/src/main/java/com/winsun/utils/PicturesUtil.java
View file @
52c84058
...
@@ -2,6 +2,7 @@ package com.winsun.utils;
...
@@ -2,6 +2,7 @@ package com.winsun.utils;
import
com.winsun.constant.FilePath
;
import
com.winsun.constant.FilePath
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
sun.misc.BASE64Decoder
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -25,7 +26,7 @@ public class PicturesUtil {
...
@@ -25,7 +26,7 @@ public class PicturesUtil {
* @param path 图片文件夹名
* @param path 图片文件夹名
* @return
* @return
*/
*/
public
static
String
uploadPictures
(
String
file
,
String
path
)
{
public
static
String
uploadPictures
(
String
file
,
String
path
){
Date
date
=
new
Date
();
Date
date
=
new
Date
();
SimpleDateFormat
yyMM
=
new
SimpleDateFormat
(
"yyMM"
);
SimpleDateFormat
yyMM
=
new
SimpleDateFormat
(
"yyMM"
);
String
y
=
yyMM
.
format
(
date
.
getTime
());
String
y
=
yyMM
.
format
(
date
.
getTime
());
...
@@ -40,10 +41,12 @@ public class PicturesUtil {
...
@@ -40,10 +41,12 @@ public class PicturesUtil {
/**
/**
* 2.解码成字节数组
* 2.解码成字节数组
*/
*/
filePath
=
FilePath
.
IDCARD
.
getValue
()
+
y
+
"/"
+
h
+
"/"
+
path
+
"/"
+
date
.
getTime
()
+
"."
+
houzhui
;
filePath
=
FilePath
.
IDCARD
.
getValue
()
+
y
+
"/"
+
h
+
"/"
+
path
+
"/"
+
date
.
getTime
()
+
"."
+
houzhui
;
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
//filePath = "C:\\Users\\asus\\Desktop\\新建文件夹\\" + date.getTime()+ "." + houzhui;
byte
[]
bytes
=
decoder
.
decode
(
base64Data
);
//byte[] bytes = Base64.getUrlDecoder().decode(base64Data);
//byte[] bytes =new BASE64Decoder().decodeBuffer(base64Data);
//byte[] bytes = Base64.getDecoder().decode(base64Data);
byte
[]
bytes
=
Base64
.
getMimeDecoder
().
decode
(
base64Data
.
replace
(
" "
,
"+"
));
FileOutputStream
fos
=
null
;
FileOutputStream
fos
=
null
;
try
{
try
{
fos
=
new
FileOutputStream
(
filePath
);
fos
=
new
FileOutputStream
(
filePath
);
...
...
service-manager/src/main/java/com/winsun/controller/QRCodeController.java
View file @
52c84058
...
@@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.*
;
import
java.util.*
;
...
@@ -40,7 +41,7 @@ public class QRCodeController extends BaseController {
...
@@ -40,7 +41,7 @@ public class QRCodeController extends BaseController {
}
}
@Permission
(
menuname
=
"二维码上传图片"
,
value
=
"picture"
,
method
=
RequestMethod
.
POST
)
@Permission
(
menuname
=
"二维码上传图片"
,
value
=
"picture"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
uploadPicture
(
@RequestParam
(
"picture"
)
String
picture
){
public
ResponseData
<
String
>
uploadPicture
(
@RequestParam
(
"picture"
)
String
picture
)
{
ShiroUser
user
=
getShiroUser
();
ShiroUser
user
=
getShiroUser
();
Integer
userId
=
user
.
getId
();
Integer
userId
=
user
.
getId
();
String
path
=
PicturesUtil
.
uploadPictures
(
picture
,
userId
.
toString
());
String
path
=
PicturesUtil
.
uploadPictures
(
picture
,
userId
.
toString
());
...
...
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