Commit dcdc961e authored by mcb's avatar mcb

commit

parent 01893647
...@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description:离线同步 * @Description:离线同步
...@@ -66,11 +67,11 @@ public class OfflineSynchController { ...@@ -66,11 +67,11 @@ public class OfflineSynchController {
@ApiOperation(value = "获取源数据库名称-下拉框", notes = "获取源数据库名称") @ApiOperation(value = "获取源数据库名称-下拉框", notes = "获取源数据库名称")
@GetMapping(value = "/sourceDbList") @GetMapping(value = "/sourceDbList")
@ApiImplicitParams({@ApiImplicitParam(name = "projectId", value = "项目id", required = true) @ApiImplicitParams({@ApiImplicitParam(name = "projectId", value = "项目id", required = true)
,@ApiImplicitParam(name = "datasourceTypeId", value = "数据源类型id") , @ApiImplicitParam(name = "datasourceTypeId", value = "数据源类型id")
,@ApiImplicitParam(name = "type", value = "01:来源,02目标") , @ApiImplicitParam(name = "type", value = "01:来源,02目标")
}) })
public JsonResult<List<SourceDbNameListDto>> getSourceDbList(@RequestParam Integer projectId,@RequestParam(required = false) String type, @RequestParam String datasourceTypeId) throws Exception { public JsonResult<List<SourceDbNameListDto>> getSourceDbList(@RequestParam Integer projectId, @RequestParam(required = false) String type, @RequestParam String datasourceTypeId) throws Exception {
JsonResult<List<SourceDbNameListDto>> jsonResult = offlineSynchService.querygSourceDbList(projectId,datasourceTypeId); JsonResult<List<SourceDbNameListDto>> jsonResult = offlineSynchService.querygSourceDbList(projectId, datasourceTypeId);
return jsonResult; return jsonResult;
} }
...@@ -78,8 +79,8 @@ public class OfflineSynchController { ...@@ -78,8 +79,8 @@ public class OfflineSynchController {
* 获取数据源——下拉框 * 获取数据源——下拉框
* *
* @return * @return
* @since 2021-01-21
* @author Bellamy * @author Bellamy
* @since 2021-01-21
*/ */
@ApiOperation(value = "获取数据源—下拉框", notes = "获取数据源—下拉框") @ApiOperation(value = "获取数据源—下拉框", notes = "获取数据源—下拉框")
@GetMapping(value = "/datasourceList") @GetMapping(value = "/datasourceList")
...@@ -202,7 +203,7 @@ public class OfflineSynchController { ...@@ -202,7 +203,7 @@ public class OfflineSynchController {
*/ */
@ApiOperation(value = "获取数据源表字段", notes = "获取数据源表字段") @ApiOperation(value = "获取数据源表字段", notes = "获取数据源表字段")
@PostMapping(value = "/getSoureAndTargetColumns") @PostMapping(value = "/getSoureAndTargetColumns")
public JsonResult getSoureAndTargetColumns(@RequestBody @Validated List<SynchTableColumnsReq> req) throws Exception { public JsonResult getSoureAndTargetColumns(@RequestBody @Validated Map<String, List<SynchTableColumnsReq>> req) throws Exception {
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
try { try {
jsonResult = offlineSynchService.querySoureTableColumns(req); jsonResult = offlineSynchService.querySoureTableColumns(req);
......
...@@ -32,7 +32,7 @@ public interface OfflineSynchService { ...@@ -32,7 +32,7 @@ public interface OfflineSynchService {
* @return * @return
* @author Bellamy * @author Bellamy
*/ */
JsonResult querygSourceDbList(Integer projectId,String databaseTypeName) throws Exception; JsonResult querygSourceDbList(Integer projectId, String databaseTypeName) throws Exception;
/** /**
* 根据源数据库id,获取源数据表——下拉框 * 根据源数据库id,获取源数据表——下拉框
...@@ -101,7 +101,7 @@ public interface OfflineSynchService { ...@@ -101,7 +101,7 @@ public interface OfflineSynchService {
* @author Bellamy * @author Bellamy
* @since 2021-01-21 * @since 2021-01-21
*/ */
JsonResult querySoureTableColumns(List<SynchTableColumnsReq> req) throws Exception; JsonResult querySoureTableColumns(Map<String, List<SynchTableColumnsReq>> req) throws Exception;
/** /**
* 任务停止运行 * 任务停止运行
......
...@@ -28,6 +28,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -28,6 +28,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -639,11 +640,12 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -639,11 +640,12 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
task.setTargetTableName(targetTable); task.setTargetTableName(targetTable);
task.setSourceTableName(sourceTableName); task.setSourceTableName(sourceTableName);
task.setSourceDbName(sourceDbName); task.setSourceDbName(sourceDbName);
task.setCreateUserId(SessionUtils.getCurrentUserId());
task.setCreateTime(new Date());
dmpDevelopTaskDao.insert(task); //保存任务数据 dmpDevelopTaskDao.insert(task); //保存任务数据
logger.info("################################## 新增任务数据结束 ############################################"); logger.info("################################## 新增任务数据结束 ############################################");
//保存时提交XML //保存时提交XML
dmpDevelopTaskService.submitSyncing(task); dmpDevelopTaskService.submitSyncing(task);
return new JsonResult(ResultCode.SUCCESS, task); return new JsonResult(ResultCode.SUCCESS, task);
} }
...@@ -702,15 +704,17 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -702,15 +704,17 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
* @since 2021-01-21 * @since 2021-01-21
*/ */
@Override @Override
public JsonResult querySoureTableColumns(List<SynchTableColumnsReq> req) throws Exception { public JsonResult querySoureTableColumns(Map<String, List<SynchTableColumnsReq>> req) throws Exception {
List<Map> returnData = new ArrayList<>(); List<Map> returnData = new ArrayList<>();
int len = 0; int len = 0;
if (req.size() == 0 || req == null) { if (req.size() == 0 || req == null) {
throw new RuntimeException("请求参数不能为空!"); throw new RuntimeException("请求参数不能为空!");
} }
for (SynchTableColumnsReq str : req) { for (SynchTableColumnsReq str : req.get("params")) {
//通过源数据库id ,查询数据源配置 //通过源数据库id ,查询数据源配置
DmpAgentDatasourceInfo dsInfo = offlineSynchDao.querySourceDbInfoBySourceId(str.getSourceDbId()); DmpAgentDatasourceInfo dsInfos = offlineSynchDao.querySourceDbInfoBySourceId(str.getSourceDbId());
DmpAgentDatasourceInfo dsInfo = new DmpAgentDatasourceInfo();
BeanUtils.copyProperties(dsInfos, dsInfo);
if (dsInfo == null) { if (dsInfo == null) {
throw new RuntimeException("数据源配置信息不存在!"); throw new RuntimeException("数据源配置信息不存在!");
} }
......
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