Commit 12d1611a authored by mcb's avatar mcb

数据服务bug修改

parent 86026ecd
......@@ -37,7 +37,7 @@ public class GatewayApiConstant {
//删除APIurl
public static final String delApi = "/api/interface/delDMPApiInterface";
//根据apiid获取API详情url
public static final String getApiInfo = "/api/interface/getApiInterfaceDetail";
public static final String getApiInfo = "/api/interface/getApiDetail";
//授权给组织url
public static final String apiAuthToOrg = "/api/auth/dmp-auth-api";
//测试url
......@@ -75,10 +75,13 @@ public class GatewayApiConstant {
//获取文件夹树
public static final String folderTree = "/api/producer/getFileCatalog";
//获取文件夹树
//服务开发---获取ApiId
public static final String getApiId = "/api/producer/getCustomApiId";
//服务开发---获取ApiId
//创建项目文件夹
public static final String createProjectFolder = "/api/producer/createProjectFolder";
private static Logger logger = LoggerFactory.getLogger(GatewayApiConstant.class);
/*
......@@ -95,12 +98,15 @@ public class GatewayApiConstant {
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
if (jsonObject.containsKey("data"))
return JsonResult.ok(jsonObject.get("data"));
else
return JsonResult.ok();
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setMessage(jsonObject.get("message").toString());
if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("msg").toString());
result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......@@ -109,22 +115,50 @@ public class GatewayApiConstant {
/*
* get 请求获取数据
* */
public static JsonResult getRequest2GetData(String url, Map params) {
public static JsonResult getRequest2GetData(String url, Map params) throws Exception {
JsonResult result = new JsonResult();
String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("查询失败!");
throw new RuntimeException("failed!");
}
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"));
Map jsonObject = JSONObject.parseObject(returnData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
if (jsonObject.containsKey("data")) {
return JsonResult.ok(jsonObject.get("data"));
} else {
return JsonResult.ok();
}
}
}
if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("msg").toString());
result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
}
/*
* get 请求
* */
public static JsonResult getRequest(String url, Map params) throws Exception {
JsonResult result = new JsonResult();
String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("failed!");
}
logger.info("#################响应结果{}" + returnData);
Map jsonObject = JSONObject.parseObject(returnData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
return JsonResult.ok();
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("msg").toString());
result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......
......@@ -135,14 +135,14 @@ public class DmpApiMangeController {
*/
@ApiOperation(value = "获取API详情", notes = "获取API详情")
@GetMapping(value = "/getApiInfo")
@ApiImplicitParam(name = "id", value = "ApiId", required = true)
public JsonResult getApiInfoByApiId(@RequestParam String id, HttpServletRequest httpRequest) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "apiId不能为空!");
@ApiImplicitParam(name = "apiKey", value = "apiKey", required = true)
public JsonResult getApiInfoByApiId(@RequestParam String apiKey, HttpServletRequest httpRequest) {
if (StringUtils.isEmpty(apiKey)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "apiKey不能为空!");
}
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.queryApiInfoByApiId(id);
jsonResult = dmpApiMangeService.queryApiInfoByApiId(apiKey);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
......
......@@ -331,6 +331,26 @@ public class DmpApiServiceMangeController {
return jsonResult;
}
/**
* 创建项目文件夹
*
* @author Bellamy
* @since 2021-02-24
*/
@ApiOperation(value = "创建项目文件夹", notes = "创建项目文件夹")
@PostMapping(value = "/createProjectFolder")
public JsonResult createProjectFolder(@RequestBody @Validated CreateFolderReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.createProjectFolder(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 获取数据源表字段
*
......
package com.jz.dmp.modules.controller.dataService.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author Bellamy
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: CreateFolderReq
* @DATE: 2021-1-27/18:12
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Data
@ApiModel("创建文件请求体")
public class CreateFolderReq implements Serializable {
@ApiModelProperty(value = "项目id", required = false)
private Long projectId;
@ApiModelProperty(value = "组织编码", required = false)
private String orgCode;
@ApiModelProperty(value = "父类文件夹id ,创建同级不传", required = false)
private Long parentId;
@ApiModelProperty(value = "文件夹名称", required = true)
@NotNull(message = "文件夹名称不能为空!")
@NotEmpty(message = "文件夹名称不能为空!")
private String fileName;
@ApiModelProperty(value = "文件来源:,1 API制做,2 组织创建", required = true)
@NotEmpty(message = "文件来源不能为空")
@NotNull(message = "文件来源不能为空")
private String fileSource;
@ApiModelProperty(value = "创建用户", required = false)
private String createUser;
}
......@@ -3,6 +3,7 @@ package com.jz.dmp.modules.service;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceInfoListReq;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq;
import com.jz.dmp.modules.controller.dataService.bean.CreateFolderReq;
import com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq;
import com.jz.dmp.modules.model.DvRuleT;
......@@ -113,4 +114,12 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-19
*/
JsonResult getApiId() throws Exception;
/**
* 创建项目文件夹
*
* @author Bellamy
* @since 2021-02-24
*/
JsonResult createProjectFolder(CreateFolderReq req) throws Exception;
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceInfoListReq;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq;
import com.jz.common.constant.GatewayApiConstant;
import com.jz.dmp.modules.controller.dataService.bean.CreateFolderReq;
import com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq;
import com.jz.dmp.modules.dao.OfflineSynchDao;
import com.jz.dmp.modules.service.DmpApiServiceMangeService;
......@@ -97,10 +98,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
result.setMessage(jsonObject.get("msg").toString());
}
return result;
}
......@@ -137,10 +138,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
result.setMessage(jsonObject.get("msg").toString());
}
return result;
}
......@@ -229,6 +230,21 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return result;
}
/**
* 创建项目文件夹
*
* @param req
* @author Bellamy
* @since 2021-02-24
*/
@Override
public JsonResult createProjectFolder(CreateFolderReq req) throws Exception {
String url = gatewayUrl + GatewayApiConstant.createProjectFolder;
req.setCreateUser(SessionUtils.getCurrentUserName());
JsonResult result = GatewayApiConstant.postRequest2GetData(url, JSONObject.toJSONString(req));
return result;
}
/**
* 服务开发API列表
*
......@@ -273,9 +289,9 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return JsonResult.ok(map.get("data"));
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
if (map.containsKey("msg")) {
logger.info(map.get("msg").toString());
result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......
......@@ -59,9 +59,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok(jsonObject.get("data"));
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setMessage(jsonObject.get("message").toString());
if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("msg").toString());
result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......@@ -117,9 +117,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok();
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
if (map.containsKey("msg")) {
logger.info(map.get("msg").toString());
result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......@@ -150,9 +150,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok();
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
if (map.containsKey("msg")) {
logger.info(map.get("msg").toString());
result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......@@ -182,9 +182,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok(map.get("data"));
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
if (map.containsKey("msg")) {
logger.info(map.get("msg").toString());
result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
......
......@@ -102,8 +102,8 @@
"executorMemory":"1", //分配任务内存
"driverMemory":"",//分配任务内存
"executorCore":"1", //单executor的cpu数
"driverCore":"1",//单executor的cpu数
"fieldMapping":""//字段映射关系
"driverCore":"1"//单executor的cpu数
//"fieldMapping":""//字段映射关系
},
"reader": {
"sourceDbId": "",
......@@ -219,8 +219,8 @@
},
"mappingRelation":[
{
"source":"",
"target":""
"sourceField":"",
"targetField":""
}
]
},
......
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