Commit 83685b10 authored by mcb's avatar mcb

commit

parent 16943735
...@@ -285,6 +285,12 @@ ...@@ -285,6 +285,12 @@
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>jz-dmp-service</finalName> <finalName>jz-dmp-service</finalName>
......
...@@ -83,4 +83,10 @@ public class GatewayApiConstant { ...@@ -83,4 +83,10 @@ public class GatewayApiConstant {
//日志详情 //日志详情
public static final String logDetails = "/api/logging/getReqDetail"; public static final String logDetails = "/api/logging/getReqDetail";
//服务开发 api列表
public static final String listServerApplyApi = "/api/interface/listServerApplyApi";
//获取文件夹树
public static final String folderTree = "/api/producer/getFileCatalog";
} }
...@@ -48,6 +48,9 @@ public class RestClient { ...@@ -48,6 +48,9 @@ public class RestClient {
*/ */
@SuppressWarnings({ "unchecked" }) @SuppressWarnings({ "unchecked" })
public static Map<String, Object> post(String url,String jsonStr){ public static Map<String, Object> post(String url,String jsonStr){
LOGGER.info("===================post request Start=======================");
LOGGER.info("url:" + url);
LOGGER.info("json:" + jsonStr);
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json;charset=UTF-8");//解决请求乱码问题 headers.set("Content-Type", "application/json;charset=UTF-8");//解决请求乱码问题
Map<String, Object> resutMap = null ; Map<String, Object> resutMap = null ;
...@@ -58,6 +61,7 @@ public class RestClient { ...@@ -58,6 +61,7 @@ public class RestClient {
e.printStackTrace(); e.printStackTrace();
LOGGER.error("rest post 异常",e.getMessage(),e); LOGGER.error("rest post 异常",e.getMessage(),e);
} }
LOGGER.info("===================post request end=======================");
return resutMap; return resutMap;
} }
......
package com.jz.common.utils.web;
import com.squareup.okhttp.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
* @ClassName: OKHttpUtil
* @Description: OKHttpUtil
* @Author Bellamy
* @Date 2021/2/25
* @Version 1.0
*/
public class OKHttpUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientUtils.class);
/**
* get请求
*
* @param url
* @return
*/
public static String httpGet(String url) {
String result = null;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(url).build();
try {
Response response = client.newCall(request).execute();
result = response.body().string();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* post请求
*
* @param url
* @param data 提交的参数为key=value&key1=value1的形式
*/
public static String httpPost(String url, String data) {
String result = null;
OkHttpClient httpClient = new OkHttpClient();
RequestBody requestBody = RequestBody.create(MediaType.parse("text/html;charset=utf-8"), data);
Request request = new Request.Builder().url(url).post(requestBody).build();
try {
Response response = httpClient.newCall(request).execute();
result = response.body().string();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
public static String httpPut(String url, String stringJson) {
LOGGER.info("===================put request start=======================");
LOGGER.info("url:" + url);
LOGGER.info("json:" + stringJson);
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(mediaType, stringJson);
Request request = new Request.Builder()
.url(url)
.put(body)
.addHeader("Content-Type", "application/json")
//.addHeader("Connection", "keep-alive")
.build();
try {
client.newCall(request).execute();
/*Response response = client.newCall(request).execute();
String str = response.body().string();*/
} catch (IOException e) {
e.printStackTrace();
}
LOGGER.info("===================put request end=======================");
return null;
}
}
package com.jz.dmp.modules.controller.DataIntegration; package com.jz.dmp.modules.controller.DataIntegration;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.constant.JsonResult; import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
import com.jz.common.page.PageInfoResponse; import com.jz.common.page.PageInfoResponse;
...@@ -75,29 +76,30 @@ public class RealTimeSyncController { ...@@ -75,29 +76,30 @@ public class RealTimeSyncController {
* @author Bellamy * @author Bellamy
* @since 2021-01-05 * @since 2021-01-05
*/ */
@ApiOperation(value = "批量启动运行实时同步任务", notes = "批量启动实时同步任务") @ApiOperation(value = "批量启动/停止运行实时同步任务", notes = "批量启动实时同步任务")
@GetMapping(value = "/startRealTimeSync") @GetMapping(value = "/startRealTimeSync")
@ApiImplicitParam(name = "realTaskId", value = "任务id") @ApiImplicitParams({@ApiImplicitParam(name = "taskId", value = "任务id", required = true),
public JsonResult startRealTimeSync(@RequestParam String realTaskId) throws Exception { @ApiImplicitParam(name = "type", value = "01:运行,02:停止", required = true),
if (StringUtils.isEmpty(realTaskId)) { @ApiImplicitParam(name = "projectId", value = "项目id", required = true)})
public JsonResult startRealTimeSync(@RequestParam String taskId, @RequestParam String projectId, @RequestParam String type) throws Exception {
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR, "任务id不能为空!"); return new JsonResult(ResultCode.PARAMS_ERROR, "任务id不能为空!");
} }
String[] ids = realTaskId.split(","); if (StringUtils.isEmpty(projectId)) {
List<DmpRealtimeSyncInfo> list = dmpRealtimeSyncInfoService.queryListById(ids); return new JsonResult(ResultCode.PARAMS_ERROR, "projectId不能为空!");
if (list.size() > 0 && list != null) { }
for (int i = 0; i < list.size(); i++) { if (StringUtils.isEmpty(type)) {
DmpRealtimeSyncInfo dmpRealtimeSyncInfo = list.get(i); return new JsonResult(ResultCode.PARAMS_ERROR, "type不能为空!");
String srcTopicName = dmpRealtimeSyncInfo.getSrcTopicName();
System.out.println(srcTopicName);
logger.info("############正常执行表数据id{}........" + ids[i]);
String shellPath = "/app/bigdata-app/scripts/trigger_straming.sh";
boolean flag = CmdUtils.callShell(shellPath, srcTopicName);
if(flag){
logger.info("############执行成功{}" + flag);
}
}
} }
return new JsonResult(); JsonResult result = new JsonResult();
try {
result = dmpRealtimeSyncInfoService.executeRealtimeTask(taskId, type, projectId);
} catch (Exception e) {
e.printStackTrace();
result.setMessage("执行失败!");
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
} }
/** /**
...@@ -204,13 +206,13 @@ public class RealTimeSyncController { ...@@ -204,13 +206,13 @@ public class RealTimeSyncController {
} }
/** /**
* 保存实时同步任务 * 保存/编辑实时同步任务
* *
* @return * @return
* @author Bellamy * @author Bellamy
* @since 2021-01-08 * @since 2021-01-08
*/ */
@ApiOperation(value = "保存实时同步任务", notes = "保存实时同步任务") @ApiOperation(value = "保存/编辑实时同步任务", notes = "保存实时同步任务")
@PostMapping(value = "/addTask") @PostMapping(value = "/addTask")
public JsonResult addTask(@RequestBody Map<String, Object> params, HttpServletRequest httpRequest) throws Exception { public JsonResult addTask(@RequestBody Map<String, Object> params, HttpServletRequest httpRequest) throws Exception {
logger.info("###################请求参数{}" + params.toString() + "############"); logger.info("###################请求参数{}" + params.toString() + "############");
...@@ -224,7 +226,7 @@ public class RealTimeSyncController { ...@@ -224,7 +226,7 @@ public class RealTimeSyncController {
return new JsonResult(ResultCode.PARAMS_ERROR, "目标数据源id不能为空!"); return new JsonResult(ResultCode.PARAMS_ERROR, "目标数据源id不能为空!");
} }
if (StringUtils.isEmpty(params.get("treeId").toString())) { if (StringUtils.isEmpty(params.get("treeId").toString())) {
return new JsonResult(ResultCode.PARAMS_ERROR, "业务节点id不能为空!"); return new JsonResult(ResultCode.PARAMS_ERROR, "treeId不能为空!");
} }
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
...@@ -245,7 +247,7 @@ public class RealTimeSyncController { ...@@ -245,7 +247,7 @@ public class RealTimeSyncController {
* @author Bellamy * @author Bellamy
* @since 2021-01-08 * @since 2021-01-08
*/ */
@ApiOperation(value = "编辑实时同步任务", notes = "编辑实时同步任务") /* @ApiOperation(value = "编辑实时同步任务", notes = "编辑实时同步任务")
@PostMapping(value = "/updateTask") @PostMapping(value = "/updateTask")
public JsonResult updateTask(@RequestBody Map<String, Object> params, HttpServletRequest httpRequest) throws Exception { public JsonResult updateTask(@RequestBody Map<String, Object> params, HttpServletRequest httpRequest) throws Exception {
logger.info("################请求参数{}" + params.toString() + "############"); logger.info("################请求参数{}" + params.toString() + "############");
...@@ -262,20 +264,16 @@ public class RealTimeSyncController { ...@@ -262,20 +264,16 @@ public class RealTimeSyncController {
return new JsonResult(ResultCode.PARAMS_ERROR, "任务id不能为空!"); return new JsonResult(ResultCode.PARAMS_ERROR, "任务id不能为空!");
} }
//异步提交 JsonResult jsonResult = new JsonResult();
Thread thread = new Thread(new Runnable() { try {
@Override jsonResult = dmpRealtimeSyncInfoService.updateRealTimeTask(params);
public void run() { } catch (Exception e) {
try { e.printStackTrace();
dmpRealtimeSyncInfoService.updateRealTimeTask(params); jsonResult.setMessage(e.getMessage());
} catch (Exception e) { jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace(); }
} return jsonResult;
} }*/
});
thread.start();
return new JsonResult();
}
/** /**
* 编辑--数据回显,通过id查询任务相关信息 * 编辑--数据回显,通过id查询任务相关信息
......
...@@ -183,6 +183,9 @@ public class DataSourceListDto { ...@@ -183,6 +183,9 @@ public class DataSourceListDto {
@ApiModelProperty(value = "accessKey") @ApiModelProperty(value = "accessKey")
private String accessKey; private String accessKey;
@ApiModelProperty(value = "密码")
private String password;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -422,4 +425,12 @@ public class DataSourceListDto { ...@@ -422,4 +425,12 @@ public class DataSourceListDto {
public void setDatasourceTypeId(String datasourceTypeId) { public void setDatasourceTypeId(String datasourceTypeId) {
this.datasourceTypeId = datasourceTypeId; this.datasourceTypeId = datasourceTypeId;
} }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
} }
...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @ClassName: RealTimeEditDataEchoDto * @ClassName: RealTimeEditDataEchoDto
...@@ -23,41 +24,35 @@ public class RealTimeEditDataEchoDto { ...@@ -23,41 +24,35 @@ public class RealTimeEditDataEchoDto {
@ApiModelProperty(value = "实时同步任务ID") @ApiModelProperty(value = "实时同步任务ID")
private String id; private String id;
@ApiModelProperty(value = "项目id")
private String projectId;
@ApiModelProperty(value = "treeId")
private String treeId;
/* /*
* 来源数据源id * 来源数据源id
* */ * */
@ApiModelProperty(value = "来源数据源id") @ApiModelProperty(value = "来源数据源id")
private String srcDatasourceId; private String srcDataSourceId;
/* @ApiModelProperty(value = "来源数据源类型id")
* 来源数据源名称 private String srcDatasourceTypeId;
* */
@ApiModelProperty(value = "来源数据源")
private String srcDatasourceName;
/* /*
* 目标数据源id * 目标数据源id
* */ * */
@ApiModelProperty(value = "目标数据源id") @ApiModelProperty(value = "目标数据源id")
private String targetDatasourceId; private String targetDataSourceId;
/* @ApiModelProperty(value = "目标数据源类型id")
* 目标数据源名称 private String targetDataSourceTypeId;
* */
@ApiModelProperty(value = "去向数据源")
private String targetDatasourceName;
/* @ApiModelProperty(value = "正则表达式")
* 黑名单表 private String regularExpression;
* */
@ApiModelProperty(value = "黑名单表")
private String blacklistTable;
/*
* 已选择的表
* */
@ApiModelProperty(value = "已选择的表") @ApiModelProperty(value = "已选择的表")
private List<DmpRealtimeSyncSelectTable> selectTable; private List<Map> tables;
public String getId() { public String getId() {
return id; return id;
...@@ -67,51 +62,67 @@ public class RealTimeEditDataEchoDto { ...@@ -67,51 +62,67 @@ public class RealTimeEditDataEchoDto {
this.id = id; this.id = id;
} }
public String getSrcDatasourceId() { public String getSrcDataSourceId() {
return srcDatasourceId; return srcDataSourceId;
}
public void setSrcDataSourceId(String srcDataSourceId) {
this.srcDataSourceId = srcDataSourceId;
}
public String getTargetDataSourceId() {
return targetDataSourceId;
}
public void setTargetDataSourceId(String targetDataSourceId) {
this.targetDataSourceId = targetDataSourceId;
}
public String getProjectId() {
return projectId;
} }
public void setSrcDatasourceId(String srcDatasourceId) { public void setProjectId(String projectId) {
this.srcDatasourceId = srcDatasourceId; this.projectId = projectId;
} }
public String getSrcDatasourceName() { public String getTreeId() {
return srcDatasourceName; return treeId;
} }
public void setSrcDatasourceName(String srcDatasourceName) { public void setTreeId(String treeId) {
this.srcDatasourceName = srcDatasourceName; this.treeId = treeId;
} }
public String getTargetDatasourceId() { public String getSrcDatasourceTypeId() {
return targetDatasourceId; return srcDatasourceTypeId;
} }
public void setTargetDatasourceId(String targetDatasourceId) { public void setSrcDatasourceTypeId(String srcDatasourceTypeId) {
this.targetDatasourceId = targetDatasourceId; this.srcDatasourceTypeId = srcDatasourceTypeId;
} }
public String getTargetDatasourceName() { public String getTargetDataSourceTypeId() {
return targetDatasourceName; return targetDataSourceTypeId;
} }
public void setTargetDatasourceName(String targetDatasourceName) { public void setTargetDataSourceTypeId(String targetDataSourceTypeId) {
this.targetDatasourceName = targetDatasourceName; this.targetDataSourceTypeId = targetDataSourceTypeId;
} }
public String getBlacklistTable() { public String getRegularExpression() {
return blacklistTable; return regularExpression;
} }
public void setBlacklistTable(String blacklistTable) { public void setRegularExpression(String regularExpression) {
this.blacklistTable = blacklistTable; this.regularExpression = regularExpression;
} }
public List<DmpRealtimeSyncSelectTable> getSelectTable() { public List<Map> getTables() {
return selectTable; return tables;
} }
public void setSelectTable(List<DmpRealtimeSyncSelectTable> selectTable) { public void setTables(List<Map> tables) {
this.selectTable = selectTable; this.tables = tables;
} }
} }
...@@ -83,6 +83,12 @@ public class RealTimeSyncListDto { ...@@ -83,6 +83,12 @@ public class RealTimeSyncListDto {
@ApiModelProperty(value = "上下线状态:Y 上线,N 下线") @ApiModelProperty(value = "上下线状态:Y 上线,N 下线")
private String onlineStatus; private String onlineStatus;
@ApiModelProperty(value = "数据量")
private String dataSize;
@ApiModelProperty(value = "任务描述")
private String taskDesc;
public String getId() { public String getId() {
return id; return id;
} }
...@@ -178,4 +184,20 @@ public class RealTimeSyncListDto { ...@@ -178,4 +184,20 @@ public class RealTimeSyncListDto {
public void setOnlineStatus(String onlineStatus) { public void setOnlineStatus(String onlineStatus) {
this.onlineStatus = onlineStatus; this.onlineStatus = onlineStatus;
} }
public String getDataSize() {
return dataSize;
}
public void setDataSize(String dataSize) {
this.dataSize = dataSize;
}
public String getTaskDesc() {
return taskDesc;
}
public void setTaskDesc(String taskDesc) {
this.taskDesc = taskDesc;
}
} }
...@@ -58,13 +58,13 @@ public class RealTimeSyncListReq extends BasePageBean { ...@@ -58,13 +58,13 @@ public class RealTimeSyncListReq extends BasePageBean {
/* /*
* 节点id * 节点id
* */ * */
@ApiModelProperty(value = "节点名称或id") @ApiModelProperty(value = "任务名称称或id")
private String treeId; private String treeId;
/* /*
* 节点id * 任务名称
* */ * */
@ApiModelProperty(value = "节点名称") @ApiModelProperty(value = "任务名称")
private String treeName; private String treeName;
public String getProjectId() { public String getProjectId() {
......
...@@ -245,6 +245,48 @@ public class DmpApiServiceMangeController { ...@@ -245,6 +245,48 @@ public class DmpApiServiceMangeController {
return jsonResult; return jsonResult;
} }
/**
* 服务开发API列表
*
* @author Bellamy
* @since 2021-02-24
*/
@ApiOperation(value = "服务开发--API列表", notes = "服务开发API列表")
@PostMapping(value = "/apiListPaging")
public JsonResult apiListPaging(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.apiListPaging(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 获取文件夹列表
*
* @return
* @author Bellamy
*/
@ApiOperation(value = "获取文件夹列表", notes = "获取文件夹列表")
@GetMapping(value = "/folderTree")
@ApiImplicitParams({@ApiImplicitParam(name = "projectId", value = "项目id"),
@ApiImplicitParam(name = "orgCode", value = "组织编码")})
public JsonResult getFolderTree(@RequestParam(name = "projectId",required = false) String projectId,@RequestParam(name = "orgCode",required = false) String orgCode) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.getFolderTree(projectId,orgCode);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/** /**
* 获取数据源表字段 * 获取数据源表字段
* *
...@@ -252,12 +294,12 @@ public class DmpApiServiceMangeController { ...@@ -252,12 +294,12 @@ public class DmpApiServiceMangeController {
* @author Bellamy * @author Bellamy
* @since 2021-01-21 * @since 2021-01-21
*/ */
/* @ApiOperation(value = "获取数据源表字段", notes = "获取数据源表字段") /* @ApiOperation(value = "获取数据源表字段111", notes = "获取数据源表字段")
@PostMapping(value = "/getTableColumns") @PostMapping(value = "/getTableColumns")
public JsonResult getTableColumns(@RequestBody @Validated SoureTableColumnsReq req) throws Exception { public JsonResult getTableColumns() throws Exception {
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
try { try {
jsonResult = offlineSynchService.querySoureTableColumns(req); jsonResult = dmpApiServiceMangeService.test();
} catch (Exception e) { } catch (Exception e) {
jsonResult.setMessage(e.getMessage()); jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR); jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
......
...@@ -22,4 +22,16 @@ public class ApiInterfaceInfoListReq extends BasePageBean implements Serializabl ...@@ -22,4 +22,16 @@ public class ApiInterfaceInfoListReq extends BasePageBean implements Serializabl
private String status; private String status;
@ApiModelProperty(value = "ApiKey") @ApiModelProperty(value = "ApiKey")
private String apiKey; private String apiKey;
@ApiModelProperty(value = "api名称")
private String apiName;
@ApiModelProperty(value = "组织名称")
private String orgName;
// 服务开发----------------API列表
@ApiModelProperty(value = "项目id--服务开发")
private Long projectId;
@ApiModelProperty(value = "文件id--服务开发")
private Long fileId;
} }
...@@ -56,7 +56,7 @@ public class DmpRealtimeSyncInfo implements Serializable { ...@@ -56,7 +56,7 @@ public class DmpRealtimeSyncInfo implements Serializable {
* 项目id * 项目id
*/ */
@ApiModelProperty(value = "项目id") @ApiModelProperty(value = "项目id")
private Object projectId; private String projectId;
@ApiModelProperty(value = "${column.comment}") @ApiModelProperty(value = "${column.comment}")
private Integer parentId; private Integer parentId;
...@@ -238,11 +238,11 @@ public class DmpRealtimeSyncInfo implements Serializable { ...@@ -238,11 +238,11 @@ public class DmpRealtimeSyncInfo implements Serializable {
this.srcTopicName = srcTopicName; this.srcTopicName = srcTopicName;
} }
public Object getProjectId() { public String getProjectId() {
return projectId; return projectId;
} }
public void setProjectId(Object projectId) { public void setProjectId(String projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
......
...@@ -80,4 +80,22 @@ public interface DmpApiServiceMangeService { ...@@ -80,4 +80,22 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-22 * @since 2021-01-22
*/ */
JsonResult queryApiNotCalledListPage(ApiInterfaceInfoListReq req) throws Exception; JsonResult queryApiNotCalledListPage(ApiInterfaceInfoListReq req) throws Exception;
/**
* 服务开发API列表
*
* @author Bellamy
* @since 2021-02-24
*/
JsonResult apiListPaging(ApiInterfaceInfoListReq req) throws Exception;
/**
* 获取文件夹列表
*
* @return
* @author Bellamy
* @since 2021-02-24
*/
JsonResult getFolderTree(String projectId, String orgCode) throws Exception;
} }
\ No newline at end of file
...@@ -153,4 +153,13 @@ public interface DmpRealtimeSyncInfoService { ...@@ -153,4 +153,13 @@ public interface DmpRealtimeSyncInfoService {
* @since 2021-02-22 * @since 2021-02-22
*/ */
JsonResult conflictCheck(ConflictCheckReq params) throws Exception; JsonResult conflictCheck(ConflictCheckReq params) throws Exception;
/**
* 启动/停止运行实时同步任务
*
* @return
* @author Bellamy
* @since 2021-01-05
*/
JsonResult executeRealtimeTask(String realTaskId, String type, String projectId) throws Exception;
} }
\ No newline at end of file
...@@ -281,4 +281,74 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -281,4 +281,74 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
} }
return result; return result;
} }
/**
* 服务开发API列表
*
* @param req
* @author Bellamy
* @since 2021-02-24
*/
@Override
public JsonResult apiListPaging(ApiInterfaceInfoListReq req) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.listServerApplyApi;
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
return JsonResult.ok(jsonObject.get("data"));
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setMessage(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
}
/**
* 获取文件夹列表
*
* @param projectId
* @param orgCode
* @return
* @author Bellamy
* @since 2021-02-24
*/
@Override
public JsonResult getFolderTree(String projectId, String orgCode) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.folderTree;
Map params = new HashMap();
if(StringUtils.isNotEmpty(projectId)){
params.put("projectId", projectId);
}
params.put("orgCode", orgCode);
String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果{}" + returnData);
Map map = JSONObject.parseObject(returnData);
if (map.containsKey("code")) {
if ("200".equals(map.get("code").toString())) {
return JsonResult.ok(map.get("data"));
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
}
} }
\ No newline at end of file
...@@ -338,6 +338,9 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ ...@@ -338,6 +338,9 @@ public class DmpSyncingDatasourceServiceImpl implements DmpSyncingDatasourceServ
@Override @Override
public JsonResult selectDataSourceInfoById(Map map) throws Exception { public JsonResult selectDataSourceInfoById(Map map) throws Exception {
DataSourceListDto asd = dmpSyncingDatasourceDao.selectDataSourceInfoById(map); DataSourceListDto asd = dmpSyncingDatasourceDao.selectDataSourceInfoById(map);
if(StringUtils.isNotEmpty(asd.getPassword())){
asd.setPassword(new BaseService().decode(asd.getPassword(),publicKey));
}
return new JsonResult(asd); return new JsonResult(asd);
} }
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
<result property="targetTableName" column="target_table_name" jdbcType="VARCHAR"/> <result property="targetTableName" column="target_table_name" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="INTEGER"/> <result property="type" column="type" jdbcType="INTEGER"/>
<result property="connectorJobId" column="connector_job_id" jdbcType="VARCHAR"/> <result property="connectorJobId" column="connector_job_id" jdbcType="VARCHAR"/>
<result property="connectorJsonData" column="connector_json_data" jdbcType="OTHER"/> <result property="connectorJsonData" column="connector_json_data" jdbcType="BLOB" typeHandler="com.jz.common.persistence.CBTHandler"/>
<result property="srcTopicName" column="src_topic_name" jdbcType="VARCHAR"/> <result property="srcTopicName" column="src_topic_name" jdbcType="VARCHAR"/>
<result property="projectId" column="project_id" jdbcType="OTHER"/> <result property="projectId" column="project_id" jdbcType="BLOB" typeHandler="com.jz.common.persistence.CBTHandler"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/> <result property="parentId" column="parent_id" jdbcType="INTEGER"/>
<result property="desensitizationField" column="desensitization_field" jdbcType="VARCHAR"/> <result property="desensitizationField" column="desensitization_field" jdbcType="VARCHAR"/>
<result property="arithmetic" column="arithmetic" jdbcType="VARCHAR"/> <result property="arithmetic" column="arithmetic" jdbcType="VARCHAR"/>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
id, tree_id, src_datasource_id, target_datasource_id, src_table_name, target_table_name, type, connector_job_id, connector_json_data id, tree_id, src_datasource_id, target_datasource_id, src_table_name, target_table_name, type, connector_job_id, connector_json_data
, src_topic_name, project_id, parent_id, desensitization_field, arithmetic, pk_name, source_type_name, target_type_name , src_topic_name, project_id, parent_id, desensitization_field, arithmetic, pk_name, source_type_name, target_type_name
, src_database_type, src_database_name, connector_url, target_database_type, target_database_name, src_datasource_name , src_database_type, src_database_name, connector_url, target_database_type, target_database_name, src_datasource_name
, target_datasource_name, store_type, status, create_time, update_time, cre_person, upt_person , target_datasource_name, store_type, status, create_time, update_time, cre_person, upt_person,version
from dmp_realtime_sync_info from dmp_realtime_sync_info
where data_status='1' and id = #{id} where data_status='1' and id = #{id}
</select> </select>
...@@ -303,6 +303,12 @@ ...@@ -303,6 +303,12 @@
<if test="uptPerson != null and uptPerson != ''"> <if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson}, upt_person = #{uptPerson},
</if> </if>
<if test="scriptJson != null and scriptJson != ''">
script_json = #{scriptJson},
</if>
<if test="treeId != null and treeId != ''">
tree_id = #{treeId},
</if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
...@@ -319,7 +325,7 @@ ...@@ -319,7 +325,7 @@
t1.id, t1.id,
t1.tree_id as treeId, t1.tree_id as treeId,
t2.name as treeName, t2.name as treeName,
t1.status, (case when t1.status='PAUSED' then '空闲' when t1.status='RUNNING' then '运行中' end) status,
date_format(t1.update_time,'%Y-%m-%d %H:%i:%s') as updateTime, date_format(t1.update_time,'%Y-%m-%d %H:%i:%s') as updateTime,
t1.src_datasource_id as srcDatasourceId, t1.src_datasource_id as srcDatasourceId,
t1.src_datasource_name as srcDatasourceName, t1.src_datasource_name as srcDatasourceName,
...@@ -327,7 +333,8 @@ ...@@ -327,7 +333,8 @@
t1.target_datasource_id as targetDatasourceId, t1.target_datasource_id as targetDatasourceId,
t1.target_datasource_name as targetDatasourceName, t1.target_datasource_name as targetDatasourceName,
t1.target_database_type as targetDatabaseType, t1.target_database_type as targetDatabaseType,
t1.online_status as onlineStatus t1.online_status as onlineStatus,
t1.task_desc as taskDesc
FROM dmp_realtime_sync_info t1 FROM dmp_realtime_sync_info t1
inner join dmp_navigation_tree t2 on t1.tree_id=t2.id inner join dmp_navigation_tree t2 on t1.tree_id=t2.id
left join dmp_syncing_datasource t3 ON t1.src_datasource_id = t3.ID left join dmp_syncing_datasource t3 ON t1.src_datasource_id = t3.ID
...@@ -512,24 +519,15 @@ ...@@ -512,24 +519,15 @@
<select id="selectRealtimeTaskById" resultType="java.util.Map"> <select id="selectRealtimeTaskById" resultType="java.util.Map">
SELECT SELECT
t1.id, t1.id,
t1.tree_id as treeId,
t1.src_datasource_id AS srcDatasourceId, 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_id AS targetDatasourceId,
t1.target_datasource_name AS targetDatasourceName, t1.script_json as scriptJson
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 FROM
dmp_realtime_sync_info t1 dmp_realtime_sync_info t1
left join dmp_realtime_sync_blacklist_table_info t2 ON t1.id = t2.realtime_id inner join dmp_navigation_tree t2 on t1.tree_id=t2.id and t2.data_status='1'
left join dmp_realtime_sync_select_table t3 on t1.id=t3.realtime_id
WHERE WHERE
1 = 1 and t1.data_status='1' and id = #{taskId} 1 = 1 and t1.data_status='1' and t1.id = #{taskId}
</select> </select>
<!--批量删除 或 批量上下线--> <!--批量删除 或 批量上下线-->
......
...@@ -267,6 +267,9 @@ ...@@ -267,6 +267,9 @@
<if test="impalaMasterFqdn != null"> <if test="impalaMasterFqdn != null">
impala_master_fqdn = #{impalaMasterFqdn}, impala_master_fqdn = #{impalaMasterFqdn},
</if> </if>
<if test="testConnectStatus != null">
test_connect_status = #{testConnectStatus},
</if>
</set> </set>
where ID = #{id} where ID = #{id}
</update> </update>
...@@ -374,6 +377,7 @@ ...@@ -374,6 +377,7 @@
a.jdbc_url as jdbcUrl, a.jdbc_url as jdbcUrl,
a.db_name as dbName, a.db_name as dbName,
a.user_name as userName, a.user_name as userName,
a.password,
a.project_id as projectId, a.project_id as projectId,
a.protocol, a.protocol,
a.host, a.host,
......
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