Commit e8d0e9f4 authored by 宋源硕's avatar 宋源硕

Merge branch 'songyuanshuo' into 'master'

1.发布评审时进行验重 2.ReviewSceneChangeTask的reviewUsecaseId改为String类型

See merge request !14
parents 4fcb519f 68cfe566
...@@ -235,6 +235,6 @@ public class ReviewSceneChangeTask { ...@@ -235,6 +235,6 @@ public class ReviewSceneChangeTask {
private String usecaseDescribe; private String usecaseDescribe;
@ApiModelProperty("评审用例id") @ApiModelProperty("评审用例id")
private Long reviewUsecaseId; private String reviewUsecaseId;
} }
...@@ -9,6 +9,7 @@ import com.ruoyi.web.response.ReviewKeyPointListResponse; ...@@ -9,6 +9,7 @@ import com.ruoyi.web.response.ReviewKeyPointListResponse;
import com.ruoyi.web.response.ReviewOpinionResponse; import com.ruoyi.web.response.ReviewOpinionResponse;
import com.ruoyi.web.response.ReviewSceneChangeTaskResponse; import com.ruoyi.web.response.ReviewSceneChangeTaskResponse;
import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -22,7 +23,7 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange ...@@ -22,7 +23,7 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange
/** /**
* 新建一个任务 * 新建一个任务
*/ */
void create(ReviewSceneChangeTask reviewSceneChangeTask); void create(ReviewSceneChangeTask reviewSceneChangeTask) throws IOException;
/** /**
* 审核通过一个任务 * 审核通过一个任务
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
...@@ -10,11 +11,8 @@ import com.ruoyi.domain.ReviewSceneChangeTask; ...@@ -10,11 +11,8 @@ import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation; import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.ruoyi.framework.web.domain.server.Sys; import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.mapper.ReviewKeyPointMapper; import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.service.ReviewSceneChangeTaskService; import com.ruoyi.service.*;
import com.ruoyi.mapper.ReviewSceneChangeTaskMapper; import com.ruoyi.mapper.ReviewSceneChangeTaskMapper;
import com.ruoyi.service.ReviewSceneChangeTaskUserRelationService;
import com.ruoyi.service.ReviewSceneService;
import com.ruoyi.service.ReviewTaskInboxService;
import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
...@@ -24,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.*; import java.util.*;
/** /**
...@@ -61,9 +60,56 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -61,9 +60,56 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
@Autowired @Autowired
private ReviewKeyPointMapper reviewKeyPointMapper; private ReviewKeyPointMapper reviewKeyPointMapper;
@Autowired
private TestUseCaseService testUseCaseService;
@Override @Override
public void create(ReviewSceneChangeTask reviewSceneChangeTask) { public void create(ReviewSceneChangeTask reviewSceneChangeTask) throws IOException {
//若是新增测试用例 则需要去查看科恩数据库,进行验重
if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "ADD_USECASE")){
GetSerialNumberRequest getSerialNumberRequest = new GetSerialNumberRequest();
Offset offset = new Offset();
offset.setOffset(0);
offset.setLimit(9999);
getSerialNumberRequest.setOffset(offset);
getSerialNumberRequest.setName(reviewSceneChangeTask.getStandard());
String s = JSONUtil.toJsonStr(getSerialNumberRequest);
List<SerialNumberResponse> list = testUseCaseService.getSerialNumberList(s);
for (SerialNumberResponse serialNumberResponse : list){
if (Objects.equals(serialNumberResponse.getSerialNumber(), reviewSceneChangeTask.getUsecaseId())){
throw new ServiceException("用例编号重复", HttpStatus.ERROR);
}
}
}
//若是修改测试用例 则需要去查看科恩数据库去验重
if(Objects.equals(reviewSceneChangeTask.getOperationSort(),"UPDATE_USECASE")){
GetSerialNumberRequest getSerialNumberRequest = new GetSerialNumberRequest();
Offset offset = new Offset();
offset.setOffset(0);
offset.setLimit(9999);
getSerialNumberRequest.setOffset(offset);
getSerialNumberRequest.setName(reviewSceneChangeTask.getStandard());
String s = JSONUtil.toJsonStr(getSerialNumberRequest);
List<SerialNumberResponse> list = testUseCaseService.getSerialNumberList(s);
//先判断用例编号是否有
for (SerialNumberResponse serialNumberResponse : list){
if (Objects.equals(serialNumberResponse.getSerialNumber(),reviewSceneChangeTask.getUsecaseId())){
if (!Objects.equals(serialNumberResponse.getSerialNumber(),reviewSceneChangeTask.getReviewUsecaseId())){
throw new ServiceException("当前用例编号对象已存在", HttpStatus.ERROR);
}
}
}
}
// 获取当前登陆人 // 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser(); SysUser loginUser = SecurityUtils.getLoginUser().getUser();
......
...@@ -113,63 +113,70 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper, ...@@ -113,63 +113,70 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
public List<ReviewStandardResponseAll> listByPageAllUseCase(ReviewStandardListByPageRequest request) throws IOException { public List<ReviewStandardResponseAll> listByPageAllUseCase(ReviewStandardListByPageRequest request) throws IOException {
// 创建查询请求对象 // 创建查询请求对象
UseCaseRequest useCaseRequest = new UseCaseRequest(); UseCaseRequestNew useCaseRequestNew = new UseCaseRequestNew();
Offset offset = new Offset(); Offset offset = new Offset();
offset.setOffset(0); offset.setOffset((request.getPageNum()/request.getPageSize())+1);
offset.setLimit(9999); // offset.setOffset(request.getPageNum());
useCaseRequest.setOffset(offset); offset.setLimit(request.getPageSize());
useCaseRequest.setName(request.getName()); useCaseRequestNew.setOffset(offset);
useCaseRequestNew.setName(request.getName());
SearchFields searchFields = new SearchFields();
searchFields.setSerialNumber(request.getChapter());
searchFields.setRequirements(request.getText());
useCaseRequestNew.setSearchFields(searchFields);
// 将请求转换为JSON格式 // 将请求转换为JSON格式
String requestJson = JSONUtil.toJsonStr(useCaseRequest); String requestJson = JSONUtil.toJsonStr(useCaseRequestNew);
// 获取新的测试用例列表响应 // 获取新的测试用例列表响应
TestUserCaseListNewResponse useCaseListNew = testUseCaseService.getUseCaseListNew(requestJson); NewTestUserCaseListResponse caseListNew = testUseCaseService.getCaseListNew(requestJson);
// 初始化返回的 ReviewStandardResponseAll 列表 List<ReviewStandardResponseAll> reviewStandardResponses = new ArrayList<>();
List<ReviewStandardResponseAll> reviewStandardResponseAllList = new ArrayList<>();
// 遍历所有用例
// 如果获取的用例列表不为空 for (NewStandardVO newStandardVO : caseListNew.getUseCases()) {
if (useCaseListNew != null && useCaseListNew.getUseCases() != null) { ReviewStandardResponseAll reviewStandardResponse = new ReviewStandardResponseAll();
// 遍历每个标准要求(StandardNewVO)
for (StandardNewVO standard : useCaseListNew.getUseCases()) { // 处理标准相关信息
// 创建新的 ReviewStandardResponseAll 对象 /*reviewStandardResponse.setId(Long.parseLong(newStandardVO.getId()));*/
ReviewStandardResponseAll reviewStandard = new ReviewStandardResponseAll(); reviewStandardResponse.setChapter(newStandardVO.getSerialNumber());
reviewStandardResponse.setText(newStandardVO.getRequirements());
// 将 StandardNewVO 的字段映射到 ReviewStandardResponseAll reviewStandardResponse.setName(request.getName()); // 假设没有提供此信息
// ID 转换为 Long reviewStandardResponse.setStandardNo(request.getStandardNo()); // 假设没有提供此信息
reviewStandard.setChapter(standard.getSerialNumber()); // 章节号映射 reviewStandardResponse.setType("test"); // 假设没有提供此信息
reviewStandard.setText(standard.getRequirements()); // 标准要求映射为文本内容
reviewStandard.setName(null); // 标准名称(如果需要,手动设置) // 处理检验内容集合
reviewStandard.setStandardNo(null); // 标准号(可以手动设置或从其他地方获取)
reviewStandard.setType(null); // 类型字段(可以根据需要填充)
// 处理 UseCaseNewVO 映射到 ReviewKeyPoint 列表
List<ReviewKeyPointNew> keyPointList = new ArrayList<>(); List<ReviewKeyPointNew> keyPointList = new ArrayList<>();
for (UseCaseNewVO useCase : standard.getUseCases()) { for (NewScenarioUseCasesVO scenarioUseCaseVO : newStandardVO.getScenarioUseCases()) {
// 创建新的 ReviewKeyPoint 对象 ReviewKeyPointNew keyPoint = new ReviewKeyPointNew();
ReviewKeyPointNew reviewKeyPoint = new ReviewKeyPointNew(); // keyPoint.setId(UUID.randomUUID().toString()); // 假设没有id,使用UUID生成
/*reviewKeyPoint.setId(Long.parseLong(useCase.getId())); */ // 用例ID keyPoint.setText(scenarioUseCaseVO.getTestScenario());
reviewKeyPoint.setText(useCase.getDescription()); // 用例描述映射到文本内容
/*reviewKeyPoint.setReviewStandardId(Long.parseLong(standard.getId()));*/ // 设置审查标准ID
reviewKeyPoint.setId(useCase.getCustomizedID());
// 审查细则列表暂时设置为空,后续可根据需求填充
reviewKeyPoint.setReviewDetailsList(new ArrayList<>());
// 将 ReviewKeyPoint 添加到列表 // 处理审查细则列表
keyPointList.add(reviewKeyPoint); List<ReviewDetails> reviewDetailsList = new ArrayList<>();
} for (UseCaseNewVO useCase : scenarioUseCaseVO.getUseCases()) {
ReviewDetails reviewDetails = new ReviewDetails();
// reviewDetails.setId(Long.parseLong(useCase.getId()));
reviewDetails.setText(useCase.getDescription());
// 设置检验内容集合(keyPointList) // 设置冗余信息便于前端显示
reviewStandard.setKeyPointList(keyPointList); reviewDetails.setChapter(useCase.getCustomizedID());
reviewDetails.setStandardText(useCase.getDescription());
// 将转换后的 ReviewStandardResponseAll 添加到结果列表中 reviewDetailsList.add(reviewDetails);
reviewStandardResponseAllList.add(reviewStandard);
} }
keyPoint.setReviewDetailsList(reviewDetailsList);
keyPointList.add(keyPoint);
}
reviewStandardResponse.setKeyPointList(keyPointList);
reviewStandardResponses.add(reviewStandardResponse);
} }
// 返回转换后的 ReviewStandardResponseAll 列表 return reviewStandardResponses;
return reviewStandardResponseAllList;
} }
......
...@@ -98,18 +98,6 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange, ...@@ -98,18 +98,6 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange,
reviewSceneChangeTaskService.updateById(reviewSceneChangeTask); reviewSceneChangeTaskService.updateById(reviewSceneChangeTask);
} }
//新增测试用例评审
if(Objects.equals(reviewSceneChangeTask.getOperationSort(),"ADD_USECASE")){
//保存新增的测试用例
ReviewUsecase reviewUsecase = new ReviewUsecase();
reviewUsecase.setUsecaseDescribe(reviewSceneChangeTask.getUsecaseDescribe());
reviewUsecase.setUsecaseId(reviewSceneChangeTask.getUsecaseId());
reviewUsecase.setReviewStandardId(reviewSceneChangeTask.getStandardId());
reviewUsecaseMapper.insert(reviewUsecase);
//为用例变更任务的场景关联字段赋值
reviewSceneChangeTask.setReviewUsecaseId(reviewUsecase.getId());
reviewSceneChangeTaskService.updateById(reviewSceneChangeTask);
}
} }
......
...@@ -97,10 +97,6 @@ public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChang ...@@ -97,10 +97,6 @@ public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChang
reviewSceneService.removeBatchByIds(reviewScenesList); reviewSceneService.removeBatchByIds(reviewScenesList);
} }
//删除用例
if (Objects.equals(reviewSceneChangeTask.getOperationSort(),"DELETE_USECASE")){
reviewUsecaseMapper.deleteById(reviewSceneChangeTask.getReviewUsecaseId());
}
} }
} }
......
...@@ -37,14 +37,6 @@ public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChang ...@@ -37,14 +37,6 @@ public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChang
reviewSceneService.updateById(reviewScene); reviewSceneService.updateById(reviewScene);
} }
if (Objects.equals(reviewSceneChangeTask.getOperationSort(),"UPDATE_USECASE")){
ReviewUsecase reviewUsecase = reviewUsecaseMapper.getById(reviewSceneChangeTask.getReviewUsecaseId());
reviewUsecase.setUsecaseDescribe(reviewSceneChangeTask.getUsecaseDescribe());
reviewUsecase.setUsecaseId(reviewSceneChangeTask.getNewText());
reviewUsecaseMapper.updateById(reviewUsecase);
}
} }
@Override @Override
......
...@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -55,7 +56,7 @@ public class ReviewSceneChangeTaskController extends BaseController { ...@@ -55,7 +56,7 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "场景变更任务", businessType = BusinessType.INSERT) @Log(title = "场景变更任务", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/add") @RequestMapping(method = RequestMethod.POST, value = "/add")
public R<String> create(@Validated @RequestBody ReviewSceneChangeTaskCreateRequest request) { public R<String> create(@Validated @RequestBody ReviewSceneChangeTaskCreateRequest request) throws IOException {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask(); ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask();
BeanUtils.copyBeanProp(reviewSceneChangeTask, request); BeanUtils.copyBeanProp(reviewSceneChangeTask, request);
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value = "GetSerialNumberRequest" ,description = "获取科恩编号id数组")
public class GetSerialNumberRequest {
private Offset offset;
private String name;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel
public class UseCaseRequestNew {
private Offset offset;
private SearchFields searchFields;
private String name;
}
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