Commit 6eed5f31 authored by 刘凡's avatar 刘凡

*)故障原因占比

parent 2d1eccee
......@@ -55,6 +55,12 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
*/
List<Map<String, Object>> queryListByLocation(@Param("regionCode") String regionCode, @Param("dto") DPFilterParamDto filterParamDto);
/**
* 接警情况统计(故障原因)
*
* @return
*/
List<Map<String, Object>> faultCauseRatio(@Param("regionCode") String regionCode);
/**
* 接警情况统计
*
* @param beginDate
......
......@@ -160,6 +160,28 @@
ORDER BY ibjuj.USE_PLACE ASC
</select>
<select id="faultCauseRatio" resultType="java.util.Map">
SELECT
tafv.field_value AS errorResult,
ifnull ( SUM ( CASE WHEN tac.father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) AS majorAlertCount
FROM
tz_alert_called tac
LEFT JOIN tz_dispatch_task tdt ON tac.sequence_nbr = tdt.alert_id
LEFT JOIN tz_alert_form_value tafv ON tac.sequence_nbr = tafv.alert_called_id
LEFT JOIN cb_data_dictionary cdd ON cdd.NAME = tafv.field_value
WHERE
tac.biz_org_code LIKE concat(#{regionCode}, '%')
AND tac.alarm_type_code = '961'
AND cdd.TYPE = 'GZYY'
AND tafv.field_code = 'error_result'
AND tafv.field_value IS NOT NULL
GROUP BY
tafv.field_value
ORDER BY
majorAlertCount ASC
LIMIT 5
</select>
<select id="queryAlertListByQueryDto" resultType="java.util.Map">
SELECT
a.sequence_nbr AS sequenceNbr,
......
......@@ -76,6 +76,17 @@ public class DPStatisticsController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-故障原因占比", notes = "大屏-应急-故障原因占比")
@PostMapping(value = "/yj/faultCauseRatio")
public ResponseModel<JSONObject> faultCauseRatio(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.faultCauseRatio(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-困人救援月度情况", notes = "大屏-应急-困人救援月度情况")
@PostMapping(value = "/yj/trappedUserCount")
public ResponseModel<JSONObject> trappedUserCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
......
......@@ -146,6 +146,19 @@ public class DPStatisticsServiceImpl {
return jsonObject;
}
public JSONObject faultCauseRatio(DPFilterParamDto dpFilterParamDto) throws Exception {
String orgCode = this.getAndSetOrgCode(dpFilterParamDto);
List<Map<String, Object>> maps = alertCalledMapper.faultCauseRatio(orgCode);
List<Object> xdata = maps.stream().map(item -> item.get("errorResult")).collect(Collectors.toList());
List<Object> ydata = maps.stream().map(item -> item.get("majorAlertCount")).collect(Collectors.toList());
JSONObject jsonObject = new JSONObject();
jsonObject.put("xdata", xdata);
jsonObject.put("ydata", ydata);
return jsonObject;
}
public List<AlertPaperInfoDto> instantAlert(DPFilterParamDto dpFilterParamDto) throws Exception {
List<String> regionCodes = new ArrayList<>();
regionCodes.add(dpFilterParamDto.getCityCode());
......
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