Commit 8c41c588 authored by 宋源硕's avatar 宋源硕

Merge branch 'songyuanshuo' into 'master'

实施细则与测试用例库页面合并添加新街口

See merge request !11
parents a661e4d5 b334456d
......@@ -12,6 +12,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.checkerframework.checker.units.qual.K;
import java.util.List;
......
......@@ -34,4 +34,7 @@ public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
// 查询细则列表
List<ReviewDetails> findDetailsList(ReviewFindListRequest request);
// 根据检验要点ID查询细则(Details)列表
List<ReviewDetails> selectDetailsListByKeypointId(Long keypointId);
}
......@@ -36,6 +36,9 @@ public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResul
List<ReviewDetailsResult> findByDetailsId(@Param("detailsId") Long detailsId);
List<UserNameResponse> findByResultList(@Param("resultList") List<ReviewDetailsResult> resultList);
// 根据细则ID查询审查结果
ReviewDetailsResult selectReviewDetailsResultByDetailsId(Long detailsId);;
}
......
......@@ -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.ReviewKeyPointNew;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -26,4 +27,9 @@ public interface ReviewKeyPointMapper extends BaseMapper<ReviewKeyPoint> {
List<ReviewKeyPointListResponse> getKeyPointList(@Param("standardId") Long standardId);
List<ReviewDetailsListResponse> getDetailsList(@Param("keyPointId") Long keyPointId);
// 根据标准ID查询检验要点(KeyPoint)列表
List<ReviewKeyPointNew> selectKeypointListByStandardId(Long standardId);
ReviewKeyPointNew selectKeypointById(Long id);
}
......@@ -22,4 +22,7 @@ public interface ReviewSceneMapper extends BaseMapper<ReviewScene> {
List<ReviewScene> findList(ReviewSceneFindListRequest request);
List<GetSceneListResponse> getSceneListById(@Param("id") Long id);
// 根据细则ID查询审核场景(Scene)列表
List<ReviewScene> selectSceneListByDetailsId(Long detailsId);
}
......@@ -24,6 +24,14 @@ public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
*/
List<ReviewStandardResponse> selectReviewStandardList(ReviewStandardListByPageRequest request);
/**
* 查询标准列表
*
* @param request
* @return
*/
List<ReviewStandardResponseAll> selectReviewStandardListAll(ReviewStandardListByPageRequest request);
/**
* 根据标准主键ID查询车型试验的检验内容
* @param id
......@@ -71,4 +79,18 @@ public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
// 获取标准信息
ReviewStandardResponseNew selectReviewStandardById(@Param("key") Long key);
List<StandardTypeListResponse> findTypeByStandardNew(@Param("standardId") String standardId);
List<ReviewStandardChapterListResponse> findChaptersByStandardNew(@Param("standardId") String standardId);
List<ReviewStandardChapterListResponse> getChapterListByType(@Param("getChapterListRequest") GetChapterListRequest getChapterListRequest);
List<StandardTypeListResponse> getType(@Param("getChapterListRequest") GetChapterListRequest getChapterListRequest);
List<ReviewStandardResponse> selectReviewStandardListBySystemType();
List<ReviewStandardResponse> selectReviewStandardListByCarType();
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Standard;
import com.ruoyi.domain.StandardInspectionItemRelation;
import com.ruoyi.domain.vo.DictDataVO;
import com.ruoyi.web.response.StandardDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -18,4 +21,6 @@ public interface StandardInspectionItemRelationMapper extends BaseMapper<Standar
* @return
*/
List<StandardInspectionItemRelation> getListByStandard(Long standardId);
List<StandardInspectionItemRelation> findList(@Param("standardList") List<StandardDTO> standardList);
}
......@@ -2,7 +2,12 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Standard;
import com.ruoyi.web.request.GetChapterListRequest;
import com.ruoyi.web.request.StandardListRequest;
import com.ruoyi.web.response.ReviewStandardChapterListResponse;
import com.ruoyi.web.response.StandardDTO;
import com.ruoyi.web.response.StandardTypeListResponse;
import com.ruoyi.web.response.StandardVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -26,4 +31,11 @@ public interface StandardMapper extends BaseMapper<Standard> {
* @return
*/
List<Standard> findStandardList(StandardListRequest request);
List<StandardDTO> getStandardDTOList();
List<String> getTypeList(@Param("getChapterListRequest") GetChapterListRequest getChapterListRequest);
List<ReviewStandardChapterListResponse> getChapterList(@Param("type") String type);
}
......@@ -3,6 +3,7 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.response.ReviewKeyPointNew;
import java.util.List;
......@@ -10,4 +11,5 @@ public interface ReviewKeyPointService extends IService<ReviewKeyPoint> {
List<ReviewKeyPoint> findByStandardList(List<ReviewStandard> reviewStandardList);
ReviewKeyPointNew selectKeypoint(Long id);
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.*;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.*;
......@@ -28,6 +28,30 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
*/
List<ReviewStandardResponse> listByPage(ReviewStandardListByPageRequest request);
/**
* 分页查询标准列表
*
* @param request
* @return
*/
List<ReviewStandardResponseAll> listByPageAll(ReviewStandardListByPageRequest request);
/*
* 分页查科恩
* */
List<ReviewStandardResponseAll> listByPageAllUseCase(ReviewStandardListByPageRequest request) throws IOException;
// 根据标准ID查询检验内容(KeyPoint)列表
List<ReviewKeyPointNew> selectKeypointListAll(ReviewStandardInspectionContentRequest request);
// 根据检验要点ID查询细则(Details)列表
List<ReviewDetails> selectDetailsListByKeypointId(Long keypointId);
// 根据细则ID查询审核场景(Scene)列表
List<ReviewScene> selectSceneListByDetailsId(Long detailsId);
// 根据细则ID查询审查结果
ReviewDetailsResult getReviewDetailsResultByDetailsId(Long detailsId);
/**
* 通过标准ID查询检验内容(树状结构)
*
......@@ -35,6 +59,8 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
* @return
*/
ReviewStandardInspectionContentResponse selectInspectionContent(Long id);
/**
* 根据标准主键ID查询车型试验的检验内容
* @param id
......@@ -106,4 +132,8 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
* 删除细则按钮
* */
List<Long> getDetailsIdList(DeleteDetailsRequest deleteDetailsRequest);
ReviewStandardListNewResponse getListAll(String standardId);
}
......@@ -2,11 +2,15 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.Standard;
import com.ruoyi.web.request.GetChapterListRequest;
import com.ruoyi.web.request.StandardEditRequest;
import com.ruoyi.web.request.StandardGetInfoRequest;
import com.ruoyi.web.request.StandardListRequest;
import com.ruoyi.web.response.StandardDTO;
import com.ruoyi.web.response.StandardResponse;
import com.ruoyi.web.response.StandardVO;
import java.io.IOException;
import java.util.List;
/**
......@@ -30,4 +34,10 @@ public interface StandardService extends IService<Standard> {
* @return
*/
List<Standard> findStandardList(StandardListRequest request);
List<StandardDTO> getStandardDTOList();
// List<StandardDTO> getStandardDTOListAll(List<StandardDTO> standardDTOList) throws IOException;
List<StandardDTO> getStandardListNew() throws IOException;
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.service.ReviewKeyPointService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.web.response.ReviewKeyPointNew;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -16,8 +22,33 @@ public class ReviewKeyPointServiceImpl extends ServiceImpl<ReviewKeyPointMapper,
@Autowired
private ReviewKeyPointMapper reviewKeyPointMapper;
@Autowired
private ReviewStandardService reviewStandardService;
@Override
public List<ReviewKeyPoint> findByStandardList(List<ReviewStandard> reviewStandardList) {
return reviewKeyPointMapper.findByStandardList(reviewStandardList);
}
@Override
public ReviewKeyPointNew selectKeypoint(Long id) {
ReviewKeyPointNew reviewKeyPoint = reviewKeyPointMapper.selectKeypointById(id);
// 根据检验要点ID (keyPoint.getId()) 查询细则列表
Long reviewKeypointId = Long.parseLong(reviewKeyPoint.getId());
List<ReviewDetails> reviewDetailsList = reviewStandardService.selectDetailsListByKeypointId(reviewKeypointId);
// 将细则列表设置到当前检验要点对象中
reviewKeyPoint.setReviewDetailsList(reviewDetailsList);
// 遍历每个细则,并查询审核场景列表
for (ReviewDetails reviewDetails : reviewDetailsList) {
// 根据细则ID (reviewDetails.getId()) 查询审核场景列表
List<ReviewScene> reviewSceneList = reviewStandardService.selectSceneListByDetailsId(reviewDetails.getId());
// 将审核场景列表设置到当前细则对象中
reviewDetails.setReviewSceneList(reviewSceneList);
}
return reviewKeyPoint;
}
}
package com.ruoyi.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.domain.vo.InspectionContentVO;
import com.ruoyi.domain.vo.OptionalUseCasesVO;
import com.ruoyi.domain.vo.UseCaseUrlVO;
import com.ruoyi.domain.vo.*;
import com.ruoyi.mapper.*;
import com.ruoyi.service.*;
import com.ruoyi.web.request.*;
......@@ -48,6 +47,18 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
@Autowired
private TestUseCaseMapper testUseCaseMapper;
@Autowired
private ReviewSceneMapper reviewSceneMapper;
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private TestUseCaseService testUseCaseService;
/**
* 查询所有审查 标准、要点、细则、场景 并组织成树状结构返回
* @param standardId 关联到标准库中的id
......@@ -56,14 +67,11 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
*/
@Override
public List<ReviewStandard> findTree(Long standardId, String type) {
List<ReviewStandard> reviewStandardList = reviewStandardMapper.findListByStandardIdAndType(standardId, type); // 查询审查标准
List<ReviewKeyPoint> reviewKeyPointList = reviewKeyPointService.findByStandardList(reviewStandardList); // 查询审查要点
List<ReviewDetails> reivewDetailsList = reviewDetailsService.findByKeyPointsList(reviewKeyPointList); // 查询审查细则
List<ReviewScene> reviewSceneList = reviewSceneService.findByDetailsList(reivewDetailsList); // 查询审查场景
return buildTree(reviewStandardList, reviewKeyPointList, reivewDetailsList, reviewSceneList);
}
/**
......@@ -77,6 +85,114 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
return list;
}
/**
* 分页查询标准列表
*
* @return
*/
@Override
public List<ReviewStandardResponseAll> listByPageAll(ReviewStandardListByPageRequest request) {
List<ReviewStandardResponseAll> list = reviewStandardMapper.selectReviewStandardListAll(request);
// 遍历每个标准信息
for (ReviewStandardResponseAll reviewStandardResponseAll : list) {
// 创建 ReviewStandardInspectionContentRequest 请求对象,并设置标准ID
ReviewStandardInspectionContentRequest reviewStandardInspectionContentRequest = new ReviewStandardInspectionContentRequest();
reviewStandardInspectionContentRequest.setId(reviewStandardResponseAll.getId());
// 根据标准ID查询该标准的检验内容 (即 KeyPoint 列表)
List<ReviewKeyPointNew> keyPointList = reviewStandardService.selectKeypointListAll(reviewStandardInspectionContentRequest);
// 将查询到的 keyPointList 设置到当前标准对象中
reviewStandardResponseAll.setKeyPointList(keyPointList);
}
return list;
}
@Override
public List<ReviewStandardResponseAll> listByPageAllUseCase(ReviewStandardListByPageRequest request) throws IOException {
// 创建查询请求对象
UseCaseRequest useCaseRequest = new UseCaseRequest();
Offset offset = new Offset();
offset.setOffset(0);
offset.setLimit(9999);
useCaseRequest.setOffset(offset);
useCaseRequest.setName(request.getName());
// 将请求转换为JSON格式
String requestJson = JSONUtil.toJsonStr(useCaseRequest);
// 获取新的测试用例列表响应
TestUserCaseListNewResponse useCaseListNew = testUseCaseService.getUseCaseListNew(requestJson);
// 初始化返回的 ReviewStandardResponseAll 列表
List<ReviewStandardResponseAll> reviewStandardResponseAllList = new ArrayList<>();
// 如果获取的用例列表不为空
if (useCaseListNew != null && useCaseListNew.getUseCases() != null) {
// 遍历每个标准要求(StandardNewVO)
for (StandardNewVO standard : useCaseListNew.getUseCases()) {
// 创建新的 ReviewStandardResponseAll 对象
ReviewStandardResponseAll reviewStandard = new ReviewStandardResponseAll();
// 将 StandardNewVO 的字段映射到 ReviewStandardResponseAll
// ID 转换为 Long
reviewStandard.setChapter(standard.getSerialNumber()); // 章节号映射
reviewStandard.setText(standard.getRequirements()); // 标准要求映射为文本内容
reviewStandard.setName(null); // 标准名称(如果需要,手动设置)
reviewStandard.setStandardNo(null); // 标准号(可以手动设置或从其他地方获取)
reviewStandard.setType(null); // 类型字段(可以根据需要填充)
// 处理 UseCaseNewVO 映射到 ReviewKeyPoint 列表
List<ReviewKeyPointNew> keyPointList = new ArrayList<>();
for (UseCaseNewVO useCase : standard.getUseCases()) {
// 创建新的 ReviewKeyPoint 对象
ReviewKeyPointNew reviewKeyPoint = new ReviewKeyPointNew();
/*reviewKeyPoint.setId(Long.parseLong(useCase.getId())); */ // 用例ID
reviewKeyPoint.setText(useCase.getDescription()); // 用例描述映射到文本内容
/*reviewKeyPoint.setReviewStandardId(Long.parseLong(standard.getId()));*/ // 设置审查标准ID
reviewKeyPoint.setId(useCase.getCustomizedID());
// 审查细则列表暂时设置为空,后续可根据需求填充
reviewKeyPoint.setReviewDetailsList(new ArrayList<>());
// 将 ReviewKeyPoint 添加到列表
keyPointList.add(reviewKeyPoint);
}
// 设置检验内容集合(keyPointList)
reviewStandard.setKeyPointList(keyPointList);
// 将转换后的 ReviewStandardResponseAll 添加到结果列表中
reviewStandardResponseAllList.add(reviewStandard);
}
}
// 返回转换后的 ReviewStandardResponseAll 列表
return reviewStandardResponseAllList;
}
@Override
public List<ReviewKeyPointNew> selectKeypointListAll(ReviewStandardInspectionContentRequest request) {
return reviewKeyPointMapper.selectKeypointListByStandardId(request.getId());
}
@Override
public List<ReviewDetails> selectDetailsListByKeypointId(Long keypointId) {
return reviewDetailsMapper.selectDetailsListByKeypointId(keypointId);
}
@Override
public List<ReviewScene> selectSceneListByDetailsId(Long detailsId) {
return reviewSceneMapper.selectSceneListByDetailsId(detailsId);
}
@Override
public ReviewDetailsResult getReviewDetailsResultByDetailsId(Long detailsId) {
return reviewDetailsResultMapper.selectReviewDetailsResultByDetailsId(detailsId);
}
/**
* 通过标准ID查询检验内容(树状结构)
*
......@@ -116,6 +232,7 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
return response;
}
/**
* 根据标准主键ID查询车型试验的检验内容
* @param id
......@@ -554,5 +671,35 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
return reviewStandardMapper.getDetailsIdList(deleteDetailsRequest);
}
@Override
public ReviewStandardListNewResponse getListAll(String standardId) {
// 获取标准类型列表
List<StandardTypeListResponse> typeListResponses = reviewStandardMapper.findTypeByStandardNew(standardId);
// 获取章节列表
List<ReviewStandardChapterListResponse> chapterList = reviewStandardMapper.findChaptersByStandardNew(standardId);
// 去重类型列表,并为每种类型分配章节列表
Set<String> uniqueTypes = new HashSet<>();
List<StandardTypeListResponse> uniqueTypeList = typeListResponses.stream()
.filter(type -> uniqueTypes.add(type.getType())) // 去重 type
.peek(type -> {
// 过滤并设置对应的章节列表
List<ReviewStandardChapterListResponse> filteredChapters = chapterList.stream()
.filter(chapter -> chapter.getType().equals(type.getType())) // 这里使用 getType 方法
.collect(Collectors.toList());
type.setReviewStandardChapterListResponses(filteredChapters);
})
.collect(Collectors.toList());
// 构建响应对象
ReviewStandardListNewResponse response = new ReviewStandardListNewResponse();
response.setTypeList(uniqueTypeList);
return response;
}
}
package com.ruoyi.service.impl;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.domain.Standard;
import com.ruoyi.domain.StandardInspectionItemRelation;
import com.ruoyi.domain.vo.DictDataVO;
import com.ruoyi.domain.vo.StandardNewVO;
import com.ruoyi.domain.vo.UseCaseNewVO;
import com.ruoyi.mapper.ReviewStandardMapper;
import com.ruoyi.mapper.StandardInspectionItemRelationMapper;
import com.ruoyi.mapper.StandardMapper;
import com.ruoyi.service.StandardInspectionItemRelationService;
import com.ruoyi.service.StandardService;
import com.ruoyi.web.request.StandardEditRequest;
import com.ruoyi.web.request.StandardGetInfoRequest;
import com.ruoyi.web.request.StandardListRequest;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.response.StandardResponse;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import java.util.*;
@Service
public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> implements StandardService {
......@@ -34,6 +37,12 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
@Autowired
private StandardInspectionItemRelationService standardInspectionItemRelationService;
@Autowired
private TestUseCaseService testUseCaseService;
@Autowired
private ReviewStandardMapper reviewStandardMapper;
/**
* 分页查询
* @param
......@@ -101,4 +110,243 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
public List<Standard> findStandardList(StandardListRequest request) {
return standardMapper.findStandardList(request);
}
@Override
public List<StandardDTO> getStandardDTOList() {
return standardMapper.getStandardDTOList();
}
// @Override
// public List<StandardDTO> getStandardDTOListAll(List<StandardDTO> standardDTOList) throws IOException {
//
// for (StandardDTO standardDTO : standardDTOList) {
// // 创建 GetChapterListRequest 请求对象
// GetChapterListRequest getChapterListRequest = new GetChapterListRequest();
// getChapterListRequest.setStandardNo(standardDTO.getStandardNo());
// getChapterListRequest.setStandardId(standardDTO.getId());
// getChapterListRequest.setName(standardDTO.getName());
//
// List<StandardTypeListResponse> standardTypeListResponseList = reviewStandardMapper.getType(getChapterListRequest);
//
//// List<StandardTypeListResponse> typeList = standardDTO.getTypeList();
//
// // 1. 查询每个标准的类型列表
// List<StandardTypeListResponse> standardTypeListResponseList = reviewStandardMapper.getType(getChapterListRequest);
//
// reviewStandardMapper.selectCount();
//
// // 2. 去重处理类型列表 (使用Set进行去重)
// Set<String> uniqueTypes = new HashSet<>();
// List<StandardTypeListResponse> uniqueTypeList = new ArrayList<>();
//
// for (StandardTypeListResponse standardTypeListResponse : standardTypeListResponseList) {
// // 判断type是否已经存在,如果不存在则添加到Set中
// if (uniqueTypes.add(standardTypeListResponse.getType())) {
// uniqueTypeList.add(standardTypeListResponse); // 将不重复的类型加入新的列表
// }
// }
//
//
//
//
// // 3. 遍历去重后的类型列表,获取对应的章节集合
// for (StandardTypeListResponse uniqueStandardType : uniqueTypeList) {
// GetChapterListRequest getChapterListRequest1 = new GetChapterListRequest();
// getChapterListRequest1.setStandardId(standardDTO.getId());
// getChapterListRequest1.setStandardType(uniqueStandardType.getType());
//
// // 查询该类型对应的章节集合
// List<ReviewStandardChapterListResponse> reviewStandardChapterListResponseList = reviewStandardMapper.getChapterListByType(getChapterListRequest1);
//
// // 将查询到的章节信息赋值给当前的 StandardTypeListResponse 对象
// uniqueStandardType.setReviewStandardChapterListResponses(reviewStandardChapterListResponseList);
// }
//
// // 4. 将查询到的标准类型列表赋值给当前的 StandardDTO 对象
// standardDTO.setTypeList(uniqueTypeList);
// // 5. 调用第三方接口获取 "test" 类型数据
// GetUseCaseRequest getUseCaseRequest = new GetUseCaseRequest();
//
// Offset offset = new Offset();
// offset.setOffset(0);
// offset.setLimit(9999);
// getUseCaseRequest.setOffset(offset);
//
// SearchFields searchFields = new SearchFields();
// searchFields.setRequirements("");
// searchFields.setSerialNumber("");
// getUseCaseRequest.setSearchFields(searchFields);
//
// getUseCaseRequest.setName(standardDTO.getName());
//
// // 6. 将请求转换为 JSON 字符串并调用第三方服务
// String s = JSONUtil.toJsonStr(getUseCaseRequest);
// TestStandardListResponse standardList = testUseCaseService.getStandardList(s);
//
// // 7. 将 TestStandardListResponse 转换为 StandardTypeListResponse
// if (standardList != null && standardList.getStandards() != null) {
// StandardTypeListResponse testType = new StandardTypeListResponse();
// testType.setType("test");
//
// List<ReviewStandardChapterListResponse> testChapterList = new ArrayList<>();
// for (StandardNewVO standardNewVO : standardList.getStandards()) {
// ReviewStandardChapterListResponse reviewChapter = new ReviewStandardChapterListResponse();
// reviewChapter.setStandardId(standardDTO.getId()); // 将标准ID设置为当前DTO的ID
// reviewChapter.setChapter(standardNewVO.getSerialNumber()); // 将章节号映射到 serialNumber
// reviewChapter.setText(standardNewVO.getRequirements()); // 将章节内容映射到 requirements
// reviewChapter.setType("test"); // 设置类型为 "test"
//
// testChapterList.add(reviewChapter);
// }
//
// // 将转换后的章节信息赋值给 testType
// testType.setReviewStandardChapterListResponses(testChapterList);
//
// // 将 "test" 类型的对象添加到 typeList 中
// uniqueTypeList.add(testType);
// }
// }
//
// // 返回填充完毕的标准列表
// return standardDTOList;
// }
@Override
public List<StandardDTO> getStandardListNew() throws IOException {
List<StandardDTO> standardList = standardMapper.getStandardDTOList();
List<StandardInspectionItemRelation> vos = standardInspectionItemRelationMapper.findList(standardList);
for (StandardDTO standard : standardList) {
List<StandardInspectionItemRelation> relationList = new ArrayList<>();
List<StandardTypeListResponse> typeListResponses = new ArrayList<>();
StandardTypeListResponse responseSystem = new StandardTypeListResponse();
responseSystem.setType("system");
responseSystem.setReviewStandardChapterListResponses(new ArrayList<>());
typeListResponses.add(responseSystem);
StandardTypeListResponse responseCar = new StandardTypeListResponse();
responseCar.setType("car");
responseCar.setReviewStandardChapterListResponses(new ArrayList<>());
typeListResponses.add(responseCar);
StandardTypeListResponse responseTest = new StandardTypeListResponse();
responseTest.setType("test");
responseTest.setReviewStandardChapterListResponses(new ArrayList<>());
typeListResponses.add(responseTest);
for (StandardInspectionItemRelation relation : vos) {
if (Objects.equals(relation.getStandardId(), standard.getId())) {
relationList.add(relation);
}
}
for (StandardInspectionItemRelation item : relationList) {
if (item.getDictCode() == 150) {
// car
GetChapterListRequest getChapterListRequest = new GetChapterListRequest();
getChapterListRequest.setStandardType("car");
getChapterListRequest.setStandardId(item.getStandardId().toString());
List<ReviewStandardChapterListResponse> reviewStandardChapterListResponseList = reviewStandardMapper.getChapterListByType(getChapterListRequest);
for (StandardTypeListResponse response : typeListResponses) {
if (Objects.equals(response.getType(), "car")) {
response.setReviewStandardChapterListResponses(reviewStandardChapterListResponseList);
}
}
}
if (item.getDictCode() == 151) {
// test
GetUseCaseRequest getUseCaseRequest = new GetUseCaseRequest();
Offset offset = new Offset();
offset.setOffset(0);
offset.setLimit(9999);
getUseCaseRequest.setOffset(offset);
SearchFields searchFields = new SearchFields();
searchFields.setRequirements("");
searchFields.setSerialNumber("");
getUseCaseRequest.setSearchFields(searchFields);
getUseCaseRequest.setName(standard.getName());
// 将请求转换为 JSON 字符串并调用第三方服务
String s = JSONUtil.toJsonStr(getUseCaseRequest);
TestStandardListResponse standardList1 = testUseCaseService.getStandardList(s);
// 将 TestStandardListResponse 转换为 StandardTypeListResponse
if (standardList1 != null && standardList1.getStandards() != null) {
List<ReviewStandardChapterListResponse> reviewStandardChapterListResponseList = new ArrayList<>();
// 遍历 TestStandardListResponse 中的 standards 并转换为 ReviewStandardChapterListResponse
for (StandardNewVO standardNew : standardList1.getStandards()) {
// 检查是否有 useCases
if (standardNew.getUseCases() != null && !standardNew.getUseCases().isEmpty()) {
for (UseCaseNewVO useCase : standardNew.getUseCases()) {
ReviewStandardChapterListResponse chapterResponse = new ReviewStandardChapterListResponse();
// 设置章节号和章节内容
chapterResponse.setStandardId(standardNew.getId()); // 设置标准号id
chapterResponse.setChapter(standardNew.getSerialNumber()); // 设置章节号
chapterResponse.setText(standardNew.getRequirements()); // 设置章节内容为标准要求
// 可根据实际需求设置类型
chapterResponse.setType("test");
// 将转换后的对象加入列表
reviewStandardChapterListResponseList.add(chapterResponse);
}
} else {
// 如果没有 useCases,则创建一个默认的 ReviewStandardChapterListResponse
ReviewStandardChapterListResponse chapterResponse = new ReviewStandardChapterListResponse();
chapterResponse.setStandardId(standardNew.getId()); // 设置标准号id
chapterResponse.setChapter(standardNew.getSerialNumber()); // 设置章节号
chapterResponse.setText(standardNew.getRequirements()); // 设置章节内容为标准要求
chapterResponse.setType("test");
// 将转换后的对象加入列表
reviewStandardChapterListResponseList.add(chapterResponse);
}
}
// 将转换后的列表设置到相应的 StandardTypeListResponse 中
for (StandardTypeListResponse response : typeListResponses) {
if (Objects.equals(response.getType(), "test")) {
response.setReviewStandardChapterListResponses(reviewStandardChapterListResponseList);
}
}
}
}
if (item.getDictCode() == 152) {
// system
GetChapterListRequest getChapterListRequest = new GetChapterListRequest();
getChapterListRequest.setStandardType("system");
getChapterListRequest.setStandardId(item.getStandardId().toString());
List<ReviewStandardChapterListResponse> reviewStandardChapterListResponseList = reviewStandardMapper.getChapterListByType(getChapterListRequest);
for (StandardTypeListResponse response : typeListResponses) {
if (Objects.equals(response.getType(), "system")) {
response.setReviewStandardChapterListResponses(reviewStandardChapterListResponseList);
}
}
}
}
standard.setTypeList(typeListResponses);
}
return standardList;
}
}
......@@ -5,7 +5,8 @@ import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.*;
import com.ruoyi.service.ReviewKeyPointService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.*;
......@@ -14,11 +15,13 @@ import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -33,6 +36,8 @@ public class ReviewStandardController extends BaseController {
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewKeyPointService reviewKeyPointService;
/**
* 分页查询标准(检验内容库)
* @return
......@@ -45,6 +50,33 @@ public class ReviewStandardController extends BaseController {
List<ReviewStandardResponse> list = reviewStandardService.listByPage(request);
return getDataTable(list);
}
@Anonymous
@ApiOperation("页面右侧数据")
@PostMapping("/listNew")
public TableDataInfo<ReviewStandardResponseAll> listByPageNew(@RequestBody ReviewStandardListByPageRequest request) throws IOException {
startPage(request);
if (request.getType().equals("system") || request.getType().equals("car")){
List<ReviewStandardResponseAll> list = reviewStandardService.listByPageAll(request);
return getDataTable(list);
}
else if (request.getType().equals("test")){
List<ReviewStandardResponseAll> list = reviewStandardService.listByPageAllUseCase(request);
return getDataTable(list);
} else {
List<ReviewStandardResponseAll> reviewStandardResponseAll = new ArrayList<>();
return getDataTable(reviewStandardResponseAll);
}
}
@Anonymous
@ApiOperation("分页查询标准(检验内容库)")
@PostMapping("/getDetailsAll")
public R<ReviewKeyPointNew> getDetailsAll(@RequestBody ReviewDetailsListRequest request){
Long id = Long.parseLong(request.getKeypointId());
ReviewKeyPointNew reviewKeyPoint = reviewKeyPointService.selectKeypoint(id);
return R.ok(reviewKeyPoint);
}
/**
* 根据标准主键ID查询树状结构
* @param request
......
package com.ruoyi.web;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
......@@ -11,7 +12,7 @@ import com.ruoyi.domain.vo.DictDataVO;
import com.ruoyi.service.StandardInspectionItemRelationService;
import com.ruoyi.service.StandardService;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.StandardResponse;
import com.ruoyi.web.response.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
......@@ -24,6 +25,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
@Api(tags = "标准库")
@RestController
@RequestMapping("/standard")
......@@ -34,7 +38,6 @@ public class StandardController extends BaseController {
@Autowired
private StandardInspectionItemRelationService standardInspectionItemRelationService;
/**
* 分页查询
* @return
......@@ -47,6 +50,16 @@ public class StandardController extends BaseController {
startPage(request);
return getDataTable(standardService.findStandardList(request));
}
@ApiOperation("标准库左侧数据分页查询(可选用标准列表)")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getStandardListNew")
public R<List<StandardDTO>> getStandardListNew() throws IOException {
List<StandardDTO> list = standardService.getStandardListNew();
return R.ok(list);
}
@ApiOperation("标准库分页查询(仅做展示列表)")
@Trace
......
......@@ -17,10 +17,7 @@ import com.ruoyi.domain.vo.RecaordUseCasesVO;
import com.ruoyi.mapper.TTestPlanRecordMapper;
import com.ruoyi.service.TTestPlanRecordService;
import com.ruoyi.service.impl.ReviewStandardServiceImpl;
import com.ruoyi.web.request.PlanDetailStandardRequest;
import com.ruoyi.web.request.SystemReviewExportRequest;
import com.ruoyi.web.request.TestPlanRecordGetInfoRequest;
import com.ruoyi.web.request.TestPlanRecordPageRequest;
import com.ruoyi.web.request.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "GetChapterListRequest", description = "下载附件")
@Data
public class GetChapterListRequest {
@ApiModelProperty("标准号")
private String standardNo;
@ApiModelProperty("标准名称")
private String name;
@ApiModelProperty("标准分类")
private String standardType;
@ApiModelProperty("标准状态")
private String standardStatus;
@ApiModelProperty("标准id")
private String standardId;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel(value = "GetChapterListRequest", description = "下载附件")
@Data
public class GetUseCaseRequest {
private String name;
private Offset offset;
private SearchFields searchFields;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel(value = "offset", description = "offset")
@Data
public class Offset {
private Integer offset;
private Integer limit;
}
......@@ -103,4 +103,13 @@ public class ReviewSceneChangeTaskCreateRequest {
@ApiModelProperty(value = "审查场景id", notes = "1.若为修改、删除任务时,此id在创建任务时赋值; 2.若为新增任务时,此id在审批通过并保存新场景后赋值 ")
private Long reviewSceneId;
@ApiModelProperty("用例编号")
private String usecaseId;
@ApiModelProperty("用例描述")
private String usecaseDescribe;
@ApiModelProperty("评审用例id")
private Long reviewUsecaseId;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel(value = "searchFields", description = "searchFields")
@Data
public class SearchFields {
private String serialNumber;
private String requirements;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel
public class UseCaseRequest {
private Offset offset;
private String name;
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "ChapterListVO", description = "类型下章节集合")
@Data
public class ChapterListVO {
@ApiModelProperty("章节")
private String chapter;
}
package com.ruoyi.web.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.domain.ReviewDetails;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List;
@ApiModel
@TableName(value ="t_review_keypoint")
@Accessors(chain = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewKeyPointNew {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private String id;
/**
* 文本内容
*/
@ApiModelProperty("文本内容")
private String text;
/**
* 审查标准id
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查标准id")
private Long reviewStandardId;
/**
* 审查细则列表
*/
@ApiModelProperty("审查细则列表")
@TableField(exist = false)
private List<ReviewDetails> reviewDetailsList;
}
package com.ruoyi.web.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.domain.ReviewKeyPoint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel
@Data
public class ReviewStandardResponseAll {
@ApiModelProperty("ID")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
/**
* 章节
*/
@ApiModelProperty("章节")
private String chapter;
/**
* 文本内容
*/
@ApiModelProperty("文本内容")
private String text;
/**
* 测试方法(车型试验专有)
*/
@ApiModelProperty("测试方法(车型试验专有)")
private String testMethod;
@ApiModelProperty("标准名称")
private String name;
@ApiModelProperty("标准号")
private String standardNo;
@ApiModelProperty("类型")
private String type;
@ApiModelProperty("检验内容集合")
private List<ReviewKeyPointNew> keyPointList;
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel(value = "StandardDTO", description = "标准库左侧")
@Data
public class StandardDTO {
@ApiModelProperty("大标准id")
private Long id;
@ApiModelProperty("大标准编号")
private String standardNo;
@ApiModelProperty("大标准名称")
private String name;
@ApiModelProperty("标准下三个子任务集合")
private List<StandardTypeListResponse> typeList;
}
package com.ruoyi.web.response;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel(value = "StandardVO", description = "标准库左侧")
@Data
public class StandardVO {
@ApiModelProperty("大标准id")
private String id;
@ApiModelProperty("大标准编号")
private String standardNo;
@ApiModelProperty("大标准名称")
private String name;
@ApiModelProperty("标准下三个子任务集合")
private ReviewStandardListNewResponse reviewStandardListNewResponse;
/*@ApiModelProperty("标准下三个子任务集合")
private List<StandardTypeListResponse> typeList;*/
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel(value = "typeListVO", description = "标准库左侧")
@Data
public class TypeListVO {
@ApiModelProperty("大标准下类型")
private String type;
@ApiModelProperty("类型下的章节集合")
private List<ChapterListVO> chapterListVOList;
}
......@@ -83,4 +83,7 @@
</if>
</where>
</select>
<select id="selectDetailsListByKeypointId" resultType="com.ruoyi.domain.ReviewDetails">
select * from t_review_details where review_keypoint_id = #{keypointId}
</select>
</mapper>
......@@ -63,5 +63,8 @@
#{item.userId}
</foreach>
</select>
<select id="selectReviewDetailsResultByDetailsId" resultType="com.ruoyi.domain.ReviewDetailsResult">
select * from t_review_details_result
</select>
</mapper>
......@@ -34,5 +34,13 @@
select id, text from t_review_details
where review_keypoint_id = #{keyPointId}
</select>
<select id="selectKeypointListByStandardId" resultType="com.ruoyi.web.response.ReviewKeyPointNew">
select * from t_review_keypoint where review_standard_id = #{standardId}
</select>
<select id="selectKeypointById" resultType="com.ruoyi.web.response.ReviewKeyPointNew">
select *
from t_review_keypoint
where id = #{id}
</select>
</mapper>
......@@ -31,4 +31,7 @@
from t_review_scene
where review_details_id = #{id}
</select>
<select id="selectSceneListByDetailsId" resultType="com.ruoyi.domain.ReviewScene">
select * from t_review_scene where review_details_id = #{detailsId}
</select>
</mapper>
......@@ -67,6 +67,34 @@
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(chapter, '.', 3), '.', -1) AS UNSIGNED)
</select>
<select id="selectReviewStandardListAll" parameterType="com.ruoyi.web.request.ReviewStandardListByPageRequest" resultType="com.ruoyi.web.response.ReviewStandardResponseAll">
select
id,
chapter,
text,
test_method AS testMethod,
name,
standard_no AS standardNo,
type
from
t_review_standard
<where>
<if test="standardId != null"> and standard_id = #{standardId} </if>
<if test="type != null and type != ''"> and `type` = #{type} </if>
<if test="chapter != null and chapter != ''"> and chapter =#{chapter} </if>
<if test="text != null and text != ''"> and text like concat('%', #{text}, '%') </if>
<if test="testMethod != null and testMethod != ''"> and test_method like concat('%', #{testMethod}, '%') </if>
<if test="name != null and text != ''">and name like concat('%',#{name}, '%')</if>
<if test="standardNo != null and standardNo != ''">and standard_no like concat('%',#{standardNo},'%')</if>
</where>
/*ORDER BY
chapter*/
ORDER BY
CAST(SUBSTRING_INDEX(chapter, '.', 1) AS UNSIGNED),
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(chapter, '.', 2), '.', -1) AS UNSIGNED),
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(chapter, '.', 3), '.', -1) AS UNSIGNED)
</select>
<select id="selectTestInspectionContent"
resultType="com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse">
SELECT
......@@ -157,7 +185,35 @@
from t_review_standard
where id = #{key}
</select>
<select id="findTypeByStandardNew" resultType="com.ruoyi.web.response.StandardTypeListResponse">
SELECT DISTINCT type
FROM t_review_standard
WHERE standard_id = #{standardId}
</select>
<select id="findChaptersByStandardNew"
resultType="com.ruoyi.web.response.ReviewStandardChapterListResponse">
SELECT chapter, text, type ,standard_id as standardId <!-- 添加 type 字段 -->
FROM t_review_standard
WHERE standard_id = #{standardId}
</select>
<select id="getChapterListByType" resultType="com.ruoyi.web.response.ReviewStandardChapterListResponse">
select standard_id,chapter,text,type
from t_review_standard
where type = #{getChapterListRequest.standardType}
and standard_id = #{getChapterListRequest.standardId}
</select>
<select id="getType" resultType="com.ruoyi.web.response.StandardTypeListResponse">
select type
from t_review_standard
where standard_id = #{getChapterListRequest.standardId}
</select>
<select id="selectReviewStandardListBySystemType"
resultType="com.ruoyi.web.response.ReviewStandardResponse">
select * from t_review_standard where type = 'system'
</select>
<select id="selectReviewStandardListByCarType" resultType="com.ruoyi.web.response.ReviewStandardResponse">
select * from t_review_standard where type = 'car'
</select>
</mapper>
......@@ -18,6 +18,13 @@
SELECT id, standard_id, dict_code FROM t_standard_inspection_item_relation
WHERE standard_id = #{standardId}
</select>
<select id="findList" resultType="com.ruoyi.domain.StandardInspectionItemRelation">
SELECT id, standard_id, dict_code FROM t_standard_inspection_item_relation
WHERE standard_id IN
<foreach collection="standardList" item="standard" open="(" separator="," close=")">
#{standard.id}
</foreach>
</select>
</mapper>
......@@ -63,4 +63,18 @@
</if>
</where>
</select>
<select id="getStandardDTOList" resultType="com.ruoyi.web.response.StandardDTO">
select id,standard_no,name
from t_standard
</select>
<select id="getTypeList" resultType="java.lang.String">
select type
from t_review_standard
where standard_id = #{getChapterListRequest.standardId}
</select>
<select id="getChapterList" resultType="com.ruoyi.web.response.ReviewStandardChapterListResponse">
select standard_id,chapter,text,type
from t_review_standard
where type = #{type}
</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