|
@@ -372,218 +372,5 @@ public class MsgAlarmController extends BaseController {
|
|
|
List<MsgAlarm> list = msgAlarmService.list(wrapper);
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * web数据统计
|
|
|
- *
|
|
|
- * @param alarmStatisticResVo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.OTHER)
|
|
|
- @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 = "灾害类型"),
|
|
|
- })
|
|
|
- public AjaxResult dataStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
- Integer pageNum = alarmStatisticResVo.getPageNum().intValue();
|
|
|
- Integer pageSize = alarmStatisticResVo.getPageSize().intValue();
|
|
|
- SysUser user = getLoginUser().getUser();
|
|
|
- String userId = getUserId();
|
|
|
- if (user.isAdmin(user.getId())) {
|
|
|
- userId = "";
|
|
|
- }
|
|
|
- List<AlarmStatisticVo> list = msgAlarmService.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), pageNum, pageSize, userId);
|
|
|
- if (!ObjectUtils.isEmpty(list)) {
|
|
|
- list.forEach(l -> {
|
|
|
- if (!ObjectUtils.isEmpty(l.getAlarmMile())) {
|
|
|
- l.setAlarmMile(AppendUtils.stringAppend(Integer.valueOf(l.getAlarmMile())));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(l.getReleasedBy())) {
|
|
|
- BaseUser buser = baseUserService.getUser(l.getReleasedBy());
|
|
|
- l.setReleasedByName(buser.getNickName());
|
|
|
- }
|
|
|
-
|
|
|
- if (!ObjectUtils.isEmpty(l.getLineDir())) {
|
|
|
- l.setLineDirName(l.getLineDir() == 1 ? "上行" : "下行");
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(l.getAlarmType())) {
|
|
|
- l.setAlarmTypeName(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(l.getAlarmType())));
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(l.getIsRelease())) {
|
|
|
- l.setIsReleaseName(l.getIsRelease() == 1 ? "已解除" : "未解除");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- IPage page = msgAlarmService.listToPage(list, pageNum, pageSize);
|
|
|
- return AjaxResult.success(page);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * web数据统计
|
|
|
- *
|
|
|
- * @param
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.OTHER)
|
|
|
- @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 = "灾害类型"),
|
|
|
- })
|
|
|
- public AjaxResult alarmMonthStatistic(@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
- SysUser user = getLoginUser().getUser();
|
|
|
- String userId = getUserId();
|
|
|
- ;
|
|
|
- if (user.isAdmin(user.getId())) {
|
|
|
- userId = "";
|
|
|
- }
|
|
|
- List<Integer> numbs = new ArrayList<>();
|
|
|
- Integer listSize;
|
|
|
- List<AlarmStatisticMonthDto> list = null;
|
|
|
- if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
|
|
|
- list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- listSize = 12;
|
|
|
- } else {
|
|
|
- if (alarmStatisticResVo.getCurrentMonth().equals(2)) {//2
|
|
|
- listSize = 28;
|
|
|
- } else if (alarmStatisticResVo.getCurrentMonth().equals(4) || alarmStatisticResVo.getCurrentMonth().equals(6) ||
|
|
|
- alarmStatisticResVo.getCurrentMonth().equals(9) || alarmStatisticResVo.getCurrentMonth().equals(11)) {//4,6,9,11
|
|
|
- listSize = 30;
|
|
|
- } else {//1,3,5,7,8,10,12
|
|
|
- listSize = 31;
|
|
|
- }
|
|
|
- list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- }
|
|
|
- for (int i = 1; i <= listSize; i++) {
|
|
|
- numbs.add(i);
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> list1 = new ArrayList<>();
|
|
|
- if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
- list.forEach(l -> {
|
|
|
- list1.add(l.getMonthsta());
|
|
|
- });
|
|
|
- }
|
|
|
- AlarmStatisticMonthDto dto;
|
|
|
- for (int i = 0; i < numbs.size(); i++) {
|
|
|
- if (!list1.contains(numbs.get(i))) {
|
|
|
- dto = new AlarmStatisticMonthDto();
|
|
|
- dto.setMonthsta(numbs.get(i));
|
|
|
- dto.setFrequency(0);
|
|
|
- list.add(dto);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
- Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
|
|
|
- @Override
|
|
|
- public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
|
|
|
-
|
|
|
- return o1.getMonthsta().compareTo(o2.getMonthsta());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- return AjaxResult.success(list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * web数据统计 数据导出
|
|
|
- *
|
|
|
- * @param
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Log(title = "报警信息管理", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/exportDataStatistic")
|
|
|
- @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 = "灾害类型"),
|
|
|
- })
|
|
|
- public void exportDataStatistic(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
- SysUser user = getLoginUser().getUser();
|
|
|
- String userId = getUserId();
|
|
|
- if (user.isAdmin(user.getId())) {
|
|
|
- userId = "";
|
|
|
- }
|
|
|
- try {
|
|
|
- List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
|
|
|
- if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
- list.forEach(l -> {
|
|
|
- if (!ObjectUtils.isEmpty(l.getAlarmMile())) {
|
|
|
- l.setAlarmMiles(AppendUtils.stringAppend(Integer.valueOf(l.getAlarmMile())));
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(l.getReleasedBy())) {
|
|
|
- BaseUser buser = baseUserService.getUser(l.getReleasedBy());
|
|
|
- l.setReleasedByName(buser.getNickName());
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(l.getAlarmType())) {
|
|
|
- String alarmType = l.getAlarmType();
|
|
|
- String alarmTypeValue = dictDataService.selectDictLabel("sys_alarm_type", alarmType);
|
|
|
- l.setAlarmTypeValue(alarmTypeValue);
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(l.getLineDir())) {
|
|
|
- String lineDir = l.getLineDir();
|
|
|
- String lineDirValue = dictDataService.selectDictLabel("sys_line_dir", lineDir);
|
|
|
- l.setLineDirValue(lineDirValue);
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(l.getIsRelease())) {
|
|
|
- l.setIsReleaseName(l.getIsRelease() == 1 ? "已解除" : "未解除");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- ExcelUtil<AlarmStatisticDto> util = new ExcelUtil<>(AlarmStatisticDto.class);
|
|
|
- util.exportExcel(response, list, "报警数据详情");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- log.info(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * web数据统计 报警月统计数据导出
|
|
|
- *
|
|
|
- * @param
|
|
|
- * @return
|
|
|
- */
|
|
|
- @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 = "灾害类型"),
|
|
|
- })
|
|
|
- public void exportDataStatisticMonth(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
|
|
|
- SysUser user = getLoginUser().getUser();
|
|
|
- String userId = getUserId();
|
|
|
- if (user.isAdmin(user.getId())) {
|
|
|
- userId = "";
|
|
|
- }
|
|
|
-
|
|
|
- List<AlarmStatisticMonthDto> list = null;
|
|
|
- if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
|
|
|
- list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- } else {
|
|
|
- list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- }
|
|
|
- ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
|
|
|
- util.exportExcel(response, list, "报警月统计数据");
|
|
|
- }
|
|
|
}
|
|
|
|