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