Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
5b8b3076
Commit
5b8b3076
authored
May 15, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
8c3d46f7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
26 deletions
+78
-26
workspace.xml
.idea/workspace.xml
+5
-1
en-cn.properties
conf/en-cn.properties
+1
-0
workspace.xml
lib/java/bi-report-service/.idea/workspace.xml
+4
-1
EmailService.java
...va/com/gmei/data/gateway/server/service/EmailService.java
+2
-1
EmailServiceImpl.java
...ei/data/gateway/server/service/impl/EmailServiceImpl.java
+37
-0
ExcelServiceImpl.java
...ei/data/gateway/server/service/impl/ExcelServiceImpl.java
+22
-22
EmailServiceTest.java
...om/gmei/data/gateway/server/service/EmailServiceTest.java
+7
-1
No files found.
.idea/workspace.xml
View file @
5b8b3076
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"18c38e3b-9b7f-4a3f-b141-edcb320b1d24"
name=
"Default Changelist"
comment=
""
/>
<list
default=
"true"
id=
"18c38e3b-9b7f-4a3f-b141-edcb320b1d24"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/conf/en-cn.properties"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/conf/en-cn.properties"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -125,6 +127,8 @@
<workItem
from=
"1588248522289"
duration=
"2820000"
/>
<workItem
from=
"1588344251422"
duration=
"21636000"
/>
<workItem
from=
"1588761853482"
duration=
"3826000"
/>
<workItem
from=
"1588905392183"
duration=
"4522000"
/>
<workItem
from=
"1589447155495"
duration=
"7400000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"add init codes."
>
<created>
1587723565207
</created>
...
...
conf/en-cn.properties
View file @
5b8b3076
...
...
@@ -2,6 +2,7 @@ demo=示例程序-demo
demo_bak
=
示例程序-demo_bak
demo_param
=
带参数的示例程序
demo_java
=
JAVA实例程序
meigou-detail-page
=
美购详情页
meigou-detail-page-dispense-pv
=
美购详情页分发pv
meigou-detail-page-dispense-uv
=
美购详情页分发uv
...
...
lib/java/bi-report-service/.idea/workspace.xml
View file @
5b8b3076
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"73604af3-3cbc-41f8-9a5f-e6a14a2ada76"
name=
"Default Changelist"
comment=
"add"
/>
<list
default=
"true"
id=
"73604af3-3cbc-41f8-9a5f-e6a14a2ada76"
name=
"Default Changelist"
comment=
"add"
>
<change
beforePath=
"$PROJECT_DIR$/../../../conf/en-cn.properties"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../../../conf/en-cn.properties"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -217,6 +219,7 @@
<workItem
from=
"1588344252163"
duration=
"15923000"
/>
<workItem
from=
"1588762492573"
duration=
"403000"
/>
<workItem
from=
"1588837331043"
duration=
"673000"
/>
<workItem
from=
"1589455301393"
duration=
"4293000"
/>
</task>
<servers
/>
</component>
...
...
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/EmailService.java
View file @
5b8b3076
package
com
.
gmei
.
data
.
gateway
.
server
.
service
;
public
interface
EmailService
{
int
sendAttachmentsMail
(
String
to
,
String
cc
,
String
subject
);
int
sendAttachmentsMail
(
String
to
,
String
cc
,
String
name
);
int
sendFormatedMail
(
String
to
,
String
cc
,
String
name
,
String
content
);
}
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/impl/EmailServiceImpl.java
View file @
5b8b3076
...
...
@@ -75,4 +75,41 @@ public class EmailServiceImpl implements EmailService {
}
return
rs
;
}
@Override
public
int
sendFormatedMail
(
String
to
,
String
cc
,
String
name
,
String
htmlContent
){
int
rs
=
Constants
.
SUCCESS
;
// 主题内容转义
String
subject
=
""
;
String
value
=
ProperUtils
.
getValue
(
properFilePath
,
name
);
if
(
null
!=
value
){
subject
=
value
;
}
else
{
subject
=
name
;
}
// 邮件发送逻辑
MimeMessage
message
=
mailSender
.
createMimeMessage
();
try
{
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
message
,
true
,
"UTF-8"
);
helper
.
setFrom
(
from
);
String
[]
toUsers
=
to
.
split
(
","
);
helper
.
setTo
(
toUsers
);
helper
.
setSubject
(
subject
);
helper
.
setText
(
htmlContent
,
true
);
if
(
cc
!=
null
&&
!
""
.
equals
(
cc
.
trim
()))
{
String
[]
ccUsers
=
cc
.
split
(
","
);
helper
.
setCc
(
ccUsers
);
}
if
(
bcc
!=
null
&&
!
""
.
equals
(
bcc
.
trim
()))
{
String
[]
bccUsers
=
bcc
.
split
(
","
);
helper
.
setBcc
(
bccUsers
);
}
mailSender
.
send
(
message
);
logger
.
info
(
"格式化的邮件已经发送。"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"格式化后的邮件发送异常!"
,
e
);
rs
=
Constants
.
FAIL
;
}
return
rs
;
}
}
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/impl/ExcelServiceImpl.java
View file @
5b8b3076
...
...
@@ -45,29 +45,29 @@ public class ExcelServiceImpl implements ExcelService {
@Override
public
int
genExcel
(
ExcelGenDto
excelGenDto
,
String
name
)
{
int
rs
=
Constants
.
SUCCESS
;
List
<
String
>
sheetNameList
=
excelGenDto
.
getSheetNameList
();
List
<
List
<
String
>>
headersList
=
excelGenDto
.
getHeadersList
();
List
<
List
<
List
>>
rowsList
=
excelGenDto
.
getRowsList
();
XSSFWorkbook
wb
=
new
XSSFWorkbook
();
if
(
null
!=
sheetNameList
&&
sheetNameList
.
size
()
>
0
){
List
<
XSSFSheet
>
sheets
=
new
ArrayList
<
XSSFSheet
>();
for
(
int
i
=
0
;
i
<
sheetNameList
.
size
();
i
++){
XSSFSheet
sheet
=
wb
.
createSheet
(
sheetNameList
.
get
(
i
));
sheets
.
add
(
sheet
);
}
this
.
output
(
wb
,
sheets
,
headersList
,
rowsList
);
}
else
{
rs
=
Constants
.
FAIL
;
logger
.
error
(
"Error!"
);
}
// String subject = "";
// String value = ProperUtils.getValue(properFilePath, name);
// if(null != value){
// subject = value;
// }else{
// subject = name;
// }
try
{
List
<
String
>
sheetNameList
=
excelGenDto
.
getSheetNameList
();
List
<
List
<
String
>>
headersList
=
excelGenDto
.
getHeadersList
();
List
<
List
<
List
>>
rowsList
=
excelGenDto
.
getRowsList
();
XSSFWorkbook
wb
=
new
XSSFWorkbook
();
if
(
null
!=
sheetNameList
&&
sheetNameList
.
size
()
>
0
){
List
<
XSSFSheet
>
sheets
=
new
ArrayList
<
XSSFSheet
>();
for
(
int
i
=
0
;
i
<
sheetNameList
.
size
();
i
++){
XSSFSheet
sheet
=
wb
.
createSheet
(
sheetNameList
.
get
(
i
));
sheets
.
add
(
sheet
);
}
this
.
output
(
wb
,
sheets
,
headersList
,
rowsList
);
}
else
{
rs
=
Constants
.
FAIL
;
logger
.
error
(
"Error!"
);
}
// String subject = "";
// String value = ProperUtils.getValue(properFilePath, name);
// if(null != value){
// subject = value;
// }else{
// subject = name;
// }
FileOutputStream
out
=
new
FileOutputStream
(
filePath
+
name
+
"-"
+
DateUtils
.
getYesterdayDateSimpleStr
()
+
".xlsx"
);
wb
.
write
(
out
);
out
.
close
();
...
...
lib/java/bi-report-service/service-server/src/test/java/com/gmei/data/gateway/server/service/EmailServiceTest.java
View file @
5b8b3076
...
...
@@ -21,6 +21,12 @@ public class EmailServiceTest {
@Test
public
void
testSendAttachmentsMail
()
{
emailService
.
sendAttachmentsMail
(
"zhaojianwei@igengmei.com"
,
"jianweizhao@yeah.net"
,
"敏感稽查元数据库账户"
);
emailService
.
sendAttachmentsMail
(
"zhaojianwei@igengmei.com"
,
"jianweizhao@yeah.net"
,
"demo"
);
}
@Test
public
void
testSendFormattedMail
()
{
String
htmlContent
=
"<h1>demo</h1>"
;
emailService
.
sendFormatedMail
(
"zhaojianwei@igengmei.com"
,
"jianweizhao@yeah.net"
,
"demo"
,
htmlContent
);
}
}
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