Commit 24846237 authored by mcb's avatar mcb

commit

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