|
|
|
@ -11,7 +11,7 @@ import com.finebi.common.impl.vo.relation.FineBusinessRelation;
|
|
|
|
|
import com.finebi.common.impl.vo.table.FineDBBusinessTable; |
|
|
|
|
import com.finebi.direct.burger.api.service.FineTableService; |
|
|
|
|
import com.finebi.direct.burger.api.service.FineUserInfoService; |
|
|
|
|
import com.finebi.direct.common.api.cell.user.authority.UserAuthority; |
|
|
|
|
import com.finebi.common.api.cell.user.authority.UserAuthority; |
|
|
|
|
import com.finebi.foundation.api.reponse.FineRespond; |
|
|
|
|
import com.finebi.foundation.api.service.FineService; |
|
|
|
|
import com.finebi.foundation.api.service.context.BaseContext; |
|
|
|
@ -32,6 +32,7 @@ import com.fr.third.fasterxml.jackson.databind.JsonMappingException;
|
|
|
|
|
import com.fr.third.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
import com.fr.third.org.apache.poi.hssf.usermodel.HSSFSheet; |
|
|
|
|
import com.fr.third.org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
|
|
import com.fr.third.v2.org.apache.poi.xssf.streaming.SXSSFWorkbook; |
|
|
|
|
import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFSheet; |
|
|
|
|
import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
|
import com.finebi.direct.common.api.cell.context.CellCreator; |
|
|
|
@ -71,9 +72,8 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
JSONObject finalResult = JSONObject.create(); |
|
|
|
|
|
|
|
|
|
List<FineBusinessTable> allTables = CellCreator.getCellProvider().tableCell().getAllTableWithoutAuth(); |
|
|
|
|
allTables.forEach(fineBusinessTable -> { |
|
|
|
|
allTables.stream().filter(fineBusinessTable -> fineBusinessTable instanceof FineExcelBusinessTable).limit(15).forEach(fineBusinessTable -> { |
|
|
|
|
Map<String, List> values = new HashMap<String, List>(); |
|
|
|
|
if (fineBusinessTable instanceof FineExcelBusinessTable) { |
|
|
|
|
JSONArray items = JSONArray.create(); |
|
|
|
|
FineAttachment sheetInfo = ((FineExcelBusinessTable) fineBusinessTable).getBaseAttach(); |
|
|
|
|
String attachId = sheetInfo.getId(); |
|
|
|
@ -82,17 +82,21 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
|
|
|
|
|
List<FineBusinessField> fields = ((FineExcelBusinessTable) fineBusinessTable).getExcelFields(); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
if (fileName.endsWith(".xlsx")) { |
|
|
|
|
|
|
|
|
|
XSSFWorkbook excelWork = HWUtils.getExcelWork(attachId); |
|
|
|
|
if(excelWork != null){ |
|
|
|
|
XSSFSheet sheet = excelWork.getSheetAt(sheetNo); |
|
|
|
|
SXSSFWorkbook swb = new SXSSFWorkbook(excelWork,100); |
|
|
|
|
XSSFWorkbook xssfWorkbook = swb.getXSSFWorkbook(); |
|
|
|
|
XSSFSheet sheet = xssfWorkbook.getSheetAt(sheetNo); |
|
|
|
|
JSONObject tableCol = JSONObject.create(); |
|
|
|
|
for(int i = 0; i < fields.size(); i++){ |
|
|
|
|
FineBusinessField field = fields.get(i); |
|
|
|
|
tableCol.put(field.getName(), i); |
|
|
|
|
|
|
|
|
|
JSONObject item = new JSONObject(); |
|
|
|
|
item.put("colLength", "255"); |
|
|
|
|
item.put("colLength", "8000"); |
|
|
|
|
item.put("colName", field.getName()); |
|
|
|
|
item.put("colType", this.getFieldSqlType(field.getType())); |
|
|
|
|
item.put("excelCol", i); |
|
|
|
@ -112,7 +116,7 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
tableCol.put(field.getName(), i); |
|
|
|
|
|
|
|
|
|
JSONObject item = new JSONObject(); |
|
|
|
|
item.put("colLength", "255"); |
|
|
|
|
item.put("colLength", "8000"); |
|
|
|
|
item.put("colName", field.getName()); |
|
|
|
|
item.put("colType", this.getFieldSqlType(field.getType())); |
|
|
|
|
item.put("excelCol", i); |
|
|
|
@ -123,6 +127,9 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
values = HWUtils.get2003SheetContent(sheetAt,0, tableCol); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String schema = ""; |
|
|
|
|
String tableName = fineBusinessTable.getName(); |
|
|
|
@ -177,9 +184,6 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
} catch(Exception e){ |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
WebUtils.printAsJSON(res, finalResult.put("importDbResult", importDbResult).put("addDbResult", addDbResult)); |
|
|
|
|