修复空指针

master
youys 2 years ago
parent 4874377f89
commit a3acd04f2c

@ -129,7 +129,7 @@ public class QualityInspectController {
*/
@GetMapping("/problemAnalysis")
@ResponseBody
public ResponseResult<String> problemAnalysis(@RequestParam Integer ruleId) {
public ResponseResult<ProblemAnalysisDTO> problemAnalysis(@RequestParam Integer ruleId) {
ProblemAnalysisDTO problemAnalysis = qualityInspectService.getProblemAnalysis(ruleId);
return ResponseResult.success(problemAnalysis);
}

@ -20,6 +20,7 @@ import net.educoder.ecsonar.utils.IdUtils;
import net.educoder.ecsonar.utils.SystemUtil;
import net.educoder.ecsonar.utils.html.HtmlSourceDecorator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -318,7 +319,13 @@ public class QualityInspectService {
problemAnalysisDTO.setExample(example);
problemAnalysisDTO.setLanguage(rule.getLanguage());
problemAnalysisDTO.setConstantIssue(rule.getDefRemediationBaseEffort());
if (StringUtils.isBlank(rule.getTags())) {
problemAnalysisDTO.setTags(new ArrayList<>());
}else{
problemAnalysisDTO.setTags(Arrays.asList(rule.getTags().split(",")));
}
problemAnalysisDTO.setCreateTime(DateUtil.formatDateTime(new Date(rule.getCreateTime())));
}else{
problemAnalysisDTO.setTitle("");

@ -11,6 +11,7 @@
inner join rules r on i.rule_id =r.id
inner join projects p on p.uuid =i.component_uuid
where i.project_uuid = #{projectUuid,jdbcType=VARCHAR}
and i.status='OPEN'
and p.root_uuid =#{projectUuid,jdbcType=VARCHAR} and p.uuid !=#{projectUuid,jdbcType=VARCHAR} and p."scope" ='FIL'
<if test="issueType != null">
and i.issue_type=#{issueType,jdbcType=INTEGER}
@ -28,6 +29,7 @@
inner join rules r on i.rule_id =r.id
inner join projects p on p.uuid =i.component_uuid
where i.project_uuid = #{projectUuid,jdbcType=VARCHAR}
and i.status='OPEN'
and p.root_uuid =#{projectUuid,jdbcType=VARCHAR} and p.uuid !=#{projectUuid,jdbcType=VARCHAR} and p."scope" ='FIL'
<if test="issueType != null">
and i.issue_type=#{issueType,jdbcType=INTEGER}
@ -40,11 +42,11 @@
<select id="queryDegree" resultType="net.educoder.ecsonar.model.dto.DegreeDTO">
select
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType}) total,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'MAJOR') major,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'MINOR') minor,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'BLOCKER') blocker,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'CRITICAL') critical,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and status='OPEN') total,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'MAJOR' and status='OPEN') major,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'MINOR' and status='OPEN') minor,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'BLOCKER' and status='OPEN') blocker,
(select count(1) from issues i where project_uuid =#{projectUuid} and issue_type=#{issueType} and severity = 'CRITICAL' and status='OPEN') critical,
(select text_value from project_measures i where component_uuid =#{projectUuid} and metric_id = 80 order by id desc limit 1) levelStr
</select>

Loading…
Cancel
Save