fix(功能用例): 尝试修复功能用例脑图保存立即查看报错问题
This commit is contained in:
parent
581b5dfca5
commit
117a0c3d33
|
@ -0,0 +1 @@
|
|||
select database();
|
|
@ -0,0 +1,12 @@
|
|||
-- set innodb lock wait timeout
|
||||
SET SESSION innodb_lock_wait_timeout = 7200;
|
||||
|
||||
DROP TABLE IF EXISTS functional_mind_insert_relation;
|
||||
|
||||
|
||||
|
||||
-- set innodb lock wait timeout to default
|
||||
SET SESSION innodb_lock_wait_timeout = DEFAULT;
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- set innodb lock wait timeout
|
||||
SET SESSION innodb_lock_wait_timeout = 7200;
|
||||
|
||||
DROP TABLE IF EXISTS functional_minder_extra_node;
|
||||
|
||||
|
||||
-- set innodb lock wait timeout to default
|
||||
SET SESSION innodb_lock_wait_timeout = DEFAULT;
|
|
@ -65,7 +65,7 @@ public class FunctionalCaseMinderController {
|
|||
@Operation(summary = "用例管理-功能用例-脑图用例跟根据模块ID查询列表")
|
||||
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_MINDER)
|
||||
@CheckOwner(resourceId = "#request.getReviewId()", resourceType = "case_review")
|
||||
public List<FunctionalMinderTreeDTO> getReviewMindFunctionalCase(@Validated @RequestBody FunctionalCaseReviewMindRequest request) {
|
||||
public Pager<List<FunctionalMinderTreeDTO>> getReviewMindFunctionalCase(@Validated @RequestBody FunctionalCaseReviewMindRequest request) {
|
||||
String userId = StringUtils.EMPTY;
|
||||
if (request.isViewFlag()) {
|
||||
userId = SessionUtils.getUserId();
|
||||
|
@ -74,15 +74,16 @@ public class FunctionalCaseMinderController {
|
|||
if (request.isViewStatusFlag()) {
|
||||
viewStatusUserId = SessionUtils.getUserId();
|
||||
}
|
||||
return functionalCaseMinderService.getReviewMindFunctionalCase(request, false, userId, viewStatusUserId);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), 100 );
|
||||
return PageUtils.setPageInfo(page, functionalCaseMinderService.getReviewMindFunctionalCase(request, false, userId, viewStatusUserId));
|
||||
}
|
||||
|
||||
@PostMapping("/plan/list")
|
||||
@Operation(summary = "测试计划-功能用例-脑图用例跟根据模块ID查询列表")
|
||||
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_MINDER)
|
||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||
public List<FunctionalMinderTreeDTO> getPlanFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCasePlanMindRequest request) {
|
||||
return functionalCaseMinderService.getPlanMindFunctionalCase(request, false);
|
||||
public Pager<List<FunctionalMinderTreeDTO>> getPlanFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCasePlanMindRequest request) { Page<Object> page = PageHelper.startPage(request.getCurrent(), 100 );
|
||||
return PageUtils.setPageInfo(page, functionalCaseMinderService.getPlanMindFunctionalCase(request, false));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import io.metersphere.system.mapper.CustomFieldMapper;
|
|||
import io.metersphere.system.mapper.UserMapper;
|
||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||
import io.metersphere.system.service.CommonNoticeSendService;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
|
@ -752,7 +751,7 @@ public class FunctionalCaseMinderService {
|
|||
|
||||
private MindAdditionalNode buildNode(FunctionalCaseMinderEditRequest request, String userId, MindAdditionalNodeRequest mindAdditionalNodeRequest, MindAdditionalNodeMapper additionalNodeMapper) {
|
||||
MindAdditionalNode mindAdditionalNode = new MindAdditionalNode();
|
||||
mindAdditionalNode.setId(IDGenerator.nextStr());
|
||||
mindAdditionalNode.setId(mindAdditionalNodeRequest.getId());
|
||||
if (mindAdditionalNodeRequest.getName().length()>255) {
|
||||
mindAdditionalNodeRequest.setName(mindAdditionalNodeRequest.getName().substring(0,249));
|
||||
}
|
||||
|
@ -930,7 +929,7 @@ public class FunctionalCaseMinderService {
|
|||
@NotNull
|
||||
private FunctionalCaseModule buildModule(FunctionalCaseMinderEditRequest request, String userId, FunctionalCaseModuleEditRequest functionalCaseModuleEditRequest) {
|
||||
FunctionalCaseModule functionalCaseModule = new FunctionalCaseModule();
|
||||
functionalCaseModule.setId(IDGenerator.nextStr());
|
||||
functionalCaseModule.setId(functionalCaseModuleEditRequest.getId());
|
||||
if (StringUtils.isBlank(functionalCaseModuleEditRequest.getName())) {
|
||||
throw new MSException(Translator.get("api_definition_module.name.not_blank"));
|
||||
}
|
||||
|
@ -1101,8 +1100,6 @@ public class FunctionalCaseMinderService {
|
|||
private FunctionalCase addCase(FunctionalCaseMinderEditRequest request, String userId, FunctionalCaseChangeRequest functionalCaseChangeRequest, FunctionalCaseMapper caseMapper, Map<String, String> sourceIdAndInsertModuleIdMap) {
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
BeanUtils.copyBean(functionalCase, functionalCaseChangeRequest);
|
||||
String caseId = IDGenerator.nextStr();
|
||||
functionalCase.setId(caseId);
|
||||
if (StringUtils.isNotBlank(sourceIdAndInsertModuleIdMap.get(functionalCaseChangeRequest.getModuleId()))) {
|
||||
functionalCase.setModuleId(sourceIdAndInsertModuleIdMap.get(functionalCaseChangeRequest.getModuleId()));
|
||||
}
|
||||
|
@ -1117,7 +1114,7 @@ public class FunctionalCaseMinderService {
|
|||
functionalCase.setNum(functionalCaseService.getNextNum(request.getProjectId()));
|
||||
functionalCase.setReviewStatus(FunctionalCaseReviewStatus.UN_REVIEWED.name());
|
||||
functionalCase.setPos(LIMIT_POS);
|
||||
functionalCase.setRefId(caseId);
|
||||
functionalCase.setRefId(functionalCaseChangeRequest.getId());
|
||||
functionalCase.setLastExecuteResult(ExecStatus.PENDING.name());
|
||||
functionalCase.setLatest(true);
|
||||
functionalCase.setCreateUser(userId);
|
||||
|
|
|
@ -381,11 +381,12 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
request.setReviewId("TEST_MINDER_REVIEW_ID_GYQ");
|
||||
request.setCurrent(1);
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_REVIEW_LIST_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<FunctionalMinderTreeDTO> baseTreeNodes = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), FunctionalMinderTreeDTO.class);
|
||||
Assertions.assertNotNull(baseTreeNodes);
|
||||
Assertions.assertEquals(1, baseTreeNodes.size());
|
||||
Pager<List<FunctionalMinderTreeDTO>> tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
|
||||
Assertions.assertNotNull(tableData.getList());
|
||||
Assertions.assertEquals(1, tableData.getList().size());
|
||||
request = new FunctionalCaseReviewMindRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4");
|
||||
|
@ -394,11 +395,11 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
request.setViewStatusFlag(true);
|
||||
request.setCurrent(1);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_REVIEW_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
baseTreeNodes = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), FunctionalMinderTreeDTO.class);
|
||||
Assertions.assertNotNull(baseTreeNodes);
|
||||
Assertions.assertEquals(1, baseTreeNodes.size());
|
||||
tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData.getList());
|
||||
Assertions.assertEquals(1, tableData.getList().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -410,12 +411,11 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
request.setPlanId("TEST_MINDER_PLAN_ID_1");
|
||||
request.setCurrent(1);
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_PLAN_LIST_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<FunctionalMinderTreeDTO> baseTreeNodes = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), FunctionalMinderTreeDTO.class);
|
||||
Assertions.assertNotNull(baseTreeNodes);
|
||||
Assertions.assertEquals(2, baseTreeNodes.size());
|
||||
System.out.println(baseTreeNodes);
|
||||
Pager<List<FunctionalMinderTreeDTO>> tableData = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
Pager.class);
|
||||
Assertions.assertNotNull(tableData.getList());
|
||||
Assertions.assertEquals(2, tableData.getList().size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -675,18 +675,31 @@ export const getHashParameters = (): Record<string, string> => {
|
|||
return params;
|
||||
};
|
||||
|
||||
let lastTimestamp = 0;
|
||||
let sequence = 0;
|
||||
|
||||
/**
|
||||
* 生成 id 序列号
|
||||
* @returns
|
||||
*/
|
||||
export const getGenerateId = () => {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
const r = (Math.random() * 16) | 0;
|
||||
// eslint-disable-next-line no-bitwise
|
||||
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
let timestamp = new Date().getTime();
|
||||
if (timestamp === lastTimestamp) {
|
||||
sequence++;
|
||||
if (sequence >= 100000) {
|
||||
// 如果超过999,则重置为0,等待下一秒
|
||||
sequence = 0;
|
||||
while (timestamp <= lastTimestamp) {
|
||||
timestamp = new Date().getTime();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sequence = 0;
|
||||
}
|
||||
|
||||
lastTimestamp = timestamp;
|
||||
|
||||
return timestamp.toString() + sequence.toString().padStart(5, '0');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue