Commit babf1bd3 authored by mcb's avatar mcb

no message

parent 880656a1
......@@ -4,10 +4,7 @@ import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode;
import com.jz.common.page.PageInfoResponse;
import com.jz.common.utils.realTime.CmdUtils;
import com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeSyncListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeSyncListReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeTableInfoReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.*;
import com.jz.dmp.modules.model.DmpRealtimeSyncInfo;
import com.jz.dmp.modules.model.RealTimeSyncModel;
import com.jz.dmp.modules.service.DmpRealtimeSyncInfoService;
......@@ -112,6 +109,7 @@ public class RealTimeSyncController {
@GetMapping(value = "/delRealTimeSync")
@ApiImplicitParam(name = "realTaskId", value = "任务id")
public JsonResult delRealTimeSync(@RequestParam String realTaskId) throws Exception {
logger.info("###################请求参数{}taskId=" + realTaskId + "###################");
if (StringUtils.isEmpty(realTaskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR, "任务id不能为空!");
}
......@@ -286,4 +284,22 @@ public class RealTimeSyncController {
return new JsonResult();
}
/**
* 编辑--数据回显,通过id查询任务相关信息
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
@ApiOperation(value = "编辑--数据回显", notes = "编辑--数据回显")
@GetMapping(value = "/editDataEcho")
@ApiImplicitParam(name = "taskId", value = "实时任务id", required = true)
public JsonResult<RealTimeEditDataEchoDto> getRealtimeTaskInfo(@RequestParam String taskId) throws Exception {
logger.info("###################请求参数{}taskId=" + taskId + "###################");
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR, "实时任务id不能为空!");
}
JsonResult<RealTimeEditDataEchoDto> jsonResult = dmpRealtimeSyncInfoService.selectRealtimeTaskById(taskId);
return jsonResult;
}
}
\ No newline at end of file
package com.jz.dmp.modules.controller.DataIntegration.bean;
import com.jz.dmp.modules.model.DmpRealtimeSyncSelectTable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @ClassName: RealTimeEditDataEchoDto
* @Description: 编辑任务数据回显返回参数
* @Author:Bellamy
* @Date 2021/01/12
* @Version 1.0
*/
@ApiModel(value = "编辑任务数据回显返回参数", description = "编辑任务数据回显返回参数")
public class RealTimeEditDataEchoDto {
/*
* 实时同步任务ID
* */
@ApiModelProperty(value = "实时同步任务ID")
private String id;
/*
* 来源数据源id
* */
@ApiModelProperty(value = "来源数据源id")
private String srcDatasourceId;
/*
* 来源数据源名称
* */
@ApiModelProperty(value = "来源数据源")
private String srcDatasourceName;
/*
* 目标数据源id
* */
@ApiModelProperty(value = "目标数据源id")
private String targetDatasourceId;
/*
* 目标数据源名称
* */
@ApiModelProperty(value = "去向数据源")
private String targetDatasourceName;
/*
* 黑名单表
* */
@ApiModelProperty(value = "黑名单表")
private String blacklistTable;
/*
* 已选择的表
* */
@ApiModelProperty(value = "已选择的表")
private List<DmpRealtimeSyncSelectTable> selectTable;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSrcDatasourceId() {
return srcDatasourceId;
}
public void setSrcDatasourceId(String srcDatasourceId) {
this.srcDatasourceId = srcDatasourceId;
}
public String getSrcDatasourceName() {
return srcDatasourceName;
}
public void setSrcDatasourceName(String srcDatasourceName) {
this.srcDatasourceName = srcDatasourceName;
}
public String getTargetDatasourceId() {
return targetDatasourceId;
}
public void setTargetDatasourceId(String targetDatasourceId) {
this.targetDatasourceId = targetDatasourceId;
}
public String getTargetDatasourceName() {
return targetDatasourceName;
}
public void setTargetDatasourceName(String targetDatasourceName) {
this.targetDatasourceName = targetDatasourceName;
}
public String getBlacklistTable() {
return blacklistTable;
}
public void setBlacklistTable(String blacklistTable) {
this.blacklistTable = blacklistTable;
}
public List<DmpRealtimeSyncSelectTable> getSelectTable() {
return selectTable;
}
public void setSelectTable(List<DmpRealtimeSyncSelectTable> selectTable) {
this.selectTable = selectTable;
}
}
......@@ -168,4 +168,13 @@ public interface DmpRealtimeSyncInfoDao {
* @since 2021-01-11
*/
int updateRealtimeSelectTable(DmpRealtimeSyncSelectTable selectTable) throws Exception;
/**
* 编辑--数据回显,通过id查询任务相关信息
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
List<Map> selectRealtimeTaskById(@Param("taskId") String taskId) throws Exception;
}
\ No newline at end of file
......@@ -2,10 +2,7 @@ package com.jz.dmp.modules.service;
import com.jz.common.constant.JsonResult;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeSyncListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeSyncListReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeTableInfoReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.*;
import com.jz.dmp.modules.model.DmpRealtimeSyncInfo;
import com.jz.dmp.modules.model.RealTimeSyncModel;
......@@ -121,4 +118,13 @@ public interface DmpRealtimeSyncInfoService {
* @since 2021-01-08
*/
JsonResult updateRealTimeTask(Map<String, Object> params) throws Exception;
/**
* 编辑--数据回显,通过id查询任务相关信息
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
JsonResult<RealTimeEditDataEchoDto> selectRealtimeTaskById(String taskId) throws Exception;
}
\ No newline at end of file
......@@ -11,10 +11,7 @@ import com.jz.common.persistence.BaseService;
import com.jz.common.utils.realTime.DBUtil;
import com.jz.common.utils.realTime.RestClient;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.DataIntegration.bean.DataSourceNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeSyncListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeSyncListReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.RealTimeTableInfoReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.*;
import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.dao.DmpRealtimeSyncHandleCountDao;
import com.jz.dmp.modules.dao.DmpRealtimeSyncInfoDao;
......@@ -641,7 +638,7 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
* @since 2021-01-08
*/
@Override
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public JsonResult updateRealTimeTask(Map<String, Object> params) throws Exception {
String srcDataSourceId = params.get("srcDataSourceId").toString(); //来源id
String targetDataSourceId = params.get("targetDataSourceId").toString(); //目标源id
......@@ -681,8 +678,8 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
}
private JsonResult updateDatasource2DatasourceToConnector(Long projectId, RealTimeSyncDataSourceModel sourceDbInfo, RealTimeSyncDataSourceModel targetDbInfo, DmpProjectSystemInfo dmpProjectSystemInfo, String connectorUrl, Map<String, Object> params) throws Exception {
Integer srcDataSourceId = sourceDbInfo.getId();
Integer targetDataSourceId = targetDbInfo.getId();
Integer srcDataSourceId = sourceDbInfo.getId(); //来源数据源id
Integer targetDataSourceId = targetDbInfo.getId(); //目标数据源id
String realtiemId = params.get("taskId").toString(); //同步任务id
//解析黑名单表
......@@ -700,13 +697,13 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
dataModelMap.put("whitelistTablesConut", selectlistTablesInfo.get("whitelistTablesConut").toString()); //已选择表数量
dataModelMap.put("connectorWhitelistTables", selectlistTablesInfo.get("connectorWhitelistTables").toString()); //设置的已选择表
//选择的来源数据信息
dataModelMap.put("dbHost", sourceDbInfo.getHost());
dataModelMap.put("dbPort", sourceDbInfo.getPort());
dataModelMap.put("dbHost", sourceDbInfo.getHost()); //IP
dataModelMap.put("dbPort", sourceDbInfo.getPort()); //端口
dataModelMap.put("dbUserName", sourceDbInfo.getUserName());
dataModelMap.put("dbPassWord", sourceDbInfo.getPassword());
dataModelMap.put("dataSourceId", sourceDbInfo.getId().toString());
dataModelMap.put("datasourceName", sourceDbInfo.getDatasourceName());
dataModelMap.put("dbName", sourceDbInfo.getDbName());
dataModelMap.put("datasourceName", sourceDbInfo.getDatasourceName()); //数据源名称
dataModelMap.put("dbName", sourceDbInfo.getDbName()); //数据库名称
dataModelMap.put("connectorSecurityFlag", (String) params.get("connectorSecurityFlag")); //安全验证开关,是否启用KERBEROS
//前端定义的sourceConnectorName前缀
String sourceName = (String) params.get("sourceName");
......@@ -720,7 +717,7 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
Map<String, Object> dataSource2DataSourceResult = RestClient.post(connectorUrl, dataSource2DataSourceJsonStr);
String connectorJobId = getConnectorJobId(dataSource2DataSourceResult);
//请求接口正常则保存数据,否则失败
//if (StringUtils.isNotEmpty(connectorJobId)) {
if (StringUtils.isNotEmpty(connectorJobId)) {
DmpRealtimeSyncInfo saveBody = new DmpRealtimeSyncInfo();
saveBody.setSrcDatasourceId(srcDataSourceId);
saveBody.setSrcDatasourceName(sourceDbInfo.getDatasourceName());
......@@ -741,21 +738,21 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
saveBody.setConnectorJsonData(dataSource2DataSourceJsonStr);
saveBody.setUpdateTime(new Date());
saveBody.setId(Integer.valueOf(realtiemId));
//saveBody.setUptPerson(SessionUtils.getCurrentUserId());
saveBody.setUptPerson(SessionUtils.getCurrentUserId());
dmpRealtimeSyncInfoDao.update(saveBody);
logger.info("###################修改实时同步任务--结束 ################");
Map blacklist = new HashMap();
blacklist.put("uptTime", new Date());
//blacklist.put("uptPerson", SessionUtils.getCurrentUserId());
blacklist.put("uptPerson", SessionUtils.getCurrentUserId());
blacklist.put("realtimeId", realtiemId);
blacklist.put("datasourceId", srcDataSourceId);
blacklist.put("blacklistTable", blacklistTablesInfo.get("blacklistTables").toString());
dmpRealtimeSyncInfoDao.updateRealtimeBlackList(blacklist);
logger.info("###################修改实时同步黑名单数据--结束 ################");
/* } else {
} else {
throw new RuntimeException("提交失败!");
}*/
}
return new JsonResult();
}
......@@ -774,7 +771,7 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
if (tables.size() > 0 && tables != null) {
for (Map<String, String> str : tables) {
DmpRealtimeSyncSelectTable selectTable = new DmpRealtimeSyncSelectTable();
//selectTable.setUptPerson(SessionUtils.getCurrentUserId());
selectTable.setUptPerson(SessionUtils.getCurrentUserId());
selectTable.setUptTime(new Date());
selectTable.setSrcTableName(str.get("sourceTableName"));
selectTable.setTargetTableName(str.get("targetTableName"));
......@@ -788,4 +785,40 @@ public class DmpRealtimeSyncInfoServiceImpl implements DmpRealtimeSyncInfoServic
logger.info("###################处理已选择的表信息--结束################");
return new JsonResult();
}
/**
* 编辑--数据回显,通过id查询任务相关信息
*
* @return
* @author Bellamy
* @since 2021-01-12
*/
@Override
public JsonResult<RealTimeEditDataEchoDto> selectRealtimeTaskById(String taskId) throws Exception {
RealTimeEditDataEchoDto returnModel = new RealTimeEditDataEchoDto();
List<Map> list = dmpRealtimeSyncInfoDao.selectRealtimeTaskById(taskId);
if (list.size() > 0 && list != null) {
Map realtimeMap = list.get(0);
returnModel.setBlacklistTable(realtimeMap.get("blacklistTable").toString());
returnModel.setSrcDatasourceId(realtimeMap.get("srcDatasourceId").toString());
returnModel.setSrcDatasourceName(realtimeMap.get("srcDatasourceName").toString());
returnModel.setTargetDatasourceId(realtimeMap.get("targetDatasourceId").toString());
returnModel.setTargetDatasourceName(realtimeMap.get("targetDatasourceName").toString());
returnModel.setId(realtimeMap.get("id").toString());
List<DmpRealtimeSyncSelectTable> selectList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
Map str = list.get(i);
DmpRealtimeSyncSelectTable selectTable = new DmpRealtimeSyncSelectTable();
selectTable.setDesensitizationField(str.get("desensitizationField").toString());
selectTable.setArithmetic(str.get("arithmetic").toString());
selectTable.setPkName(str.get("pkName").toString());
selectTable.setSrcTableName(str.get("srcTableName").toString());
selectTable.setTargetTableName(str.get("targetTableName").toString());
selectList.add(selectTable);
returnModel.setSelectTable(selectList);
}
}
return new JsonResult(returnModel);
}
}
\ No newline at end of file
......@@ -492,4 +492,27 @@
</set>
where realtime_id=#{realtimeId}
</update>
<select id="selectRealtimeTaskById" resultType="java.util.Map">
SELECT
t1.id,
t1.src_datasource_id AS srcDatasourceId,
t1.src_datasource_name AS srcDatasourceName,
t1.src_database_type AS srcDatabaseType,
t1.target_datasource_id AS targetDatasourceId,
t1.target_datasource_name AS targetDatasourceName,
t1.target_database_type AS targetDatabaseType,
t2.blacklist_table AS blacklistTable,
t3.desensitization_field AS desensitizationField,
t3.arithmetic,
t3.pk_name AS pkName,
t3.src_table_name AS srcTableName,
t3.target_table_name AS targetTableName
FROM
dmp_realtime_sync_info t1
left join dmp_realtime_sync_blacklist_table_info t2 ON t1.id = t2.realtime_id
left join dmp_realtime_sync_select_table t3 on t1.id=t3.realtime_id
WHERE
1 = 1 and id = #{taskId}
</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