|
@@ -13,9 +13,11 @@ import com.zkqy.common.utils.file.FileUploadUtils;
|
|
|
import com.zkqy.common.utils.file.FileUtils;
|
|
|
import com.zkqy.framework.config.ServerConfig;
|
|
|
import com.zkqy.system.entity.CommonEntity;
|
|
|
+import com.zkqy.system.entity.DragTable;
|
|
|
import com.zkqy.system.entity.TableSql;
|
|
|
import com.zkqy.system.service.ICommonService;
|
|
|
import com.zkqy.system.service.IDataSourceService;
|
|
|
+import com.zkqy.system.service.IDragTableService;
|
|
|
import com.zkqy.system.service.ITableSqlService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.slf4j.Logger;
|
|
@@ -58,6 +60,9 @@ public class CommonFileController {
|
|
|
@Resource
|
|
|
private ITableSqlService iTableSqlService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IDragTableService iDragTableService;
|
|
|
+
|
|
|
private static final String FILE_DELIMETER = ",";
|
|
|
|
|
|
/**
|
|
@@ -200,14 +205,19 @@ public class CommonFileController {
|
|
|
return AjaxResult.warn("请检查表格中的数据!");
|
|
|
}
|
|
|
// 得到当前导出入数据的格式k/v
|
|
|
- TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(sqlKey);
|
|
|
+ DragTable dragTable = iDragTableService.selectSqlKeyByTableKey(sqlKey);
|
|
|
+ if (dragTable.getSqlKey().isEmpty()) {
|
|
|
+ return AjaxResult.error("网络出现问题,请等待网络恢复!");
|
|
|
+ }
|
|
|
+ TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(dragTable.getSqlKey());
|
|
|
// 存储 字段描述:字段列名
|
|
|
Map<String, Object> fieldMap = (Map<String, Object>) JSON.parse(tableSql.getTableExportField());
|
|
|
Map<String, Object> endFieldMap = new HashMap<>();
|
|
|
// 处理导入title对应问题,双重校验
|
|
|
fieldMap.forEach((mKey, mVal) -> {
|
|
|
if (!mKey.contains("@")) {
|
|
|
- endFieldMap.put(mVal.toString(), mKey);
|
|
|
+ // 表示列名 删除掉表名称
|
|
|
+ endFieldMap.put(mVal.toString(), mKey.replace(tableName + "_", ""));
|
|
|
} else {
|
|
|
// 定义新的title map集合
|
|
|
Map<String, String> map = listMap.get(0);
|