Commit dcdc961e authored by mcb's avatar mcb

commit

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