Commit 18dcd668 authored by yuanshuo's avatar yuanshuo

2024/11/18修改方法

1.添加方法/system/testCase/getUseCaseListNew用于获取测试用例,并且添加对应的实体类
2.查看除pending状态外的车型审查表单时 没有查到enterpriseName字段,这次添加上了。
parent f52b10da
package com.ruoyi.domain.vo;
import lombok.Data;
import java.util.List;
@Data
public class NewScenarioUseCasesVO {
// 场景
private String testScenario;
// 用例VO
List<UseCaseNewVO> useCases;
}
package com.ruoyi.domain.vo;
import lombok.Data;
import java.util.List;
@Data
public class NewStandardVO {
// 标准要求id
private String id;
// 标准要求章节号
private String serialNumber;
// 标准要求
private String requirements;
// 场景及其所属用例VO
List<NewScenarioUseCasesVO> scenarioUseCases;
}
package com.ruoyi.domain.vo;
import lombok.Data;
@Data
public class UseCaseNewVO {
// 用例id
private String id;
// 用例编号
private String customizedID;
// 用例描述
private String description;
}
......@@ -94,4 +94,9 @@ public interface TaskMapper extends BaseMapper<Task> {
* 获取任务企业名称
* */
Task getTaskBySystemTaskId(Long id);
/*
* 获取任务企业名称
* */
Task getTaskByCarTaskId(Long id);
}
......@@ -7,6 +7,7 @@ import com.ruoyi.domain.vo.UseCaseUrlVO;
import com.ruoyi.web.request.TestUseCaseByScenarioRequest;
import com.ruoyi.web.request.TestUseCaseIdListRequest;
import com.ruoyi.web.request.TestUserCaseRequest;
import com.ruoyi.web.response.NewTestUserCaseListResponse;
import com.ruoyi.web.response.TestUserCaseListResponse;
import com.ruoyi.web.response.UseCaseResponse;
......@@ -81,4 +82,9 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @throws IOException
*/
List<String> selectCaseListByScenario(String request) throws IOException;
/*
* 获取科恩数据
**/
NewTestUserCaseListResponse getCaseListNew(String request) throws IOException;
}
......@@ -3,10 +3,7 @@ package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.mapper.TaskUserRelationMapper;
import com.ruoyi.service.ReviewDetailsResultService;
......@@ -64,6 +61,10 @@ public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, Initi
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
//设置企业名称
Task task = taskMapper.getTaskByCarTaskId(carReviewTask.getId());
carReviewTask.setEnterpriseName(task.getEnterpriseName());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
......
......@@ -4,7 +4,10 @@ import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.Task;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewStandardMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
......@@ -34,6 +37,9 @@ public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, Initiali
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
@Autowired
private TaskMapper taskMapper;
// NEW状态下
// 1.standard字段查询当前最新问卷
......@@ -48,6 +54,10 @@ public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, Initiali
// 将问卷赋值到任务
carReviewTask.setStandard(standardTree);
//设置企业名称
Task task = taskMapper.getTaskByCarTaskId(carReviewTask.getId());
carReviewTask.setEnterpriseName(task.getEnterpriseName());
// 生成返回结果
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
response.setCarReviewTask(carReviewTask);
......
......@@ -79,6 +79,10 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
// 获取当前问卷答案
List<ReviewDetailsResult> carResults = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
//设置企业名称
Task task = taskMapper.getTaskByCarTaskId(carReviewTask.getId());
carReviewTask.setEnterpriseName(task.getEnterpriseName());
// 车型审查
setCarDataStatistics(carStandardTree,carResults,carReviewTask);
......
......@@ -4,15 +4,13 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.domain.vo.CaseResultVO;
import com.ruoyi.domain.vo.CountVO;
import com.ruoyi.domain.vo.TestUsecaseVO;
import com.ruoyi.domain.vo.UseCaseUrlVO;
import com.ruoyi.domain.vo.*;
import com.ruoyi.mapper.TestUseCaseMapper;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.request.TestUseCaseByScenarioRequest;
import com.ruoyi.web.request.TestUseCaseIdListRequest;
import com.ruoyi.web.request.TestUserCaseRequest;
import com.ruoyi.web.response.NewTestUserCaseListResponse;
import com.ruoyi.web.response.TestUserCaseListResponse;
import com.ruoyi.web.response.UseCaseResponse;
import okhttp3.*;
......@@ -272,6 +270,51 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
.collect(Collectors.toList());
}
/*
* 获取科恩数据
* */
@Override
public NewTestUserCaseListResponse getCaseListNew(String request) throws IOException {
NewTestUserCaseListResponse caseResponse = new NewTestUserCaseListResponse();
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query regulationItems($name:String!$offset:OffsetConnectionInput$orderBy:OrderByInput$searchFields:Map$withScenarioUseCases:Boolean=true){regulationByName(name:$name){items(offset:$offset orderBy:$orderBy searchFields:$searchFields){totalCount nodes{id serialNumber requirements scenarioUseCases@include(if:$withScenarioUseCases){testScenario useCases{id customizedID description}}}}}}\",\"variables\":"+ request +"}");
Request requestKE = new Request.Builder()
.url("http://10.12.48.80:8089/api/query")
.method("POST", body)
.addHeader("Content-Type", "application/json")
// TODO 连接
.addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjAsInRva2VuaWQiOjYxLCJ0eXBlIjoiYXBpIiwidXNlcm5hbWUiOiJhZG1pbiJ9.48Ggjx-FtOcecf73vAHn0XglwgLXZlfXxhXiLDHWWQE")
// .addHeader("Host", "10.12.48.80:8089")
// .addHeader("Origin", "http://10.12.48.80:8089")
// .addHeader("Referer", "http://10.12.48.80:8089/api/graphql/playground")
// .addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
.build();
Response response = client.newCall(requestKE).execute();
String string = response.body().string();
JSONObject jsonObject = JSONObject.parseObject(string);
// 获取测试标准
if (jsonObject.getJSONObject("data").getJSONObject("regulationByName") != null) {
List<NewStandardVO> list = jsonObject.getJSONObject("data").getJSONObject("regulationByName").getJSONObject("items").getList("nodes", NewStandardVO.class);
caseResponse.setUseCases(list);
// 获取总条数
Integer totalCount = (Integer) jsonObject.getJSONObject("data").getJSONObject("regulationByName").getJSONObject("items").get("totalCount");
caseResponse.setTotalCount(totalCount);
} else {
caseResponse.setUseCases(new ArrayList<>());
caseResponse.setTotalCount(0);
}
return caseResponse;
}
}
......
......@@ -8,6 +8,7 @@ import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.request.TestUseCaseByScenarioRequest;
import com.ruoyi.web.request.TestUseCaseIdListRequest;
import com.ruoyi.web.request.TestUserCaseRequest;
import com.ruoyi.web.response.NewTestUserCaseListResponse;
import com.ruoyi.web.response.TestUserCaseListResponse;
import com.ruoyi.web.response.UseCaseResponse;
import io.swagger.annotations.Api;
......@@ -124,4 +125,13 @@ public class TestUserCaseController extends BaseController{
}
@ApiOperation("查询测试用例(科恩)改版")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getUseCaseListNew", produces="application/json;charset=UTF-8")
public R<NewTestUserCaseListResponse> getUseCaseListNew(@Validated @RequestBody String request) throws IOException {
return R.ok(testUseCaseService.getCaseListNew(request));
}
}
package com.ruoyi.web.response;
import com.ruoyi.domain.vo.NewStandardVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel(value = "NewTestUserCaseListResponse", description = "查询测试用例")
@Data
public class NewTestUserCaseListResponse {
@ApiModelProperty("测试用例")
List<NewStandardVO> useCases;
@ApiModelProperty("总条数")
Integer totalCount;
@ApiModelProperty("用例总条数")
Integer useCaseNum;
}
......@@ -443,6 +443,11 @@
from t_task
where system_review_task_id = #{id}
</select>
<select id="getTaskByCarTaskId" resultType="com.ruoyi.domain.Task">
select *
from t_task
where car_review_task_id = #{id}
</select>
</mapper>
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