|
@@ -10,10 +10,10 @@ import com.ozs.common.utils.AppendUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.poi.ExcelUtil;
|
|
|
import com.ozs.entity.BaseUser;
|
|
|
+import com.ozs.entity.vo.AlarmFreqArea;
|
|
|
import com.ozs.entity.vo.AlarmStatisticDto;
|
|
|
import com.ozs.entity.vo.AlarmStatisticMonthDto;
|
|
|
import com.ozs.entity.vo.AlarmStatisticResVo;
|
|
|
-import com.ozs.entity.vo.AlarmStatisticVo;
|
|
|
import com.ozs.service.BaseUserService;
|
|
|
import com.ozs.service.MsgAlarmService;
|
|
|
import com.ozs.system.service.ISysDictDataService;
|
|
@@ -32,6 +32,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.text.NumberFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -55,14 +57,13 @@ public class DataStatisticController extends BaseController {
|
|
|
* @param alarmStatisticResVo
|
|
|
* @return
|
|
|
*/
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.OTHER)
|
|
|
+ @Log(title = "报警数据详情", businessType = BusinessType.SELECT)
|
|
|
@PostMapping("/dataStatistic")
|
|
|
@ApiOperation(value = "web数据统计 报警数据详情")
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
|
|
|
@ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
|
|
|
})
|
|
|
public AjaxResult dataStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
Integer pageNum = alarmStatisticResVo.getPageNum().intValue();
|
|
@@ -100,14 +101,13 @@ public class DataStatisticController extends BaseController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.OTHER)
|
|
|
+ @Log(title = "报警月统计", businessType = BusinessType.SELECT)
|
|
|
@PostMapping("/alarmMonthStatistic")
|
|
|
@ApiOperation(value = "web数据统计 报警月统计数据")
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
|
|
|
@ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
|
|
|
})
|
|
|
public AjaxResult alarmMonthStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
List<Integer> numbs = new ArrayList<>();
|
|
@@ -160,6 +160,67 @@ public class DataStatisticController extends BaseController {
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * web数据统计
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "灾害类型统计", businessType = BusinessType.SELECT)
|
|
|
+ @PostMapping("/alarmTypeStatistic")
|
|
|
+ @ApiOperation(value = "web数据统计 灾害类型统计数据")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
|
|
|
+ })
|
|
|
+ public AjaxResult alarmTypeStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
+ List<AlarmStatisticMonthDto> list = msgAlarmService.getAlarmTypeCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
+ alarmStatisticResVo.getCurrentMonth());
|
|
|
+ Integer sum = list.stream().mapToInt((x) -> Integer.parseInt(String.valueOf(x.getFrequency()))).sum();
|
|
|
+ NumberFormat numberFormat = NumberFormat.getPercentInstance();
|
|
|
+ numberFormat.setMinimumFractionDigits(2);
|
|
|
+ if (!CollectionUtils.isEmpty(list) && list.size()!= 0){
|
|
|
+ list.forEach(l -> {
|
|
|
+ if (!ObjectUtils.isEmpty(l.getAlarmType())) {
|
|
|
+ l.setAlarmTypeValue(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(l.getAlarmType())));
|
|
|
+ }
|
|
|
+ l.setPercent(numberFormat.format(l.getFrequency()*1.0 / sum));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * web数据统计
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "频繁出现灾害地点排名", businessType = BusinessType.SELECT)
|
|
|
+ @PostMapping("/alarmTypeAreaCount")
|
|
|
+ @ApiOperation(value = "web数据统计 频繁出现灾害地点排名")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
|
|
|
+ })
|
|
|
+ public AjaxResult alarmTypeAreaCount(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
+ Integer pageNum = alarmStatisticResVo.getPageNum().intValue();
|
|
|
+ Integer pageSize = alarmStatisticResVo.getPageSize().intValue();
|
|
|
+ List<AlarmFreqArea> list = msgAlarmService.alarmTypeAreaCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
+ alarmStatisticResVo.getCurrentMonth());
|
|
|
+ list.forEach(l -> {
|
|
|
+ if (!ObjectUtils.isEmpty(l.getAlarmMile())) {
|
|
|
+ l.setAlarmMiles(AppendUtils.stringAppend(Integer.valueOf(l.getAlarmMile())));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ IPage page = msgAlarmService.listToPage(list, pageNum, pageSize);
|
|
|
+ if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())) {
|
|
|
+ return AjaxResult.success(page);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(null);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* web数据统计 数据导出
|
|
@@ -167,14 +228,13 @@ public class DataStatisticController extends BaseController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.EXPORT)
|
|
|
+ @Log(title = "报警详情导出管理", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/exportDataStatistic")
|
|
|
- @ApiOperation(value = "web数据统计-数据导出")
|
|
|
+ @ApiOperation(value = "报警详情导出管理")
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
|
|
|
@ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
|
|
|
})
|
|
|
public void exportDataStatistic(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
try {
|
|
@@ -216,14 +276,13 @@ public class DataStatisticController extends BaseController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.EXPORT)
|
|
|
+ @Log(title = "报警月统计数据导出", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/exportDataStatisticMonth")
|
|
|
@ApiOperation(value = "报警月统计数据导出")
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(paramType = "query", name = "railwayCode", value = "线路编码"),
|
|
|
@ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份"),
|
|
|
- @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
|
|
|
})
|
|
|
public void exportDataStatisticMonth(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
List<AlarmStatisticMonthDto> list = null;
|