Commit bb202591 authored by 高滢's avatar 高滢

首页平均检验通过率

parent 84f8045b
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("平均检验通过率")
public class AverageInspectionRateVO {
@ApiModelProperty("检验项目")
private String inspectionItems;
@ApiModelProperty("通过率")
private Integer passingRate;
@ApiModelProperty("标准号")
private String standardNumber;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "首页任务保密等级占比")
public class ConfidentialityLevelProportionVO {
@ApiModelProperty("任务等级数量")
private Long value;
@ApiModelProperty("任务等级")
private String name;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("三个子项目检验通过个数")
public class InspectionItemPassedNumVO {
@ApiModelProperty("体系审查已完成个数")
private Integer sysReviewcompletedNum;
@ApiModelProperty("体系审查已通过个数")
private Integer sysReviewPassedNum;
@ApiModelProperty("车型审查已完成个数")
private Integer carReviewcompletedNum;
@ApiModelProperty("车型审查已通过个数")
private Integer carReviewPassedNum;
@ApiModelProperty("车型实验已完成个数")
private Integer modelTestCompletedNum;
@ApiModelProperty("车型实验已通过个数")
private Integer modelTestPassedNum;
}
...@@ -16,4 +16,7 @@ public interface StandardMapper extends BaseMapper<Standard> { ...@@ -16,4 +16,7 @@ public interface StandardMapper extends BaseMapper<Standard> {
// 根据id查询 // 根据id查询
Standard findListById(@Param("id") Long Id); Standard findListById(@Param("id") Long Id);
//查询全部
List<Standard> selectListAll();
} }
package com.ruoyi.mapper; package com.ruoyi.mapper;
import com.ruoyi.domain.vo.ConfidentialityLevelProportionVO;
import com.ruoyi.domain.vo.InspectionItemPassedNumVO;
import com.ruoyi.domain.vo.QuantityStatisticsVO; import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO; import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -14,4 +16,10 @@ public interface StatisticsHomeMapper { ...@@ -14,4 +16,10 @@ public interface StatisticsHomeMapper {
// 标准类别统计 // 标准类别统计
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(); public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics();
// 任务保密等级统计
public List<ConfidentialityLevelProportionVO> selectConfidentialityLevelStatistics();
// 体系审查任务通过数量
public InspectionItemPassedNumVO selectInspectionItemPassedNum();
} }
package com.ruoyi.service; package com.ruoyi.service;
import com.ruoyi.domain.vo.AverageInspectionRateVO;
import com.ruoyi.domain.vo.ConfidentialityLevelProportionVO;
import com.ruoyi.domain.vo.QuantityStatisticsVO; import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO; import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
...@@ -11,4 +13,10 @@ public interface StatisticsHomeService { ...@@ -11,4 +13,10 @@ public interface StatisticsHomeService {
// 标准类别统计 // 标准类别统计
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(); public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics();
// 任务保密等级统计
public List<ConfidentialityLevelProportionVO> selectConfidentialityLevelStatistics();
//平均检验通过率
public List<AverageInspectionRateVO> selectAverageInspectionRate();
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.domain.vo.QuantityStatisticsVO; import com.ruoyi.domain.Standard;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO; import com.ruoyi.domain.vo.*;
import com.ruoyi.mapper.StandardMapper;
import com.ruoyi.mapper.StatisticsHomeMapper; import com.ruoyi.mapper.StatisticsHomeMapper;
import com.ruoyi.service.StatisticsHomeService; import com.ruoyi.service.StatisticsHomeService;
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;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
...@@ -16,6 +18,9 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService { ...@@ -16,6 +18,9 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
@Autowired @Autowired
private StatisticsHomeMapper statisticsHomeMapper; private StatisticsHomeMapper statisticsHomeMapper;
@Autowired
private StandardMapper standardMapper;
@Override @Override
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome){ public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome){
...@@ -30,7 +35,39 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService { ...@@ -30,7 +35,39 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
return statisticsHomeMapper.selectStandardCategoryStatistics(); return statisticsHomeMapper.selectStandardCategoryStatistics();
} }
// 计算百分比 @Override
public List<ConfidentialityLevelProportionVO> selectConfidentialityLevelStatistics(){
return statisticsHomeMapper.selectConfidentialityLevelStatistics();
}
@Override
public List<AverageInspectionRateVO> selectAverageInspectionRate(){
List<Standard> standards = standardMapper.selectListAll();
String standardNo = null;
if(!standards.isEmpty()){
standardNo = standards.get(0).getStandardNo();
}
InspectionItemPassedNumVO inspectionItemPassedNumVO = statisticsHomeMapper.selectInspectionItemPassedNum();
List<AverageInspectionRateVO> list = new ArrayList<>();
AverageInspectionRateVO averageInspectionRateOne = new AverageInspectionRateVO();
averageInspectionRateOne.setInspectionItems("汽车信息安全管理体系要求");
averageInspectionRateOne.setPassingRate(proportionCalculation(inspectionItemPassedNumVO.getSysReviewPassedNum(), inspectionItemPassedNumVO.getSysReviewcompletedNum()));
list.add(averageInspectionRateOne);
AverageInspectionRateVO averageInspectionRateTwo = new AverageInspectionRateVO();
averageInspectionRateTwo.setInspectionItems("汽车信息安全一般要求");
averageInspectionRateTwo.setPassingRate(proportionCalculation(inspectionItemPassedNumVO.getCarReviewPassedNum(),inspectionItemPassedNumVO.getCarReviewcompletedNum()));
list.add(averageInspectionRateTwo);
AverageInspectionRateVO averageInspectionRateThree = new AverageInspectionRateVO();
averageInspectionRateThree.setInspectionItems("汽车信息安全技术要求");
averageInspectionRateThree.setPassingRate(proportionCalculation(inspectionItemPassedNumVO.getModelTestPassedNum(),inspectionItemPassedNumVO.getModelTestCompletedNum()));
list.add(averageInspectionRateThree);
for(AverageInspectionRateVO averageInspectionRate:list){
averageInspectionRate.setStandardNumber(standardNo);
}
return list;
}
// 计算两个数各占比
public int percentageCalculation(Integer a, Integer b){ public int percentageCalculation(Integer a, Integer b){
int total = a+b; int total = a+b;
if(total == 0){ if(total == 0){
...@@ -40,4 +77,14 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService { ...@@ -40,4 +77,14 @@ public class StatisticsHomeServiceImpl implements StatisticsHomeService {
return Math.round(c*100); return Math.round(c*100);
} }
} }
// 计算百分比
public int proportionCalculation(Integer a, Integer b){
if(b == 0){
return 0;
}else {
float c = (float)a/b;
return Math.round(c*100);
}
}
} }
package com.ruoyi.web; package com.ruoyi.web;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.vo.AverageInspectionRateVO;
import com.ruoyi.domain.vo.ConfidentialityLevelProportionVO;
import com.ruoyi.domain.vo.QuantityStatisticsVO; import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO; import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
import com.ruoyi.service.StatisticsHomeService; import com.ruoyi.service.StatisticsHomeService;
...@@ -32,4 +34,14 @@ public class StatisticsHomeController { ...@@ -32,4 +34,14 @@ public class StatisticsHomeController {
public R<List<StandardCategoryStatisticsVO>> selectStandardCategoryStatistics(){ public R<List<StandardCategoryStatisticsVO>> selectStandardCategoryStatistics(){
return R.ok(statisticsHomeService.selectStandardCategoryStatistics()); return R.ok(statisticsHomeService.selectStandardCategoryStatistics());
} }
@ApiOperation("首页任务保密等级占比")
@PostMapping("/confidentialityLevel")
public R<List<ConfidentialityLevelProportionVO>> selectConfidentialityLevelStatistics(){
return R.ok(statisticsHomeService.selectConfidentialityLevelStatistics());
}
@ApiOperation("首页平均检验通过率")
@PostMapping("/averageInspectionRate")
public R<List<AverageInspectionRateVO>> selectAverageInspectionRate(){
return R.ok(statisticsHomeService.selectAverageInspectionRate());
}
} }
...@@ -30,4 +30,7 @@ ...@@ -30,4 +30,7 @@
FROM t_standard WHERE id = #{id} FROM t_standard WHERE id = #{id}
</select> </select>
<select id="selectListAll" resultMap="BaseResultMap">
SELECT id, name, standard_no, file,standard_type,standard_status,release_date,implementation_date FROM t_standard
</select>
</mapper> </mapper>
...@@ -38,4 +38,24 @@ ...@@ -38,4 +38,24 @@
GROUP BY GROUP BY
standard_type standard_type
</select> </select>
<select id="selectConfidentialityLevelStatistics" resultType="com.ruoyi.domain.vo.ConfidentialityLevelProportionVO">
SELECT
count( id ) AS value,
confidentiality_level AS name
FROM
t_task
GROUP BY
confidentiality_level
</select>
<select id="selectInspectionItemPassedNum" resultType="com.ruoyi.domain.vo.InspectionItemPassedNumVO">
SELECT
( SELECT COUNT( id ) FROM t_system_review_task WHERE task_status = 'FINISH' ) AS sysReviewcompletedNum,
( SELECT COUNT( id ) FROM t_system_review_task WHERE task_status = 'FINISH' AND task_result = 'PASS' ) AS sysReviewPassedNum,
( SELECT COUNT( id ) FROM t_car_review_task WHERE task_status = 'FINISH' ) AS carReviewcompletedNum,
( SELECT COUNT( id ) FROM t_car_review_task WHERE task_status = 'FINISH' AND task_result = 'PASS' ) AS carReviewPassedNum,
( SELECT COUNT( id ) FROM t_model_test_task WHERE task_status = 'FINISH' ) AS modelTestCompletedNum,
( SELECT COUNT( id ) FROM t_model_test_task WHERE task_status = 'FINISH' AND task_result = 'PASS' ) AS modelTestPassedNum
</select>
</mapper> </mapper>
\ No newline at end of file
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