|
|
|
@ -27,10 +27,7 @@ import org.springblade.system.user.entity.User;
|
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
@ -104,7 +101,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService {
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 数据过滤
|
|
|
|
|
List<HistoryLevelAlarmEntity> entitys = alarms.stream().filter(alarm -> CollectionUtil.isEmpty(historys) || !historys.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(alarm.getId())).map(item->{ |
|
|
|
|
List<HistoryLevelAlarmEntity> entitys = alarms.stream().filter(alarm -> CollectionUtil.isNotEmpty(historys) /*|| !historys.stream().map(HistoryLevelAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(alarm.getId())*/).map(item->{ |
|
|
|
|
HistoryLevelAlarmEntity entity = new HistoryLevelAlarmEntity(); |
|
|
|
|
entity.setAlarmId(item.getId()); |
|
|
|
|
entity.setAlarmTime(DateUtil.parse(item.getTs(), "yyyy-MM-dd HH:mm:ss.s")); |
|
|
|
@ -165,7 +162,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService {
|
|
|
|
|
// app,web消息推送
|
|
|
|
|
this.sendMessageByWebApp(depts.get(0),entity); |
|
|
|
|
// 短信推送
|
|
|
|
|
this.message(depts.get(0),entity); |
|
|
|
|
//this.message(depts.get(0),entity);
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -189,13 +186,12 @@ public class LevelAlarmServiceImpl implements LevelAlarmService {
|
|
|
|
|
if (deptName.isSuccess()) { |
|
|
|
|
message.setDeptName(deptName.getData()); |
|
|
|
|
} |
|
|
|
|
User admin = userClient.userByAccount("200000", "admin").getData(); |
|
|
|
|
message.setCreateDept(admin.getCreateDept()); |
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
message.setCreateDept(dept); |
|
|
|
|
result.getData().forEach(user->{ |
|
|
|
|
message.setPusher(String.valueOf(user.getId())); |
|
|
|
|
message.setPusherName(user.getName()); |
|
|
|
|
message.setAccount(String.valueOf(user.getId())); |
|
|
|
|
message.setCreateUser(user.getId()); |
|
|
|
|
messageClient.sendMessage(message); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -206,6 +202,33 @@ public class LevelAlarmServiceImpl implements LevelAlarmService {
|
|
|
|
|
* @param entity |
|
|
|
|
*/ |
|
|
|
|
private void message(Long dept,HistoryLevelAlarmEntity entity) { |
|
|
|
|
|
|
|
|
|
// 获取站点用户
|
|
|
|
|
R<List<User>> result = userClient.relationUserListByRoleAlias("200000",dept,"projectManager"); |
|
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
MessagePushRecordDto message = new MessagePushRecordDto(); |
|
|
|
|
message.setBusinessClassify("warning"); |
|
|
|
|
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); |
|
|
|
|
message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); |
|
|
|
|
message.setTaskId(entity.getId()); |
|
|
|
|
message.setTenantId("200000"); |
|
|
|
|
message.setContent(entity.getSoeExplain()); |
|
|
|
|
message.setTypes(Collections.singletonList(MessageConstants.SMS_PUSH)); |
|
|
|
|
message.setPushType(MessageConstants.IMMEDIATELY); |
|
|
|
|
message.setDeptId(dept); |
|
|
|
|
R<String> deptName = sysClient.getDeptName(dept); |
|
|
|
|
if (deptName.isSuccess()) { |
|
|
|
|
message.setDeptName(deptName.getData()); |
|
|
|
|
} |
|
|
|
|
User admin = userClient.userByAccount("200000", "admin").getData(); |
|
|
|
|
message.setCreateDept(admin.getCreateDept()); |
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
result.getData().forEach(user->{ |
|
|
|
|
message.setPusher(String.valueOf(user.getId())); |
|
|
|
|
message.setPusherName(user.getName()); |
|
|
|
|
message.setAccount(String.valueOf(user.getId())); |
|
|
|
|
messageClient.sendMessage(message); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|