Commit e5d2ae02 authored by 魏艺敏's avatar 魏艺敏

Merge branch 'master' of http://git.wanmeizhensuo.com/zhaojianwei/bi-report into weiyimin

 Conflicts:
	.idea/workspace.xml
parents d4175ee0 a44ddc3a
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager"> <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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
...@@ -68,23 +48,30 @@ ...@@ -68,23 +48,30 @@
</component> </component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" /> <property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="DatabaseDriversLRU" value="hive" /> <property name="DatabaseDriversLRU" value="hive" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" /> <property name="aspect.path.notification.shown" value="true" />
<property name="ignore_missing_gitignore" value="true" /> <property name="ignore_missing_gitignore" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/bin" />
<property name="project.structure.last.edited" value="Global Libraries" /> <property name="project.structure.last.edited" value="Global Libraries" />
<property name="project.structure.proportion" value="0.0" /> <property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.2" /> <property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="File.Encoding" /> <property name="settings.editor.selected.configurable" value="File.Encoding" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/bin" />
<recent name="$PROJECT_DIR$/jobs/demo_java_gen" />
<recent name="$PROJECT_DIR$/jobs" />
<recent name="$PROJECT_DIR$/jobs/hive_insert" />
<recent name="$PROJECT_DIR$/sqls" />
</key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/jobs/bak" /> <recent name="$PROJECT_DIR$/jobs/bak" />
<recent name="$PROJECT_DIR$/sqls/bak" /> <recent name="$PROJECT_DIR$/sqls/bak" />
...@@ -92,13 +79,6 @@ ...@@ -92,13 +79,6 @@
<recent name="$PROJECT_DIR$/sqls/demo" /> <recent name="$PROJECT_DIR$/sqls/demo" />
<recent name="$PROJECT_DIR$/lib/java" /> <recent name="$PROJECT_DIR$/lib/java" />
</key> </key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/jobs/demo_java_gen" />
<recent name="$PROJECT_DIR$/jobs" />
<recent name="$PROJECT_DIR$/jobs/hive_insert" />
<recent name="$PROJECT_DIR$/sqls" />
<recent name="$PROJECT_DIR$/jobs/meigou-detail-page" />
</key>
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="ClojureREPL" factoryName="Local" activateToolWindowBeforeRun="false"> <configuration default="true" type="ClojureREPL" factoryName="Local" activateToolWindowBeforeRun="false">
...@@ -145,6 +125,8 @@ ...@@ -145,6 +125,8 @@
<workItem from="1588248522289" duration="2820000" /> <workItem from="1588248522289" duration="2820000" />
<workItem from="1588344251422" duration="21636000" /> <workItem from="1588344251422" duration="21636000" />
<workItem from="1588761853482" duration="3826000" /> <workItem from="1588761853482" duration="3826000" />
<workItem from="1588905392183" duration="4522000" />
<workItem from="1589447155495" duration="14053000" />
</task> </task>
<task id="LOCAL-00001" summary="add init codes."> <task id="LOCAL-00001" summary="add init codes.">
<created>1587723565207</created> <created>1587723565207</created>
...@@ -300,7 +282,42 @@ ...@@ -300,7 +282,42 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1588522705925</updated> <updated>1588522705925</updated>
</task> </task>
<option name="localTasksCounter" value="23" /> <task id="LOCAL-00023" summary="update codes">
<created>1589531180950</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1589531180950</updated>
</task>
<task id="LOCAL-00024" summary="update codes">
<created>1589531276027</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1589531276027</updated>
</task>
<task id="LOCAL-00025" summary="update codes">
<created>1589531399499</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1589531399499</updated>
</task>
<task id="LOCAL-00026" summary="update codes">
<created>1589534027533</created>
<option name="number" value="00026" />
<option name="presentableId" value="LOCAL-00026" />
<option name="project" value="LOCAL" />
<updated>1589534027533</updated>
</task>
<task id="LOCAL-00027" summary="update codes">
<created>1589536751237</created>
<option name="number" value="00027" />
<option name="presentableId" value="LOCAL-00027" />
<option name="project" value="LOCAL" />
<updated>1589536751237</updated>
</task>
<option name="localTasksCounter" value="28" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
...@@ -334,19 +351,13 @@ ...@@ -334,19 +351,13 @@
</State> </State>
</value> </value>
</entry> </entry>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map> </map>
</option> </option>
<option name="OPEN_GENERIC_TABS"> <option name="OPEN_TABS">
<map> <set>
<entry key="1" value="TOOL_WINDOW" /> <option value="1" />
</map> </set>
</option> </option>
<option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
...@@ -372,10 +383,11 @@ ...@@ -372,10 +383,11 @@
<screen x="246" y="1080" width="1920" height="1151" /> <screen x="246" y="1080" width="1920" height="1151" />
</state> </state>
<state x="826" y="1351" key="#com.intellij.ide.util.frameworkSupport.AddFrameworkSupportDialog/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587720303076" /> <state x="826" y="1351" key="#com.intellij.ide.util.frameworkSupport.AddFrameworkSupportDialog/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587720303076" />
<state x="554" y="197" key="CommitChangelistDialog2" timestamp="1588522705736"> <state x="554" y="205" key="CommitChangelistDialog2" timestamp="1589536751036">
<screen x="0" y="22" width="1920" height="1129" /> <screen x="0" y="22" width="1920" height="1178" />
</state> </state>
<state x="554" y="197" key="CommitChangelistDialog2/0.22.1920.1129@0.22.1920.1129" timestamp="1588522705736" /> <state x="554" y="197" key="CommitChangelistDialog2/0.22.1920.1129@0.22.1920.1129" timestamp="1588522705736" />
<state x="554" y="205" key="CommitChangelistDialog2/1752.1200.1920.1151/0.22.1920.1178/1920.120.1920.1080@0.22.1920.1178" timestamp="1589536751036" />
<state x="554" y="186" key="CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588232534973" /> <state x="554" y="186" key="CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588232534973" />
<state x="800" y="1258" key="CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587900238196" /> <state x="800" y="1258" key="CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587900238196" />
<state x="792" y="309" key="RollbackChangesDialog" timestamp="1588521468770"> <state x="792" y="309" key="RollbackChangesDialog" timestamp="1588521468770">
...@@ -388,12 +400,17 @@ ...@@ -388,12 +400,17 @@
</state> </state>
<state x="448" y="176" key="SettingsEditor/0.22.1920.1129@0.22.1920.1129" timestamp="1588346857662" /> <state x="448" y="176" key="SettingsEditor/0.22.1920.1129@0.22.1920.1129" timestamp="1588346857662" />
<state x="694" y="1237" key="SettingsEditor/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587720319782" /> <state x="694" y="1237" key="SettingsEditor/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587720319782" />
<state x="560" y="331" key="Vcs.Push.Dialog.v2" timestamp="1588522707302"> <state x="560" y="344" key="Vcs.Push.Dialog.v2" timestamp="1589536752839">
<screen x="0" y="22" width="1920" height="1129" /> <screen x="0" y="22" width="1920" height="1178" />
</state> </state>
<state x="560" y="331" key="Vcs.Push.Dialog.v2/0.22.1920.1129@0.22.1920.1129" timestamp="1588522707302" /> <state x="560" y="331" key="Vcs.Push.Dialog.v2/0.22.1920.1129@0.22.1920.1129" timestamp="1588522707302" />
<state x="560" y="344" key="Vcs.Push.Dialog.v2/1752.1200.1920.1151/0.22.1920.1178/1920.120.1920.1080@0.22.1920.1178" timestamp="1589536752839" />
<state x="560" y="312" key="Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588232541898" /> <state x="560" y="312" key="Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588232541898" />
<state x="806" y="1395" key="Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587900239771" /> <state x="806" y="1395" key="Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151" timestamp="1587900239771" />
<state x="625" y="409" key="git4idea.merge.GitPullDialog" timestamp="1589534639344">
<screen x="0" y="22" width="1920" height="1178" />
</state>
<state x="625" y="409" key="git4idea.merge.GitPullDialog/1752.1200.1920.1151/0.22.1920.1178/1920.120.1920.1080@0.22.1920.1178" timestamp="1589534639344" />
<state x="578" y="257" key="search.everywhere.popup" timestamp="1588231057499"> <state x="578" y="257" key="search.everywhere.popup" timestamp="1588231057499">
<screen x="0" y="22" width="1920" height="1058" /> <screen x="0" y="22" width="1920" height="1058" />
</state> </state>
......
#!/bin/bash
set -e
set -x
git checkout weiyimin
git pull origin weiyimin
\ No newline at end of file
...@@ -2,6 +2,7 @@ demo=示例程序-demo ...@@ -2,6 +2,7 @@ demo=示例程序-demo
demo_bak=示例程序-demo_bak demo_bak=示例程序-demo_bak
demo_param=带参数的示例程序 demo_param=带参数的示例程序
demo_java=JAVA实例程序 demo_java=JAVA实例程序
meigou-detail-page=美购详情页 meigou-detail-page=美购详情页
meigou-detail-page-dispense-pv=美购详情页分发pv meigou-detail-page-dispense-pv=美购详情页分发pv
meigou-detail-page-dispense-uv=美购详情页分发uv meigou-detail-page-dispense-uv=美购详情页分发uv
......
package com.gmei.data.gateway.server.service; package com.gmei.data.gateway.server.service;
public interface EmailService { 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);
} }
...@@ -43,9 +43,13 @@ public class BiReportServiceImpl implements BiReportService { ...@@ -43,9 +43,13 @@ public class BiReportServiceImpl implements BiReportService {
public int sendEmail(String to,String cc,String name){ public int sendEmail(String to,String cc,String name){
int rs = Constants.SUCCESS; int rs = Constants.SUCCESS;
ExcelGenDto resultDto = sparksqlService.getResultDto(name); ExcelGenDto resultDto = sparksqlService.getResultDto(name);
int genExcelRs = excelService.genExcel(resultDto,name); if(null == resultDto){
if(Constants.SUCCESS == genExcelRs){ rs = Constants.FAIL;
rs = emailService.sendAttachmentsMail(to,cc,name); }else{
int genExcelRs = excelService.genExcel(resultDto,name);
if(Constants.SUCCESS == genExcelRs){
rs = emailService.sendAttachmentsMail(to,cc,name);
}
} }
return rs; return rs;
} }
......
...@@ -75,4 +75,41 @@ public class EmailServiceImpl implements EmailService { ...@@ -75,4 +75,41 @@ public class EmailServiceImpl implements EmailService {
} }
return rs; 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;
}
} }
...@@ -45,29 +45,29 @@ public class ExcelServiceImpl implements ExcelService { ...@@ -45,29 +45,29 @@ public class ExcelServiceImpl implements ExcelService {
@Override @Override
public int genExcel(ExcelGenDto excelGenDto, String name) { public int genExcel(ExcelGenDto excelGenDto, String name) {
int rs = Constants.SUCCESS; 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 { 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"); FileOutputStream out = new FileOutputStream(filePath + name + "-" + DateUtils.getYesterdayDateSimpleStr() + ".xlsx");
wb.write(out); wb.write(out);
out.close(); out.close();
......
...@@ -39,4 +39,5 @@ logging: ...@@ -39,4 +39,5 @@ logging:
proper: proper:
file: file:
path: /home/bi/bi-report/conf/en-cn.properties path: /home/bi/bi-report/conf/en-cn.properties
\ No newline at end of file #path: /Users/apple/git-repo/bi-report/conf/en-cn.properties
\ No newline at end of file
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<h1 style="text-align:center;">北极星监控预警信息</h1>
<h2 style="color:red;">北极星监控预警</h2>
<h3>北极星监控预警</h3>
<h4>北极星监控预警</h4>
<h5>北极星监控预警</h5>
<h6>北极星监控预警</h6>
\ No newline at end of file
...@@ -21,6 +21,12 @@ public class EmailServiceTest { ...@@ -21,6 +21,12 @@ public class EmailServiceTest {
@Test @Test
public void testSendAttachmentsMail() { 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);
} }
} }
#!/bin/bash
git chekcout master
git pull origin master
\ No newline at end of file
#!/bin/bash
set -e
set -x
git checkout weiyimin
git pull origin weiyimin
\ No newline at end of file
#!/bin/bash
git chekcout zhaojianwei
git pull origin zhaojianwei
\ No newline at end of file
#!/bin/bash
curl -X GET http://localhost:8553/api/report/sendEmail/zhaojianwei@igengmei.com/jianweizhao@yeah.net/demo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment