Commit 24846237 authored by mcb's avatar mcb

commit

parent a0c41ac7
......@@ -137,8 +137,8 @@ public class DataSourceController {
result = dmpSyncingDatasourceService.testConnection(saveBody);
} catch (Exception e) {
Map map = new HashMap();
map.put("status","异常");
map.put("testConnectStatus","03");
map.put("status", "异常");
map.put("testConnectStatus", "03");
map.put("testTime", DateUtils.currentDatetime());
result.setData(map);
result.setCode(ResultCode.SUCCESS);
......@@ -155,7 +155,8 @@ public class DataSourceController {
*/
@ApiOperation(value = "编辑数据源--根据id查询数据回显", notes = "编辑数据源--根据id查询数据回显")
@GetMapping(value = "/selectDataSourceInfoById")
@ApiImplicitParams({@ApiImplicitParam(name = "datasourceId", value = "数据源id", required = true), @ApiImplicitParam(name = "projectId", value = "项目id")})
@ApiImplicitParams({@ApiImplicitParam(name = "datasourceId", value = "数据源id", required = true),
@ApiImplicitParam(name = "projectId", value = "项目id")})
public JsonResult<DataSourceListDto> getDataSourceInfoById(@RequestParam String datasourceId, @RequestParam(value = "projectId", required = false) String projectId) throws Exception {
if (StringUtils.isEmpty(datasourceId)) {
return new JsonResult(ResultCode.PARAMS_ERROR);
......@@ -177,7 +178,7 @@ public class DataSourceController {
@PostMapping(value = "/updateDatasourceInfo")
public JsonResult updateDatasourceInfo(@RequestBody @Validated DmpSyncingDatasourceReq saveBody, HttpServletRequest httpRequest) throws Exception {
if (StringUtils.isEmpty(saveBody.getId())) {
return new JsonResult(ResultCode.PARAMS_ERROR);
return new JsonResult(ResultCode.PARAMS_ERROR, "数据源ID不能为空");
}
JsonResult result = dmpSyncingDatasourceService.updateDatasourceById(saveBody);
return result;
......@@ -194,7 +195,7 @@ public class DataSourceController {
@GetMapping(value = "/getDatasourceTypeAttr")
public JsonResult getDatasourceTypeAttr(@RequestParam String datasourceTypeId, HttpServletRequest httpRequest) throws Exception {
if (StringUtils.isEmpty(datasourceTypeId)) {
return new JsonResult(ResultCode.PARAMS_ERROR);
return new JsonResult(ResultCode.PARAMS_ERROR, "数据源类型id不能为空");
}
JsonResult result = dmpSyncingDatasourceService.selectDatasourceTypeAttrById(datasourceTypeId);
return result;
......
......@@ -478,11 +478,11 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public JsonResult addSyncTask(SyncDmpTaskAddReq syncDmpTaskAddReq) throws Exception {
JsonResult jsonResult = new JsonResult();
Map<String, Object> reqParam = syncDmpTaskAddReq.getParams();
if (reqParam.size() > 0 && reqParam != null) {
jsonResult = addSyncing(reqParam);
if (reqParam.size() == 0 || reqParam == null) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "请求参数不能为空");
}
JsonResult jsonResult = addSyncing(reqParam);
return jsonResult;
}
......@@ -579,7 +579,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
* @return
*/
public JsonResult addSyncing(Map<String, Object> body) throws Exception {
if (StringUtils.isEmpty(body.get("treeId").toString())) {
if (StringUtils.isEmpty(String.valueOf(body.get("treeId")))) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "treeId不能为空!");
}
if (StringUtils.isEmpty(body.get("projectId").toString())) {
......@@ -592,8 +592,6 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
Integer projectId = Integer.valueOf(body.get("projectId").toString());
String taskId = body.get("taskId").toString(); //任务ID
Integer treeId = Integer.valueOf(body.get("treeId").toString()); //树节点ID
String taskName = body.get("taskName").toString(); //任务名称 业务节点名称 一对一
//Integer parentId = Integer.valueOf(body.get("parentId").toString()); //父节点ID
Map<String, Object> scriptMap = (Map<String, Object>) body.get("scripts"); //任务json数据
Object content = scriptMap.get("content");
......@@ -604,23 +602,24 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
//保存目标库类型
Map<String, Object> writer = (Map<String, Object>) scriptMap.get("writer"); // 目标数据
String targetDb = (String) writer.get("targetDbConnection"); // 目标库名称
String targetDb = String.valueOf(writer.get("targetDbConnection")); // 目标库名称
String targetDbId = String.valueOf(writer.get("targetDbId")); // 目标库id
String targetTable = (String) writer.get("targetTable"); // 目标库表名称
Map<String, Object> reader = (Map<String, Object>) scriptMap.get("reader");//源数据
if (StringUtils.isEmpty(targetDbId)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "targetDbId不能为空!");
}
//源数据
Map<String, Object> reader = (Map<String, Object>) scriptMap.get("reader");
String sourceDbName = (String) reader.get("dbConnection"); // 源库名称
String sourceDbId = (String) reader.get("sourceDbId"); // 来源库id
String sourceTableName = (String) reader.get("registerTableName"); // 源库表名称
Integer dataSourceId = null; //数据源ID
if (StringUtils.isNotBlank(targetDb)) {
//根据 目标库和项目id 查询
dataSourceId = dmpDevelopTaskDao.getDbInfoByParam(targetDb, projectId);
if (StringUtils.isEmpty(sourceDbId)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "sourceDbId不能为空!");
}
DmpDevelopTask task = new DmpDevelopTask();
task.setProjectId(projectId);
task.setTaskType("2"); //任务类型
task.setDatasourceId(dataSourceId); //数据源ID
task.setType("3");
task.setTaskDesc("Syncing Task"); //任务描述
task.setIsSubmit("0"); //是否已提交
......@@ -1017,7 +1016,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
map.put("isPk", 0); //主键
map.put("isPt", 0); //分区
returnData.add(map);
if(id == str.getSourceDbId()){
if (id == str.getSourceDbId()) {
syncData.add(map);
}
}
......@@ -1025,8 +1024,8 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
}
}
Map data = new HashMap();
data.put("allTable",returnData);
data.put("firstTable",returnData);
data.put("allTable", returnData);
data.put("firstTable", syncData);
return JsonResult.ok(data);
}
......
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