|
|
@ -13,6 +13,7 @@ import java.util.Map; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.StringUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import com.inspect.agg.config.AggProperties; |
|
|
import com.inspect.agg.entity.AggAnalysisDefectMonth; |
|
|
import com.inspect.agg.entity.AggAnalysisDefectMonth; |
|
|
import com.inspect.agg.entity.AggStation; |
|
|
import com.inspect.agg.entity.AggStation; |
|
|
import com.inspect.agg.enums.AlgCategory; |
|
|
import com.inspect.agg.enums.AlgCategory; |
|
|
@ -34,6 +35,7 @@ public class AggStatisticService { |
|
|
private final AggAnalysisDefectMonthMapper defectMonthMapper; |
|
|
private final AggAnalysisDefectMonthMapper defectMonthMapper; |
|
|
private final AggPatrolTaskStatusMapper taskStatusMapper; |
|
|
private final AggPatrolTaskStatusMapper taskStatusMapper; |
|
|
private final AggStationMapper stationMapper; |
|
|
private final AggStationMapper stationMapper; |
|
|
|
|
|
private final AggProperties props; |
|
|
|
|
|
|
|
|
public List<Map<String, Object>> defectStatistic(String stationCode, String algCategory, |
|
|
public List<Map<String, Object>> defectStatistic(String stationCode, String algCategory, |
|
|
String dateType) { |
|
|
String dateType) { |
|
|
@ -159,12 +161,12 @@ public class AggStatisticService { |
|
|
item.put("stationCode", stationCode); |
|
|
item.put("stationCode", stationCode); |
|
|
item.put("stationName", stationName != null ? stationName : stationCode); |
|
|
item.put("stationName", stationName != null ? stationName : stationCode); |
|
|
} |
|
|
} |
|
|
item.put("minorCount", counts.minor); |
|
|
|
|
|
|
|
|
item.put("minorCount", minorCount(counts)); |
|
|
item.put("generalCount", counts.general); |
|
|
item.put("generalCount", counts.general); |
|
|
item.put("seriousCount", counts.serious); |
|
|
item.put("seriousCount", counts.serious); |
|
|
item.put("urgentCount", counts.urgent); |
|
|
item.put("urgentCount", counts.urgent); |
|
|
item.put("normalCount", counts.normal); |
|
|
item.put("normalCount", counts.normal); |
|
|
item.put("defectCount", counts.defectCount()); |
|
|
|
|
|
|
|
|
item.put("defectCount", defectCount(counts)); |
|
|
return item; |
|
|
return item; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -179,14 +181,25 @@ public class AggStatisticService { |
|
|
} |
|
|
} |
|
|
result.put("inspectedTaskCount", number(taskStats, "inspected_task_count")); |
|
|
result.put("inspectedTaskCount", number(taskStats, "inspected_task_count")); |
|
|
result.put("completedTaskCount", number(taskStats, "completed_task_count")); |
|
|
result.put("completedTaskCount", number(taskStats, "completed_task_count")); |
|
|
result.put("defectCount", defectStats.defectCount()); |
|
|
|
|
|
result.put("minorCount", defectStats.minor); |
|
|
|
|
|
|
|
|
result.put("defectCount", defectCount(defectStats)); |
|
|
|
|
|
result.put("minorCount", minorCount(defectStats)); |
|
|
result.put("generalCount", defectStats.general); |
|
|
result.put("generalCount", defectStats.general); |
|
|
result.put("seriousCount", defectStats.serious); |
|
|
result.put("seriousCount", defectStats.serious); |
|
|
result.put("urgentCount", defectStats.urgent); |
|
|
result.put("urgentCount", defectStats.urgent); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int minorCount(Counts counts) { |
|
|
|
|
|
return props.getStatistic().isMinorDefectEnabled() ? counts.minor : 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private long defectCount(Counts counts) { |
|
|
|
|
|
if (props.getStatistic().isMinorDefectEnabled()) { |
|
|
|
|
|
return counts.defectCount(); |
|
|
|
|
|
} |
|
|
|
|
|
return (long) counts.general + counts.serious + counts.urgent; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private String stationDisplayName(String stationCode) { |
|
|
private String stationDisplayName(String stationCode) { |
|
|
if (!StringUtils.hasText(stationCode)) { |
|
|
if (!StringUtils.hasText(stationCode)) { |
|
|
return null; |
|
|
return null; |
|
|
|