| @@ -1,93 +0,0 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MailMsg; | |||
| import com.iformall.domain.po.WxMsgRecord; | |||
| import com.iformall.enums.EnumMsgRecordType; | |||
| import com.iformall.mq.MQConfig; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.mq.impl.RabbitMqMessageProducer; | |||
| import com.iformall.mq.impl.RocketMqMessageProducer; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.context.annotation.Profile; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.Map; | |||
| @RestController | |||
| @Api(description = "登录相关接口") | |||
| public class HomeController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Value("${version}") | |||
| private String version; | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| // @Autowired | |||
| // private RabbitMqMessageProducer rabbitMqMessageProducer; | |||
| @Value("${spring.mail.username}") | |||
| private String from; | |||
| @ApiOperation("获取后端版本号") | |||
| @GetMapping("/version") | |||
| public ResultData version() { | |||
| return new ResultData(version); | |||
| } | |||
| @GetMapping("/mqtest") | |||
| public ResultData mqtest() { | |||
| WxMsgRecord wxMsgRecord = new WxMsgRecord(); | |||
| wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | |||
| wxMsgRecord.setSender("aa"); | |||
| wxMsgRecord.setModelType(4); | |||
| wxMsgRecord.setReceiver("18601973448"); | |||
| wxMsgRecord.setSignature("富茂科技"); | |||
| wxMsgRecord.setTenantId("456"); | |||
| Map<String,String> map = new HashedMap(); | |||
| map.put("contract","A11111"); | |||
| map.put("page","www.baidu.com"); | |||
| wxMsgRecord.setDynamicContentMap(map); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, "topic-1", "tag-1", "key-1"); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/mail") | |||
| public ResultData mail() { | |||
| MailMsg wxMsgRecord = new MailMsg(); | |||
| wxMsgRecord.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||
| wxMsgRecord.setFrom(from); | |||
| wxMsgRecord.setTo(new String[]{"luozukai@iformall.com"}); | |||
| wxMsgRecord.setSubject("回家吃饭了"); | |||
| wxMsgRecord.setMsg("大熊熊"); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, "topic-1", "tag-1", "key-1"); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 重发 | |||
| * @return | |||
| */ | |||
| @GetMapping("/resend") | |||
| public ResultData resend() { | |||
| MailMsg wxMsgRecord = new MailMsg(); | |||
| wxMsgRecord.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||
| wxMsgRecord.setFrom(from); | |||
| wxMsgRecord.setTo(new String[]{"luozukai@iformall.com"}); | |||
| wxMsgRecord.setSubject("回家吃饭了"); | |||
| wxMsgRecord.setMsg("大熊熊"); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, "topic-1", "tag-1", "key-1"); | |||
| return new ResultData(); | |||
| } | |||
| } | |||