|
|
|
@ -1,15 +1,16 @@
|
|
|
|
|
package com.fr.plugin.decision.request.handler; |
|
|
|
|
|
|
|
|
|
import com.finebi.activate.foundation.StableManager; |
|
|
|
|
import com.finebi.activate.foudation.StableManager; |
|
|
|
|
import com.finebi.burger.api.bean.configuration.table.attachment.FineAttachment; |
|
|
|
|
import com.finebi.burger.api.bean.configuration.table.field.FineBusinessField; |
|
|
|
|
import com.finebi.burger.api.request.configuration.table.DataBaseAddTableItemRequestBean; |
|
|
|
|
import com.finebi.burger.api.request.configuration.table.DataBaseAddTableRequestBean; |
|
|
|
|
import com.finebi.burger.api.response.configuration.table.TableAddResponseBean; |
|
|
|
|
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.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.foundation.api.reponse.FineRespond; |
|
|
|
|
import com.finebi.foundation.api.service.FineService; |
|
|
|
|
import com.finebi.foundation.api.service.context.BaseContext; |
|
|
|
@ -32,7 +33,6 @@ 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.usermodel.XSSFSheet; |
|
|
|
|
import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
|
import com.finebi.direct.common.api.cell.context.CellCreator; |
|
|
|
|
import com.finebi.common.impl.vo.table.FineBusinessTable; |
|
|
|
|
import com.finebi.common.impl.vo.table.FineExcelBusinessTable; |
|
|
|
|
import com.fr.web.utils.WebUtils; |
|
|
|
@ -139,7 +139,7 @@ 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); |
|
|
|
|
CellCreator.getCellProvider().tableCell().removeTable(fineBusinessTable.getName(), CellCreator.getCellProvider().userCellProvider().authorityCell().getSuperAuthority()); |
|
|
|
|
CellCreator.getCellProvider().tableCell().removeTable(fineBusinessTable.getName(), FineAuthorityUser.ROOT_USER_ID); |
|
|
|
|
} |
|
|
|
|
} catch(Exception e){ |
|
|
|
|
e.printStackTrace(); |
|
|
|
@ -150,11 +150,11 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
JSONArray tables = JSONArray.create().put(table); |
|
|
|
|
JSONObject tablesBean = JSONObject.create().put("tables", tables); |
|
|
|
|
try{ |
|
|
|
|
UserAuthority authorityUser = getFineUserInfoService().getUserAuthority(req); |
|
|
|
|
String packid = "__my_analysis__" + authorityUser.getUser().getInfo().getUserId() + "1"; |
|
|
|
|
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.getUser().getInfo().getUserId()); |
|
|
|
|
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) { |
|
|
|
@ -181,15 +181,12 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected static FineTableService getTableService() { |
|
|
|
|
return getBean(FineTableService.class); |
|
|
|
|
return (FineTableService)getBean(FineTableService.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static <T extends FineService> T getBean(Class<T> annotatedClass) { |
|
|
|
|
return getContext().getServiceBean(annotatedClass); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* service获取集合 |
|
|
|
|
*/ |
|
|
|
|
private static BaseContext getContext() { |
|
|
|
|
return StableManager.getContext(); |
|
|
|
|
} |
|
|
|
@ -233,12 +230,6 @@ public class UpgradeHandler extends HWAbstractHandler {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String getTableNameWithConnection(DataBaseAddTableItemRequestBean itemBean) { |
|
|
|
|
// return com.finebi.utils.StringUtils.join("_", itemBean.getConnectionName(), itemBean.getDbTableName());
|
|
|
|
|
return itemBean.getDbTableName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected static FineUserInfoService getFineUserInfoService() { |
|
|
|
|
return getBean(FineUserInfoService.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|