|
@@ -110,6 +110,7 @@ public class DashboardJob {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void broadCastData(){
|
|
|
String pushMsg = null;
|
|
|
try {
|
|
@@ -174,14 +175,16 @@ public class DashboardJob {
|
|
|
dataScreenMap.put("repairMap", repairMap);
|
|
|
|
|
|
//警报数据
|
|
|
-
|
|
|
LbqWrapper<AAutoNodeLog> warnWrapper = new LbqWrapper<AAutoNodeLog>();
|
|
|
//Date start = new Date();
|
|
|
//警报弹框只执行一次
|
|
|
//返回还未处理、执行状态为失败、需要人工处理,并且还未推送的日志记录
|
|
|
warnWrapper.eq(AAutoNodeLog::getExeResult, "0").eq(AAutoNodeLog::getStatus, "0").eq(AAutoNodeLog::getManual, "1")
|
|
|
.orderByDesc(AAutoNodeLog::getCreateTime);
|
|
|
- IPage<AAutoNodeLog> warnData = aAutoNodeLogMapper.pageList(new Page<AAutoNodeLog>(1L, 5), warnWrapper, new DataScope(), null);
|
|
|
+ Page<Repair> warnDataPage = new Page<Repair>(1L, 5);
|
|
|
+ warnDataPage.setSearchCount(false);
|
|
|
+
|
|
|
+ IPage<AAutoNodeLog> warnData = aAutoNodeLogMapper.pageList(warnDataPage, warnWrapper, new DataScope(), null);
|
|
|
|
|
|
Map warnMap = Maps.newHashMap();
|
|
|
warnMap.put("warnData", warnData);
|
|
@@ -209,37 +212,44 @@ public class DashboardJob {
|
|
|
userIds.forEach(item -> {
|
|
|
List<Session> sessions = webSocketServer.getSessions(item);
|
|
|
String userid = this.parseJWT(item).get("userid").toString();
|
|
|
- String pushMsg = null;
|
|
|
- try {
|
|
|
- //警报数据
|
|
|
- Map<String, Map<String, Object>> exceptionMap = new HashMap<String, Map<String, Object>>();
|
|
|
- DataScope datascope = new DataScope();
|
|
|
- datascope.setUserId(Long.parseLong(userid));
|
|
|
- LbqWrapper<AAutoNodeLog> warnWrapper = new LbqWrapper<AAutoNodeLog>();
|
|
|
- warnWrapper.eq(AAutoNodeLog::getExeResult, "0").eq(AAutoNodeLog::getStatus, "0").eq(AAutoNodeLog::getManual, "1")
|
|
|
- .orderByDesc(AAutoNodeLog::getCreateTime);
|
|
|
- IPage<AAutoNodeLog> warnData = aAutoNodeLogMapper.pageList(new Page<AAutoNodeLog>(1L, 5), warnWrapper, datascope, null);
|
|
|
- Map warnMap = Maps.newHashMap();
|
|
|
- warnMap.put("warnData", warnData);
|
|
|
- exceptionMap.put("warnMap", warnMap);
|
|
|
-
|
|
|
- Map<String, Object> exMap = new HashMap<>();
|
|
|
- exMap.put("type", WebSocketServer.PUSH_TYPE_GLOBAL_EXCEPTION);
|
|
|
- exMap.put("data", exceptionMap);
|
|
|
-
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- objectMapper.findAndRegisterModules();
|
|
|
-
|
|
|
- pushMsg = objectMapper.writeValueAsString(exMap);
|
|
|
- webSocketServer.BroadCastInfo(pushMsg, sessions);
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("全局推送异常======"+e.getMessage());
|
|
|
- }
|
|
|
+ this.broadCastData(userid, sessions);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void broadCastData(String userid, List<Session> sessions){
|
|
|
+ String pushMsg = null;
|
|
|
+ try {
|
|
|
+ //警报数据
|
|
|
+ Map<String, Map<String, Object>> exceptionMap = new HashMap<String, Map<String, Object>>();
|
|
|
+ DataScope datascope = new DataScope();
|
|
|
+ datascope.setUserId(Long.parseLong(userid));
|
|
|
+ LbqWrapper<AAutoNodeLog> warnWrapper = new LbqWrapper<AAutoNodeLog>();
|
|
|
+ warnWrapper.eq(AAutoNodeLog::getExeResult, "0").eq(AAutoNodeLog::getStatus, "0").eq(AAutoNodeLog::getManual, "1")
|
|
|
+ .orderByDesc(AAutoNodeLog::getCreateTime);
|
|
|
+ Page<Repair> warnDataPage = new Page<Repair>(1L, 5);
|
|
|
+ warnDataPage.setSearchCount(false);
|
|
|
+ IPage<AAutoNodeLog> warnData = aAutoNodeLogMapper.pageList(warnDataPage, warnWrapper, datascope, null);
|
|
|
+
|
|
|
+ Map warnMap = Maps.newHashMap();
|
|
|
+ warnMap.put("warnData", warnData);
|
|
|
+ exceptionMap.put("warnMap", warnMap);
|
|
|
+
|
|
|
+ Map<String, Object> exMap = new HashMap<>();
|
|
|
+ exMap.put("type", WebSocketServer.PUSH_TYPE_GLOBAL_EXCEPTION);
|
|
|
+ exMap.put("data", exceptionMap);
|
|
|
+
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ objectMapper.findAndRegisterModules();
|
|
|
+
|
|
|
+ pushMsg = objectMapper.writeValueAsString(exMap);
|
|
|
+ webSocketServer.BroadCastInfo(pushMsg, sessions);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("全局推送异常======"+e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Claims parseJWT(String token){
|
|
|
final String BASE64_SECURITY = Base64.getEncoder().encodeToString(BaseContextConstants.JWT_SIGN_KEY.getBytes(Charsets.UTF_8));
|
|
|
Claims claims = null;
|