Commit c6fb901b authored by mcb's avatar mcb

commit

parent 697ed7a7
......@@ -286,7 +286,7 @@ public class RealTimeSyncController {
@GetMapping(value = "/editDataEcho")
@ApiImplicitParam(name = "taskId", value = "实时任务id", required = true)
public JsonResult<RealTimeEditDataEchoDto> getRealtimeTaskInfo(@RequestParam String taskId) throws Exception {
logger.info("###################请求参数{}taskId=" + taskId + "###################");
logger.info("########请求参数{}taskId=" + taskId + "#######");
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR, "实时任务id不能为空!");
}
......@@ -294,6 +294,25 @@ public class RealTimeSyncController {
return jsonResult;
}
/**
* 通过treeId 查询实时任务
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
@ApiOperation(value = "通过treeId 查询实时任务", notes = "通过treeId 查询实时任务")
@GetMapping(value = "/getRealtimeTaskInfoByTreeId")
@ApiImplicitParam(name = "treeId", value = "treeId", required = true)
public JsonResult getRealtimeTaskInfoByTreeId(@RequestParam String treeId) throws Exception {
logger.info("########请求参数{}treeId=" + treeId + "#######");
if (StringUtils.isEmpty(treeId)) {
return new JsonResult(ResultCode.PARAMS_ERROR, "treeId不能为空!");
}
JsonResult jsonResult = dmpRealtimeSyncInfoService.queryRealtimeTaskInfoByTreeId(treeId);
return jsonResult;
}
/**
* 批量上下线
*
......
......@@ -204,4 +204,13 @@ public interface DmpRealtimeSyncInfoDao {
* @since 2021-02-02
*/
Map<String, Object> queryTaskStatus(String projectId) throws Exception;
/**
* 通过treeId 查询实时任务
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
Map queryRealtimeTaskInfoByTreeId(String treeId) throws Exception;
}
\ No newline at end of file
......@@ -162,4 +162,13 @@ public interface DmpRealtimeSyncInfoService {
* @since 2021-01-05
*/
JsonResult executeRealtimeTask(String realTaskId, String type, String projectId) throws Exception;
/**
* 通过treeId 查询实时任务
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
JsonResult queryRealtimeTaskInfoByTreeId(String treeId) throws Exception;
}
\ No newline at end of file
......@@ -442,8 +442,6 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
DmpRealtimeSyncInfo realtimeTask = dmpRealtimeSyncInfoDao.queryById(Integer.valueOf(params.get("taskId").toString()));
if (realtimeTask == null)
throw new RuntimeException("操作数据不存在!");
if (StringUtils.isEmpty(realtimeTask.getConnectorJobId()))
throw new RuntimeException("操作数据不存在!");
//编辑时,先删除任务,再发布任务
HttpClientUtils.httpDelete(connectorUrl + "/" + realtimeTask.getConnectorJobId() + "/");
......@@ -856,11 +854,12 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
List<Map> list = dmpRealtimeSyncInfoDao.selectRealtimeTaskById(taskId);
if (list.size() > 0 && list != null) {
Map realtimeMap = list.get(0);
Map map = (Map) JSONObject.parse((String) realtimeMap.get("scriptJson"));
returnModel.setSrcDataSourceId(String.valueOf(realtimeMap.get("srcDatasourceId")));
returnModel.setTargetDataSourceId(String.valueOf(realtimeMap.get("targetDatasourceId")));
returnModel.setTreeId((String) realtimeMap.get("treeId"));
returnModel.setId(realtimeMap.get("id").toString());
Map map = (Map) JSONObject.parse((String) realtimeMap.get("scriptJson"));
if (map != null && map.size() > 0) {
returnModel.setRegularExpression((String) map.get("regularExpression"));
if (map.containsKey("srcDatasourceTypeId")) {
returnModel.setSrcDatasourceTypeId(String.valueOf(map.get("srcDatasourceTypeId")));
......@@ -873,6 +872,7 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
}
returnModel.setTables((List<Map>) map.get("tables"));
}
}
return new JsonResult(returnModel);
}
......@@ -963,6 +963,8 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
for (String table : tablesName) {
Map map = new HashMap();
map.put("tableName", table);
map.put("sourceTableName", table);
map.put("targetTableName", table);
if (tableList.contains(table)) {
map.put("conflict", "Y");
} else {
......@@ -1030,6 +1032,19 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
return JsonResult.ok();
}
/**
* 通过treeId 查询实时任务
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
@Override
public JsonResult queryRealtimeTaskInfoByTreeId(String treeId) throws Exception {
Map map = dmpRealtimeSyncInfoDao.queryRealtimeTaskInfoByTreeId(treeId);
return JsonResult.ok(map);
}
/*
* kafka rest api 获取任务状态
* */
......@@ -1077,7 +1092,7 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
List<Map> tasks = (List<Map>) map.get("tasks");
if (tasks.size() == 0) {
String s = getKafkaTaskStatus(statusUrl, params);
if(StringUtils.isNotEmpty(s)){
if (StringUtils.isNotEmpty(s)) {
return s;
}
}
......
......@@ -139,6 +139,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
*/
@Override
public JsonResult querygSourceTableList(Long sourceDbId, String targetName) throws Exception {
if (sourceDbId == null) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "数据源id不能为空");
}
//通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo dsInfo = offlineSynchDao.querySourceDbInfoBySourceId(sourceDbId);
if (dsInfo == null) {
......@@ -929,6 +932,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
dmpDevelopTask.setCreateUserId(SessionUtils.getCurrentUserId());
dmpDevelopTask.setDataStatus(DelFlagEnum.NO.getValue());
dmpDevelopTask.setName(tree.getName());
dmpDevelopTask.setTaskType("2");
dmpDevelopTaskDao.insert(dmpDevelopTask);
return JsonResult.ok(dmpDevelopTask);
} else if (TaskTreeTypeEnum.SSTB.getValue().equals(newSynchTaskReq.getType())) {
......
# 测试环境配置
server:
port: 7181
port: 7183
#contextPath: /resource
management:
......@@ -101,3 +101,8 @@ dmp:
logging:
level:
com.jz.dmp: debug
ftp:
url: 192.168.1.141
port: 21
username: ftpuser
password: 9zDatacn
\ No newline at end of file
......@@ -377,7 +377,7 @@
</select>
<!--根据数据源id获取数据信息-->
<select id="querygSourceDbInfoById" parameterType="map" resultType="com.jz.dmp.modules.model.RealTimeSyncDataSourceModel">
<select id="querygSourceDbInfoById" parameterType="map" flushCache="true" resultType="com.jz.dmp.modules.model.RealTimeSyncDataSourceModel">
select
ds.id as id,
ds.datasource_name as datasourceName,
......@@ -559,4 +559,17 @@
where 1=1 and t1.data_status='1' and t2.data_status='1'
and t1.project_id =#{projectId}
</select>
<select id="queryRealtimeTaskInfoByTreeId" resultType="java.util.Map">
select
t1.id,
t2.id as treeId,
t2.name,
t2.type as treeType
from
dmp_realtime_sync_info t1
inner join dmp_navigation_tree t2 on t1.tree_id=t2.id
where 1=1 and t1.data_status='1' and t2.data_status='1'
and t2.id =#{treeId}
</select>
</mapper>
\ No newline at end of file
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