|
@@ -13,6 +13,7 @@ import com.ozs.common.core.domain.model.LoginUser;
|
|
|
import com.ozs.common.enums.BusinessType;
|
|
|
import com.ozs.common.utils.AppendUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
+import com.ozs.common.utils.file.FileUtils;
|
|
|
import com.ozs.common.utils.poi.ExcelUtil;
|
|
|
import com.ozs.service.entity.*;
|
|
|
import com.ozs.service.entity.vo.*;
|
|
@@ -36,6 +37,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -43,14 +45,18 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestHeader;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
+import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -67,7 +73,6 @@ import java.util.stream.Collectors;
|
|
|
@RequestMapping("/service/msgAlarm")
|
|
|
public class MsgAlarmController extends BaseController {
|
|
|
private static final Logger log = LoggerFactory.getLogger(MsgAlarmController.class);
|
|
|
- public static final String PATTERN = "(^K|^k)([0-9]+)\\+([0-9]{1,3})$";
|
|
|
@Resource
|
|
|
MsgAlarmService msgAlarmService;
|
|
|
@Resource
|
|
@@ -163,29 +168,14 @@ public class MsgAlarmController extends BaseController {
|
|
|
@Log(title = "报警信息管理", businessType = BusinessType.SELECT)
|
|
|
public AjaxResult selectMsgAlarm(@RequestBody MsgAlarmVo msgAlarmVo) {
|
|
|
msgAlarmVo = (MsgAlarmVo) dataScoreUtil.setDataScore(getUserId(), msgAlarmVo);
|
|
|
- if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMiles())) {
|
|
|
- if (!msgAlarmVo.getAlarmMiles().matches(PATTERN)) {
|
|
|
- return error("里程位置填写格式不正确!");
|
|
|
- } else {
|
|
|
- int miles = AppendUtils.stringSplit(msgAlarmVo.getAlarmMiles());
|
|
|
- msgAlarmVo.setAlarmMile(miles);
|
|
|
- }
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile())) {
|
|
|
+ msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile() * 1000);
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginMiles())) {
|
|
|
- if (!msgAlarmVo.getBeginMiles().matches(PATTERN)) {
|
|
|
- return error("监控范围开始里程位置填写格式不正确");
|
|
|
- } else {
|
|
|
- int begin = AppendUtils.stringSplit(msgAlarmVo.getBeginMiles());
|
|
|
- msgAlarmVo.setBeginMile(begin);
|
|
|
- }
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())) {
|
|
|
+ msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile() * 1000);
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMiles())) {
|
|
|
- if (!msgAlarmVo.getEndMiles().matches(PATTERN)) {
|
|
|
- return error("监控范围结束里程位置填写格式不正确");
|
|
|
- } else {
|
|
|
- int end = AppendUtils.stringSplit(msgAlarmVo.getEndMiles());
|
|
|
- msgAlarmVo.setEndMile(end);
|
|
|
- }
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
|
+ msgAlarmVo.setEndMile(msgAlarmVo.getEndMile() * 1000);
|
|
|
}
|
|
|
IPage<MsgAlarm> page = msgAlarmService.queryPage(msgAlarmVo);
|
|
|
page.setTotal(page.getTotal());
|
|
@@ -223,12 +213,76 @@ public class MsgAlarmController extends BaseController {
|
|
|
wrapper.eq(MsgAlarmFrequency::getAlarmId, o.getAlarmId());
|
|
|
}
|
|
|
o.setAlarmCount((int) msgAlarmFrequencyService.count(wrapper));
|
|
|
+ if (!ObjectUtils.isEmpty(o.getReleasedType())) {
|
|
|
+ o.setReleasedTypeName(o.getReleasedType() == 1 ? "真实报警" : "误报警");
|
|
|
+ }
|
|
|
return o;
|
|
|
}).collect(Collectors.toList());
|
|
|
page.setRecords(dto1);
|
|
|
}
|
|
|
return AjaxResult.success(page);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出报警消息
|
|
|
+ *
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ @ApiOperation("导出报警消息")
|
|
|
+ @PostMapping("/exportMsgAlarm")
|
|
|
+ @Log(title = "报警信息管理", businessType = BusinessType.EXPORT)
|
|
|
+ public void exportMsgAlarm(HttpServletResponse response, @RequestBody MsgAlarmVo msgAlarmVo) {
|
|
|
+ msgAlarmVo = (MsgAlarmVo) dataScoreUtil.setDataScore(getUserId(), msgAlarmVo);
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile())) {
|
|
|
+ msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile() * 1000);
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())) {
|
|
|
+ msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile() * 1000);
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
|
+ msgAlarmVo.setEndMile(msgAlarmVo.getEndMile() * 1000);
|
|
|
+ }
|
|
|
+ List<MsgAlarm> msgAlarmList = msgAlarmService.msgAlarmList(msgAlarmVo);
|
|
|
+ for (MsgAlarm msgAlarm : msgAlarmList) {
|
|
|
+ String[] split = msgAlarm.getImageUrl().split(";");
|
|
|
+ ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
|
|
|
+ msgAlarm.setImageUrls(objects);
|
|
|
+ LambdaQueryWrapper<BaseCameraManagement> cameraManagementLambdaQueryWrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getCameraCode())) {
|
|
|
+ cameraManagementLambdaQueryWrapper.eq(BaseCameraManagement::getCameraCode, msgAlarm.getCameraCode());
|
|
|
+ }
|
|
|
+ BaseCameraManagement cameraManagement = baseCameraManagementService.getOne(cameraManagementLambdaQueryWrapper);
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
+ if (!ObjectUtils.isEmpty(cameraManagement.getRailwayCode())) {
|
|
|
+ queryWrapper.eq(BaseRailwayManagement::getRailwayCode, cameraManagement.getRailwayCode());
|
|
|
+ }
|
|
|
+ BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
|
|
|
+ msgAlarm.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
+ if (StringUtils.isNotEmpty(msgAlarm.getReleasedBy())) {
|
|
|
+ BaseUser user = baseUserService.getUser(msgAlarm.getReleasedBy());
|
|
|
+ msgAlarm.setReleasedByName(user.getNickName());
|
|
|
+ }
|
|
|
+ String mils = AppendUtils.stringAppend(cameraManagement.getInstallMile());
|
|
|
+ msgAlarm.setAlarmMiles(mils);
|
|
|
+ String end = AppendUtils.stringAppend(cameraManagement.getEndMile());
|
|
|
+ msgAlarm.setEndMile(end);
|
|
|
+ String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
|
|
|
+ msgAlarm.setBeginMile(begin);
|
|
|
+ LambdaQueryWrapper<MsgAlarmFrequency> wrapper = new LambdaQueryWrapper<MsgAlarmFrequency>();
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getAlarmId())) {
|
|
|
+ wrapper.eq(MsgAlarmFrequency::getAlarmId, msgAlarm.getAlarmId());
|
|
|
+ }
|
|
|
+ msgAlarm.setAlarmCount((int) msgAlarmFrequencyService.count(wrapper));
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getReleasedType())) {
|
|
|
+ msgAlarm.setReleasedTypeName(msgAlarm.getReleasedType() == 1 ? "真实报警" : "误报警");
|
|
|
+ }
|
|
|
+ msgAlarm.setLineDirName(msgAlarm.getLineDir() == 1 ? "上行" : "下行");
|
|
|
+ msgAlarm.setIsLockName(msgAlarm.getIsLock() == 1 ? "已解除" : "未解除");
|
|
|
+ msgAlarm.setAlarmTypeName("泥石流");
|
|
|
+ }
|
|
|
+ ExcelUtil<MsgAlarm> util = new ExcelUtil<>(MsgAlarm.class);
|
|
|
+ util.exportExcel(response, msgAlarmList, "报警信息管理");
|
|
|
+ }
|
|
|
|
|
|
@GetMapping(value = "/getByAlarmId/{alarmId}")
|
|
|
@ApiOperation("根据报警信息ID获取详细信息-app")
|
|
@@ -250,6 +304,10 @@ public class MsgAlarmController extends BaseController {
|
|
|
String[] split = msgAlarm.getImageUrl().split(";");
|
|
|
ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
|
|
|
msgAlarm.setImageUrls(objects);
|
|
|
+ if (StringUtils.isNotEmpty(msgAlarm.getReleasedBy())) {
|
|
|
+ BaseUser user = baseUserService.getUser(msgAlarm.getReleasedBy());
|
|
|
+ msgAlarm.setReleasedByName(user.getNickName());
|
|
|
+ }
|
|
|
BeanUtils.copyProperties(msgAlarm, msgAlarmResp);
|
|
|
msgAlarmResp.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
|
|
@@ -286,6 +344,10 @@ public class MsgAlarmController extends BaseController {
|
|
|
String[] split = msgAlarm.getImageUrl().split(";");
|
|
|
ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
|
|
|
msgAlarm.setImageUrls(objects);
|
|
|
+ if (StringUtils.isNotEmpty(msgAlarm.getReleasedBy())) {
|
|
|
+ BaseUser user = baseUserService.getUser(msgAlarm.getReleasedBy());
|
|
|
+ msgAlarm.setReleasedByName(user.getNickName());
|
|
|
+ }
|
|
|
BeanUtils.copyProperties(msgAlarm, msgAlarmResp);
|
|
|
msgAlarmResp.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
|
|
@@ -304,15 +366,23 @@ public class MsgAlarmController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @PutMapping(value = "/{id}")
|
|
|
+ @PutMapping(value = "/updateIsLock")
|
|
|
@ApiOperation("根据报警信息ID解除报警")
|
|
|
@Log(title = "报警信息管理", businessType = BusinessType.UPDATE)
|
|
|
- public AjaxResult updateIsLock(@PathVariable Long id) {
|
|
|
+ public AjaxResult updateIsLock(@RequestParam(value = "id") Long id,
|
|
|
+ @RequestParam(value = "releasedType",required = false) Integer releasedType,
|
|
|
+ @RequestParam(value = "releasedReason",required = false) String releasedReason) {
|
|
|
MsgAlarm msgAlarm = msgAlarmService.getById(id);
|
|
|
msgAlarm.setIsLock(1);
|
|
|
msgAlarm.setUpdateBy(getUserId());
|
|
|
msgAlarm.setReleasedBy(getUserId());
|
|
|
msgAlarm.setReleasedTime(new Date());
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getReleasedReason())) {
|
|
|
+ msgAlarm.setReleasedReason(releasedReason);
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getReleasedType())) {
|
|
|
+ msgAlarm.setReleasedType(releasedType);
|
|
|
+ }
|
|
|
return AjaxResult.success(msgAlarmService.updateById(msgAlarm));
|
|
|
}
|
|
|
|
|
@@ -361,8 +431,32 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (user.isAdmin(user.getId())) {
|
|
|
userId = "";
|
|
|
}
|
|
|
- IPage<AlarmStatisticVo> page = msgAlarmService.list(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
+ 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.getReleasedType())) {
|
|
|
+ l.setReleasedTypeName(l.getReleasedType() == 1 ? "真实报警" : "误报警");
|
|
|
+ }
|
|
|
+ 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.getIsLock())) {
|
|
|
+ l.setIsLockName(l.getIsLock() == 1 ? "已解除" : "未解除");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ IPage page = msgAlarmService.listToPage(list, pageNum, pageSize);
|
|
|
return AjaxResult.success(page);
|
|
|
}
|
|
|
|
|
@@ -388,34 +482,54 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (user.isAdmin(user.getId())) {
|
|
|
userId = "";
|
|
|
}
|
|
|
- List<AlarmStatisticMonthDto> list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- List<Integer> numbs = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
|
|
|
- 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);
|
|
|
+ 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);
|
|
|
}
|
|
|
- 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());
|
|
|
+ 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);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -444,14 +558,29 @@ public class MsgAlarmController extends BaseController {
|
|
|
List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
|
|
|
if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
list.forEach(l -> {
|
|
|
- String alarmType = l.getAlarmType();
|
|
|
- String alarmTypeValue = dictDataService.selectDictLabel("sys_alarm_type", alarmType);
|
|
|
- l.setAlarmTypeValue(alarmTypeValue);
|
|
|
-
|
|
|
- String lineDir = l.getLineDir();
|
|
|
- String lineDirValue = dictDataService.selectDictLabel("sys_line_dir", lineDir);
|
|
|
- l.setLineDirValue(lineDirValue);
|
|
|
- l.setAlarmMile(AppendUtils.stringAppend(Integer.valueOf(l.getAlarmMile())));
|
|
|
+ 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.getReleasedType())) {
|
|
|
+ l.setReleasedTypeName(l.getReleasedType() == 1 ? "真实报警" : "误报警");
|
|
|
+ }
|
|
|
+ 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.getIsLock())) {
|
|
|
+ l.setIsLockName(l.getIsLock() == 1 ? "已解除" : "未解除");
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -484,39 +613,17 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (user.isAdmin(user.getId())) {
|
|
|
userId = "";
|
|
|
}
|
|
|
- try {
|
|
|
- List<AlarmStatisticMonthDto> list = msgAlarmService.exportExcelMonth(alarmStatisticResVo, userId);
|
|
|
- List<Integer> numbs = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
|
|
|
- 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());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
|
|
|
- util.exportExcel(response, list, "报警月统计数据");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- log.info(e.getMessage());
|
|
|
+ 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, "报警月统计数据");
|
|
|
}
|
|
|
}
|
|
|
|