Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
5693f178
Commit
5693f178
authored
Oct 17, 2019
by
linlihuiyang
Committed by
elunez
Oct 17, 2019
Browse files
解决Gson找不到包的bug (#141)
* 解决Gson找不到包的bug * 解决Gson找不到包的bug
parent
8b5c04cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java
View file @
5693f178
package
me.zhengjie.service.impl
;
package
me.zhengjie.service.impl
;
import
com.
google.gson.Gson
;
import
com.
alibaba.fastjson.JSON
;
import
com.qiniu.common.QiniuException
;
import
com.qiniu.common.QiniuException
;
import
com.qiniu.http.Response
;
import
com.qiniu.http.Response
;
import
com.qiniu.storage.BucketManager
;
import
com.qiniu.storage.BucketManager
;
...
@@ -16,7 +16,11 @@ import me.zhengjie.repository.QiNiuConfigRepository;
...
@@ -16,7 +16,11 @@ import me.zhengjie.repository.QiNiuConfigRepository;
import
me.zhengjie.repository.QiniuContentRepository
;
import
me.zhengjie.repository.QiniuContentRepository
;
import
me.zhengjie.service.QiNiuService
;
import
me.zhengjie.service.QiNiuService
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.service.dto.QiniuQueryCriteria
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.QiNiuUtil
;
import
me.zhengjie.utils.QueryHelp
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
@@ -24,6 +28,7 @@ import org.springframework.stereotype.Service;
...
@@ -24,6 +28,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Optional
;
import
java.util.Optional
;
/**
/**
...
@@ -91,7 +96,8 @@ public class QiNiuServiceImpl implements QiNiuService {
...
@@ -91,7 +96,8 @@ public class QiNiuServiceImpl implements QiNiuService {
}
}
Response
response
=
uploadManager
.
put
(
file
.
getBytes
(),
key
,
upToken
);
Response
response
=
uploadManager
.
put
(
file
.
getBytes
(),
key
,
upToken
);
//解析上传成功的结果
//解析上传成功的结果
DefaultPutRet
putRet
=
new
Gson
().
fromJson
(
response
.
bodyString
(),
DefaultPutRet
.
class
);
DefaultPutRet
putRet
=
JSON
.
parseObject
(
response
.
bodyString
(),
DefaultPutRet
.
class
);
//存入数据库
//存入数据库
QiniuContent
qiniuContent
=
new
QiniuContent
();
QiniuContent
qiniuContent
=
new
QiniuContent
();
qiniuContent
.
setSuffix
(
FileUtil
.
getExtensionName
(
putRet
.
key
));
qiniuContent
.
setSuffix
(
FileUtil
.
getExtensionName
(
putRet
.
key
));
...
...
Write
Preview
Supports
Markdown
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