Commit 2ba126fc authored by yuanshuo's avatar yuanshuo

更改解析Excel文件代码,新增获取场景列表集合接口

parent b47e3b9c
......@@ -7,6 +7,7 @@ import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewFindListRequest;
import com.ruoyi.web.response.ReviewDetailsListResponse;
import com.ruoyi.web.response.ReviewKeyPointListResponse;
import com.ruoyi.web.response.ReviewSceneListResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -23,7 +24,18 @@ public interface ReviewKeyPointMapper extends BaseMapper<ReviewKeyPoint> {
// 根据细则列表查询要点列表
List<ReviewKeyPoint> findByDetailsList(@Param("detailsList") List<ReviewDetails> detailsList);
/*
* 发起评审-获取要点列表
* */
List<ReviewKeyPointListResponse> getKeyPointList(@Param("standardId") Long standardId);
/*
* 发起评审-获取细则列表
* */
List<ReviewDetailsListResponse> getDetailsList(@Param("keypointId") Long keypointId);
/*
* 发起评审-获取场景列表
* */
List<ReviewSceneListResponse> getSceneList(@Param("detailsId") Long detailsId);
}
......@@ -9,6 +9,7 @@ import com.ruoyi.web.request.ReviewSceneChangeTaskPassRequest;
import com.ruoyi.web.response.ReviewDetailsListResponse;
import com.ruoyi.web.response.ReviewKeyPointListResponse;
import com.ruoyi.web.response.ReviewSceneChangeTaskResponse;
import com.ruoyi.web.response.ReviewSceneListResponse;
import java.util.Date;
import java.util.List;
......@@ -115,4 +116,8 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange
* */
List<ReviewDetailsListResponse> getDetailsList(Long keypointId);
/*
* 发起评审-获取场景列表
* */
List<ReviewSceneListResponse> getSceneList(Long detailsId);
}
......@@ -22,10 +22,7 @@ import com.ruoyi.web.request.ReviewSceneChangeTaskFindCreateRequest;
import com.ruoyi.web.request.ReviewSceneChangeTaskFindFinishRequest;
import com.ruoyi.web.request.ReviewSceneChangeTaskFindPendingRequest;
import com.ruoyi.web.request.ReviewSceneChangeTaskPassRequest;
import com.ruoyi.web.response.ReviewDetailsListResponse;
import com.ruoyi.web.response.ReviewKeyPointListResponse;
import com.ruoyi.web.response.ReviewSceneChangeTaskResponse;
import com.ruoyi.web.response.ReviewerListResponse;
import com.ruoyi.web.response.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -497,6 +494,14 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
public List<ReviewDetailsListResponse> getDetailsList(Long keypointId) {
return reviewKeyPointMapper.getDetailsList(keypointId);
}
/*
* 发起评审-获取场景列表
* */
@Override
public List<ReviewSceneListResponse> getSceneList(Long detailsId) {
return reviewKeyPointMapper.getSceneList(detailsId);
}
}
......
......@@ -11,11 +11,8 @@ import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.web.request.ReviewSceneChangeTaskCreateRequest;
import com.ruoyi.web.request.ReviewSceneChangeTaskPassRequest;
import com.ruoyi.web.response.ReviewDetailsListResponse;
import com.ruoyi.web.response.ReviewKeyPointListResponse;
import com.ruoyi.web.response.ReviewSceneChangeTaskResponse;
import com.ruoyi.web.response.*;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewSceneChangeTaskResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -167,12 +164,12 @@ public class ReviewSceneChangeTaskController extends BaseController {
}
/*
* 发起评审-新增审查场景-获取要点列表
* 发起评审-获取要点列表
* */
@ApiOperation("发起评审-新增审查场景-获取要点列表")
@ApiOperation("发起评审-获取要点列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "发起评审-新增审查场景-获取要点列表", businessType = BusinessType.UPDATE)
@Log(title = "发起评审-获取要点列表", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/getKeyPointList")
public R<List<ReviewKeyPointListResponse>> getKeyPointList(@Validated @RequestBody ReviewKeyPointListRequest request){
Long id = Long.parseLong(request.getStandardId());
......@@ -181,12 +178,12 @@ public class ReviewSceneChangeTaskController extends BaseController {
}
/*
* 发起评审-新增审查场景-获取细则列表
* 发起评审-获取细则列表
* */
@ApiOperation("发起评审-新增审查场景-获取细则列表")
@ApiOperation("发起评审-获取细则列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "发起评审-新增审查场景-获取细则列表", businessType = BusinessType.UPDATE)
@Log(title = "发起评审-获取细则列表", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/getDetailsList")
public R<List<ReviewDetailsListResponse>> getKeyPointList(@Validated @RequestBody ReviewDetailsListRequest request){
Long id = Long.parseLong(request.getKeypointId());
......@@ -194,4 +191,17 @@ public class ReviewSceneChangeTaskController extends BaseController {
return R.ok(list);
}
/*
* 发起评审-获取场景列表
* */
@ApiOperation("发起评审-获取场景列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "发起评审-获取场景列表", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/getSceneList")
public R<List<ReviewSceneListResponse>> getSceneList(@Validated @RequestBody ReviewSceneListRequest request){
Long id = Long.parseLong(request.getDetailsId());
List<ReviewSceneListResponse> list = reviewSceneChangeTaskService.getSceneList(id);
return R.ok(list);
}
}
......@@ -188,6 +188,7 @@ public class TaskController extends BaseController {
return R.ok(response);
}
/*
* 开启车型实验任务时-上传文件
* */
......@@ -205,7 +206,7 @@ public class TaskController extends BaseController {
Workbook workbook = WorkbookFactory.create(file.getInputStream());
Sheet sheet = workbook.getSheetAt(3); // 获取第4个工作表
Map<String, Object> result = new HashMap<>();
List<String> useCaseList = new ArrayList<>();
List<Map<String, String>> duplicatedUseCaseList = new ArrayList<>();
// 获取第一行并查找“用例编号”所在的列
Row headerRow = sheet.getRow(0);
......@@ -222,26 +223,32 @@ public class TaskController extends BaseController {
}
if (targetColumnIndex == -1) {
workbook.close();
return R.fail("没找到测试用例列");
}
// 设置 "name" 为 "用例编号"
result.put("name", "用例编号");
// 遍历行,提取“用例编号”列的数据
// 遍历行,提取“用例编号”列的数据并构造新格式
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
if (row != null) {
Cell cell = row.getCell(targetColumnIndex); // 获取“用例编号”列的单元格
if (cell != null && !cell.toString().trim().isEmpty()) {
useCaseList.add(cell.toString().trim()); // 将非空的单元格数据添加到列表
Map<String, String> useCaseMap = new HashMap<>();
useCaseMap.put("useCaseDisplayOrCustomizedID", cell.toString().trim()); // 将用例编号作为新的Map的值
duplicatedUseCaseList.add(useCaseMap); // 添加到列表
}
}
}
if (useCaseList.isEmpty()){
if (duplicatedUseCaseList.isEmpty()) {
workbook.close();
return R.fail("测试用例id不能为空");
}
result.put("useCaseList", useCaseList); // 设置 "useCaseList" 为解析的数据列表
result.put("duplicatedUseCaseList", duplicatedUseCaseList); // 使用新的格式存储数据
workbook.close();
return R.ok(result);
......
......@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "ReviewKeyPointListResponse", description = "查询细则列表返回结果")
@ApiModel(value = "ReviewDetailsListResponse", description = "查询细则列表返回结果")
@Data
public class ReviewDetailsListResponse {
......
......@@ -34,5 +34,9 @@
select id, text from t_review_details
where review_keypoint_id = #{keypointId}
</select>
<select id="getSceneList" resultType="com.ruoyi.web.response.ReviewSceneListResponse">
select id,text from t_review_scene
where review_details_id = #{detailsId}
</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