| @@ -43,13 +43,14 @@ public class MsgSendingSchedule { | |||
| logger.info("sendmsg定时任务启动"); | |||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd HH:00:00"); | |||
| WxMsg wxMsg = new WxMsg(); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setIsright(0); | |||
| wxMsg.setSendtime(systemTime); | |||
| List<WxMsg> list = wxMsgMapper.findList(wxMsg); | |||
| logger.info("将要发送的短信列表:" + JSONArray.toJSONString(list)); | |||
| for (WxMsg msg : list) { | |||
| //sendmsg(msg); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setReceiver(msg.getPhones()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),null); | |||
| } | |||
| logger.info("sendmsg定时任务结束"); | |||
| @@ -14,6 +14,9 @@ public class BaseMsg implements Serializable { | |||
| @Transient | |||
| private String uuid; | |||
| //接收人,手机号邮件地址等 | |||
| private String receiver; | |||
| //消息类型 1短信 2回调短信 3邮件 4微信小程序模板 5微信公众号模板 6系统通知 | |||
| @Transient | |||
| private Integer msgType; | |||
| @@ -26,10 +29,19 @@ public class BaseMsg implements Serializable { | |||
| @Transient | |||
| private String statusMessage; | |||
| //延迟消息1s,5s,10s,30s,1m,2m,3m,4m,5m,6m,7m,8m,9m,10m,20m,30m,1h,2h | |||
| //rocketMQ延迟消息1s,5s,10s,30s,1m,2m,3m,4m,5m,6m,7m,8m,9m,10m,20m,30m,1h,2h | |||
| @Transient | |||
| private Integer delayTimeLevel = 0; | |||
| public String getReceiver() { | |||
| return receiver; | |||
| } | |||
| public void setReceiver(String receiver) { | |||
| this.receiver = receiver; | |||
| } | |||
| public Integer getDelayTimeLevel() { | |||
| return delayTimeLevel; | |||
| } | |||
| @@ -27,8 +27,6 @@ public class WxMsgRecord extends BaseMsg { | |||
| private Long senderUserId; | |||
| //发送人姓名 | |||
| private String senderUserName; | |||
| //接收人,手机号邮件地址等 | |||
| private String receiver; | |||
| //接收人用户id | |||
| private Long receiverUserId; | |||
| //接收人姓名 | |||
| @@ -43,9 +41,31 @@ public class WxMsgRecord extends BaseMsg { | |||
| private Date createtime; | |||
| private Date updatetime; | |||
| private Integer msgStatus; | |||
| private String statusMessage; | |||
| //动态替换内容 | |||
| private Map<String,String> dynamicContentMap; | |||
| @Override | |||
| public Integer getMsgStatus() { | |||
| return msgStatus; | |||
| } | |||
| @Override | |||
| public void setMsgStatus(Integer msgStatus) { | |||
| this.msgStatus = msgStatus; | |||
| } | |||
| @Override | |||
| public String getStatusMessage() { | |||
| return statusMessage; | |||
| } | |||
| @Override | |||
| public void setStatusMessage(String statusMessage) { | |||
| this.statusMessage = statusMessage; | |||
| } | |||
| public String getMsgJson() { | |||
| return msgJson; | |||
| @@ -105,14 +125,6 @@ public class WxMsgRecord extends BaseMsg { | |||
| this.senderUserName = senderUserName; | |||
| } | |||
| public String getReceiver() { | |||
| return receiver; | |||
| } | |||
| public void setReceiver(String receiver) { | |||
| this.receiver = receiver; | |||
| } | |||
| public Long getReceiverUserId() { | |||
| return receiverUserId; | |||
| } | |||
| @@ -5,6 +5,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumMsgSendStatus; | |||
| import com.iformall.enums.EnumMsgStatus; | |||
| import com.iformall.enums.EnumVerifyCode; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -111,7 +112,11 @@ public class SendCallBackSmsServiceImpl implements MsgSendService { | |||
| wxMsgMapper.insertSelective(wxMsg); | |||
| if (ret.equals(EnumMsgSendStatus.MSG_SEND_SUCCESS.getCode().toString())) { | |||
| wxMsgService.addMsgCallback(wxMsg, batchNo); | |||
| //wx_msg改为已发送 | |||
| wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); | |||
| wxMsgMapper.updateByPrimaryKeySelective(wxMsg); | |||
| } else { | |||
| wxMsgMapper.updateByPrimaryKeySelective(wxMsg); | |||
| throw new MallinkException(1001,"运营商返回失败:"+result); | |||
| } | |||
| } | |||
| @@ -610,6 +610,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| smartAppMsg.setTemplateType(EnumTemplateType.VERIFY_FAIL.getCode()); | |||
| smartAppMsg.setGotopage("pages/index/index"); | |||
| smartAppMsg.setTo(user.getOpenId()); | |||
| smartAppMsg.setReceiver(user.getOpenId()); | |||
| smartAppMsg.setFrom(payOrder.getPrepayId()); | |||
| smartAppMsg.setTemplateDataList(Lists.newArrayList( | |||
| new WxMaTemplateData("keyword1", coupon.getTitle(), "#173177"), | |||
| @@ -28,6 +28,7 @@ public class WxMsgRecordServiceImpl implements WxMsgRecordService { | |||
| msgRecord = (WxMsgRecord)data; | |||
| } | |||
| msgRecord.setReceiver(data.getReceiver()); | |||
| msgRecord.setMsgType(data.getMsgType()); | |||
| msgRecord.setUuid(data.getUuid()); | |||
| msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | |||
| @@ -110,6 +110,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| wxMsg.setWxMsgConfig(wxMsgConfig); | |||
| wxMsg.setCouponInject(null); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setReceiver(wxMsg.getPhones()); | |||
| mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),null); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "短信已发送"); | |||
| @@ -139,6 +140,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| //sendmsg(wxMsg, wxMsgConfig, null); | |||
| wxMsg.setWxMsgConfig(wxMsgConfig); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setReceiver(wxMsg.getPhones()); | |||
| mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "短信已发送"); | |||
| @@ -181,6 +183,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| wxMsg.setWxMsgConfig(wxMsgConfig); | |||
| wxMsg.setCouponInject(couponInject); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setReceiver(wxMsg.getPhones()); | |||
| mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| } else { | |||
| List<String> phoneList = Arrays.asList(split).subList(i * 1000, (i + 1) * 1000); | |||
| @@ -191,6 +194,7 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| wxMsg.setWxMsgConfig(wxMsgConfig); | |||
| wxMsg.setCouponInject(couponInject); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setReceiver(wxMsg.getPhones()); | |||
| mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| } | |||
| @@ -9,12 +9,12 @@ | |||
| <result column="msg" property="msg" /> | |||
| <result column="send_time" property="sendTime" /> | |||
| <result column="model_id" property="modelId" /> | |||
| <result column="sender" property="from" /> | |||
| <result column="sender_user_id" property="fromUserId" /> | |||
| <result column="sender_user_name" property="fromUserName" /> | |||
| <result column="receiver" property="to" /> | |||
| <result column="receiver_user_id" property="toUserId" /> | |||
| <result column="receiver_user_name" property="toUserName" /> | |||
| <result column="sender" property="sender" /> | |||
| <result column="sender_user_id" property="senderUserId" /> | |||
| <result column="sender_user_name" property="senderUserName" /> | |||
| <result column="receiver" property="receiver" /> | |||
| <result column="receiver_user_id" property="receiverUserId" /> | |||
| <result column="receiver_user_name" property="receiverUserName" /> | |||
| <result column="msg_status" property="msgStatus" /> | |||
| <result column="status_message" property="statusMessage" /> | |||
| <result column="createtime" property="createtime" /> | |||
| @@ -67,7 +67,7 @@ | |||
| </update> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxMsgRecord" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_msg_model | |||
| select <include refid="allColumns" /> from wx_msg_record | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||