Commit c777ccdf authored by 高滢's avatar 高滢
parents 41bf6e19 f7c66002
......@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
......@@ -17,6 +20,9 @@ import java.util.List;
@ApiModel
@TableName(value ="t_review_details")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewDetails {
/**
......
......@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
......@@ -17,6 +20,9 @@ import java.util.List;
@ApiModel
@TableName(value ="t_review_keypoint")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewKeyPoint {
/**
......
......@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
......@@ -16,6 +19,9 @@ import lombok.experimental.Accessors;
@TableName(value ="t_review_scene")
@Accessors(chain = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewScene {
/**
......
......@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
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.ArrayList;
import java.util.List;
......@@ -18,10 +21,14 @@ import java.util.List;
@ApiModel
@TableName(value ="t_review_standard")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReviewStandard {
public static final String TYPE_SYSTEM = "system"; // 体系审查类型
public static final String TYPE_CAR = "car"; // 车型审查类型
public static final String TYPE_TEST = "test"; // 车型试验类型
/**
* 主键
......@@ -43,13 +50,18 @@ public class ReviewStandard {
@ApiModelProperty("章节")
private String chapter;
/**
* 文本内容
*/
@ApiModelProperty("文本内容")
private String text;
/**
* 测试方法(车型试验专有)
*/
@ApiModelProperty("测试方法(车型试验专有)")
private String testMethod;
/**
* 要点列表
*/
......
......@@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 标准
* @TableName t_standard
......@@ -45,4 +47,16 @@ public class Standard {
@ApiModelProperty("文件路径")
private String file;
@ApiModelProperty("标准分类")
private String standardType;
@ApiModelProperty("标准状态")
private String standardStatus;
@ApiModelProperty("发布日期")
private Date releaseDate;
@ApiModelProperty("实施日期")
private Date implementationDate;
}
......@@ -2,6 +2,8 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.springframework.stereotype.Repository;
......@@ -12,4 +14,12 @@ import java.util.List;
public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
List<ReviewStandard> findListByStandardIdAndType(@Param("standardId") Long standardId, @Param("type") String type);
/**
* 查询标准列表
*
* @param request
* @return
*/
List<ReviewStandardResponse> selectReviewStandardList(ReviewStandardListByPageRequest request);
}
......@@ -12,7 +12,7 @@ import java.util.List;
public interface StandardMapper extends BaseMapper<Standard> {
// 分页查询
List<Standard> findList(@Param("params") StandardListRequest request);
List<Standard> findList();
// 根据id查询
Standard findListById(@Param("id") Long Id);
......
......@@ -2,6 +2,9 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
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;
......@@ -9,6 +12,27 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
void initData(List<ReviewStandard> reviewStandardList);
/**
* 查询标准树状结构
* @param standardId
* @param type
* @return
*/
List<ReviewStandard> findTree(Long standardId, String type);
/**
* 分页查询标准列表
*
* @param request
* @return
*/
List<ReviewStandardResponse> listByPage(ReviewStandardListByPageRequest request);
/**
* 通过标准ID查询检验内容(树状结构)
*
* @param id
* @return
*/
ReviewStandardInspectionContentResponse selectInspectionContent(Long id);
}
......@@ -12,7 +12,7 @@ import java.util.List;
public interface StandardService extends IService<Standard> {
// 分页查询
List<Standard> findList(StandardListRequest request);
List<Standard> findList();
//根据id查询
Standard findListById(Long id);
......
......@@ -5,6 +5,9 @@ import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewStandardMapper;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -35,6 +38,7 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
* @param type 问卷类型[system(体系审查),car(车型审查)]
* @return
*/
@Override
public List<ReviewStandard> findTree(Long standardId, String type) {
List<ReviewStandard> reviewStandardList = reviewStandardMapper.findListByStandardIdAndType(standardId, type); // 查询审查标准
......@@ -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
......
......@@ -18,12 +18,12 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
/**
* 分页查询
* @param request
* @param
* @return
*/
@Override
public List<Standard> findList(StandardListRequest request) {
return standardMapper.findList(request);
public List<Standard> findList() {
return standardMapper.findList();
}
/**
......
......@@ -97,6 +97,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task.setTaskInitiator(initiator.getNickName());
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
task.setTaskStatus(Task.TASK_STATUS_NEW);
task.setRunStatus(Task.RUN_STATUS_RUNNABLE);
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
task.setCreateTime(new Date());
......
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);
}
}
......@@ -31,12 +31,12 @@ public class StandardController extends BaseController {
* 分页查询
* @return
*/
@ApiOperation("标准分页查询")
@ApiOperation("标准分页查询")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findStandardList")
public TableDataInfo<Standard> findList(@Validated @RequestBody StandardListRequest request) {
startPage(request);
return getDataTable(standardService.findList(request));
return getDataTable(standardService.findList());
}
}
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;
}
......@@ -8,16 +8,4 @@ import lombok.Data;
@ApiModel(value = "StandardListRequest", description = "查询标准")
@Data
public class StandardListRequest extends PageDomain {
/**
* 标准名称
*/
@ApiModelProperty("标准名称")
private String name;
/**
* 标准号
*/
@ApiModelProperty("标准号")
private String standardNo;
}
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 @@
<result property="file" column="file" jdbcType="VARCHAR"/>
<result property="conformity" column="conformity" 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">
<result property="id" column="u_id" jdbcType="BIGINT"/>
......@@ -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>
<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>
......@@ -9,19 +9,15 @@
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="standardNo" column="standard_no" jdbcType="VARCHAR"/>
<result property="file" column="file" jdbcType="VARCHAR"/>
<result property="standardType" column="standard_type" jdbcType="VARCHAR"/>
<result property="standardStatus" column="standard_status" jdbcType="VARCHAR"/>
<result property="releaseDate" column="release_date" jdbcType="TIMESTAMP"/>
<result property="implementationDate" column="implementation_date" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="findList" parameterType="com.ruoyi.web.request.StandardListRequest" resultMap="BaseResultMap">
SELECT id, name, standard_no, file
SELECT id, name, standard_no, file,standard_type,standard_status,release_date,implementation_date
FROM t_standard
<where>
<if test="params.name != null and params.name != ''">
and name like concat('%',#{params.name},'%')
</if>
<if test="params.standardNo != null and params.standardNo != ''">
and standard_no = #{params.standardNo}
</if>
</where>
</select>
<select id="findListById" resultMap="BaseResultMap">
......
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