Commit d6930096 authored by 赵建伟's avatar 赵建伟

update codes

parent 11067eaa
......@@ -215,7 +215,7 @@
<workItem from="1584945647680" duration="4469000" />
<workItem from="1588148891822" duration="2318000" />
<workItem from="1588152718016" duration="1463000" />
<workItem from="1588154601852" duration="25454000" />
<workItem from="1588154601852" duration="26091000" />
</task>
<servers />
</component>
......
#!/usr/bin/env bash
curl -X POST -H "Content-Type:application/json" --data '{"name":"demo","subject":"abc"}' http://localhost:8553/api/report/sendEmail
curl -X GET http://localhost:8553/api/report/sendEmail?name=demo&subject=123
\ No newline at end of file
curl -X GET http://localhost:8553/api/report/sendEmail/demo/test
\ No newline at end of file
......@@ -18,8 +18,9 @@ public class BiReportEndpoint {
}
@ResponseBody
@RequestMapping(value = "/sendEmail/{name}/{subject}",method = RequestMethod.GET)
public int sendEmail(@PathVariable("name") String name,@PathVariable("subject") String subject){
return biReportService.sendEmail(name,subject);
@RequestMapping(value = "/sendEmail/{to}/{cc}/{name}/{subject}",method = RequestMethod.GET)
public int sendEmail(@PathVariable("to") String to,@PathVariable("cc") String cc,@PathVariable("name") String name,
@PathVariable("subject") String subject){
return biReportService.sendEmail(to,cc,name,subject);
}
}
......@@ -2,5 +2,5 @@ package com.gmei.data.gateway.server.service;
public interface BiReportService {
int genExcel(String name);
int sendEmail(String name,String subject);
int sendEmail(String to,String cc,String name,String subject);
}
......@@ -36,12 +36,12 @@ public class BiReportServiceImpl implements BiReportService {
}
@Override
public int sendEmail(String name,String subject){
public int sendEmail(String to,String cc,String name,String subject){
int rs = Constants.SUCCESS;
ExcelGenDto resultDto = sparksqlService.getResultDto(name);
int genExcelRs = excelService.genExcel(resultDto, subject);
if(Constants.SUCCESS == genExcelRs){
rs = emailService.sendAttachmentsMail("zhaojianwei@igengmei.com","jianweizhao@yeah.net","测试示例");
rs = emailService.sendAttachmentsMail(to,cc,subject);
}
return rs;
}
......
......@@ -3,6 +3,7 @@ package com.gmei.data.gateway.server.service.impl;
import com.gmei.data.gateway.server.common.Constants;
import com.gmei.data.gateway.server.dto.ExcelGenDto;
import com.gmei.data.gateway.server.service.ExcelService;
import com.gmei.data.gateway.server.utils.DateUtils;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
......@@ -57,7 +58,7 @@ public class ExcelServiceImpl implements ExcelService {
logger.error("Error!");
}
try {
FileOutputStream out = new FileOutputStream(filePath+ subject + ".xlsx");
FileOutputStream out = new FileOutputStream(filePath + subject + "-" + DateUtils.getCurrentDateSimpleStr() + ".xlsx");
wb.write(out);
out.close();
} catch (IOException e) {
......
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