Commit 12d1611a authored by mcb's avatar mcb

数据服务bug修改

parent 86026ecd
...@@ -37,7 +37,7 @@ public class GatewayApiConstant { ...@@ -37,7 +37,7 @@ public class GatewayApiConstant {
//删除APIurl //删除APIurl
public static final String delApi = "/api/interface/delDMPApiInterface"; public static final String delApi = "/api/interface/delDMPApiInterface";
//根据apiid获取API详情url //根据apiid获取API详情url
public static final String getApiInfo = "/api/interface/getApiInterfaceDetail"; public static final String getApiInfo = "/api/interface/getApiDetail";
//授权给组织url //授权给组织url
public static final String apiAuthToOrg = "/api/auth/dmp-auth-api"; public static final String apiAuthToOrg = "/api/auth/dmp-auth-api";
//测试url //测试url
...@@ -75,10 +75,13 @@ public class GatewayApiConstant { ...@@ -75,10 +75,13 @@ public class GatewayApiConstant {
//获取文件夹树 //获取文件夹树
public static final String folderTree = "/api/producer/getFileCatalog"; public static final String folderTree = "/api/producer/getFileCatalog";
//获取文件夹树 //服务开发---获取ApiId
public static final String getApiId = "/api/producer/getCustomApiId"; 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); private static Logger logger = LoggerFactory.getLogger(GatewayApiConstant.class);
/* /*
...@@ -95,12 +98,15 @@ public class GatewayApiConstant { ...@@ -95,12 +98,15 @@ public class GatewayApiConstant {
Map jsonObject = JSONObject.parseObject(resultData); Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) { if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) { if ("200".equals(jsonObject.get("code").toString())) {
return JsonResult.ok(jsonObject.get("data")); if (jsonObject.containsKey("data"))
return JsonResult.ok(jsonObject.get("data"));
else
return JsonResult.ok();
} }
} }
if (jsonObject.containsKey("message")) { if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("message").toString()); logger.info(jsonObject.get("msg").toString());
result.setMessage(jsonObject.get("message").toString()); result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
...@@ -109,22 +115,50 @@ public class GatewayApiConstant { ...@@ -109,22 +115,50 @@ public class GatewayApiConstant {
/* /*
* get 请求获取数据 * get 请求获取数据
* */ * */
public static JsonResult getRequest2GetData(String url, Map params) { public static JsonResult getRequest2GetData(String url, Map params) throws Exception {
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
String returnData = HttpClientUtils.getJsonForParam(url, params); String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) { if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("查询失败!"); throw new RuntimeException("failed!");
} }
logger.info("#################响应结果{}" + returnData); logger.info("#################响应结果{}" + returnData);
Map map = JSONObject.parseObject(returnData); Map jsonObject = JSONObject.parseObject(returnData);
if (map.containsKey("code")) { if (jsonObject.containsKey("code")) {
if ("200".equals(map.get("code").toString())) { if ("200".equals(jsonObject.get("code").toString())) {
return JsonResult.ok(map.get("data")); 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")) { if (jsonObject.containsKey("msg")) {
logger.info(map.get("message").toString()); logger.info(jsonObject.get("msg").toString());
result.setMessage(map.get("message").toString()); result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
......
...@@ -135,14 +135,14 @@ public class DmpApiMangeController { ...@@ -135,14 +135,14 @@ public class DmpApiMangeController {
*/ */
@ApiOperation(value = "获取API详情", notes = "获取API详情") @ApiOperation(value = "获取API详情", notes = "获取API详情")
@GetMapping(value = "/getApiInfo") @GetMapping(value = "/getApiInfo")
@ApiImplicitParam(name = "id", value = "ApiId", required = true) @ApiImplicitParam(name = "apiKey", value = "apiKey", required = true)
public JsonResult getApiInfoByApiId(@RequestParam String id, HttpServletRequest httpRequest) { public JsonResult getApiInfoByApiId(@RequestParam String apiKey, HttpServletRequest httpRequest) {
if (StringUtils.isEmpty(id)) { if (StringUtils.isEmpty(apiKey)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "apiId不能为空!"); return JsonResult.error(ResultCode.PARAMS_ERROR, "apiKey不能为空!");
} }
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
try { try {
jsonResult = dmpApiMangeService.queryApiInfoByApiId(id); jsonResult = dmpApiMangeService.queryApiInfoByApiId(apiKey);
} 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);
......
...@@ -331,6 +331,26 @@ public class DmpApiServiceMangeController { ...@@ -331,6 +331,26 @@ public class DmpApiServiceMangeController {
return jsonResult; 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; ...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.service;
import com.jz.common.constant.JsonResult; import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceInfoListReq; 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.ApiInterfaceReq;
import com.jz.dmp.modules.controller.dataService.bean.CreateFolderReq;
import com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq; import com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq;
import com.jz.dmp.modules.model.DvRuleT; import com.jz.dmp.modules.model.DvRuleT;
...@@ -113,4 +114,12 @@ public interface DmpApiServiceMangeService { ...@@ -113,4 +114,12 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-19 * @since 2021-01-19
*/ */
JsonResult getApiId() throws Exception; 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; ...@@ -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.ApiInterfaceInfoListReq;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq; import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq;
import com.jz.common.constant.GatewayApiConstant; 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.controller.dataService.bean.MakeBigDataApiReq;
import com.jz.dmp.modules.dao.OfflineSynchDao; import com.jz.dmp.modules.dao.OfflineSynchDao;
import com.jz.dmp.modules.service.DmpApiServiceMangeService; import com.jz.dmp.modules.service.DmpApiServiceMangeService;
...@@ -97,10 +98,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -97,10 +98,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return result; return result;
} }
} }
if (jsonObject.containsKey("message")) { if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("message").toString()); logger.info(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString()); result.setMessage(jsonObject.get("msg").toString());
} }
return result; return result;
} }
...@@ -137,10 +138,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -137,10 +138,10 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return result; return result;
} }
} }
if (jsonObject.containsKey("message")) { if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("message").toString()); logger.info(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString()); result.setMessage(jsonObject.get("msg").toString());
} }
return result; return result;
} }
...@@ -229,6 +230,21 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -229,6 +230,21 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return result; 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列表 * 服务开发API列表
* *
...@@ -273,9 +289,9 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -273,9 +289,9 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
return JsonResult.ok(map.get("data")); return JsonResult.ok(map.get("data"));
} }
} }
if (map.containsKey("message")) { if (map.containsKey("msg")) {
logger.info(map.get("message").toString()); logger.info(map.get("msg").toString());
result.setMessage(map.get("message").toString()); result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
......
...@@ -59,9 +59,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -59,9 +59,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok(jsonObject.get("data")); return JsonResult.ok(jsonObject.get("data"));
} }
} }
if (jsonObject.containsKey("message")) { if (jsonObject.containsKey("msg")) {
logger.info(jsonObject.get("message").toString()); logger.info(jsonObject.get("msg").toString());
result.setMessage(jsonObject.get("message").toString()); result.setMessage(jsonObject.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
...@@ -117,9 +117,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -117,9 +117,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok(); return JsonResult.ok();
} }
} }
if (map.containsKey("message")) { if (map.containsKey("msg")) {
logger.info(map.get("message").toString()); logger.info(map.get("msg").toString());
result.setMessage(map.get("message").toString()); result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
...@@ -150,9 +150,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -150,9 +150,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok(); return JsonResult.ok();
} }
} }
if (map.containsKey("message")) { if (map.containsKey("msg")) {
logger.info(map.get("message").toString()); logger.info(map.get("msg").toString());
result.setMessage(map.get("message").toString()); result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
...@@ -182,9 +182,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -182,9 +182,9 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
return JsonResult.ok(map.get("data")); return JsonResult.ok(map.get("data"));
} }
} }
if (map.containsKey("message")) { if (map.containsKey("msg")) {
logger.info(map.get("message").toString()); logger.info(map.get("msg").toString());
result.setMessage(map.get("message").toString()); result.setMessage(map.get("msg").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR); result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
} }
return result; return result;
......
...@@ -102,8 +102,8 @@ ...@@ -102,8 +102,8 @@
"executorMemory":"1", //分配任务内存 "executorMemory":"1", //分配任务内存
"driverMemory":"",//分配任务内存 "driverMemory":"",//分配任务内存
"executorCore":"1", //单executor的cpu数 "executorCore":"1", //单executor的cpu数
"driverCore":"1",//单executor的cpu数 "driverCore":"1"//单executor的cpu数
"fieldMapping":""//字段映射关系 //"fieldMapping":""//字段映射关系
}, },
"reader": { "reader": {
"sourceDbId": "", "sourceDbId": "",
...@@ -219,8 +219,8 @@ ...@@ -219,8 +219,8 @@
}, },
"mappingRelation":[ "mappingRelation":[
{ {
"source":"", "sourceField":"",
"target":"" "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