Commit e4d163f7 authored by mcb's avatar mcb

commit

parent aaf004b1
...@@ -786,6 +786,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -786,6 +786,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
} }
List<SynchTableColumnsReq> list = req.get("params"); List<SynchTableColumnsReq> list = req.get("params");
for (SynchTableColumnsReq str : list) { for (SynchTableColumnsReq str : list) {
if (null != str.getSourceDbId() && null != str.getTargetTableName()) {
//通过源数据库id ,查询数据源配置 //通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo dsInfos = offlineSynchDao.querySourceDbInfoBySourceId(str.getSourceDbId()); DmpAgentDatasourceInfo dsInfos = offlineSynchDao.querySourceDbInfoBySourceId(str.getSourceDbId());
DmpAgentDatasourceInfo dsInfo = new DmpAgentDatasourceInfo(); DmpAgentDatasourceInfo dsInfo = new DmpAgentDatasourceInfo();
...@@ -820,6 +821,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -820,6 +821,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
} }
} }
} }
}
if (StringUtils.isNotEmpty(list.get(0).getFieldName())) { if (StringUtils.isNotEmpty(list.get(0).getFieldName())) {
List<Map> searchFieldList = getFieldName(returnData, list.get(0).getFieldName()); List<Map> searchFieldList = getFieldName(returnData, list.get(0).getFieldName());
...@@ -1051,6 +1053,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -1051,6 +1053,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
int num = 0; int num = 0;
for (SynchTableColumnsReq str : list) { for (SynchTableColumnsReq str : list) {
num++; num++;
if (null != str.getSourceDbId() && null != str.getTargetTableName()) {
//通过源数据库id ,查询数据源配置 //通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo dsInfos = offlineSynchDao.querySourceDbInfoBySourceId(str.getSourceDbId()); DmpAgentDatasourceInfo dsInfos = offlineSynchDao.querySourceDbInfoBySourceId(str.getSourceDbId());
DmpAgentDatasourceInfo dsInfo = new DmpAgentDatasourceInfo(); DmpAgentDatasourceInfo dsInfo = new DmpAgentDatasourceInfo();
...@@ -1086,6 +1089,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -1086,6 +1089,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
} }
} }
} }
}
Map data = new HashMap(); Map data = new HashMap();
data.put("allTable", returnData); data.put("allTable", returnData);
data.put("firstTable", syncData); data.put("firstTable", syncData);
...@@ -1100,9 +1104,39 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -1100,9 +1104,39 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
*/ */
@Override @Override
public JsonResult querySyncTaskInfoById(String id) throws Exception { public JsonResult querySyncTaskInfoById(String id) throws Exception {
Map returnMap = new HashMap();
DmpDevelopTask dmpDevelopTask = dmpDevelopTaskDao.selectTaskById(id); DmpDevelopTask dmpDevelopTask = dmpDevelopTaskDao.selectTaskById(id);
if (StringUtils.isNotEmpty(dmpDevelopTask.getScript())) {
return JsonResult.ok(dmpDevelopTask); Map map = (Map) JSONObject.parse(dmpDevelopTask.getScript());
Map scripts = (Map) map.get("scripts");
Integer projectId = Integer.valueOf((String) map.get("projectId"));
Map reader = (Map) scripts.get("reader");
Map writer = (Map) scripts.get("writer");
String sourceDbType = String.valueOf(reader.get("sourceDbType"));
String sourceDbId = String.valueOf(reader.get("sourceDbId"));
String[] sourceDbName = String.valueOf(reader.get("dbConnection")).split(",");
String targetDbType = String.valueOf(writer.get("targetDbType"));
String targetDbId = String.valueOf(writer.get("targetDbId"));
String targetName = String.valueOf(writer.get("targetDbConnection"));
//数据源
JsonResult sourceDb = querygSourceDbList(projectId, sourceDbType);
returnMap.put("sourceDb", sourceDb.getData());
JsonResult targetDb = querygSourceDbList(projectId, targetDbType);
returnMap.put("targetDb", targetDb.getData());
//表
String[] sourceDbIds = sourceDbId.split(",");
for (int i = 0; i < sourceDbIds.length; i++) {
JsonResult sourceTable = querygSourceTableList(Long.valueOf(sourceDbIds[i]), "");
returnMap.put(sourceDbName[i], sourceTable.getData());
}
JsonResult targetTable = querygSourceTableList(Long.valueOf(targetDbId), "");
returnMap.put(targetName, targetTable.getData());
}
returnMap.put("task", dmpDevelopTask);
return JsonResult.ok(returnMap);
} }
} }
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