|
@@ -1,30 +1,31 @@
|
|
|
package com.ozs.web.controller.accountmanagment;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
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;
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
+import com.ozs.common.core.domain.entity.SysDictData;
|
|
|
import com.ozs.common.core.domain.entity.SysUser;
|
|
|
import com.ozs.common.enums.BusinessType;
|
|
|
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.MsgAlarm;
|
|
|
-import com.ozs.entity.MsgAlarmFrequency;
|
|
|
-import com.ozs.entity.MsgWebPush;
|
|
|
+import com.ozs.entity.*;
|
|
|
import com.ozs.entity.vo.*;
|
|
|
import com.ozs.mapper.MsgAlarmMapper;
|
|
|
import com.ozs.service.*;
|
|
|
import com.ozs.system.service.DataScoreUtil;
|
|
|
import com.ozs.system.service.ISysDeptService;
|
|
|
import com.ozs.system.service.ISysDictDataService;
|
|
|
+import com.ozs.system.service.ISysDictTypeService;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -67,6 +68,8 @@ public class MsgAlarmController extends BaseController {
|
|
|
private BaseUserService baseUserService;
|
|
|
@Autowired
|
|
|
private ISysDeptService deptService;
|
|
|
+ @Autowired
|
|
|
+ private ISysDictTypeService dictTypeService;
|
|
|
|
|
|
/**
|
|
|
* web更多消息-总数,已读数
|
|
@@ -143,13 +146,13 @@ public class MsgAlarmController extends BaseController {
|
|
|
public AjaxResult selectMsgAlarm(@RequestBody MsgAlarmVo msgAlarmVo) {
|
|
|
msgAlarmVo = (MsgAlarmVo) dataScoreUtil.setDataScore(getUserId(), msgAlarmVo);
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile())) {
|
|
|
- msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile() * 1000);
|
|
|
+ msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile() * 1000);
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())) {
|
|
|
- msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile() * 1000);
|
|
|
+ msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile() * 1000);
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
|
- msgAlarmVo.setEndMile(msgAlarmVo.getEndMile() * 1000);
|
|
|
+ msgAlarmVo.setEndMile(msgAlarmVo.getEndMile() * 1000);
|
|
|
}
|
|
|
IPage<MsgAlarm> page = msgAlarmService.queryPage(msgAlarmVo);
|
|
|
page.setTotal(page.getTotal());
|
|
@@ -158,42 +161,37 @@ public class MsgAlarmController extends BaseController {
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(page) && page.getRecords().size() > 0) {
|
|
|
List<MsgAlarm> dto1 = page.getRecords().stream().map(o -> {
|
|
|
-// String[] split = o.getImageUrl().split(";");
|
|
|
-// ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
|
|
|
-// o.setImageUrls(objects);
|
|
|
-// LambdaQueryWrapper<BaseCameraManagement> cameraManagementLambdaQueryWrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
-// if (!ObjectUtils.isEmpty(o.getCameraCode())) {
|
|
|
-// cameraManagementLambdaQueryWrapper.eq(BaseCameraManagement::getCameraCode, o.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);
|
|
|
-// o.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
+ if (!ObjectUtils.isEmpty(o.getRailwayCode())) {
|
|
|
+ queryWrapper.eq(BaseRailwayManagement::getRailwayCode, o.getRailwayCode());
|
|
|
+ }
|
|
|
+ BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
|
|
|
+ o.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
// if (StringUtils.isNotEmpty(o.getReleasedBy())) {
|
|
|
// BaseUser user = baseUserService.getUser(o.getReleasedBy());
|
|
|
// o.setReleasedByName(user.getNickName());
|
|
|
// }
|
|
|
-// String mils = AppendUtils.stringAppend(cameraManagement.getInstallMile());
|
|
|
-// o.setAlarmMiles(mils);
|
|
|
-// String end = AppendUtils.stringAppend(cameraManagement.getEndMile());
|
|
|
-// o.setEndMile(end);
|
|
|
-// String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
|
|
|
-// o.setBeginMile(begin);
|
|
|
+ String mils = AppendUtils.stringAppend(o.getAlarmMile());
|
|
|
+ o.setAlarmMiles(mils);
|
|
|
+ o.setLineDirName(o.getLineDir() == 1 ? "上行" : "下行");
|
|
|
+ List<SysDictData> data = dictTypeService.selectDictDataByType("sys_alarm_type");
|
|
|
+ data.stream().forEach(sysDictData -> {
|
|
|
+ if (sysDictData.getDictValue().equals(o.getAlarmType().toString())) {
|
|
|
+ o.setAlarmTypeName(sysDictData.getDictLabel());
|
|
|
+ }
|
|
|
+ });
|
|
|
// LambdaQueryWrapper<MsgAlarmFrequency> wrapper = new LambdaQueryWrapper<MsgAlarmFrequency>();
|
|
|
// if (!ObjectUtils.isEmpty(o.getAlarmId())) {
|
|
|
// wrapper.eq(MsgAlarmFrequency::getAlarmId, o.getAlarmId());
|
|
|
// }
|
|
|
-// o.setAlarmCount((int) msgAlarmFrequencyService.count(wrapper));
|
|
|
+// o.setAlarmCount((int) msgAlarmFrequencyService.count(wrapper));
|
|
|
return o;
|
|
|
}).collect(Collectors.toList());
|
|
|
page.setRecords(dto1);
|
|
|
}
|
|
|
return AjaxResult.success(page);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 导出报警消息
|
|
|
*
|
|
@@ -303,11 +301,11 @@ public class MsgAlarmController extends BaseController {
|
|
|
// lw.eq(BaseCameraManagement::getCameraCode, msgAlarm.getCameraCode());
|
|
|
// }
|
|
|
// BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(lw);
|
|
|
-// LambdaQueryWrapper<BaseRailwayManagement> wrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
-// if (!ObjectUtils.isEmpty(baseCameraManagement.getRailwayCode())) {
|
|
|
-// wrapper.eq(BaseRailwayManagement::getRailwayCode, baseCameraManagement.getRailwayCode());
|
|
|
-// }
|
|
|
-// BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(wrapper);
|
|
|
+ LambdaQueryWrapper<BaseRailwayManagement> wrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarm.getRailwayCode())) {
|
|
|
+ wrapper.eq(BaseRailwayManagement::getRailwayCode, msgAlarm.getRailwayCode());
|
|
|
+ }
|
|
|
+ BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(wrapper);
|
|
|
MsgAlarmResp msgAlarmResp = new MsgAlarmResp();
|
|
|
// String[] split = msgAlarm.getImageUrl().split(";");
|
|
|
// ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
|
|
@@ -316,16 +314,23 @@ public class MsgAlarmController extends BaseController {
|
|
|
// BaseUser user = baseUserService.getUser(msgAlarm.getReleasedBy());
|
|
|
// msgAlarm.setReleasedByName(user.getNickName());
|
|
|
// }
|
|
|
-// BeanUtils.copyProperties(msgAlarm, msgAlarmResp);
|
|
|
-// msgAlarmResp.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
+ BeanUtils.copyProperties(msgAlarm, msgAlarmResp);
|
|
|
+ msgAlarmResp.setRailwayName(baseRailwayManagement.getRailwayName());
|
|
|
// msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
|
|
|
// String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
|
|
|
// String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
|
|
|
// String endMile = "[" + begin + "]-[" + end + "]";
|
|
|
// msgAlarmResp.setBeginMile(endMile);
|
|
|
-// String mile = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
|
|
|
-// msgAlarmResp.setAlarmMile(mile);
|
|
|
-// msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude() + "," + baseCameraManagement.getInstallLatitude());
|
|
|
+ String mile = AppendUtils.stringAppend(msgAlarm.getAlarmMile());
|
|
|
+ msgAlarmResp.setAlarmMile(mile);
|
|
|
+ msgAlarmResp.setLineDirStr(msgAlarm.getLineDir() == 1 ? "上行" : "下行");
|
|
|
+ List<SysDictData> data = dictTypeService.selectDictDataByType("sys_alarm_type");
|
|
|
+ data.stream().forEach(sysDictData -> {
|
|
|
+ if (sysDictData.getDictValue().equals(msgAlarm.getAlarmType().toString())) {
|
|
|
+ msgAlarmResp.setAlarmTypeName(sysDictData.getDictLabel());
|
|
|
+ }
|
|
|
+ });
|
|
|
+// msgAlarmResp.setInstallLongitude(msgAlarm.getInstallLongitude() + "," + baseCameraManagement.getInstallLatitude());
|
|
|
// SysDept sysDept = deptService.selectDeptById(baseCameraManagement.getDeptId());
|
|
|
// msgAlarmResp.setDeptName(sysDept.getDeptName());
|
|
|
return AjaxResult.success(msgAlarmResp);
|
|
@@ -402,7 +407,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
BaseUser buser = baseUserService.getUser(l.getReleasedBy());
|
|
|
l.setReleasedByName(buser.getNickName());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!ObjectUtils.isEmpty(l.getLineDir())) {
|
|
|
l.setLineDirName(l.getLineDir() == 1 ? "上行" : "下行");
|
|
|
}
|
|
@@ -464,30 +469,30 @@ public class MsgAlarmController extends BaseController {
|
|
|
}
|
|
|
|
|
|
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))) {
|
|
|
+ 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) {
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ return o1.getMonthsta().compareTo(o2.getMonthsta());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return AjaxResult.success(list);
|
|
|
}
|
|
|
|
|
|
|