|
|
|
@ -10,6 +10,7 @@ import com.finebi.burger.api.service.FineTableService;
|
|
|
|
|
import com.finebi.common.api.cell.context.CellCreator; |
|
|
|
|
import com.finebi.common.authority.api.FineAuthorityUtils; |
|
|
|
|
import com.finebi.common.authority.decision.role.FineAuthorityUser; |
|
|
|
|
import com.finebi.common.impl.vo.relation.FineBusinessRelation; |
|
|
|
|
import com.finebi.common.impl.vo.table.FineDBBusinessTable; |
|
|
|
|
import com.finebi.foundation.api.reponse.FineRespond; |
|
|
|
|
import com.finebi.foundation.api.service.FineService; |
|
|
|
@ -137,33 +138,35 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
if (StringUtils.equals("success", dmlResult.getString("status")) && dmlResult.getBoolean("addLink")) { |
|
|
|
|
ExcelLinkService.getInstance().addLink(name, connection, schema, tableName, createUser); |
|
|
|
|
FineLoggerFactory.getLogger().info("HW_excel导入:FineDB 新增数据成功" + name); |
|
|
|
|
List<FineBusinessRelation> fineBusinessRelations = CellCreator.getCellProvider().relationPathCell().getRelationsByTableNameWithoutAuth(fineBusinessTable.getName()); |
|
|
|
|
CellCreator.getCellProvider().tableCell().removeTable(fineBusinessTable.getName(), FineAuthorityUser.ROOT_USER_ID); |
|
|
|
|
} |
|
|
|
|
} catch(Exception e){ |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
|
JSONObject table = JSONObject.create().put("tableName", fineBusinessTable.getName()).put("connectionName", connection); |
|
|
|
|
JSONArray tables = JSONArray.create().put(table); |
|
|
|
|
JSONObject tablesBean = JSONObject.create().put("tables", tables); |
|
|
|
|
try{ |
|
|
|
|
FineAuthorityUser authorityUser = FineAuthorityUtils.getAuth(req); |
|
|
|
|
String packid = "__my_analysis__" + authorityUser.getUserId(); |
|
|
|
|
try { |
|
|
|
|
String tableString = tablesBean.toString(); |
|
|
|
|
FineBusinessTable[] businessTables = createBusinessTablesFromDBNewAddTableInfo(mapper.readValue(tableString, DataBaseAddTableRequestBean.class), authorityUser.getUserId()); |
|
|
|
|
TableAddResponseBean responed = getTableService().addNewTable(packid, authorityUser, businessTables); |
|
|
|
|
addDbResult.put(FineRespond.success(responed)); |
|
|
|
|
} catch (JsonMappingException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} catch (JsonGenerationException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
|
JSONObject table = JSONObject.create().put("tableName", fineBusinessTable.getName()).put("connectionName", connection); |
|
|
|
|
JSONArray tables = JSONArray.create().put(table); |
|
|
|
|
JSONObject tablesBean = JSONObject.create().put("tables", tables); |
|
|
|
|
try{ |
|
|
|
|
FineAuthorityUser authorityUser = FineAuthorityUtils.getAuth(req); |
|
|
|
|
String packid = "__my_analysis__" + authorityUser.getUserId(); |
|
|
|
|
try { |
|
|
|
|
String tableString = tablesBean.toString(); |
|
|
|
|
FineBusinessTable[] businessTables = createBusinessTablesFromDBNewAddTableInfo(mapper.readValue(tableString, DataBaseAddTableRequestBean.class), authorityUser.getUserId()); |
|
|
|
|
TableAddResponseBean responed = getTableService().addNewTable(packid, authorityUser, businessTables); |
|
|
|
|
CellCreator.getCellProvider().relationPathCell().addRelations(fineBusinessRelations, authorityUser); |
|
|
|
|
addDbResult.put(FineRespond.success(responed)); |
|
|
|
|
} catch (JsonMappingException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} catch (JsonGenerationException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch(Exception e){ |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch(Exception e){ |
|
|
|
|
} catch(Exception e){ |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|