|
|
@ -11,9 +11,11 @@ import com.foreverwin.mesnac.common.model.Message;
|
|
|
|
import com.foreverwin.mesnac.common.service.MessageService;
|
|
|
|
import com.foreverwin.mesnac.common.service.MessageService;
|
|
|
|
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
|
|
|
|
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
|
|
|
|
import com.foreverwin.mesnac.common.util.StringUtil;
|
|
|
|
import com.foreverwin.mesnac.common.util.StringUtil;
|
|
|
|
|
|
|
|
import com.foreverwin.mesnac.listener.mapper.UsrMapper;
|
|
|
|
import com.foreverwin.mesnac.meapi.mapper.UserGroupMapper;
|
|
|
|
import com.foreverwin.mesnac.meapi.mapper.UserGroupMapper;
|
|
|
|
import com.foreverwin.mesnac.meapi.model.NwaUser;
|
|
|
|
import com.foreverwin.mesnac.meapi.model.NwaUser;
|
|
|
|
import com.foreverwin.mesnac.meapi.service.NwaUserService;
|
|
|
|
import com.foreverwin.mesnac.meapi.service.NwaUserService;
|
|
|
|
|
|
|
|
import com.foreverwin.modular.core.exception.BaseException;
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -21,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -53,6 +56,9 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private UserGroupMapper userGroupMapper;
|
|
|
|
private UserGroupMapper userGroupMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private UsrMapper usrMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void anomalyJobProcess(String site) {
|
|
|
|
public void anomalyJobProcess(String site) {
|
|
|
@ -64,6 +70,8 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
|
|
|
|
abnormalMessageQueryWrapper.lt("UP_DATE_TIME",now);
|
|
|
|
abnormalMessageQueryWrapper.lt("UP_DATE_TIME",now);
|
|
|
|
// AbnormalBill abnormalBill = new AbnormalBill();
|
|
|
|
// AbnormalBill abnormalBill = new AbnormalBill();
|
|
|
|
List<Message> abnormalMessages = messageMapper.selectList(abnormalMessageQueryWrapper);
|
|
|
|
List<Message> abnormalMessages = messageMapper.selectList(abnormalMessageQueryWrapper);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(Message _abnormalMessage : abnormalMessages){
|
|
|
|
for(Message _abnormalMessage : abnormalMessages){
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
Message abnormalMessage = new Message();
|
|
|
|
Message abnormalMessage = new Message();
|
|
|
@ -124,19 +132,40 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
|
|
|
|
// String sendUsers = abnormalMessage.getSendUser().replace(',', '|');
|
|
|
|
// String sendUsers = abnormalMessage.getSendUser().replace(',', '|');
|
|
|
|
// activeMQUtil.wechatSendMessage(sendUsers,abnormalMessage.getContent());
|
|
|
|
// activeMQUtil.wechatSendMessage(sendUsers,abnormalMessage.getContent());
|
|
|
|
// }else if(!Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getAbnormalNode())){
|
|
|
|
// }else if(!Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getAbnormalNode())){
|
|
|
|
//判断是否有该用户组
|
|
|
|
// 判断是否有该用户组
|
|
|
|
|
|
|
|
|
|
|
|
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup());
|
|
|
|
// List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup());
|
|
|
|
StringBuilder sendUsers = new StringBuilder();
|
|
|
|
// StringBuilder sendUsers = new StringBuilder();
|
|
|
|
for (int i = 0; i < nwaUsers.size(); i++) {
|
|
|
|
// for (int i = 0; i < nwaUsers.size(); i++) {
|
|
|
|
if(i == (nwaUsers.size() - 1)){
|
|
|
|
// if(i == (nwaUsers.size() - 1)){
|
|
|
|
sendUsers.append(nwaUsers.get(i).getUserName());
|
|
|
|
// sendUsers.append(nwaUsers.get(i).getUserName());
|
|
|
|
}else{
|
|
|
|
// }else{
|
|
|
|
sendUsers.append(nwaUsers.get(i).getUserName()).append("|");
|
|
|
|
// sendUsers.append(nwaUsers.get(i).getUserName()).append("|");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//发送消息
|
|
|
|
|
|
|
|
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup());
|
|
|
|
|
|
|
|
if(nwaUsers != null && nwaUsers.size() <= 0){
|
|
|
|
|
|
|
|
throw new BaseException("消息发送失败,发送的用户组下面没有用户");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> customFieldByUserId = usrMapper.findCustomFieldByUserId(site, nwaUsers);
|
|
|
|
|
|
|
|
if(customFieldByUserId != null && customFieldByUserId.size() <= 0){
|
|
|
|
|
|
|
|
throw new BaseException("消息发送失败,发送的用户组下面的自定义数据没有维护");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuilder sendUsers = new StringBuilder();
|
|
|
|
|
|
|
|
for (int i = 0; i < Objects.requireNonNull(customFieldByUserId).size(); i++) {
|
|
|
|
|
|
|
|
if(i == (customFieldByUserId.size() - 1)){
|
|
|
|
|
|
|
|
sendUsers.append(customFieldByUserId.get(i));
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
sendUsers.append(customFieldByUserId.get(i)).append("|");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
|
|
|
|
//保存升级的消息类型
|
|
|
|
//保存升级的消息类型
|
|
|
|
messageService.saveOrUpdate(abnormalMessage);
|
|
|
|
messageService.saveOrUpdate(abnormalMessage);
|
|
|
|
//保存原先的消息类型,让原先的消息类型的stauts改为Y
|
|
|
|
//保存原先的消息类型,让原先的消息类型的stauts改为Y
|
|
|
|