|
@@ -1,5 +1,6 @@
|
|
|
package com.ozs.web.controller.accountmanagment;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ozs.common.annotation.Log;
|
|
|
import com.ozs.common.core.controller.BaseController;
|
|
@@ -10,12 +11,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.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.entity.BaseVehicleTerminal;
|
|
|
+import com.ozs.entity.TerminalIgnoreAlarm;
|
|
|
+import com.ozs.entity.vo.*;
|
|
|
+import com.ozs.service.*;
|
|
|
import com.ozs.system.service.ISysDictDataService;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -32,6 +31,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.*;
|
|
|
|
|
|
/**
|
|
@@ -44,25 +45,30 @@ import java.util.*;
|
|
|
public class DataStatisticController extends BaseController {
|
|
|
private static final Logger log = LoggerFactory.getLogger(DataStatisticController.class);
|
|
|
@Resource
|
|
|
- MsgAlarmService msgAlarmService;
|
|
|
+ private MsgAlarmService msgAlarmService;
|
|
|
@Resource
|
|
|
private BaseUserService baseUserService;
|
|
|
@Autowired
|
|
|
private ISysDictDataService dictDataService;
|
|
|
+ @Autowired
|
|
|
+ private BaseVehicleService baseVehicleService;
|
|
|
+ @Autowired
|
|
|
+ private BaseCameraManagementService baseCameraManagementService;
|
|
|
+ @Autowired
|
|
|
+ private BaseVehicleTerminalService baseVehicleTerminalService;
|
|
|
/**
|
|
|
* web数据统计
|
|
|
*
|
|
|
* @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 +106,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 +165,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 +233,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 +281,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;
|
|
@@ -237,4 +301,36 @@ public class DataStatisticController extends BaseController {
|
|
|
ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
|
|
|
util.exportExcel(response, list, "报警月统计数据");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询终端数、机车数、相机数、预警数
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询终端数、机车数、相机数、预警数")
|
|
|
+ @PostMapping("/getNum")
|
|
|
+ @Log(title = "查询终端数、机车数、相机数、预警数", businessType = BusinessType.SELECT)
|
|
|
+ public AjaxResult getNum() {
|
|
|
+ Long alarmNum = msgAlarmService.getAlarmNum();
|
|
|
+ Long vehicleNum = baseVehicleService.count();
|
|
|
+ QueryWrapper<BaseVehicleTerminal> wrapper = new QueryWrapper<BaseVehicleTerminal>();
|
|
|
+ wrapper.lambda().eq(BaseVehicleTerminal::getStatus,1);
|
|
|
+ Long terminalNum= baseVehicleTerminalService.count();
|
|
|
+ Long cameraNum = baseCameraManagementService.count();
|
|
|
+ DataStatisticNum dataStatisticNum =new DataStatisticNum();
|
|
|
+ if(!ObjectUtils.isEmpty(alarmNum)){
|
|
|
+ dataStatisticNum.setAlarmNum(alarmNum);
|
|
|
+ }
|
|
|
+ if(!ObjectUtils.isEmpty(vehicleNum)){
|
|
|
+ dataStatisticNum.setVehicleNum(vehicleNum);
|
|
|
+ }
|
|
|
+ if(!ObjectUtils.isEmpty(terminalNum)){
|
|
|
+ dataStatisticNum.setTerminalNum(terminalNum);
|
|
|
+ }
|
|
|
+ if(!ObjectUtils.isEmpty(cameraNum)){
|
|
|
+ dataStatisticNum.setCameraNum(cameraNum);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(dataStatisticNum);
|
|
|
+ }
|
|
|
}
|