Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
16f7e25e
Commit
16f7e25e
authored
Aug 09, 2021
by
张辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加上tmpDir
parent
b56e5067
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+12
-1
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
16f7e25e
...
@@ -73,8 +73,10 @@ import org.springframework.util.LinkedMultiValueMap;
...
@@ -73,8 +73,10 @@ import org.springframework.util.LinkedMultiValueMap;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -132,6 +134,15 @@ public class ThemeManager {
...
@@ -132,6 +134,15 @@ public class ThemeManager {
@Resource
@Resource
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@PostConstruct
public
void
init
()
throws
IOException
{
File
f
=
new
File
(
tmpDir
);
log
.
info
(
"create directory {}"
,
tmpDir
);
if
(!
f
.
exists
())
{
FileUtils
.
forceMkdir
(
f
);
}
}
// 专栏
// 专栏
@Autowired
@Autowired
private
FeignClientForCommunity
feignClientForCommunity
;
private
FeignClientForCommunity
feignClientForCommunity
;
...
@@ -276,7 +287,7 @@ public class ThemeManager {
...
@@ -276,7 +287,7 @@ public class ThemeManager {
String
imgUrl
=
img
.
getRemark
();
String
imgUrl
=
img
.
getRemark
();
String
[]
arr
=
StringUtils
.
split
(
imgUrl
,
"."
);
String
[]
arr
=
StringUtils
.
split
(
imgUrl
,
"."
);
String
suffix
=
arr
[
arr
.
length
-
1
];
String
suffix
=
arr
[
arr
.
length
-
1
];
String
fileName
=
imgUrl
.
substring
(
imgUrl
.
lastIndexOf
(
'/'
)
+
1
);
String
fileName
=
tmpDir
+
imgUrl
.
substring
(
imgUrl
.
lastIndexOf
(
'/'
)
+
1
);
ResponseEntity
<
byte
[]>
resp
=
restTemplate
.
getForEntity
(
img
.
getRemark
(),
byte
[].
class
);
ResponseEntity
<
byte
[]>
resp
=
restTemplate
.
getForEntity
(
img
.
getRemark
(),
byte
[].
class
);
byte
[]
rst
=
resp
.
getBody
();
byte
[]
rst
=
resp
.
getBody
();
...
...
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