Commit 825e9ee5 by 李小龙

fix:发送公众号消息模板

parent 1109304a
package com.makeit.mqtt;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.entity.platform.alarm.PlatDayDurationRecord;
import com.makeit.global.annotation.AuthIgnore;
import com.makeit.module.iot.vo.DeviceInfo;
import com.makeit.service.platform.alarm.PlatDayDurationRecordService;
import com.makeit.utils.msg.dto.MsgSendDTO;
import com.makeit.utils.msg.sender.WxSpSender;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Api(tags = "告警记录2")
@RestController
@RequestMapping("/plat/test")
public class TestAlarmRecordController {
// @Autowired
// private MailMsgSender mailMsgSender;
// @Autowired
// private SmsMsgSender smsMsgSender;
// @Autowired
// private SmsVoiceSender smsVoiceSender;
//
// @ApiOperation("测试邮箱")
// @PostMapping("testMail")
// public ApiResponseEntity<Void> testMail(@RequestBody BaseIdDTO dto) {
// MsgSendDTO msgDTO = new MsgSendDTO();
// msgDTO.setSubject("测试消息");
// msgDTO.setReceiverList(Collections.singletonList("994997968@qq.com"));
// msgDTO.setOriContent("测试发送邮箱");
// mailMsgSender.send(msgDTO);
// return ApiResponseUtils.success();
// }
//
// @ApiOperation("测试短信")
// @PostMapping("testMsg")
// public ApiResponseEntity<Void> testMsg(@RequestBody BaseIdDTO dto) throws Exception {
// MsgSendDTO msgDTO = new MsgSendDTO();
// msgDTO.setReceiverList(Collections.singletonList("18850503603"));
// msgDTO.setOriContent("测试短信test");
// smsMsgSender.send(msgDTO);
// return ApiResponseUtils.success();
// }
//
// @ApiOperation("测试语音短信")
// @PostMapping("testVoice")
// @AuthIgnore
// public ApiResponseEntity<Void> testVoice(@RequestBody BaseIdDTO dto) throws Exception {
// MsgSendDTO msgDTO = new MsgSendDTO();
// msgDTO.setReceiverList(Collections.singletonList("18850503603"));
// msgDTO.setOriContent("测试短信test");
// smsVoiceSender.send(msgDTO);
// return ApiResponseUtils.success();
// }
@Autowired
private WxSpSender wxSpSender;
// @ApiOperation("测试公众号消息")
// @PostMapping("testSp")
// @AuthIgnore
// public ApiResponseEntity<Void> testVoice(@RequestBody BaseIdDTO dto) throws Exception {
// MsgSendDTO msgDTO = new MsgSendDTO();
// msgDTO.setReceiverList(Collections.singletonList("18850503603"));
// msgDTO.setOriContent("测试短信test");
// wxSpSender.send(msgDTO);
// return ApiResponseUtils.success();
// }
@ApiOperation("测试公众号消息")
@PostMapping("testSp")
@AuthIgnore
public ApiResponseEntity<Void> testSpVoice(@RequestBody BaseIdDTO dto) throws Exception {
MsgSendDTO msgDTO = new MsgSendDTO();
msgDTO.setReceiverList(Collections.singletonList("18850503603"));
msgDTO.setOriContent("测试短信test");
wxSpSender.send(msgDTO);
return ApiResponseUtils.success();
}
@Autowired
private PushCallback pushCallback;
@ApiOperation("测试跌倒")
@PostMapping("testFall")
@AuthIgnore
public ApiResponseEntity<Void> testVoice(@RequestBody DeviceInfo info) throws Exception {
pushCallback.checkAlarm(info);
return ApiResponseUtils.success();
}
@Autowired
private PlatDayDurationRecordService platDayDurationRecordService;
@ApiOperation("测试")
@PostMapping("test")
@AuthIgnore
public ApiResponseEntity<List<PlatDayDurationRecord>> test(@RequestBody DeviceInfo info) throws Exception {
PlatDayDurationRecord platDayDurationRecord = new PlatDayDurationRecord();
platDayDurationRecord.setDay(new Date());
LambdaQueryWrapper<PlatDayDurationRecord> platDayDurationRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
platDayDurationRecordLambdaQueryWrapper.eq(PlatDayDurationRecord::getDay,platDayDurationRecord.getDay());
List<PlatDayDurationRecord> list = platDayDurationRecordService.list();
return ApiResponseUtils.success(list);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment