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
363446af
Commit
363446af
authored
Apr 30, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
eaff3d18
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
39 deletions
+65
-39
workspace.xml
.idea/workspace.xml
+2
-5
workspace.xml
lib/java/bi-report-service/.idea/workspace.xml
+1
-1
BiReportEndpoint.java
...m/gmei/data/gateway/server/endpoint/BiReportEndpoint.java
+6
-16
BiReportService.java
...com/gmei/data/gateway/server/service/BiReportService.java
+2
-0
EmailService.java
...va/com/gmei/data/gateway/server/service/EmailService.java
+1
-1
BiReportServiceImpl.java
...data/gateway/server/service/impl/BiReportServiceImpl.java
+22
-9
EmailServiceImpl.java
...ei/data/gateway/server/service/impl/EmailServiceImpl.java
+4
-1
BiReportServiceTest.java
...gmei/data/gateway/server/service/BiReportServiceTest.java
+1
-6
EmailServiceTest.java
...om/gmei/data/gateway/server/service/EmailServiceTest.java
+26
-0
No files found.
.idea/workspace.xml
View file @
363446af
<?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=
""
>
<change
beforePath=
"$PROJECT_DIR$/sbin/start_service.sh"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/sbin/start_service.sh"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/sbin/stop_service.sh"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/sbin/stop_service.sh"
afterDir=
"false"
/>
</list>
<list
default=
"true"
id=
"18c38e3b-9b7f-4a3f-b141-edcb320b1d24"
name=
"Default Changelist"
comment=
""
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -121,7 +118,7 @@
<workItem
from=
"1587982524517"
duration=
"5052000"
/>
<workItem
from=
"1588152481879"
duration=
"139000"
/>
<workItem
from=
"1588154352798"
duration=
"195000"
/>
<workItem
from=
"1588220085338"
duration=
"4
354
000"
/>
<workItem
from=
"1588220085338"
duration=
"4
971
000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"add init codes."
>
<created>
1587723565207
</created>
...
...
lib/java/bi-report-service/.idea/workspace.xml
View file @
363446af
...
...
@@ -214,7 +214,7 @@
<workItem
from=
"1584945647680"
duration=
"4469000"
/>
<workItem
from=
"1588148891822"
duration=
"2318000"
/>
<workItem
from=
"1588152718016"
duration=
"1463000"
/>
<workItem
from=
"1588154601852"
duration=
"1
6438
000"
/>
<workItem
from=
"1588154601852"
duration=
"1
7055
000"
/>
</task>
<servers
/>
</component>
...
...
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/endpoint/BiReportEndpoint.java
View file @
363446af
package
com
.
gmei
.
data
.
gateway
.
server
.
endpoint
;
import
com.gmei.data.gateway.server.dto.ExcelGenDto
;
import
com.gmei.data.gateway.server.service.ExcelService
;
import
com.gmei.data.gateway.server.service.EmailService
;
import
com.gmei.data.gateway.server.service.SparksqlService
;
import
com.gmei.data.gateway.server.service.BiReportService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -15,24 +12,17 @@ import org.springframework.web.bind.annotation.RestController;
public
class
BiReportEndpoint
{
@Autowired
public
EmailService
emailService
;
@Autowired
public
ExcelService
excelService
;
@Autowired
public
SparksqlService
sparksqlService
;
public
BiReportService
biReportService
;
@ResponseBody
@RequestMapping
(
value
=
"/genExcel"
)
public
int
genExcel
(
@RequestParam
String
hql
){
ExcelGenDto
resultDto
=
sparksqlService
.
getResultDto
(
hql
);
return
0
;
public
int
genExcel
(
@RequestParam
String
name
){
return
biReportService
.
genExcel
(
name
);
}
@ResponseBody
@RequestMapping
(
value
=
"/sendEmail"
)
public
int
sendEmail
(
@RequestParam
String
hql
){
return
0
;
public
int
sendEmail
(
@RequestParam
String
name
,
@RequestParam
String
subject
){
return
biReportService
.
sendEmail
(
name
,
subject
);
}
}
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/BiReportService.java
View file @
363446af
package
com
.
gmei
.
data
.
gateway
.
server
.
service
;
public
interface
BiReportService
{
int
genExcel
(
String
name
);
int
sendEmail
(
String
name
,
String
subject
);
}
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/EmailService.java
View file @
363446af
package
com
.
gmei
.
data
.
gateway
.
server
.
service
;
public
interface
EmailService
{
void
sendAttachmentsMail
(
String
to
,
String
cc
,
String
subject
);
int
sendAttachmentsMail
(
String
to
,
String
cc
,
String
subject
);
}
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/impl/BiReportServiceImpl.java
View file @
363446af
package
com
.
gmei
.
data
.
gateway
.
server
.
service
.
impl
;
import
com.gmei.data.gateway.server.dto.ExcelGenDto
;
import
com.gmei.data.gateway.server.service.BiReportService
;
import
com.gmei.data.gateway.server.service.ExcelService
;
import
com.gmei.data.gateway.server.service.EmailService
;
import
com.gmei.data.gateway.server.service.ExcelService
;
import
com.gmei.data.gateway.server.service.SparksqlService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* @ClassName BiReportServiceImpl
...
...
@@ -11,20 +14,30 @@ import org.springframework.beans.factory.annotation.Autowired;
* @Date 2020/4/30
* @Version V1.0
**/
@Service
public
class
BiReportServiceImpl
implements
BiReportService
{
@Autowired
p
rivate
ExcelService
exce
lService
;
p
ublic
EmailService
emai
lService
;
@Autowired
p
rivate
EmailService
emai
lService
;
public
int
genExcel
(){
p
ublic
ExcelService
exce
lService
;
@Autowired
public
SparksqlService
sparksqlService
;
return
0
;
@Override
public
int
genExcel
(
String
name
){
ExcelGenDto
resultDto
=
sparksqlService
.
getResultDto
(
name
);
return
excelService
.
genExcel
(
resultDto
,
"测试示例"
);
}
public
int
sendEmail
(){
return
0
;
@Override
public
int
sendEmail
(
String
name
,
String
subject
){
int
rs
=
0
;
ExcelGenDto
resultDto
=
sparksqlService
.
getResultDto
(
name
);
int
genExcelRs
=
excelService
.
genExcel
(
resultDto
,
subject
);
if
(
0
==
genExcelRs
){
rs
=
emailService
.
sendAttachmentsMail
(
"zhaojianwei@igengmei.com"
,
"jianweizhao@yeah.net"
,
"测试示例"
);
}
return
rs
;
}
}
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/impl/EmailServiceImpl.java
View file @
363446af
...
...
@@ -31,7 +31,8 @@ public class EmailServiceImpl implements EmailService {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EmailServiceImpl
.
class
);
@Override
public
void
sendAttachmentsMail
(
String
to
,
String
cc
,
String
subject
){
public
int
sendAttachmentsMail
(
String
to
,
String
cc
,
String
subject
){
int
rs
=
0
;
MimeMessage
message
=
mailSender
.
createMimeMessage
();
try
{
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
message
,
true
);
...
...
@@ -53,6 +54,8 @@ public class EmailServiceImpl implements EmailService {
logger
.
info
(
"带附件的邮件已经发送。"
);
}
catch
(
MessagingException
e
)
{
logger
.
error
(
"发送带附件的邮件时发生异常!"
,
e
);
rs
=
-
1
;
}
return
rs
;
}
}
lib/java/bi-report-service/service-server/src/test/java/com/gmei/data/gateway/server/service/BiReportServiceTest.java
View file @
363446af
package
com
.
gmei
.
data
.
gateway
.
server
.
service
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -17,10 +16,6 @@ import org.springframework.test.context.junit4.SpringRunner;
public
class
BiReportServiceTest
{
@Autowired
private
EmailService
email
Service
;
private
BiReportService
biReport
Service
;
@Test
public
void
testSendAttachmentsMail
()
{
emailService
.
sendAttachmentsMail
(
"zhaojianwei@igengmei.com"
,
"jianweizhao@yeah.net"
,
"敏感稽查元数据库账户"
);
}
}
lib/java/bi-report-service/service-server/src/test/java/com/gmei/data/gateway/server/service/EmailServiceTest.java
0 → 100644
View file @
363446af
package
com
.
gmei
.
data
.
gateway
.
server
.
service
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
/**
* @ClassName EmailServiceTest
* @Author apple
* @Date 2020/4/30
* @Version V1.0
**/
@SpringBootTest
@RunWith
(
SpringRunner
.
class
)
public
class
EmailServiceTest
{
@Autowired
private
EmailService
emailService
;
@Test
public
void
testSendAttachmentsMail
()
{
emailService
.
sendAttachmentsMail
(
"zhaojianwei@igengmei.com"
,
"jianweizhao@yeah.net"
,
"敏感稽查元数据库账户"
);
}
}
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