|
@@ -527,46 +527,43 @@ public class MsgAlarmController extends BaseController {
|
|
|
@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())));
|
|
|
+ alarmStatisticResVo = (AlarmStatisticResVo) dataScoreUtil.setDataScore(getUserId(), alarmStatisticResVo);
|
|
|
+ IPage<AlarmStatisticVo> page = msgAlarmService.list(alarmStatisticResVo);
|
|
|
+ page.setTotal(page.getTotal());
|
|
|
+ page.setCurrent(page.getCurrent());
|
|
|
+ page.setPages(page.getPages());
|
|
|
+ if (!ObjectUtils.isEmpty(page) && page.getRecords().size() > 0) {
|
|
|
+ List<AlarmStatisticVo> dto1 = page.getRecords().stream().map(o -> {
|
|
|
+ if (!ObjectUtils.isEmpty(o.getAlarmMile())) {
|
|
|
+ o.setAlarmMile(AppendUtils.stringAppend(Integer.valueOf(o.getAlarmMile())));
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(l.getReleasedBy())) {
|
|
|
- BaseUser buser = baseUserService.getUser(l.getReleasedBy());
|
|
|
- l.setReleasedByName(buser.getNickName());
|
|
|
+ if (StringUtils.isNotEmpty(o.getReleasedBy())) {
|
|
|
+ BaseUser buser = baseUserService.getUser(o.getReleasedBy());
|
|
|
+ o.setReleasedByName(buser.getNickName());
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(l.getReleasedType())) {
|
|
|
- l.setReleasedTypeName(l.getReleasedType() == 1 ? "实报" : "误报");
|
|
|
+ if (!ObjectUtils.isEmpty(o.getReleasedType())) {
|
|
|
+ o.setReleasedTypeName(o.getReleasedType() == 1 ? "实报" : "误报");
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(l.getLineDir())) {
|
|
|
- l.setLineDirName(l.getLineDir() == 1 ? "上行" : "下行");
|
|
|
+ if (!ObjectUtils.isEmpty(o.getLineDir())) {
|
|
|
+ o.setLineDirName(o.getLineDir() == 1 ? "上行" : "下行");
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(l.getAlarmType())) {
|
|
|
- l.setAlarmTypeName(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(l.getAlarmType())));
|
|
|
+ if (!ObjectUtils.isEmpty(o.getAlarmType())) {
|
|
|
+ o.setAlarmTypeName(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(o.getAlarmType())));
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(l.getIsLock())) {
|
|
|
- l.setIsLockName(l.getIsLock() == 1 ? "已解除" : "未解除");
|
|
|
+ if (!ObjectUtils.isEmpty(o.getIsLock())) {
|
|
|
+ o.setIsLockName(o.getIsLock() == 1 ? "已解除" : "未解除");
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(l.getAlarmAttr())) {
|
|
|
- String[] split1 = l.getAlarmAttr().split(",");
|
|
|
+ if (!ObjectUtils.isEmpty(o.getAlarmAttr())) {
|
|
|
+ String[] split1 = o.getAlarmAttr().split(",");
|
|
|
String stringBuilder = "画面大小" + split1[0] + "×" + split1[1] + "," +
|
|
|
"泥石流范围为左上角坐标(" + split1[2] + "," + split1[3] + ")" +
|
|
|
"大小" + split1[4] + "×" + split1[5];
|
|
|
- l.setAlarmAttrString(stringBuilder);
|
|
|
+ o.setAlarmAttrString(stringBuilder);
|
|
|
}
|
|
|
- });
|
|
|
+ return o;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ page.setRecords(dto1);
|
|
|
}
|
|
|
- IPage page = msgAlarmService.listToPage(list, pageNum, pageSize);
|
|
|
return AjaxResult.success(page);
|
|
|
}
|
|
|
|
|
@@ -586,18 +583,12 @@ public class MsgAlarmController extends BaseController {
|
|
|
@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 = "";
|
|
|
- }
|
|
|
+ alarmStatisticResVo = (AlarmStatisticResVo) dataScoreUtil.setDataScore(getUserId(), alarmStatisticResVo);
|
|
|
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);
|
|
|
+ list = msgAlarmService.getCount(alarmStatisticResVo);
|
|
|
listSize = 12;
|
|
|
} else {
|
|
|
if (alarmStatisticResVo.getCurrentMonth().equals(2)) {//2
|
|
@@ -608,8 +599,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
} else {//1,3,5,7,8,10,12
|
|
|
listSize = 31;
|
|
|
}
|
|
|
- list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
+ list = msgAlarmService.getDayCount(alarmStatisticResVo);
|
|
|
}
|
|
|
for (int i = 1; i <= listSize; i++) {
|
|
|
numbs.add(i);
|
|
@@ -659,13 +649,9 @@ public class MsgAlarmController extends BaseController {
|
|
|
@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 = "";
|
|
|
- }
|
|
|
+ alarmStatisticResVo = (AlarmStatisticResVo) dataScoreUtil.setDataScore(getUserId(), alarmStatisticResVo);
|
|
|
try {
|
|
|
- List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
|
|
|
+ List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo);
|
|
|
if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
list.forEach(l -> {
|
|
|
if (!ObjectUtils.isEmpty(l.getAlarmMile())) {
|
|
@@ -725,18 +711,13 @@ public class MsgAlarmController extends BaseController {
|
|
|
@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 = "";
|
|
|
- }
|
|
|
+ alarmStatisticResVo = (AlarmStatisticResVo) dataScoreUtil.setDataScore(getUserId(), alarmStatisticResVo);
|
|
|
String sheetName = "报警年统计数据";
|
|
|
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);
|
|
|
+ list = msgAlarmService.getCount(alarmStatisticResVo);
|
|
|
listSize = 12;
|
|
|
} else {
|
|
|
sheetName = "报警月统计数据";
|
|
@@ -748,8 +729,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
} else {//1,3,5,7,8,10,12
|
|
|
listSize = 31;
|
|
|
}
|
|
|
- list = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
+ list = msgAlarmService.getDayCount(alarmStatisticResVo);
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
for (int i = 1; i <= listSize; i++) {
|