异常消息

master
赵嘉伟 3 years ago
parent 1e6a417f34
commit c2d027d20b

@ -1033,6 +1033,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage1.setSite(site); abnormalMessage1.setSite(site);
abnormalMessage1.setObjectBo(abnormalBill.getHandle()); abnormalMessage1.setObjectBo(abnormalBill.getHandle());
abnormalMessage1.setNode(Constants.ABNORMAL_MESSAGE_REPORT); abnormalMessage1.setNode(Constants.ABNORMAL_MESSAGE_REPORT);
abnormalMessage1.setGrade(Double.parseDouble("1"));
// QueryWrapper<Message> wrapper = new QueryWrapper<>(); // QueryWrapper<Message> wrapper = new QueryWrapper<>();
// wrapper.setEntity(abnormalMessage1); // wrapper.setEntity(abnormalMessage1);
List<Message> messages = messageService.selectList(abnormalMessage1); List<Message> messages = messageService.selectList(abnormalMessage1);
@ -1043,9 +1044,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setGrade(messages.get(0).getGrade()); abnormalMessage.setGrade(messages.get(0).getGrade());
abnormalMessage.setUpDateTime(messages.get(0).getUpDateTime()); abnormalMessage.setUpDateTime(messages.get(0).getUpDateTime());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_RESPONSE); abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_RESPONSE);
}else{
throw new BaseException("发送消息时,异常响应报错");
} }
// }else{
// throw new BaseException("发送消息时,异常响应报错");
// }
break; break;
//纠纷确认 //纠纷确认

@ -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();
@ -126,17 +134,38 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
// }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());
// StringBuilder sendUsers = new StringBuilder();
// for (int i = 0; i < nwaUsers.size(); i++) {
// if(i == (nwaUsers.size() - 1)){
// sendUsers.append(nwaUsers.get(i).getUserName());
// }else{
// sendUsers.append(nwaUsers.get(i).getUserName()).append("|");
// }
// }
// activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
//
//
//
//
//发送消息
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup()); 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(); StringBuilder sendUsers = new StringBuilder();
for (int i = 0; i < nwaUsers.size(); i++) { for (int i = 0; i < Objects.requireNonNull(customFieldByUserId).size(); i++) {
if(i == (nwaUsers.size() - 1)){ if(i == (customFieldByUserId.size() - 1)){
sendUsers.append(nwaUsers.get(i).getUserName()); sendUsers.append(customFieldByUserId.get(i));
}else{ }else{
sendUsers.append(nwaUsers.get(i).getUserName()).append("|"); 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

Loading…
Cancel
Save