Commit f42bd6d4 authored by 盖献康's avatar 盖献康

检验内容库 查询列表、检验内容接口

parent 3aecfc37
...@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
...@@ -17,6 +20,9 @@ import java.util.List; ...@@ -17,6 +20,9 @@ import java.util.List;
@ApiModel @ApiModel
@TableName(value ="t_review_details") @TableName(value ="t_review_details")
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewDetails { public class ReviewDetails {
/** /**
......
...@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
...@@ -17,6 +20,9 @@ import java.util.List; ...@@ -17,6 +20,9 @@ import java.util.List;
@ApiModel @ApiModel
@TableName(value ="t_review_keypoint") @TableName(value ="t_review_keypoint")
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewKeyPoint { public class ReviewKeyPoint {
/** /**
......
...@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
...@@ -16,6 +19,9 @@ import lombok.experimental.Accessors; ...@@ -16,6 +19,9 @@ import lombok.experimental.Accessors;
@TableName(value ="t_review_scene") @TableName(value ="t_review_scene")
@Accessors(chain = true) @Accessors(chain = true)
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewScene { public class ReviewScene {
/** /**
......
...@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -18,10 +21,14 @@ import java.util.List; ...@@ -18,10 +21,14 @@ import java.util.List;
@ApiModel @ApiModel
@TableName(value ="t_review_standard") @TableName(value ="t_review_standard")
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewStandard { public class ReviewStandard {
public static final String TYPE_SYSTEM = "system"; // 体系审查类型 public static final String TYPE_SYSTEM = "system"; // 体系审查类型
public static final String TYPE_CAR = "car"; // 车型审查类型 public static final String TYPE_CAR = "car"; // 车型审查类型
public static final String TYPE_TEST = "test"; // 车型试验类型
/** /**
* 主键 * 主键
...@@ -43,13 +50,18 @@ public class ReviewStandard { ...@@ -43,13 +50,18 @@ public class ReviewStandard {
@ApiModelProperty("章节") @ApiModelProperty("章节")
private String chapter; private String chapter;
/** /**
* 文本内容 * 文本内容
*/ */
@ApiModelProperty("文本内容") @ApiModelProperty("文本内容")
private String text; private String text;
/**
* 测试方法(车型试验专有)
*/
@ApiModelProperty("测试方法(车型试验专有)")
private String testMethod;
/** /**
* 要点列表 * 要点列表
*/ */
......
...@@ -2,6 +2,8 @@ package com.ruoyi.mapper; ...@@ -2,6 +2,8 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ReviewStandard; import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.response.ReviewStandardResponse;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -12,4 +14,12 @@ import java.util.List; ...@@ -12,4 +14,12 @@ import java.util.List;
public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> { public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
List<ReviewStandard> findListByStandardIdAndType(@Param("standardId") Long standardId, @Param("type") String type); List<ReviewStandard> findListByStandardIdAndType(@Param("standardId") Long standardId, @Param("type") String type);
/**
* 查询标准列表
*
* @param request
* @return
*/
List<ReviewStandardResponse> selectReviewStandardList(ReviewStandardListByPageRequest request);
} }
...@@ -2,6 +2,9 @@ package com.ruoyi.service; ...@@ -2,6 +2,9 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewStandard; import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import java.util.List; import java.util.List;
...@@ -9,6 +12,27 @@ public interface ReviewStandardService extends IService<ReviewStandard> { ...@@ -9,6 +12,27 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
void initData(List<ReviewStandard> reviewStandardList); void initData(List<ReviewStandard> reviewStandardList);
/**
* 查询标准树状结构
* @param standardId
* @param type
* @return
*/
List<ReviewStandard> findTree(Long standardId, String type); List<ReviewStandard> findTree(Long standardId, String type);
/**
* 分页查询标准列表
*
* @param request
* @return
*/
List<ReviewStandardResponse> listByPage(ReviewStandardListByPageRequest request);
/**
* 通过标准ID查询检验内容(树状结构)
*
* @param id
* @return
*/
ReviewStandardInspectionContentResponse selectInspectionContent(Long id);
} }
...@@ -5,6 +5,9 @@ import com.ruoyi.common.utils.SnowflakeUtil; ...@@ -5,6 +5,9 @@ import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*; import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewStandardMapper; import com.ruoyi.mapper.ReviewStandardMapper;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import org.springframework.beans.factory.annotation.Autowired; 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;
...@@ -35,6 +38,7 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper, ...@@ -35,6 +38,7 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
* @param type 问卷类型[system(体系审查),car(车型审查)] * @param type 问卷类型[system(体系审查),car(车型审查)]
* @return * @return
*/ */
@Override
public List<ReviewStandard> findTree(Long standardId, String type) { public List<ReviewStandard> findTree(Long standardId, String type) {
List<ReviewStandard> reviewStandardList = reviewStandardMapper.findListByStandardIdAndType(standardId, type); // 查询审查标准 List<ReviewStandard> reviewStandardList = reviewStandardMapper.findListByStandardIdAndType(standardId, type); // 查询审查标准
...@@ -46,6 +50,42 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper, ...@@ -46,6 +50,42 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
} }
/**
* 分页查询标准列表
*
* @return
*/
@Override
public List<ReviewStandardResponse> listByPage(ReviewStandardListByPageRequest request) {
List<ReviewStandardResponse> list = reviewStandardMapper.selectReviewStandardList(request);
return list;
}
/**
* 通过标准ID查询检验内容(树状结构)
*
* @param id
* @return
*/
@Override
public ReviewStandardInspectionContentResponse selectInspectionContent(Long id) {
// 模拟一个审查标准集合
ReviewStandard reviewStandard = ReviewStandard.builder().id(id).build();
List<ReviewStandard> reviewStandardList = new ArrayList<>();
reviewStandardList.add(reviewStandard);
// 查询审查要点
List<ReviewKeyPoint> reviewKeyPointList = reviewKeyPointService.findByStandardList(reviewStandardList);
// 查询审查细则
List<ReviewDetails> reivewDetailsList = reviewDetailsService.findByKeyPointsList(reviewKeyPointList);
// 查询审查场景
List<ReviewScene> reviewSceneList = reviewSceneService.findByDetailsList(reivewDetailsList);
List<ReviewDetails> reviewDetails = buildDetails(reivewDetailsList, reviewSceneList);
List<ReviewKeyPoint> keyPoints = buildKeyPoint(reviewKeyPointList, reviewDetails);
ReviewStandardInspectionContentResponse response = ReviewStandardInspectionContentResponse.builder().keyPointList(keyPoints).build();
return response;
}
/** /**
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中 * 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* @param reviewStandardList * @param reviewStandardList
......
package com.ruoyi.web;
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.service.ReviewStandardService;
import com.ruoyi.web.request.ReviewStandardInspectionContentRequest;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 检验内容库(标准)Controller层
* @author gxk
*/
@Api(tags = "检验内容库")
@RestController
@RequestMapping("/review/standard")
public class ReviewStandardController extends BaseController {
@Autowired
private ReviewStandardService reviewStandardService;
/**
* 分页查询标准(检验内容库)
* @return
*/
@ApiOperation("分页查询标准(检验内容库)")
@PostMapping("/list")
public TableDataInfo<ReviewStandardResponse> listByPage(@Validated @RequestBody ReviewStandardListByPageRequest request) {
startPage();
List<ReviewStandardResponse> list = reviewStandardService.listByPage(request);
return getDataTable(list);
}
/**
* 根据标准主键ID查询树状结构
* @param request
* @return
*/
@ApiOperation("查询标准的检验内容")
@PostMapping("/getInspectionContent")
public R<ReviewStandardInspectionContentResponse> getInspectionContent(@Validated @RequestBody ReviewStandardInspectionContentRequest request) {
ReviewStandardInspectionContentResponse response = reviewStandardService.selectInspectionContent(request.getId());
return R.ok(response);
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 体系审查和车型审查检验内容请求实体类
* @author gxk
*/
@Data
@ApiModel
public class ReviewStandardInspectionContentRequest {
@ApiModelProperty("标准主键ID")
@NotNull(message = "标准主键ID不能为空")
private Long id;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* 检验内容库(标准)分页请求实体类
* @author gxk
*/
@Data
@ApiModel
public class ReviewStandardListByPageRequest extends PageDomain {
/**
* 大标准ID
*/
@ApiModelProperty("总标准ID")
@NotNull(message = "总标准ID不能为空")
private Long standardId;
/**
* 标准的类型
*/
@ApiModelProperty("标准类型[system、car、test]")
@NotNull(message = "标准类型不能为空")
@NotEmpty(message = "标准类型不能为空")
private String type;
/**
* 章节
*/
@ApiModelProperty("章节")
private String chapter;
/**
* 文本内容
*/
@ApiModelProperty("文本内容")
private String text;
}
package com.ruoyi.web.response;
import com.ruoyi.domain.ReviewKeyPoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 体系审查、车型审查点击检验内容后的返回值
* @author gxk
*/
@ApiModel
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewStandardInspectionContentResponse {
@ApiModelProperty("检验内容集合")
private List<ReviewKeyPoint> keyPointList;
}
package com.ruoyi.web.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 检验内容库(标准)响应体
* @author gxk
*/
@Data
@ApiModel
public class ReviewStandardResponse {
@ApiModelProperty("ID")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
/**
* 章节
*/
@ApiModelProperty("章节")
private String chapter;
/**
* 文本内容
*/
@ApiModelProperty("文本内容")
private String text;
/**
* 测试方法(车型试验专有)
*/
@ApiModelProperty("测试方法(车型试验专有)")
private String testMethod;
}
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result property="file" column="file" jdbcType="VARCHAR"/> <result property="file" column="file" jdbcType="VARCHAR"/>
<result property="conformity" column="conformity" jdbcType="VARCHAR"/> <result property="conformity" column="conformity" jdbcType="VARCHAR"/>
<result property="inconformity" column="inconformity" jdbcType="VARCHAR"/> <result property="inconformity" column="inconformity" jdbcType="VARCHAR"/>
<result property="testMethod" column="test_method" jdbcType="VARCHAR"/>
<collection property="keyPointList" ofType="com.ruoyi.domain.ReviewKeyPoint" select="com.ruoyi.mapper.ReviewKeyPointMapper.findAllByReviewStandardId" column="id"> <collection property="keyPointList" ofType="com.ruoyi.domain.ReviewKeyPoint" select="com.ruoyi.mapper.ReviewKeyPointMapper.findAllByReviewStandardId" column="id">
<result property="id" column="u_id" jdbcType="BIGINT"/> <result property="id" column="u_id" jdbcType="BIGINT"/>
...@@ -32,5 +33,18 @@ ...@@ -32,5 +33,18 @@
SELECT id, type, chapter, text, standard_id, name, standard_no, file, conformity, inconformity FROM t_review_standard WHERE standard_id = #{standardId} AND type = #{type}; SELECT id, type, chapter, text, standard_id, name, standard_no, file, conformity, inconformity FROM t_review_standard WHERE standard_id = #{standardId} AND type = #{type};
</select> </select>
<select id="selectReviewStandardList" parameterType="com.ruoyi.web.request.ReviewStandardListByPageRequest" resultType="com.ruoyi.web.response.ReviewStandardResponse">
select
id, chapter, text
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 like concat('%', #{chapter}, '%') </if>
<if test="text != null and text != ''"> and text like concat('%', #{text}, '%') </if>
</where>
</select>
</mapper> </mapper>
package com.ruoyi;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewDetailsService;
import com.ruoyi.service.ReviewKeyPointService;
import com.ruoyi.service.ReviewSceneService;
import com.ruoyi.service.ReviewStandardService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class InspectionContentTest {
@Autowired
private ReviewKeyPointService reviewKeyPointService;
@Autowired
private ReviewDetailsService reviewDetailsService;
@Autowired
private ReviewSceneService reviewSceneService;
@Autowired
private ReviewStandardService reviewStandardService;
// 标准新增
@Test
public void standardAdd() {
ReviewStandard build = ReviewStandard.builder()
.chapter("7.1.1.1")
.text("车端具备远程控制功能的系统、授权的第三方应用等外部连接系统不应存在由汽车行业权威漏洞平台6个月前公布且未经处置的高危及以上的安全漏洞。\n" +
"\n" +
"注1:汽车行业权威漏洞平台如车联网产品专用漏洞库NVDB-CAVD等政府主管部门认可的其他漏洞平台。\n" +
"\n" +
"注2:处置包括消除漏洞、制定减缓措施等方式。")
.testMethod("测试人员应使用漏洞扫描工具对车辆外部连接系统进行漏洞扫描,并将测试结果与汽车行业权威漏洞平台6个月前公布的高危及以上的安全漏洞清单和车辆生产企业提供的车辆外部连接系统漏洞处置方案进行比对,测试车辆是否满足7.1.1.1的要求。")
.build();
reviewStandardService.save(build);
}
// 要点新增
@Test
public void pointAdd() {
ReviewKeyPoint build = ReviewKeyPoint.builder()
.text("车辆全生命周期每个阶段的流程文件能够包含相应阶段的信息安全活动及要求。")
.reviewStandardId(1735216941104238592L)
.build();
reviewKeyPointService.save(build);
}
// 细则新增
@Test
public void detailsAdd() {
ReviewDetails build = ReviewDetails.builder()
.text("后生产阶段流程文件应考虑运维阶段、终止支持、退役阶段的信息安全需求,运维阶段包含网络安全事件响应和软件升级。")
.reviewKeypointId(1760578720524886017L)
.build();
reviewDetailsService.save(build);
}
// 场景新增
@Test
public void sceneAdd() {
ReviewScene build = ReviewScene.builder()
.text("--")
.reviewDetailsId(1760579778101854209L)
.build();
reviewSceneService.save(build);
}
}
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