|
@@ -7,16 +7,30 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.ozs.common.core.controller.BaseController;
|
|
import com.ozs.common.core.controller.BaseController;
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
|
+import com.ozs.common.core.domain.entity.SysDept;
|
|
import com.ozs.common.utils.AppendUtils;
|
|
import com.ozs.common.utils.AppendUtils;
|
|
import com.ozs.common.utils.StringUtils;
|
|
import com.ozs.common.utils.StringUtils;
|
|
-import com.ozs.service.entity.*;
|
|
|
|
|
|
+import com.ozs.common.utils.poi.ExcelUtil;
|
|
|
|
+import com.ozs.service.entity.BaseCameraManagement;
|
|
|
|
+import com.ozs.service.entity.BaseRailwayManagement;
|
|
|
|
+import com.ozs.service.entity.MsgAlarm;
|
|
|
|
+import com.ozs.service.entity.MsgAlarmFrequency;
|
|
import com.ozs.service.entity.vo.*;
|
|
import com.ozs.service.entity.vo.*;
|
|
import com.ozs.service.mapper.MsgAlarmMapper;
|
|
import com.ozs.service.mapper.MsgAlarmMapper;
|
|
-import com.ozs.service.service.*;
|
|
|
|
|
|
+import com.ozs.service.service.BaseCameraManagementService;
|
|
|
|
+import com.ozs.service.service.BaseRailwayManagementService;
|
|
|
|
+import com.ozs.service.service.MsgAlarmFrequencyService;
|
|
|
|
+import com.ozs.service.service.MsgAlarmService;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
+import org.apache.poi.ss.usermodel.*;
|
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -32,7 +46,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
+import java.io.OutputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -62,19 +80,25 @@ public class MsgAlarmController extends BaseController {
|
|
BaseRailwayManagementService baseRailwayManagementService;
|
|
BaseRailwayManagementService baseRailwayManagementService;
|
|
@Value("${base.imgUrl:http://124.71.171.71:18801/picbucket}")
|
|
@Value("${base.imgUrl:http://124.71.171.71:18801/picbucket}")
|
|
private String imgUrl;
|
|
private String imgUrl;
|
|
- @Autowired
|
|
|
|
- private MsgWebPushService msgWebPushService;
|
|
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
- * web消息已读
|
|
|
|
|
|
+ * 测试消息推送
|
|
*/
|
|
*/
|
|
- @PostMapping("/read")
|
|
|
|
|
|
+ @PostMapping("/push")
|
|
@ApiOperation(value = "预报警信息分页")
|
|
@ApiOperation(value = "预报警信息分页")
|
|
- public AjaxResult read(@RequestBody MsgWebPush msgWebPush) {
|
|
|
|
- if (StringUtils.isEmpty(msgWebPush) || StringUtils.isEmpty(msgWebPush.getId())) {
|
|
|
|
- return AjaxResult.error("主键ID不能为空!");
|
|
|
|
- }
|
|
|
|
- return toAjax(msgWebPushService.read(msgWebPush));
|
|
|
|
|
|
+ public AjaxResult insertDate(String[] args) {
|
|
|
|
+ // 模拟需要推送的用户群
|
|
|
|
+ ArrayList<String> ids = new ArrayList<>();
|
|
|
|
+ ids.add("001");
|
|
|
|
+ ids.add("002");
|
|
|
|
+ ids.add("003");
|
|
|
|
+ ids.add("004");
|
|
|
|
+ ids.add("005");
|
|
|
|
+//
|
|
|
|
+// WebSocketService webSocketService = new WebSocketService();
|
|
|
|
+// webSocketService.sendMsgToUsers(ids);
|
|
|
|
+ return AjaxResult.success("推送成功");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -86,7 +110,7 @@ public class MsgAlarmController extends BaseController {
|
|
@ApiOperation(value = "报警信息分页")
|
|
@ApiOperation(value = "报警信息分页")
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
public AjaxResult selectMsgAlarm(@RequestBody MsgAlarmVo msgAlarmVo) {
|
|
public AjaxResult selectMsgAlarm(@RequestBody MsgAlarmVo msgAlarmVo) {
|
|
- List<BaseCameraManagement> baseCameraManagementList = new ArrayList<>();
|
|
|
|
|
|
+ List<BaseCameraManagement> baseCameraManagementList=new ArrayList<>();
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode())) {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode())) {
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, msgAlarmVo.getRailwayCode());
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, msgAlarmVo.getRailwayCode());
|
|
@@ -97,7 +121,7 @@ public class MsgAlarmController extends BaseController {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
wrapper.le(BaseCameraManagement::getEndMile, msgAlarmVo.getEndMile());
|
|
wrapper.le(BaseCameraManagement::getEndMile, msgAlarmVo.getEndMile());
|
|
}
|
|
}
|
|
- if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode()) || !ObjectUtils.isEmpty(msgAlarmVo.getBeginMile()) || !ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode())||!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())||!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
|
|
baseCameraManagementList = baseCameraManagementService.list(wrapper);
|
|
baseCameraManagementList = baseCameraManagementService.list(wrapper);
|
|
}
|
|
}
|
|
List<String> userIds = baseCameraManagementService.getUserIds(getUserId());
|
|
List<String> userIds = baseCameraManagementService.getUserIds(getUserId());
|
|
@@ -108,14 +132,14 @@ public class MsgAlarmController extends BaseController {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getLineDir())) {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getLineDir())) {
|
|
lw.eq(MsgAlarm::getLineDir, msgAlarmVo.getLineDir());
|
|
lw.eq(MsgAlarm::getLineDir, msgAlarmVo.getLineDir());
|
|
}
|
|
}
|
|
- if (baseCameraManagementList.size() > 0) {
|
|
|
|
|
|
+ if (baseCameraManagementList.size()>0) {
|
|
List<String> collect = baseCameraManagementList.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
|
|
List<String> collect = baseCameraManagementList.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
|
|
lw.in(MsgAlarm::getCameraCode, collect);
|
|
lw.in(MsgAlarm::getCameraCode, collect);
|
|
}
|
|
}
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmType())) {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmType())) {
|
|
lw.eq(MsgAlarm::getAlarmType, msgAlarmVo.getAlarmType());
|
|
lw.eq(MsgAlarm::getAlarmType, msgAlarmVo.getAlarmType());
|
|
}
|
|
}
|
|
- if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile()) && msgAlarmVo.getAlarmMile() != 0) {
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile())&& msgAlarmVo.getAlarmMile() != 0) {
|
|
lw.eq(MsgAlarm::getAlarmMile, msgAlarmVo.getAlarmMile());
|
|
lw.eq(MsgAlarm::getAlarmMile, msgAlarmVo.getAlarmMile());
|
|
}
|
|
}
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginAlarmTime())) {
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginAlarmTime())) {
|
|
@@ -128,7 +152,7 @@ public class MsgAlarmController extends BaseController {
|
|
lw.eq(MsgAlarm::getIsLock, msgAlarmVo.getIsLock());
|
|
lw.eq(MsgAlarm::getIsLock, msgAlarmVo.getIsLock());
|
|
}
|
|
}
|
|
IPage<MsgAlarm> page = msgAlarmService.page(new Page<>(msgAlarmVo.getPageNum(), msgAlarmVo.getPageSize()), lw);
|
|
IPage<MsgAlarm> page = msgAlarmService.page(new Page<>(msgAlarmVo.getPageNum(), msgAlarmVo.getPageSize()), lw);
|
|
- if (!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())) {
|
|
|
|
|
|
+ if(!ObjectUtils.isEmpty(page) && !ObjectUtils.isEmpty(page.getRecords())){
|
|
List<MsgAlarm> dto1 = page.getRecords().stream().map(o -> {
|
|
List<MsgAlarm> dto1 = page.getRecords().stream().map(o -> {
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
String[] split = o.getImageUrl().split(";");
|
|
String[] split = o.getImageUrl().split(";");
|
|
@@ -155,7 +179,7 @@ public class MsgAlarmController extends BaseController {
|
|
o.setEndMile(end);
|
|
o.setEndMile(end);
|
|
String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
|
|
String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
|
|
o.setBeginMile(begin);
|
|
o.setBeginMile(begin);
|
|
- o.setAlarmCount((int) msgAlarmFrequencyService.count() + 1);
|
|
|
|
|
|
+ o.setAlarmCount((int) msgAlarmFrequencyService.count()+1);
|
|
return o;
|
|
return o;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
page.setRecords(dto1);
|
|
page.setRecords(dto1);
|
|
@@ -183,11 +207,11 @@ public class MsgAlarmController extends BaseController {
|
|
msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
|
|
msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
|
|
String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
|
|
String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
|
|
String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
|
|
String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
|
|
- String endMile = begin + "-" + end;
|
|
|
|
|
|
+ String endMile=begin+"-"+end;
|
|
msgAlarmResp.setBeginMile(endMile);
|
|
msgAlarmResp.setBeginMile(endMile);
|
|
String mile = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
|
|
String mile = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
|
|
msgAlarmResp.setAlarmMile(mile);
|
|
msgAlarmResp.setAlarmMile(mile);
|
|
- msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude() + "," + baseCameraManagement.getInstallLatitude());
|
|
|
|
|
|
+ msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude()+","+baseCameraManagement.getInstallLatitude());
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
String[] split = msgAlarm.getImageUrl().split(";");
|
|
String[] split = msgAlarm.getImageUrl().split(";");
|
|
for (String s : split) {
|
|
for (String s : split) {
|
|
@@ -301,7 +325,9 @@ public class MsgAlarmController extends BaseController {
|
|
userId = "";
|
|
userId = "";
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- msgAlarmService.exportExcel(response, alarmStatisticResVo, userId);
|
|
|
|
|
|
+ List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
|
|
|
|
+ ExcelUtil<AlarmStatisticDto> util = new ExcelUtil<>(AlarmStatisticDto.class);
|
|
|
|
+ util.exportExcel(response, list, "报警数据详情");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
log.info(e.getMessage());
|
|
log.info(e.getMessage());
|
|
@@ -309,7 +335,7 @@ public class MsgAlarmController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * web数据统计 数据导出
|
|
|
|
|
|
+ * web数据统计 报警月统计数据导出
|
|
*
|
|
*
|
|
* @param
|
|
* @param
|
|
* @return
|
|
* @return
|
|
@@ -328,7 +354,9 @@ public class MsgAlarmController extends BaseController {
|
|
userId = "";
|
|
userId = "";
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- msgAlarmService.exportExcelMonth(response, alarmStatisticResVo, userId);
|
|
|
|
|
|
+ List<AlarmStatisticMonthDto> list = msgAlarmService.exportExcelMonth(alarmStatisticResVo, userId);
|
|
|
|
+ ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
|
|
|
|
+ util.exportExcel(response, list, "报警月统计数据");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
log.info(e.getMessage());
|
|
log.info(e.getMessage());
|