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

update codes

parent a44ddc3a
......@@ -126,7 +126,7 @@
<workItem from="1588344251422" duration="21636000" />
<workItem from="1588761853482" duration="3826000" />
<workItem from="1588905392183" duration="4522000" />
<workItem from="1589447155495" duration="14053000" />
<workItem from="1589447155495" duration="19738000" />
</task>
<task id="LOCAL-00001" summary="add init codes.">
<created>1587723565207</created>
......@@ -411,9 +411,10 @@
<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">
<screen x="0" y="22" width="1920" height="1058" />
<state x="578" y="284" key="search.everywhere.popup" timestamp="1590043229933">
<screen x="0" y="22" width="1920" height="1178" />
</state>
<state x="578" y="284" key="search.everywhere.popup/1752.1200.1920.1151/0.22.1920.1178/1920.120.1920.1080@0.22.1920.1178" timestamp="1590043229933" />
<state x="578" y="257" key="search.everywhere.popup/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588231057499" />
</component>
</project>
\ No newline at end of file
......@@ -5,9 +5,11 @@ 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 com.gmei.data.gateway.server.utils.ProperUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
......@@ -156,5 +159,102 @@ public class ExcelServiceImpl implements ExcelService {
logger.error("the value is null!");
}
}
/**
* 画excel格局的demo代码
* @param args
*/
public static void main(String[] args) {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFCellStyle style = workbook.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
HSSFSheet sheet = workbook.createSheet("sheet");
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell_00 = row0.createCell(0);
cell_00.setCellStyle(style);
cell_00.setCellValue("分类");
HSSFCell cell_01 = row0.createCell(1);
cell_01.setCellStyle(style);
cell_01.setCellValue("指标");
HSSFCell cell_02 = row0.createCell(2);
cell_02.setCellStyle(style);
cell_02.setCellValue("昨日值");
HSSFCell cell_03 = row0.createCell(3);
cell_03.setCellStyle(style);
cell_03.setCellValue("前日值");
HSSFCell cell_04 = row0.createCell(4);
cell_04.setCellStyle(style);
cell_04.setCellValue("前日环比");
HSSFCell cell_05 = row0.createCell(5);
cell_05.setCellStyle(style);
cell_05.setCellValue("上周同比");
HSSFCell cell_06 = row0.createCell(6);
cell_06.setCellStyle(style);
cell_06.setCellValue("上月日均值环比");
HSSFCell cell_07 = row0.createCell(7);
cell_07.setCellStyle(style);
cell_07.setCellValue("历史同期上月日均值同比");
HSSFCell cell_08 = row0.createCell(8);
cell_08.setCellStyle(style);
cell_08.setCellValue("预警");
HSSFRow row1 = sheet.createRow(1);
HSSFCell cell_10 = row1.createCell(0);
cell_10.setCellStyle(style);
cell_10.setCellValue("活跃情况");
HSSFCell cell_11 = row1.createCell(1);
cell_11.setCellStyle(style);
cell_11.setCellValue("DAU");
HSSFRow row2 = sheet.createRow(2);
HSSFCell cell_21 = row2.createCell(1);
cell_21.setCellStyle(style);
cell_21.setCellValue("新增");
HSSFRow row3 = sheet.createRow(3);
HSSFCell cell_31 = row3.createCell(1);
cell_31.setCellStyle(style);
cell_31.setCellValue("老活");
HSSFRow row4 = sheet.createRow(4);
HSSFCell cell_41 = row4.createCell(1);
cell_41.setCellStyle(style);
cell_41.setCellValue("新增次日app留存率(前日)");
HSSFRow row5 = sheet.createRow(5);
HSSFCell cell_51 = row5.createCell(1);
cell_51.setCellStyle(style);
cell_51.setCellValue("老活次日app留存率(前日)");
HSSFRow row6 = sheet.createRow(6);
HSSFCell cell_61 = row6.createCell(1);
cell_61.setCellStyle(style);
cell_61.setCellValue("新增单设备app时长");
HSSFRow row7 = sheet.createRow(7);
HSSFCell cell_71 = row7.createCell(1);
cell_71.setCellStyle(style);
cell_71.setCellValue("新增单设备app打开");
// 合并日期占两行(4个参数,分别为起始行,结束行,起始列,结束列)
// 行和列都是从0开始计数,且起始结束都会合并
// 这里是合并excel中日期的两行为一行
CellRangeAddress region = new CellRangeAddress(1, 7, 0, 0);
sheet.addMergedRegion(region);
try{
File file = new File("/Users/apple/Downloads/北极星指标_dev.xls");
FileOutputStream fout = new FileOutputStream(file);
workbook.write(fout);
fout.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
server:
port: 8553
spring:
#---email config---
mail:
host: smtp.exmail.qq.com
username: youjiantongji@wanmeizhensuo.com
password: mq37tgk8nGi6eg1Hgq388oro3itvdmPl
default-encoding: UTF-8
datasource:
sparkSql:
jdbcUrl: jdbc:hive2://bj-gm-prod-cos-datacenter003:10010
hiveSql:
jdbcUrl: jdbc:hive2://bj-gm-prod-cos-datacenter006:10000
#---email send config---
mail:
fromMail:
addr: youjiantongji@wanmeizhensuo.com
content: BI报表见附件,请查收。
toMail:
bcc: zhaojianwei@igengmei.com
#---sql path---
sql:
input:
path: /home/bi/bi-report/sqls/
#---excel config---
excel:
output:
path: /data/bi-report/result/
#---log config---
logging:
config: classpath:logback.xml
proper:
file:
path: /home/bi/bi-report/conf/en-cn.properties
#path: /Users/apple/git-repo/bi-report/conf/en-cn.properties
\ No newline at end of file
__ .__
_______ ____ ______ ____________/ |_ ______ ______________ _|__| ____ ____
\_ __ \_/ __ \\____ \ / _ \_ __ \ __\ ______ / ___// __ \_ __ \ \/ / |/ ___\/ __ \
| | \/\ ___/| |_> > <_> ) | \/| | /_____/ \___ \\ ___/| | \/\ /| \ \__\ ___/
|__| \___ > __/ \____/|__| |__| /____ >\___ >__| \_/ |__|\___ >___ >
\/|__| \/ \/ \/ \/
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="true" scanPeriod="1 seconds">
<contextName>logback</contextName>
<property name="log.path" value="/data/bi-report/logs/bi-report-service.log"/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>
\ No newline at end of file
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