Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
email
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
陈天仲
email
Commits
2348d5ec
Commit
2348d5ec
authored
Jun 26, 2023
by
chentianzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
b8ac03c7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
src/main/java/com/zq/email/controller/EmailAttachController.java
+2
-0
src/main/java/com/zq/email/service/IEmailAttachService.java
+0
-1
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
+14
-4
No files found.
src/main/java/com/zq/email/controller/EmailAttachController.java
View file @
2348d5ec
...
...
@@ -39,6 +39,7 @@ import java.io.File;
import
java.io.OutputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* <p>
...
...
@@ -74,6 +75,7 @@ public class EmailAttachController {
String
download
=
emailAttachService
.
getDownloadPath
(
emailAttach
);
AssertUtils
.
hasText
(
download
,
"下载地址为空"
);
log
.
info
(
"下载文件地址:"
+
download
);
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
try
{
HttpUtil
.
download
(
download
,
outputStream
,
true
);
...
...
src/main/java/com/zq/email/service/IEmailAttachService.java
View file @
2348d5ec
...
...
@@ -21,7 +21,6 @@ public interface IEmailAttachService extends IService<EmailAttach> {
List
<
EmailAttach
>
saveAttach
(
EmailEditVo
vo
,
EmailContent
content
);
List
<
EmailAttach
>
findByContentId
(
Long
contentId
);
String
getDownloadPath
(
Long
id
);
...
...
src/main/java/com/zq/email/service/impl/EmailAttachServiceImpl.java
View file @
2348d5ec
...
...
@@ -40,6 +40,7 @@ import java.util.List;
public
class
EmailAttachServiceImpl
extends
ServiceImpl
<
EmailAttachMapper
,
EmailAttach
>
implements
IEmailAttachService
{
private
final
FileFeignClient
fileFeignClient
;
@Value
(
"${spring.cloud.config.profile}"
)
private
String
profile
;
...
...
@@ -98,7 +99,16 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
@Override
public
List
<
EmailAttach
>
findByContentId
(
Long
contentId
)
{
return
this
.
lambdaQuery
().
eq
(
EmailAttach:
:
getEmailContentId
,
contentId
).
orderByAsc
(
EmailAttach:
:
getId
).
list
();
List
<
EmailAttach
>
attaches
=
new
ArrayList
<>();
List
<
EmailAttach
>
list
=
this
.
lambdaQuery
().
eq
(
EmailAttach:
:
getEmailContentId
,
contentId
).
orderByAsc
(
EmailAttach:
:
getId
).
list
();
for
(
EmailAttach
attach
:
list
)
{
String
download
=
attach
.
getDownloadPath
();
if
(
StrUtil
.
isNotBlank
(
download
)
&&
profile
.
contains
(
"wan"
)){
attach
.
setDownloadPath
(
download
.
replaceAll
(
"147.2.3.3"
,
"172.28.1.71"
));
}
attaches
.
add
(
attach
);
}
return
attaches
;
}
@Override
...
...
@@ -118,8 +128,8 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
download
=
"http://172.28.1.159:82/attwjsf_yj"
+
path
;
}
}
else
{
if
(
profile
.
equals
(
"wanpro"
)
||
profile
.
equals
(
"wantest
"
))
{
download
.
replaceAll
(
"147.2.3.3"
,
"172.28.1.71"
);
if
(
profile
.
contains
(
"wan
"
))
{
download
=
download
.
replaceAll
(
"147.2.3.3"
,
"172.28.1.71"
);
}
}
return
download
;
...
...
@@ -140,7 +150,7 @@ public class EmailAttachServiceImpl extends ServiceImpl<EmailAttachMapper, Email
}
}
else
{
if
(
profile
.
equals
(
"wanpro"
)
||
profile
.
equals
(
"wantest"
))
{
download
.
replaceAll
(
"147.2.3.3"
,
"172.28.1.71"
);
download
=
download
.
replaceAll
(
"147.2.3.3"
,
"172.28.1.71"
);
}
}
return
download
;
...
...
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