refactor(用例管理): provider加错误日志读取文件关闭流
This commit is contained in:
parent
6a04e8c4dd
commit
bb3c121b8b
|
@ -60,16 +60,20 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
||||||
* 1.关联用例(单独/批量)重新计算用例评审的通过率和用例数
|
* 1.关联用例(单独/批量)重新计算用例评审的通过率和用例数
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByAssociate(Map<String, Object> paramMap) {
|
private void updateCaseReviewByAssociate(Map<String, Object> paramMap) {
|
||||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
try {
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
//获取关联前的caseIds
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListIncludes(reviewId, caseIdList, false);
|
//获取关联前的caseIds
|
||||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListIncludes(reviewId, caseIdList, false);
|
||||||
int caseCount = Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString()) + caseReviewFunctionalCases.size();
|
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||||
int passNumber = passList.size();
|
int caseCount = Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString()) + caseReviewFunctionalCases.size();
|
||||||
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
int passNumber = passList.size();
|
||||||
updateCaseReview(reviewId, caseCount, passNumber, unCompletedCaseList.size()+Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString()), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
||||||
|
updateCaseReview(reviewId, caseCount, passNumber, unCompletedCaseList.size() + Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString()), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.ASSOCIATE + "事件更新失败", e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,24 +82,28 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
||||||
* 2.删除用例和用例评审人的关系
|
* 2.删除用例和用例评审人的关系
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByDisAssociate(Map<String, Object> paramMap) {
|
private void updateCaseReviewByDisAssociate(Map<String, Object> paramMap) {
|
||||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
try {
|
||||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||||
if (caseReview == null) {
|
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||||
return;
|
if (caseReview == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
|
//获取与选中case无关的其他case
|
||||||
|
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListIncludes(reviewId, caseIdList, false);
|
||||||
|
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||||
|
int caseCount = caseReviewFunctionalCases.size() - caseIdList.size();
|
||||||
|
int passNumber = passList.size();
|
||||||
|
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
||||||
|
updateCaseReview(reviewId, caseReview.getCaseCount() - caseCount, passNumber, unCompletedCaseList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||||
|
//删除用例和用例评审人的关系
|
||||||
|
deleteCaseReviewFunctionalCaseUser(paramMap);
|
||||||
|
//将评审历史状态置为true
|
||||||
|
extCaseReviewHistoryMapper.updateDelete(caseIdList, reviewId, true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.DISASSOCIATE + "事件更新失败", e.getMessage());
|
||||||
}
|
}
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
|
||||||
//获取与选中case无关的其他case
|
|
||||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListIncludes(reviewId, caseIdList, false);
|
|
||||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
|
||||||
int caseCount = caseReviewFunctionalCases.size()- caseIdList.size();
|
|
||||||
int passNumber = passList.size();
|
|
||||||
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
|
||||||
updateCaseReview(reviewId, caseReview.getCaseCount() - caseCount, passNumber, unCompletedCaseList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
|
||||||
//删除用例和用例评审人的关系
|
|
||||||
deleteCaseReviewFunctionalCaseUser(paramMap);
|
|
||||||
//将评审历史状态置为true
|
|
||||||
extCaseReviewHistoryMapper.updateDelete(caseIdList,reviewId,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,78 +112,98 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
||||||
* 2.删除用例和用例评审人的关系
|
* 2.删除用例和用例评审人的关系
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByBatchDisassociate(Map<String, Object> paramMap) {
|
private void updateCaseReviewByBatchDisassociate(Map<String, Object> paramMap) {
|
||||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
try {
|
||||||
CaseReview caseReviewOld = caseReviewMapper.selectByPrimaryKey(reviewId);
|
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||||
Integer oldCaseCount = caseReviewOld.getCaseCount();
|
CaseReview caseReviewOld = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
Integer oldCaseCount = caseReviewOld.getCaseCount();
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
if (CollectionUtils.isEmpty(caseIdList)) {
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
return;
|
if (CollectionUtils.isEmpty(caseIdList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int passNumber = Integer.parseInt(paramMap.get(CaseEvent.Param.PASS_COUNT).toString());
|
||||||
|
int unCompletedCount = Integer.parseInt(paramMap.get(CaseEvent.Param.UN_COMPLETED_COUNT).toString());
|
||||||
|
updateCaseReview(reviewId, oldCaseCount - caseIdList.size(), passNumber, unCompletedCount, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||||
|
//删除用例和用例评审人的关系
|
||||||
|
deleteCaseReviewFunctionalCaseUser(paramMap);
|
||||||
|
//将评审历史状态置为true
|
||||||
|
extCaseReviewHistoryMapper.updateDelete(caseIdList, reviewId, true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.BATCH_DISASSOCIATE + "事件更新失败", e.getMessage());
|
||||||
}
|
}
|
||||||
int passNumber = Integer.parseInt(paramMap.get(CaseEvent.Param.PASS_COUNT).toString());
|
|
||||||
int unCompletedCount = Integer.parseInt(paramMap.get(CaseEvent.Param.UN_COMPLETED_COUNT).toString());
|
|
||||||
updateCaseReview(reviewId, oldCaseCount - caseIdList.size(), passNumber, unCompletedCount, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
|
||||||
//删除用例和用例评审人的关系
|
|
||||||
deleteCaseReviewFunctionalCaseUser(paramMap);
|
|
||||||
//将评审历史状态置为true
|
|
||||||
extCaseReviewHistoryMapper.updateDelete(caseIdList,reviewId,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4.功能用例的删除/批量删除重新计算用例评审的通过率和用例数
|
* 4.功能用例的删除/批量删除重新计算用例评审的通过率和用例数
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByDeleteFunctionalCase(Map<String, Object> paramMap) {
|
private void updateCaseReviewByDeleteFunctionalCase(Map<String, Object> paramMap) {
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
try {
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
startUpdateCaseReview(paramMap, caseIdList);
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
|
startUpdateCaseReview(paramMap, caseIdList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.DELETE_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 5.功能用例的回收站删除/批量删除重新计算用例评审的通过率和用例数
|
* 5.功能用例的回收站删除/批量删除重新计算用例评审的通过率和用例数
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByDeleteTrashFunctionalCase(Map<String, Object> paramMap) {
|
private void updateCaseReviewByDeleteTrashFunctionalCase(Map<String, Object> paramMap) {
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
try {
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
if (startUpdateCaseReview(paramMap, caseIdList)) return;
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
CaseReviewFunctionalCaseUserExample caseReviewFunctionalCaseUserExample = new CaseReviewFunctionalCaseUserExample();
|
if (startUpdateCaseReview(paramMap, caseIdList)) return;
|
||||||
caseReviewFunctionalCaseUserExample.createCriteria().andCaseIdIn(caseIdList);
|
CaseReviewFunctionalCaseUserExample caseReviewFunctionalCaseUserExample = new CaseReviewFunctionalCaseUserExample();
|
||||||
caseReviewFunctionalCaseUserMapper.deleteByExample(caseReviewFunctionalCaseUserExample);
|
caseReviewFunctionalCaseUserExample.createCriteria().andCaseIdIn(caseIdList);
|
||||||
//从回收站删除也删除关联关系
|
caseReviewFunctionalCaseUserMapper.deleteByExample(caseReviewFunctionalCaseUserExample);
|
||||||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
//从回收站删除也删除关联关系
|
||||||
caseReviewFunctionalCaseExample.createCriteria().andCaseIdIn(caseIdList);
|
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||||
caseReviewFunctionalCaseMapper.deleteByExample(caseReviewFunctionalCaseExample);
|
caseReviewFunctionalCaseExample.createCriteria().andCaseIdIn(caseIdList);
|
||||||
|
caseReviewFunctionalCaseMapper.deleteByExample(caseReviewFunctionalCaseExample);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.DELETE_TRASH_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 6.功能用例的回收站恢复/批量恢复重新计算用例评审的通过率和用例数
|
* 6.功能用例的回收站恢复/批量恢复重新计算用例评审的通过率和用例数
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByRecoverFunctionalCase(Map<String, Object> paramMap) {
|
private void updateCaseReviewByRecoverFunctionalCase(Map<String, Object> paramMap) {
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
try {
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
CaseReviewFunctionalCaseExample functionalCaseExample = new CaseReviewFunctionalCaseExample();
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
functionalCaseExample.createCriteria().andCaseIdIn(caseIdList);
|
CaseReviewFunctionalCaseExample functionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||||
List<CaseReviewFunctionalCase> recoverCases = caseReviewFunctionalCaseMapper.selectByExample(functionalCaseExample);
|
functionalCaseExample.createCriteria().andCaseIdIn(caseIdList);
|
||||||
if (CollectionUtils.isEmpty(recoverCases)) {
|
List<CaseReviewFunctionalCase> recoverCases = caseReviewFunctionalCaseMapper.selectByExample(functionalCaseExample);
|
||||||
return;
|
if (CollectionUtils.isEmpty(recoverCases)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<String> reviewIds = recoverCases.stream().map(CaseReviewFunctionalCase::getReviewId).distinct().toList();
|
||||||
|
Map<String, List<CaseReviewFunctionalCase>> recoverCaseMap = recoverCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
||||||
|
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(reviewIds, caseIdList, false);
|
||||||
|
Map<String, List<CaseReviewFunctionalCase>> reviewIdMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
||||||
|
CaseReviewExample caseReviewExample = new CaseReviewExample();
|
||||||
|
caseReviewExample.createCriteria().andIdIn(reviewIds);
|
||||||
|
List<CaseReview> caseReviews = caseReviewMapper.selectByExample(caseReviewExample);
|
||||||
|
Map<String, CaseReview> reviewMap = caseReviews.stream().collect(Collectors.toMap(CaseReview::getId, t -> t));
|
||||||
|
reviewMap.forEach((reviewId, caseReview) -> {
|
||||||
|
List<CaseReviewFunctionalCase> recoverCaseList = recoverCaseMap.get(reviewId);
|
||||||
|
List<CaseReviewFunctionalCase> caseReviewFunctionalCaseList = reviewIdMap.get(reviewId);
|
||||||
|
if (CollectionUtils.isNotEmpty(caseReviewFunctionalCaseList)) {
|
||||||
|
caseReviewFunctionalCaseList.addAll(recoverCaseList);
|
||||||
|
} else {
|
||||||
|
caseReviewFunctionalCaseList = recoverCaseList;
|
||||||
|
}
|
||||||
|
List<String> ids = caseReviewFunctionalCaseList.stream().map(CaseReviewFunctionalCase::getId).toList();
|
||||||
|
List<CaseReviewFunctionalCase> unCompleteList = getUnCompletedCaseList(caseReviewFunctionalCaseList, ids);
|
||||||
|
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||||
|
updateCaseReview(reviewId, caseReview.getCaseCount() + caseReviewFunctionalCaseList.size(), passList.size(), unCompleteList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.RECOVER_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||||
}
|
}
|
||||||
List<String> reviewIds = recoverCases.stream().map(CaseReviewFunctionalCase::getReviewId).distinct().toList();
|
|
||||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(reviewIds, caseIdList, false);
|
|
||||||
Map<String, List<CaseReviewFunctionalCase>> recoverCaseMap = recoverCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
|
||||||
Map<String, List<CaseReviewFunctionalCase>> reviewIdMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
|
||||||
CaseReviewExample caseReviewExample = new CaseReviewExample();
|
|
||||||
caseReviewExample.createCriteria().andIdIn(reviewIds);
|
|
||||||
List<CaseReview> caseReviews = caseReviewMapper.selectByExample(caseReviewExample);
|
|
||||||
Map<String, CaseReview> reviewMap = caseReviews.stream().collect(Collectors.toMap(CaseReview::getId, t -> t));
|
|
||||||
reviewIdMap.forEach((reviewId, caseReviewFunctionalCaseList) -> {
|
|
||||||
CaseReview caseReview = reviewMap.get(reviewId);
|
|
||||||
List<CaseReviewFunctionalCase> recoverCaseList = recoverCaseMap.get(reviewId);
|
|
||||||
caseReviewFunctionalCaseList.addAll(recoverCaseList);
|
|
||||||
List<String> ids = caseReviewFunctionalCaseList.stream().map(CaseReviewFunctionalCase::getId).toList();
|
|
||||||
List<CaseReviewFunctionalCase> unCompleteList = getUnCompletedCaseList(caseReviewFunctionalCaseList, ids);
|
|
||||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
|
||||||
updateCaseReview(reviewId, caseReview.getCaseCount() + caseReviewFunctionalCaseList.size(), passList.size(), unCompleteList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,45 +211,48 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
||||||
* 7.评审用例/批量评审用例重新计算用例评审的通过率和用例评审状态和发送通知
|
* 7.评审用例/批量评审用例重新计算用例评审的通过率和用例评审状态和发送通知
|
||||||
*/
|
*/
|
||||||
private void updateCaseReviewByReviewFunctionalCase(Map<String, Object> paramMap) {
|
private void updateCaseReviewByReviewFunctionalCase(Map<String, Object> paramMap) {
|
||||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
try {
|
||||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(List.of(reviewId), caseIdList, false);
|
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||||
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(List.of(reviewId), caseIdList, false);
|
||||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
||||||
|
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||||
|
|
||||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||||
boolean completed = false;
|
boolean completed = false;
|
||||||
|
|
||||||
String status = paramMap.get(CaseEvent.Param.STATUS).toString();
|
String status = paramMap.get(CaseEvent.Param.STATUS).toString();
|
||||||
List<String> completedStatusList = new ArrayList<>();
|
List<String> completedStatusList = new ArrayList<>();
|
||||||
completedStatusList.add(FunctionalCaseReviewStatus.PASS.toString());
|
completedStatusList.add(FunctionalCaseReviewStatus.PASS.toString());
|
||||||
completedStatusList.add(FunctionalCaseReviewStatus.UN_PASS.toString());
|
completedStatusList.add(FunctionalCaseReviewStatus.UN_PASS.toString());
|
||||||
if (!completedStatusList.contains(status) || CollectionUtils.isNotEmpty(unCompletedCaseList)) {
|
if (!completedStatusList.contains(status) || CollectionUtils.isNotEmpty(unCompletedCaseList)) {
|
||||||
caseReview.setStatus(CaseReviewStatus.UNDERWAY.toString());
|
caseReview.setStatus(CaseReviewStatus.UNDERWAY.toString());
|
||||||
} else {
|
} else {
|
||||||
completed = true;
|
completed = true;
|
||||||
caseReview.setStatus(CaseReviewStatus.COMPLETED.toString());
|
caseReview.setStatus(CaseReviewStatus.COMPLETED.toString());
|
||||||
}
|
}
|
||||||
int passNumber = passList.size();
|
int passNumber = passList.size();
|
||||||
if (StringUtils.equalsIgnoreCase(status, FunctionalCaseReviewStatus.PASS.toString())) {
|
|
||||||
passNumber += caseIdList.size();
|
|
||||||
}
|
|
||||||
//通过率
|
|
||||||
BigDecimal passCount = BigDecimal.valueOf(passNumber);
|
|
||||||
BigDecimal totalCount = BigDecimal.valueOf(caseReview.getCaseCount());
|
|
||||||
if (totalCount.compareTo(BigDecimal.ZERO) == 0) {
|
|
||||||
caseReview.setPassRate(BigDecimal.ZERO);
|
|
||||||
} else {
|
|
||||||
BigDecimal passRate = passCount.divide(totalCount, 2, RoundingMode.HALF_UP);
|
|
||||||
caseReview.setPassRate(passRate);
|
|
||||||
}
|
|
||||||
caseReviewMapper.updateByPrimaryKeySelective(caseReview);
|
|
||||||
|
|
||||||
if (completed) {
|
int pass = Integer.parseInt(paramMap.get(CaseEvent.Param.PASS_COUNT).toString());
|
||||||
reviewSendNoticeService.sendNotice(new ArrayList<>(), paramMap.get(CaseEvent.Param.USER_ID).toString(), reviewId, NoticeConstants.TaskType.CASE_REVIEW_TASK, NoticeConstants.Event.REVIEW_COMPLETED);
|
passNumber += pass;
|
||||||
}
|
//通过率
|
||||||
|
BigDecimal passCount = BigDecimal.valueOf(passNumber);
|
||||||
|
BigDecimal totalCount = BigDecimal.valueOf(caseReview.getCaseCount());
|
||||||
|
if (totalCount.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
caseReview.setPassRate(BigDecimal.ZERO);
|
||||||
|
} else {
|
||||||
|
BigDecimal passRate = passCount.divide(totalCount, 2, RoundingMode.HALF_UP);
|
||||||
|
caseReview.setPassRate(passRate);
|
||||||
|
}
|
||||||
|
caseReviewMapper.updateByPrimaryKeySelective(caseReview);
|
||||||
|
|
||||||
|
if (completed) {
|
||||||
|
reviewSendNoticeService.sendNotice(new ArrayList<>(), paramMap.get(CaseEvent.Param.USER_ID).toString(), reviewId, NoticeConstants.TaskType.CASE_REVIEW_TASK, NoticeConstants.Event.REVIEW_COMPLETED);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.error(CaseEvent.Event.REVIEW_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -149,10 +149,10 @@ public class CaseReviewFunctionalCaseService {
|
||||||
List<CaseReviewFunctionalCase> unCompletedCaseList = caseReviewFunctionalCases.stream().filter(t -> !ids.contains(t.getId()) && statusList.contains(t.getStatus())).toList();
|
List<CaseReviewFunctionalCase> unCompletedCaseList = caseReviewFunctionalCases.stream().filter(t -> !ids.contains(t.getId()) && statusList.contains(t.getStatus())).toList();
|
||||||
List<String> list = caseReviewFunctionalCases.stream().filter(t -> ids.contains(t.getId())).map(CaseReviewFunctionalCase::getCaseId).toList();
|
List<String> list = caseReviewFunctionalCases.stream().filter(t -> ids.contains(t.getId())).map(CaseReviewFunctionalCase::getCaseId).toList();
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.CASE_IDS, list.size());
|
param.put(CaseEvent.Param.CASE_IDS, CollectionUtils.isNotEmpty(list) ? list : new ArrayList<>());
|
||||||
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
||||||
param.put(CaseEvent.Param.PASS_COUNT, passList.size());
|
param.put(CaseEvent.Param.PASS_COUNT, CollectionUtils.isNotEmpty(passList) ? passList.size() : 0);
|
||||||
param.put(CaseEvent.Param.UN_COMPLETED_COUNT, unCompletedCaseList.size());
|
param.put(CaseEvent.Param.UN_COMPLETED_COUNT, CollectionUtils.isNotEmpty(unCompletedCaseList) ? unCompletedCaseList.size() : 0);
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +287,7 @@ public class CaseReviewFunctionalCaseService {
|
||||||
CaseReviewHistoryMapper caseReviewHistoryMapper = sqlSession.getMapper(CaseReviewHistoryMapper.class);
|
CaseReviewHistoryMapper caseReviewHistoryMapper = sqlSession.getMapper(CaseReviewHistoryMapper.class);
|
||||||
CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class);
|
CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class);
|
||||||
|
|
||||||
|
int passCount = 0;
|
||||||
for (CaseReviewFunctionalCase caseReviewFunctionalCase : caseReviewFunctionalCaseList) {
|
for (CaseReviewFunctionalCase caseReviewFunctionalCase : caseReviewFunctionalCaseList) {
|
||||||
String caseId = caseReviewFunctionalCase.getCaseId();
|
String caseId = caseReviewFunctionalCase.getCaseId();
|
||||||
CaseReviewHistory caseReviewHistory = buildCaseReviewHistory(request, userId, caseId);
|
CaseReviewHistory caseReviewHistory = buildCaseReviewHistory(request, userId, caseId);
|
||||||
|
@ -300,6 +301,9 @@ public class CaseReviewFunctionalCaseService {
|
||||||
}
|
}
|
||||||
//根据评审规则更新用例评审和功能用例关系表中的状态 1.单人评审直接更新评审结果 2.多人评审需要计算
|
//根据评审规则更新用例评审和功能用例关系表中的状态 1.单人评审直接更新评审结果 2.多人评审需要计算
|
||||||
setStatus(request, caseReviewFunctionalCase, caseHistoryMap, reviewerMap);
|
setStatus(request, caseReviewFunctionalCase, caseHistoryMap, reviewerMap);
|
||||||
|
if (StringUtils.equalsIgnoreCase(caseReviewFunctionalCase.getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
|
||||||
|
passCount += 1;
|
||||||
|
}
|
||||||
caseReviewFunctionalCaseMapper.updateByPrimaryKeySelective(caseReviewFunctionalCase);
|
caseReviewFunctionalCaseMapper.updateByPrimaryKeySelective(caseReviewFunctionalCase);
|
||||||
|
|
||||||
//检查是否有@,发送@通知
|
//检查是否有@,发送@通知
|
||||||
|
@ -319,7 +323,8 @@ public class CaseReviewFunctionalCaseService {
|
||||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||||
|
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.CASE_IDS, caseIds);
|
param.put(CaseEvent.Param.CASE_IDS, CollectionUtils.isNotEmpty(caseIds) ? caseIds : new ArrayList<>());
|
||||||
|
param.put(CaseEvent.Param.PASS_COUNT, passCount);
|
||||||
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
||||||
param.put(CaseEvent.Param.STATUS, request.getStatus());
|
param.put(CaseEvent.Param.STATUS, request.getStatus());
|
||||||
param.put(CaseEvent.Param.USER_ID, userId);
|
param.put(CaseEvent.Param.USER_ID, userId);
|
||||||
|
|
|
@ -470,7 +470,7 @@ public class CaseReviewService {
|
||||||
param.put(CaseEvent.Param.USER_ID, userId);
|
param.put(CaseEvent.Param.USER_ID, userId);
|
||||||
param.put(CaseEvent.Param.REVIEW_ID, caseReviewId);
|
param.put(CaseEvent.Param.REVIEW_ID, caseReviewId);
|
||||||
param.put(CaseEvent.Param.CASE_IDS, castIds);
|
param.put(CaseEvent.Param.CASE_IDS, castIds);
|
||||||
param.put(CaseEvent.Param.CASE_COUNT, caseRealIds.size());
|
param.put(CaseEvent.Param.CASE_COUNT, CollectionUtils.isNotEmpty(caseRealIds) ? caseRealIds.size() : 0);
|
||||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.ASSOCIATE);
|
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.ASSOCIATE);
|
||||||
provider.updateCaseReview(param);
|
provider.updateCaseReview(param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,10 +398,10 @@ public class FunctionalCaseService {
|
||||||
functionalCaseExample.createCriteria().andRefIdIn(refId);
|
functionalCaseExample.createCriteria().andRefIdIn(refId);
|
||||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
||||||
List<String> caseIds = functionalCases.stream().map(FunctionalCase::getId).toList();
|
List<String> caseIds = functionalCases.stream().map(FunctionalCase::getId).toList();
|
||||||
param.put(CaseEvent.Param.CASE_IDS, caseIds);
|
param.put(CaseEvent.Param.CASE_IDS, CollectionUtils.isNotEmpty(caseIds) ? caseIds : new ArrayList<>());
|
||||||
extFunctionalCaseMapper.batchDelete(refId, userId);
|
extFunctionalCaseMapper.batchDelete(refId, userId);
|
||||||
} else {
|
} else {
|
||||||
param.put(CaseEvent.Param.CASE_IDS, ids);
|
param.put(CaseEvent.Param.CASE_IDS, CollectionUtils.isNotEmpty(ids) ? ids : new ArrayList<>());
|
||||||
doDelete(ids, userId);
|
doDelete(ids, userId);
|
||||||
}
|
}
|
||||||
param.put(CaseEvent.Param.USER_ID, userId);
|
param.put(CaseEvent.Param.USER_ID, userId);
|
||||||
|
|
|
@ -57,14 +57,16 @@ public class FunctionalCaseTrashService {
|
||||||
throw new MSException(Translator.get("case_comment.case_is_null"));
|
throw new MSException(Translator.get("case_comment.case_is_null"));
|
||||||
}
|
}
|
||||||
List<String> ids = getIdsByRefId(functionalCase.getRefId());
|
List<String> ids = getIdsByRefId(functionalCase.getRefId());
|
||||||
//检查自定义字段是否还存在,不存在,删除关联关系(与恢复流程没关系可异步执行)
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
delCustomFields(ids);
|
//检查自定义字段是否还存在,不存在,删除关联关系(与恢复流程没关系可异步执行)
|
||||||
Map<String, Object> param = new HashMap<>();
|
delCustomFields(ids);
|
||||||
param.put(CaseEvent.Param.CASE_IDS,ids);
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.USER_ID,userId);
|
param.put(CaseEvent.Param.CASE_IDS,ids);
|
||||||
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.RECOVER_FUNCTIONAL_CASE);
|
param.put(CaseEvent.Param.USER_ID,userId);
|
||||||
provider.updateCaseReview(param);
|
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.RECOVER_FUNCTIONAL_CASE);
|
||||||
extFunctionalCaseMapper.recoverCase(ids,userId,System.currentTimeMillis());
|
provider.updateCaseReview(param);
|
||||||
|
extFunctionalCaseMapper.recoverCase(ids,userId,System.currentTimeMillis());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,7 +106,7 @@ public class FunctionalCaseTrashService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从回收站彻底用例
|
* 从回收站彻底删除用例
|
||||||
* @param id 用例ID
|
* @param id 用例ID
|
||||||
*/
|
*/
|
||||||
public void deleteCase(String id, String userId) {
|
public void deleteCase(String id, String userId) {
|
||||||
|
@ -113,12 +115,14 @@ public class FunctionalCaseTrashService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> ids = getIdsByRefId(functionalCase.getRefId());
|
List<String> ids = getIdsByRefId(functionalCase.getRefId());
|
||||||
deleteFunctionalCaseService.deleteFunctionalCaseResource(ids, functionalCase.getProjectId());
|
if (CollectionUtils.isNotEmpty(ids)){
|
||||||
Map<String, Object> param = new HashMap<>();
|
deleteFunctionalCaseService.deleteFunctionalCaseResource(ids, functionalCase.getProjectId());
|
||||||
param.put(CaseEvent.Param.CASE_IDS,ids);
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.USER_ID,userId);
|
param.put(CaseEvent.Param.CASE_IDS,ids);
|
||||||
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.DELETE_TRASH_FUNCTIONAL_CASE);
|
param.put(CaseEvent.Param.USER_ID,userId);
|
||||||
provider.updateCaseReview(param);
|
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.DELETE_TRASH_FUNCTIONAL_CASE);
|
||||||
|
provider.updateCaseReview(param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getIdsByRefId(String refId) {
|
private List<String> getIdsByRefId(String refId) {
|
||||||
|
@ -138,7 +142,7 @@ public class FunctionalCaseTrashService {
|
||||||
if (request.isSelectAll()) {
|
if (request.isSelectAll()) {
|
||||||
//回收站全部恢复
|
//回收站全部恢复
|
||||||
List<String> ids = getIds(request);
|
List<String> ids = getIds(request);
|
||||||
if (ids == null) return;
|
if (CollectionUtils.isEmpty(ids)) return;
|
||||||
refIds = extFunctionalCaseMapper.getRefIds(ids, true);
|
refIds = extFunctionalCaseMapper.getRefIds(ids, true);
|
||||||
} else {
|
} else {
|
||||||
if (CollectionUtils.isEmpty(request.getSelectIds())) {
|
if (CollectionUtils.isEmpty(request.getSelectIds())) {
|
||||||
|
@ -155,7 +159,7 @@ public class FunctionalCaseTrashService {
|
||||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
||||||
List<String> ids = functionalCases.stream().map(FunctionalCase::getId).toList();
|
List<String> ids = functionalCases.stream().map(FunctionalCase::getId).toList();
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.CASE_IDS,ids);
|
param.put(CaseEvent.Param.CASE_IDS,CollectionUtils.isNotEmpty(ids) ? ids : new ArrayList<>());
|
||||||
param.put(CaseEvent.Param.USER_ID,userId);
|
param.put(CaseEvent.Param.USER_ID,userId);
|
||||||
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.RECOVER_FUNCTIONAL_CASE);
|
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.RECOVER_FUNCTIONAL_CASE);
|
||||||
provider.updateCaseReview(param);
|
provider.updateCaseReview(param);
|
||||||
|
@ -193,7 +197,7 @@ public class FunctionalCaseTrashService {
|
||||||
if (request.isSelectAll()) {
|
if (request.isSelectAll()) {
|
||||||
//判断是否全部删除
|
//判断是否全部删除
|
||||||
List<String> ids = getIds(request);
|
List<String> ids = getIds(request);
|
||||||
if (ids == null) return;
|
if (CollectionUtils.isEmpty(ids)) return;
|
||||||
if (request.getDeleteAll()) {
|
if (request.getDeleteAll()) {
|
||||||
//回收站全部版本全都删除
|
//回收站全部版本全都删除
|
||||||
refIds = extFunctionalCaseMapper.getRefIds(ids, true);
|
refIds = extFunctionalCaseMapper.getRefIds(ids, true);
|
||||||
|
@ -237,7 +241,7 @@ public class FunctionalCaseTrashService {
|
||||||
List<String> deleteIds = functionalCases.stream().map(FunctionalCase::getId).toList();
|
List<String> deleteIds = functionalCases.stream().map(FunctionalCase::getId).toList();
|
||||||
deleteFunctionalCaseService.deleteFunctionalCaseResource(deleteIds, request.getProjectId());
|
deleteFunctionalCaseService.deleteFunctionalCaseResource(deleteIds, request.getProjectId());
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.CASE_IDS,deleteIds);
|
param.put(CaseEvent.Param.CASE_IDS,CollectionUtils.isNotEmpty(deleteIds) ? deleteIds : new ArrayList<>());
|
||||||
param.put(CaseEvent.Param.USER_ID,userId);
|
param.put(CaseEvent.Param.USER_ID,userId);
|
||||||
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.DELETE_TRASH_FUNCTIONAL_CASE);
|
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.DELETE_TRASH_FUNCTIONAL_CASE);
|
||||||
provider.updateCaseReview(param);
|
provider.updateCaseReview(param);
|
||||||
|
|
|
@ -68,6 +68,10 @@ public class ReviewFunctionalCaseService {
|
||||||
String functionalCaseStatus = getFunctionalCaseStatus(request, hasReviewedUserMap);
|
String functionalCaseStatus = getFunctionalCaseStatus(request, hasReviewedUserMap);
|
||||||
extCaseReviewFunctionalCaseMapper.updateStatus(caseId, reviewId, functionalCaseStatus);
|
extCaseReviewFunctionalCaseMapper.updateStatus(caseId, reviewId, functionalCaseStatus);
|
||||||
caseReviewHistoryMapper.insert(caseReviewHistory);
|
caseReviewHistoryMapper.insert(caseReviewHistory);
|
||||||
|
int passCount = 0;
|
||||||
|
if (StringUtils.equalsIgnoreCase(FunctionalCaseReviewStatus.PASS.toString(),functionalCaseStatus)) {
|
||||||
|
passCount=1;
|
||||||
|
}
|
||||||
|
|
||||||
//检查是否有@,发送@通知
|
//检查是否有@,发送@通知
|
||||||
if (StringUtils.isNotBlank(request.getNotifier())) {
|
if (StringUtils.isNotBlank(request.getNotifier())) {
|
||||||
|
@ -83,6 +87,7 @@ public class ReviewFunctionalCaseService {
|
||||||
}
|
}
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put(CaseEvent.Param.CASE_IDS, List.of(caseId));
|
param.put(CaseEvent.Param.CASE_IDS, List.of(caseId));
|
||||||
|
param.put(CaseEvent.Param.PASS_COUNT,passCount);
|
||||||
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
||||||
param.put(CaseEvent.Param.STATUS, request.getStatus());
|
param.put(CaseEvent.Param.STATUS, request.getStatus());
|
||||||
param.put(CaseEvent.Param.USER_ID, userId);
|
param.put(CaseEvent.Param.USER_ID, userId);
|
||||||
|
|
|
@ -66,12 +66,24 @@ VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID_g', 8, 'Trash_TEST_MOUDLE_ID_1', 'project
|
||||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||||
VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID_GYQ', 100, 'Trash_TEST_MOUDLE_ID', 'project-case-trash-test', '100001', '回收站测信', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'Trash_TEST_FUNCTIONAL_CASE_ID_GYQ', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID_GYQ', 100, 'Trash_TEST_MOUDLE_ID', 'project-case-trash-test', '100001', '回收站测信', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'Trash_TEST_FUNCTIONAL_CASE_ID_GYQ', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||||
|
|
||||||
|
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||||
|
VALUES ('unTrash_TEST_FUNCTIONAL_CASE_ID', 100, 'Trash_TEST_MOUDLE_ID', 'project-case-trash-test', '100001', '回收站测信', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'unTrash_TEST_FUNCTIONAL_CASE_ID', 'UN_EXECUTED', false, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||||
|
|
||||||
INSERT INTO case_review_functional_case(id, review_id, case_id, status, create_time, create_user, update_time, pos)
|
INSERT INTO case_review_functional_case(id, review_id, case_id, status, create_time, create_user, update_time, pos)
|
||||||
VALUES ('Gyq_Review_Case_Id','Gyq_review_id', 'Trash_TEST_FUNCTIONAL_CASE_ID', 'PASS', 1698058347559, 'admin',1698058347559, 0);
|
VALUES ('Gyq_Review_Case_Id','Gyq_review_id', 'Trash_TEST_FUNCTIONAL_CASE_ID', 'PASS', 1698058347559, 'admin',1698058347559, 0);
|
||||||
|
|
||||||
|
INSERT INTO case_review_functional_case(id, review_id, case_id, status, create_time, create_user, update_time, pos)
|
||||||
|
VALUES ('Gyq_Review_Case_Id2','Gyq_review_id1', 'Trash_TEST_FUNCTIONAL_CASE_ID_1', 'PASS', 1698058347559, 'admin',1698058347559, 0);
|
||||||
|
|
||||||
|
INSERT INTO case_review_functional_case(id, review_id, case_id, status, create_time, create_user, update_time, pos)
|
||||||
|
VALUES ('Gyq_Review_Case_Id3','Gyq_review_id1', 'unTrash_TEST_FUNCTIONAL_CASE_ID', 'PASS', 1698058347559, 'admin',1698058347559, 0);
|
||||||
|
|
||||||
INSERT INTO case_review(id, num, name, module_id, project_id, status, review_pass_rule, pos, start_time, end_time, case_count, pass_rate, tags, description, create_time, create_user, update_time, update_user)
|
INSERT INTO case_review(id, num, name, module_id, project_id, status, review_pass_rule, pos, start_time, end_time, case_count, pass_rate, tags, description, create_time, create_user, update_time, update_user)
|
||||||
VALUES ('Gyq_review_id', 10001, '用例评审1', 'Trash_TEST_MOUDLE_ID_1', 'project-case-trash-test', 'COMPLETE' , 'SINGLE', 0, 1698058347559, 1698058347559, 1, 100.00, null, null, 1698058347559, 'admin', 1698058347559, 'admin');
|
VALUES ('Gyq_review_id', 10001, '用例评审1', 'Trash_TEST_MOUDLE_ID_1', 'project-case-trash-test', 'COMPLETE' , 'SINGLE', 0, 1698058347559, 1698058347559, 1, 100.00, null, null, 1698058347559, 'admin', 1698058347559, 'admin');
|
||||||
|
|
||||||
|
INSERT INTO case_review(id, num, name, module_id, project_id, status, review_pass_rule, pos, start_time, end_time, case_count, pass_rate, tags, description, create_time, create_user, update_time, update_user)
|
||||||
|
VALUES ('Gyq_review_id1', 10001, '用例评审2', 'Trash_TEST_MOUDLE_ID_1', 'project-case-trash-test', 'COMPLETE' , 'SINGLE', 0, 1698058347559, 1698058347559, 1, 100.00, null, null, 1698058347559, 'admin', 1698058347559, 'admin');
|
||||||
|
|
||||||
INSERT INTO functional_case_custom_field(case_id, field_id, value) VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID', 'gyq_custom_id1', '22');
|
INSERT INTO functional_case_custom_field(case_id, field_id, value) VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID', 'gyq_custom_id1', '22');
|
||||||
INSERT INTO functional_case_custom_field(case_id, field_id, value) VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID', 'gyq_custom_id2', '33');
|
INSERT INTO functional_case_custom_field(case_id, field_id, value) VALUES ('Trash_TEST_FUNCTIONAL_CASE_ID', 'gyq_custom_id2', '33');
|
||||||
|
|
||||||
|
|
|
@ -78,15 +78,16 @@ public class CreateRobotResourceService implements CreateProjectResourceService
|
||||||
|
|
||||||
public void setMessageTask(String projectId, String defaultRobotId) {
|
public void setMessageTask(String projectId, String defaultRobotId) {
|
||||||
StringBuilder jsonStr = new StringBuilder();
|
StringBuilder jsonStr = new StringBuilder();
|
||||||
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
|
||||||
assert inputStream != null;
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
|
||||||
String line;
|
|
||||||
try {
|
try {
|
||||||
|
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
||||||
|
assert inputStream != null;
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
jsonStr.append(line);
|
jsonStr.append(line);
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,13 +320,20 @@ public class NoticeMessageTaskService {
|
||||||
checkProjectExist(projectId);
|
checkProjectExist(projectId);
|
||||||
//获取返回数据结构
|
//获取返回数据结构
|
||||||
StringBuilder jsonStr = new StringBuilder();
|
StringBuilder jsonStr = new StringBuilder();
|
||||||
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
try{
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
||||||
String line;
|
assert inputStream != null;
|
||||||
while ((line = reader.readLine()) != null) {
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
jsonStr.append(line);
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
jsonStr.append(line);
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e){
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
reader.close();
|
|
||||||
List<MessageTaskDTO> messageTaskDTOList = JSON.parseArray(jsonStr.toString(), MessageTaskDTO.class);
|
List<MessageTaskDTO> messageTaskDTOList = JSON.parseArray(jsonStr.toString(), MessageTaskDTO.class);
|
||||||
//查询数据
|
//查询数据
|
||||||
MessageTaskExample messageTaskExample = new MessageTaskExample();
|
MessageTaskExample messageTaskExample = new MessageTaskExample();
|
||||||
|
|
|
@ -595,18 +595,19 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
|
||||||
|
|
||||||
public void setMessageTask(String projectId, String defaultRobotId) {
|
public void setMessageTask(String projectId, String defaultRobotId) {
|
||||||
StringBuilder jsonStr = new StringBuilder();
|
StringBuilder jsonStr = new StringBuilder();
|
||||||
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
|
||||||
String line;
|
|
||||||
try {
|
try {
|
||||||
|
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
jsonStr.append(line);
|
jsonStr.append(line);
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
MessageTaskMapper mapper = sqlSession.getMapper(MessageTaskMapper.class);
|
MessageTaskMapper mapper = sqlSession.getMapper(MessageTaskMapper.class);
|
||||||
MessageTaskBlobMapper blobMapper = sqlSession.getMapper(MessageTaskBlobMapper.class);
|
MessageTaskBlobMapper blobMapper = sqlSession.getMapper(MessageTaskBlobMapper.class);
|
||||||
|
|
|
@ -516,18 +516,18 @@ public class ProjectRobotControllerTests extends BaseTest {
|
||||||
|
|
||||||
public void setMessageTask(String projectId, String defaultRobotId) throws Exception {
|
public void setMessageTask(String projectId, String defaultRobotId) throws Exception {
|
||||||
StringBuilder jsonStr = new StringBuilder();
|
StringBuilder jsonStr = new StringBuilder();
|
||||||
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
|
||||||
String line;
|
|
||||||
try {
|
try {
|
||||||
|
InputStream inputStream = getClass().getResourceAsStream("/message_task.json");
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
jsonStr.append(line);
|
jsonStr.append(line);
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
MessageTaskMapper mapper = sqlSession.getMapper(MessageTaskMapper.class);
|
MessageTaskMapper mapper = sqlSession.getMapper(MessageTaskMapper.class);
|
||||||
MessageTaskBlobMapper blobMapper = sqlSession.getMapper(MessageTaskBlobMapper.class);
|
MessageTaskBlobMapper blobMapper = sqlSession.getMapper(MessageTaskBlobMapper.class);
|
||||||
|
|
|
@ -41,6 +41,9 @@ INSERT INTO project_robot(id, project_id, name, platform, webhook, type, app_key
|
||||||
('test_message_robot4', 'project-message-test-3', '测试机器人1', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null),
|
('test_message_robot4', 'project-message-test-3', '测试机器人1', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null),
|
||||||
('test_message_robot5', 'project-message-test', '测试机器人6', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null);
|
('test_message_robot5', 'project-message-test', '测试机器人6', 'IN_SITE', 'NONE', null, null, null, true, 'admin', unix_timestamp() * 1000,'admin', unix_timestamp() * 1000, null);
|
||||||
|
|
||||||
|
INSERT INTO custom_field(id, name, scene, `type`, remark, internal, scope_type, create_time, update_time, create_user, scope_id)
|
||||||
|
VALUES('gyq_custom_id_message1', 'gyq_functional_priority', 'FUNCTIONAL', 'SELECT', '', 1, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'project-message-test');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue