Commit 7818ef4f authored by 宋源硕's avatar 宋源硕

Merge branch 'songyuanshuo' into 'dev'

/createProject接口修改

See merge request !437
parents 78b26af1 498a0e3b
......@@ -817,7 +817,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"mutation quickCreateProjct($name:String$description:String$useCaseList:[ID!]!){project{quickCreateProject(input:{name:$name description:$description useCaseIDList:$useCaseList}){id name status description createTime}}}\",\"variables\":"+ request +"}");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"mutation quickCreateProjct($name:String$description:String$useCaseList:[ID!]$duplicatedUseCaseList:[UseCaseWithDuplicateDimension!]){project{quickCreateProject(input:{name:$name description:$description useCaseIDList:$useCaseList duplicatedUseCases:$duplicatedUseCaseList}){id name status description createTime}}}\",\"variables\":"+ request +"}");
Request requestKE = new Request.Builder()
.url("http://10.12.48.80:8089/api/query")
.method("POST", body)
......@@ -834,9 +835,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
String string = response.body().string();
JSONObject jsonObject = JSONObject.parseObject(string);
System.out.println("jsonObject = " + jsonObject);
// 获取id
String testSchemeId = "";
if (jsonObject.getJSONObject("data").getJSONObject("project") != null) {
// System.out.println("jsonObject = " + jsonObject.getJSONObject("data").getJSONObject("project").getJSONObject("quickCreateProject"));
if (!jsonObject.getJSONObject("data").getJSONObject("project").isEmpty()) {
testSchemeId = (String) jsonObject.getJSONObject("data").getJSONObject("project").getJSONObject("quickCreateProject").get("id");
}
......
......@@ -261,6 +261,9 @@ public class TaskController extends BaseController {
* @throws IOException
*/
@ApiOperation("快速创建检测项目(科恩)")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "快速创建检测项目(科恩)", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/createProject", produces="application/json;charset=UTF-8")
public R<String> createProject(@Validated @RequestBody String request) throws IOException {
return R.ok(taskService.createProject(request));
......
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