异常代码优化提交

master
赵嘉伟 3 years ago
parent 2a07b6f4a9
commit b24ad49a00

@ -237,17 +237,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Override
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
//判断设备异常是否有为处理完成的sfc
// if(!StringUtil.isBlank(abnormalBill.getSfc()) ){
// List<String> status = new ArrayList<>();
// status.add(Constants.PROGRAM_CONFIRM);
// status.add(Constants.CANCEL);
// status.add(Constants.SHUT_DOWN);
// List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
// if(abnormalBillList.size() >= 1 ){
// throw BusinessException.build("设备异常有未处理完成的sfc");
// }
// }
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
this.saveOrUpdate(abnormalBill);
//发送消息
@ -398,7 +387,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBillDispose.setResolveDateTime(now);
abnormalBillDispose.setResolveUser(user);
abnormalBill.setStatus(Constants.PROGRAM_CONFIRM);
abnormalBill.setCorrection("true");
abnormalBill.setProgram("true");
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
this.saveOrUpdate(abnormalBill);
@ -440,14 +429,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String local = LocaleContextHolder.getLocale().getLanguage();
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断判责提交是否还没有进行填写
AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
if(abnormalBillDispose1 != null){
if(StringUtil.isBlank(abnormalBillDispose1.getDutyCauseType())){
throw BusinessException.build("该异常单还没有进行判责提交");
}
}
abnormalBill.setStatus(Constants.SHUT_DOWN);
abnormalBillDispose.setClosedUser(user);
@ -470,7 +451,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime currentTime = LocalDateTime.now();
String user = CommonMethods.getUser();
//return 返回的消息
String message = "提报成功";
@ -489,7 +469,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("异常单号不存在");
}
//设置异常单的handle
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
//判断该异常单是否已经提交
@ -941,17 +920,20 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_RESPONSE);
break;
case Constants.CORRECTION_CONFIRM://纠纷确认
//纠纷确认
case Constants.CORRECTION_CONFIRM:
abnormalMessage.setSendUserGroup(abnormalBillDispose.getDutySendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM);
break;
case Constants.PROGRAM_CONFIRM://方案确认
abnormalMessage.setSendUser(abnormalBillDispose.getResolveSendUserGroup());
//方案确认
case Constants.PROGRAM_CONFIRM:
abnormalMessage.setSendUserGroup(abnormalBillDispose.getResolveSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM);
break;
case Constants.CANCEL://取消
//取消
case Constants.CANCEL:
abnormalMessage.setSendUserGroup(abnormalBill.getCancelSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CANCEL);
//异常取消的时候要关闭当前异常单下所有的异常信息
@ -972,15 +954,12 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//格式化消息
String message = this.formatMessage(abnormalBill, abnormalMessage.getMessageType(), site);
//得到消息触发的时间
abnormalMessage.setResponseDateTime(now);
//得到要发送的消息
abnormalMessage.setContent(message);
//得到升级的用户组
//新建有、响应没有、纠防确认有、方案确认没有、取消没有、关闭没有
if(Constants.NEW.equals(abnormalBill.getStatus()) || Constants.CORRECTION_CONFIRM.equals(abnormalBill.getStatus())){
@ -999,7 +978,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setUpMessageType(abnormalMessage.getMessageType());
}
//设置状态新建是Y响应为N纠防确认是N方案确认是Y取消是Y
if(Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode()) ||
Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM.equals(abnormalMessage.getNode())){
@ -1014,24 +992,23 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//发送消息
// if(!Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode())){
// 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));
// }else{
// sendUsers.append(nwaUsers.get(i)).append("|");
// }
// }
// activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
// }
if(!Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode())){
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));
}else{
sendUsers.append(nwaUsers.get(i)).append("|");
}
}
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
}
messageService.saveOrUpdate(abnormalMessage);
return true;
}
@Override
public String formatMessage(AbnormalBill abnormalBill,String messageType, String site) {
//找到消息内容

Loading…
Cancel
Save