Просмотр исходного кода

[审批流][修改][完善账单审批]

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
33d260a26d
1 измененных файлов: 47 добавлений и 47 удалений
  1. +47
    -47
      mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java

+ 47
- 47
mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java Просмотреть файл

@@ -35,54 +35,54 @@ public class MqBaseConsumer {

public void doMessage(String message) {
log.info("received message: {}", message);
// BaseMsg baseMsg = null;
//
// try {
// baseMsg = (BaseMsg)JsonUtil.readValue(message,BaseMsg.class);
//
// if(EnumMsgRecordType.SMS.getCode().equals(baseMsg.getMsgType())){
// //短信
// sendSmsService.send((WxMsgRecord)JsonUtil.readValue(message,WxMsgRecord.class));
// } else if(EnumMsgRecordType.SMS_CALLBACK.getCode().equals(baseMsg.getMsgType())){
// //业务短信
// sendCallBackSmsService.send((WxMsg)JsonUtil.readValue(message,WxMsg.class));
// } else if(EnumMsgRecordType.EMAIL.getCode().equals(baseMsg.getMsgType())){
// //邮件
// sendEmailService.send((MailMsg)JsonUtil.readValue(message,MailMsg.class));
// } else if(EnumMsgRecordType.SMART_APP.getCode().equals(baseMsg.getMsgType())){
// //微信小程序-模板消息
// sendSmartAppMsgService.send((SmartAppMsg)JsonUtil.readValue(message,SmartAppMsg.class));
// } else if(EnumMsgRecordType.PUBLIC.getCode().equals(baseMsg.getMsgType())) {
// //公众号-模板消息
// sendMpMsgService.send((MpAppMsg)JsonUtil.readValue(message,MpAppMsg.class));
// } else if(EnumMsgRecordType.SMART_APP_UNIFORM.getCode().equals(baseMsg.getMsgType())) {
// //微信小程序-统一消息
// sendWeappUniformMsgService.send((AppUniformMsg)JsonUtil.readValue(message,AppUniformMsg.class));
// }
// baseMsg.setMsgStatus(EnumMsgRecordStatus.CONSUME_SUCC.getCode());
// wxMsgRecordMapper.update(baseMsg);
// }catch (Exception e){
// try {
// log.error("consum received error:{} ", e.getMessage());
// log.error("consum received error: ", e);
// //baseMsg.setStatusMessage(e.getMessage());
// baseMsg.setMsgStatus(EnumMsgRecordStatus.CONSUME_FAIL.getCode());
// wxMsgRecordMapper.update(baseMsg);
// }catch (Exception e1){
// log.error("更新db状态error: ", e1);
BaseMsg baseMsg = null;

try {
baseMsg = (BaseMsg)JsonUtil.readValue(message,BaseMsg.class);

if(EnumMsgRecordType.SMS.getCode().equals(baseMsg.getMsgType())){
//短信
sendSmsService.send((WxMsgRecord)JsonUtil.readValue(message,WxMsgRecord.class));
} else if(EnumMsgRecordType.SMS_CALLBACK.getCode().equals(baseMsg.getMsgType())){
//业务短信
sendCallBackSmsService.send((WxMsg)JsonUtil.readValue(message,WxMsg.class));
} else if(EnumMsgRecordType.EMAIL.getCode().equals(baseMsg.getMsgType())){
//邮件
sendEmailService.send((MailMsg)JsonUtil.readValue(message,MailMsg.class));
} else if(EnumMsgRecordType.SMART_APP.getCode().equals(baseMsg.getMsgType())){
//微信小程序-模板消息
sendSmartAppMsgService.send((SmartAppMsg)JsonUtil.readValue(message,SmartAppMsg.class));
} else if(EnumMsgRecordType.PUBLIC.getCode().equals(baseMsg.getMsgType())) {
//公众号-模板消息
sendMpMsgService.send((MpAppMsg)JsonUtil.readValue(message,MpAppMsg.class));
} else if(EnumMsgRecordType.SMART_APP_UNIFORM.getCode().equals(baseMsg.getMsgType())) {
//微信小程序-统一消息
sendWeappUniformMsgService.send((AppUniformMsg)JsonUtil.readValue(message,AppUniformMsg.class));
}
baseMsg.setMsgStatus(EnumMsgRecordStatus.CONSUME_SUCC.getCode());
wxMsgRecordMapper.update(baseMsg);
}catch (Exception e){
try {
log.error("consum received error:{} ", e.getMessage());
log.error("consum received error: ", e);
//baseMsg.setStatusMessage(e.getMessage());
baseMsg.setMsgStatus(EnumMsgRecordStatus.CONSUME_FAIL.getCode());
wxMsgRecordMapper.update(baseMsg);
}catch (Exception e1){
log.error("更新db状态error: ", e1);
}

// if(null != baseMsg){
// if(baseMsg.getDelayTimeLevel() < 3){
// baseMsg.setDelayTimeLevel(3); //10s后重试
// mqBaseProducer.sendMessage(baseMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode());
// }else{
// baseMsg.setStatusMessage(e.getMessage());
// baseMsg.setMsgStatus(EnumMsgRecordStatus.CONSUME_FAIL.getCode());
// wxMsgRecordMapper.update(baseMsg);
// }
// }
//
//// if(null != baseMsg){
//// if(baseMsg.getDelayTimeLevel() < 3){
//// baseMsg.setDelayTimeLevel(3); //10s后重试
//// mqBaseProducer.sendMessage(baseMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode());
//// }else{
//// baseMsg.setStatusMessage(e.getMessage());
//// baseMsg.setMsgStatus(EnumMsgRecordStatus.CONSUME_FAIL.getCode());
//// wxMsgRecordMapper.update(baseMsg);
//// }
//// }
// }
}

}
}

Загрузка…
Отмена
Сохранить