| @@ -7,9 +7,9 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.MallUserInfoVo; | import com.iformall.domain.vo.MallUserInfoVo; | ||||
| import com.iformall.enums.EnumMallUserStatus; | |||||
| import com.iformall.enums.EnumMsgModel; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.shiro.UserSession; | import com.iformall.shiro.UserSession; | ||||
| import com.iformall.shiro.UseriFormallToken; | import com.iformall.shiro.UseriFormallToken; | ||||
| @@ -66,6 +66,24 @@ public class HomeController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMsgValidationcodeService wxMsgValidationcodeService; | private WxMsgValidationcodeService wxMsgValidationcodeService; | ||||
| @Autowired | |||||
| private MqBaseProducer mqBaseProducer; | |||||
| @ApiOperation("发送邮件") | |||||
| @GetMapping("test") | |||||
| public ResultData test() throws Exception { | |||||
| String msg = "<!DOCTYPEhtml><html><head><metacharset=\"utf-8\"><metaname=\"viewport\"content=\"width=device-width,initial-scale=1.0\"><metahttp-equiv=\"Content-Type\"content=\"text/html; charset=utf-8\"/><metaname=\"viewport\"content=\"initial-scale=1.0, user-scalable=no\"/><metaname=\"renderer\"content=\"webkit\"><metahttp-equiv=\"X-UA-Compatible\"content=\"IE=edge,chrome=1\"><title>富茂审批邮件</title><title></title><script>document.documentElement.style.fontSize=document.documentElement.clientWidth/7.5+'px';</script></head><body><divid=\"box\"><headerstyle=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\"><imgstyle=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\"src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/></header><content><divstyle=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 56px;margin-left: 55px;\">审批通过通知</div><divstyle=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;margin-top: 36px;\">编号<span>123231232323</span>的合同已经审批通过,请登录,<ahref=\"http://mall.youlane.cn\">长融后台</a>跟进后续工作</div></content></div></body></html>"; | |||||
| MailMsg mailMsg = new MailMsg(); | |||||
| mailMsg.setHtml(true); | |||||
| mailMsg.setFrom("luozukai1988@126.com"); | |||||
| mailMsg.setTo(new String[]{"luozukai@iformall.com"}); | |||||
| mailMsg.setSubject("富茂测试邮件"); | |||||
| mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||||
| mailMsg.setMsg(msg); | |||||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @GetMapping("/captcha.jpg") | @GetMapping("/captcha.jpg") | ||||
| public void captcha(HttpServletResponse response)throws ServletException, IOException { | public void captcha(HttpServletResponse response)throws ServletException, IOException { | ||||
| logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | ||||
| @@ -2,8 +2,10 @@ package com.iformall.controller; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MailMsg; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -14,7 +16,10 @@ import org.apache.commons.collections.map.HashedMap; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.mail.javamail.MimeMessageHelper; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.mail.internet.MimeMessage; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -27,7 +32,6 @@ public class WxCouponController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("listCoupon") | @GetMapping("listCoupon") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.context.annotation.Profile; | import org.springframework.context.annotation.Profile; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.UUID; | |||||
| /** | /** | ||||
| * @Auther: Stormeye | * @Auther: Stormeye | ||||
| * @Date: 2019-01-31 | * @Date: 2019-01-31 | ||||
| @@ -34,6 +36,7 @@ public class RabbitMqMessageProducer implements MqBaseProducer { | |||||
| @Override | @Override | ||||
| public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | ||||
| try { | try { | ||||
| data.setUuid(UUID.randomUUID().toString()); | |||||
| wxMsgRecordService.save(data); | wxMsgRecordService.save(data); | ||||
| rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data)); | rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data)); | ||||
| @@ -59,6 +59,7 @@ public class RocketMqMessageProducer implements MqBaseProducer { | |||||
| @Override | @Override | ||||
| public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | ||||
| try { | try { | ||||
| data.setUuid(UUID.randomUUID().toString()); | |||||
| wxMsgRecordService.save(data); | wxMsgRecordService.save(data); | ||||
| byte[] messageBody = JsonUtil.obj2Json(data).getBytes(RemotingHelper.DEFAULT_CHARSET); | byte[] messageBody = JsonUtil.obj2Json(data).getBytes(RemotingHelper.DEFAULT_CHARSET); | ||||
| @@ -35,7 +35,7 @@ public class SendEmailServiceImpl implements MsgSendService { | |||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| MailMsg mailMsg = (MailMsg)baseMsg; | MailMsg mailMsg = (MailMsg)baseMsg; | ||||
| if(mailMsg.isHtml()){ | |||||
| if(mailMsg.isHtml()){ //html邮件 | |||||
| MimeMessage message = sender.createMimeMessage(); | MimeMessage message = sender.createMimeMessage(); | ||||
| MimeMessageHelper helper = new MimeMessageHelper(message, true); | MimeMessageHelper helper = new MimeMessageHelper(message, true); | ||||
| helper.setFrom(from); | helper.setFrom(from); | ||||
| @@ -29,7 +29,7 @@ public class WxMsgRecordServiceImpl implements WxMsgRecordService { | |||||
| } | } | ||||
| msgRecord.setMsgType(data.getMsgType()); | msgRecord.setMsgType(data.getMsgType()); | ||||
| msgRecord.setUuid(UUID.randomUUID().toString()); | |||||
| msgRecord.setUuid(data.getUuid()); | |||||
| msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | ||||
| msgRecord.setId(idWorker.nextId()); | msgRecord.setId(idWorker.nextId()); | ||||
| wxMsgRecordMapper.save(msgRecord); | wxMsgRecordMapper.save(msgRecord); | ||||