异常消息

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

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

@ -11,9 +11,11 @@ import com.foreverwin.mesnac.common.model.Message;
import com.foreverwin.mesnac.common.service.MessageService;
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
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.model.NwaUser;
import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.util.CommonMethods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
/**
@ -53,6 +56,9 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
@Autowired
private UserGroupMapper userGroupMapper;
@Autowired
private UsrMapper usrMapper;
@Override
public void anomalyJobProcess(String site) {
@ -64,6 +70,8 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
abnormalMessageQueryWrapper.lt("UP_DATE_TIME",now);
// AbnormalBill abnormalBill = new AbnormalBill();
List<Message> abnormalMessages = messageMapper.selectList(abnormalMessageQueryWrapper);
for(Message _abnormalMessage : abnormalMessages){
String uuid = UUID.randomUUID().toString();
Message abnormalMessage = new Message();
@ -124,19 +132,40 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
// String sendUsers = abnormalMessage.getSendUser().replace(',', '|');
// activeMQUtil.wechatSendMessage(sendUsers,abnormalMessage.getContent());
// }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("|");
}
// 判断是否有该用户组
// 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());
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);
//保存原先的消息类型让原先的消息类型的stauts改为Y

Loading…
Cancel
Save