|
@@ -7,29 +7,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ozs.common.core.controller.BaseController;
|
|
|
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.StringUtils;
|
|
|
-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.*;
|
|
|
import com.ozs.service.entity.vo.*;
|
|
|
import com.ozs.service.mapper.MsgAlarmMapper;
|
|
|
-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 com.ozs.service.service.*;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
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.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -45,11 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
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.OutputStream;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -79,25 +62,19 @@ public class MsgAlarmController extends BaseController {
|
|
|
BaseRailwayManagementService baseRailwayManagementService;
|
|
|
@Value("${base.imgUrl:http://124.71.171.71:18801/picbucket}")
|
|
|
private String imgUrl;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private MsgWebPushService msgWebPushService;
|
|
|
|
|
|
/**
|
|
|
- * 测试消息推送
|
|
|
+ * web消息已读
|
|
|
*/
|
|
|
- @PostMapping("/push")
|
|
|
+ @PostMapping("/read")
|
|
|
@ApiOperation(value = "预报警信息分页")
|
|
|
- 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("推送成功");
|
|
|
+ public AjaxResult read(@RequestBody MsgWebPush msgWebPush) {
|
|
|
+ if (StringUtils.isEmpty(msgWebPush) || StringUtils.isEmpty(msgWebPush.getId())) {
|
|
|
+ return AjaxResult.error("主键ID不能为空!");
|
|
|
+ }
|
|
|
+ return toAjax(msgWebPushService.read(msgWebPush));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -109,7 +86,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
@ApiOperation(value = "报警信息分页")
|
|
|
@PostMapping("/list")
|
|
|
public AjaxResult selectMsgAlarm(@RequestBody MsgAlarmVo msgAlarmVo) {
|
|
|
- List<BaseCameraManagement> baseCameraManagementList=new ArrayList<>();
|
|
|
+ List<BaseCameraManagement> baseCameraManagementList = new ArrayList<>();
|
|
|
LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<BaseCameraManagement>();
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getRailwayCode())) {
|
|
|
wrapper.eq(BaseCameraManagement::getRailwayCode, msgAlarmVo.getRailwayCode());
|
|
@@ -120,7 +97,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (!ObjectUtils.isEmpty(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);
|
|
|
}
|
|
|
List<String> userIds = baseCameraManagementService.getUserIds(getUserId());
|
|
@@ -131,14 +108,14 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (!ObjectUtils.isEmpty(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());
|
|
|
lw.in(MsgAlarm::getCameraCode, collect);
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(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());
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginAlarmTime())) {
|
|
@@ -151,7 +128,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
lw.eq(MsgAlarm::getIsLock, msgAlarmVo.getIsLock());
|
|
|
}
|
|
|
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 -> {
|
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
|
String[] split = o.getImageUrl().split(";");
|
|
@@ -178,7 +155,7 @@ public class MsgAlarmController extends BaseController {
|
|
|
o.setEndMile(end);
|
|
|
String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
|
|
|
o.setBeginMile(begin);
|
|
|
- o.setAlarmCount((int) msgAlarmFrequencyService.count()+1);
|
|
|
+ o.setAlarmCount((int) msgAlarmFrequencyService.count() + 1);
|
|
|
return o;
|
|
|
}).collect(Collectors.toList());
|
|
|
page.setRecords(dto1);
|
|
@@ -206,11 +183,11 @@ public class MsgAlarmController extends BaseController {
|
|
|
msgAlarmResp.setDeptId(baseCameraManagement.getDeptId());
|
|
|
String begin = AppendUtils.stringAppend(baseCameraManagement.getBeginMile());
|
|
|
String end = AppendUtils.stringAppend(baseCameraManagement.getEndMile());
|
|
|
- String endMile=begin+"-"+end;
|
|
|
+ String endMile = begin + "-" + end;
|
|
|
msgAlarmResp.setBeginMile(endMile);
|
|
|
String mile = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
|
|
|
msgAlarmResp.setAlarmMile(mile);
|
|
|
- msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude()+","+baseCameraManagement.getInstallLatitude());
|
|
|
+ msgAlarmResp.setInstallLongitude(baseCameraManagement.getInstallLongitude() + "," + baseCameraManagement.getInstallLatitude());
|
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
|
String[] split = msgAlarm.getImageUrl().split(";");
|
|
|
for (String s : split) {
|