Commit 99bbecc8 authored by 赵建伟's avatar 赵建伟

update codes

parent 3eea8c3e
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<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 afterPath="$PROJECT_DIR$/sbin/stop_service.sh" afterDir="false" />
<change beforePath="$PROJECT_DIR$/sbin/start_service.sh" beforeDir="false" afterPath="$PROJECT_DIR$/sbin/start_service.sh" 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" />
...@@ -118,7 +121,7 @@ ...@@ -118,7 +121,7 @@
<workItem from="1587982524517" duration="5052000" /> <workItem from="1587982524517" duration="5052000" />
<workItem from="1588152481879" duration="139000" /> <workItem from="1588152481879" duration="139000" />
<workItem from="1588154352798" duration="195000" /> <workItem from="1588154352798" duration="195000" />
<workItem from="1588220085338" duration="3660000" /> <workItem from="1588220085338" duration="4099000" />
</task> </task>
<task id="LOCAL-00001" summary="add init codes."> <task id="LOCAL-00001" summary="add init codes.">
<created>1587723565207</created> <created>1587723565207</created>
...@@ -318,11 +321,11 @@ ...@@ -318,11 +321,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="186" key="CommitChangelistDialog2" timestamp="1588231605201"> <state x="554" y="186" key="CommitChangelistDialog2" timestamp="1588232534973">
<screen x="0" y="22" width="1920" height="1058" /> <screen x="0" y="22" width="1920" height="1058" />
</state> </state>
<state x="554" y="197" key="CommitChangelistDialog2/0.22.1920.1129@0.22.1920.1129" timestamp="1587891829124" /> <state x="554" y="197" key="CommitChangelistDialog2/0.22.1920.1129@0.22.1920.1129" timestamp="1587891829124" />
<state x="554" y="186" key="CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588231605201" /> <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="1038" y="1373" key="RollbackChangesDialog" timestamp="1587898773703"> <state x="1038" y="1373" key="RollbackChangesDialog" timestamp="1587898773703">
<screen x="246" y="1080" width="1920" height="1151" /> <screen x="246" y="1080" width="1920" height="1151" />
...@@ -332,11 +335,11 @@ ...@@ -332,11 +335,11 @@
<screen x="246" y="1080" width="1920" height="1151" /> <screen x="246" y="1080" width="1920" height="1151" />
</state> </state>
<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="312" key="Vcs.Push.Dialog.v2" timestamp="1588231607137"> <state x="560" y="312" key="Vcs.Push.Dialog.v2" timestamp="1588232541898">
<screen x="0" y="22" width="1920" height="1058" /> <screen x="0" y="22" width="1920" height="1058" />
</state> </state>
<state x="560" y="331" key="Vcs.Push.Dialog.v2/0.22.1920.1129@0.22.1920.1129" timestamp="1587891830625" /> <state x="560" y="331" key="Vcs.Push.Dialog.v2/0.22.1920.1129@0.22.1920.1129" timestamp="1587891830625" />
<state x="560" y="312" key="Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058" timestamp="1588231607137" /> <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="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" />
......
...@@ -6,9 +6,14 @@ ...@@ -6,9 +6,14 @@
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="service-server" />
<module name="service-client" /> <module name="service-client" />
</profile> </profile>
<profile name="Annotation profile for bi-report-service" enabled="true">
<sourceOutputDir name="../../../../../target/generated-sources/annotations" />
<sourceTestOutputDir name="../../../../../target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="service-server" />
</profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
<module name="bi-report-service" target="1.5" /> <module name="bi-report-service" target="1.5" />
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <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 afterPath="$PROJECT_DIR$/../../../sbin/stop_service.sh" 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" />
...@@ -214,7 +216,7 @@ ...@@ -214,7 +216,7 @@
<workItem from="1584945647680" duration="4469000" /> <workItem from="1584945647680" duration="4469000" />
<workItem from="1588148891822" duration="2318000" /> <workItem from="1588148891822" duration="2318000" />
<workItem from="1588152718016" duration="1463000" /> <workItem from="1588152718016" duration="1463000" />
<workItem from="1588154601852" duration="15633000" /> <workItem from="1588154601852" duration="16184000" />
</task> </task>
<servers /> <servers />
</component> </component>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>service-server</artifactId> <artifactId>bi-report-service</artifactId>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
<output url="file://$MODULE_DIR$/target/classes" /> <output url="file://$MODULE_DIR$/../../../../../target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/../../../../../target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
......
package com.gmei.data.gateway.server.endpoint; 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.ExcelService;
import com.gmei.data.gateway.server.service.EmailService; import com.gmei.data.gateway.server.service.EmailService;
import com.gmei.data.gateway.server.service.SparksqlService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -16,10 +18,13 @@ public class BiReportEndpoint { ...@@ -16,10 +18,13 @@ public class BiReportEndpoint {
public EmailService emailService; public EmailService emailService;
@Autowired @Autowired
public ExcelService excelService; public ExcelService excelService;
@Autowired
public SparksqlService sparksqlService;
@ResponseBody @ResponseBody
@RequestMapping(value = "/genExcel") @RequestMapping(value = "/genExcel")
public int genExcel(@RequestParam String hql){ public int genExcel(@RequestParam String hql){
ExcelGenDto resultDto = sparksqlService.getResultDto(hql);
return 0; return 0;
} }
......
...@@ -3,5 +3,5 @@ package com.gmei.data.gateway.server.service; ...@@ -3,5 +3,5 @@ package com.gmei.data.gateway.server.service;
import com.gmei.data.gateway.server.dto.ExcelGenDto; import com.gmei.data.gateway.server.dto.ExcelGenDto;
public interface SparksqlService { public interface SparksqlService {
ExcelGenDto getResultDto(String sqlPath); ExcelGenDto getResultDto(String name);
} }
...@@ -24,17 +24,19 @@ import java.util.List; ...@@ -24,17 +24,19 @@ import java.util.List;
@Service @Service
public class SparksqlServiceImpl implements SparksqlService { public class SparksqlServiceImpl implements SparksqlService {
@Value("${sql.input.path}")
private String sqlPath;
@Value("${datasource.sparksql.jdbcUrl}") @Value("${datasource.sparksql.jdbcUrl}")
private String sparksqlJdbcUrl; private String sparksqlJdbcUrl;
private static final Logger logger = LoggerFactory.getLogger(SparksqlServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(SparksqlServiceImpl.class);
@Override @Override
public ExcelGenDto getResultDto(String sqlPath){ public ExcelGenDto getResultDto(String name){
List<String> sheetNameList = new ArrayList<String>(); List<String> sheetNameList = new ArrayList<String>();
List<List<String>> headersList = new ArrayList<List<String>>(); List<List<String>> headersList = new ArrayList<List<String>>();
List<List<List>> rowsList = new ArrayList<List<List>>(); List<List<List>> rowsList = new ArrayList<List<List>>();
File sqlDir = new File(sqlPath); File sqlDir = new File(sqlPath + name);
File[] files = sqlDir.listFiles(); File[] files = sqlDir.listFiles();
for(File file : files){ for(File file : files){
String fileName = file.getName(); String fileName = file.getName();
...@@ -75,8 +77,8 @@ public class SparksqlServiceImpl implements SparksqlService { ...@@ -75,8 +77,8 @@ public class SparksqlServiceImpl implements SparksqlService {
ResultSetMetaData metaData = rs.getMetaData(); ResultSetMetaData metaData = rs.getMetaData();
int columnCount = metaData.getColumnCount(); int columnCount = metaData.getColumnCount();
for(int i=1;i<= columnCount;i++){ for(int i=1;i<= columnCount;i++){
String name = metaData.getCatalogName(i); String catalogName = metaData.getCatalogName(i);
headers.add(name); headers.add(catalogName);
} }
while(rs.next()){ while(rs.next()){
List<String> rowVals = new ArrayList<String>(); List<String> rowVals = new ArrayList<String>();
......
server: server:
port: 8970 port: 8553
spring: spring:
#---email config--- #---email config---
...@@ -21,6 +21,10 @@ mail: ...@@ -21,6 +21,10 @@ mail:
toMail: toMail:
bcc: zhaojianwei@igengmei.com bcc: zhaojianwei@igengmei.com
#---sql path---
sql:
input:
path: /home/bi/bi-report/sqls/
#---excel config--- #---excel config---
excel: excel:
......
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