From 87bae9447fbabd2a8f1a333374077d526c08ab1c Mon Sep 17 00:00:00 2001 From: luozukai Date: Wed, 17 Apr 2019 19:13:12 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=A1=E6=89=B9=E6=B5=81][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9][=E5=AE=8C=E5=96=84=E8=B4=A6=E5=8D=95=E5=AE=A1?= =?UTF-8?q?=E6=89=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/mq/MqBaseConsumer.java | 94 +++++++++---------- .../com/iformall/domain/po/msg/BaseMsg.java | 2 + 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java b/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java index eca04fa9c..7c4a589c8 100644 --- a/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java +++ b/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); - } - -// 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); -// } +// 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); +//// } +//// } +// } } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java index 62379cfec..8619c8a0b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java @@ -14,9 +14,11 @@ public class BaseMsg implements Serializable { private static final long serialVersionUID = 923764283764823L; @io.swagger.annotations.ApiModelProperty(value="域0全部 1sys 2a端 3c端 4b端",name="domain") + @Transient private Integer domain = 0; @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") + @Transient private String tenantId; @io.swagger.annotations.ApiModelProperty(value="唯一标识",name="uuid")