|
@@ -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;
|
|
@@ -47,12 +49,14 @@ 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;
|
|
@@ -169,21 +173,21 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (!msgAlarmVo.getAlarmMile().toString().matches(PATTERN)) {
|
|
|
return error("里程位置填写格式不正确!");
|
|
|
} else {
|
|
|
- msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile()*1000);
|
|
|
+ msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile() * 1000);
|
|
|
}
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())) {
|
|
|
if (!msgAlarmVo.getBeginMile().toString().matches(PATTERN)) {
|
|
|
return error("监控范围开始里程位置填写格式不正确");
|
|
|
} else {
|
|
|
- msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile()*1000);
|
|
|
+ msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile() * 1000);
|
|
|
}
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
|
if (!msgAlarmVo.getEndMile().toString().matches(PATTERN)) {
|
|
|
return error("监控范围结束里程位置填写格式不正确");
|
|
|
} else {
|
|
|
- msgAlarmVo.setEndMile(msgAlarmVo.getEndMile()*1000);
|
|
|
+ msgAlarmVo.setEndMile(msgAlarmVo.getEndMile() * 1000);
|
|
|
}
|
|
|
}
|
|
|
IPage<MsgAlarm> page = msgAlarmService.queryPage(msgAlarmVo);
|
|
@@ -222,12 +226,74 @@ public class MsgAlarmController extends BaseController {
|
|
|
wrapper.eq(MsgAlarmFrequency::getAlarmId, o.getAlarmId());
|
|
|
}
|
|
|
o.setAlarmCount((int) msgAlarmFrequencyService.count(wrapper));
|
|
|
+ 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")
|