SmsNoticeController.java 2.11 KB
package com.zhongzhi.controller;


import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.notice.SmsNoticeDTO;
import com.zhongzhi.dto.notice.SmsNoticePageDTO;
import com.zhongzhi.service.SmsNoticeService;
import com.zhongzhi.vo.ResponseVO;
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;

/**
 * <p>
 * 短信通知记录 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2022-04-15
 */
@RestController
@Api(tags = "短信通知")
@RequestMapping("/smsNotice")
public class SmsNoticeController {

    @Autowired
    private SmsNoticeService smsNoticeService;

    @PostMapping(value = "batchSend")
    @LoginRequired({Platform.center})
    @ApiOperation("管理端 -- 批量发送短信:matchId/赛事年份ID、projectGroup/组别、projectSchedule/阶段、projectStatus/状态、name/搜索名称")
    public ResponseVO batchSend(@RequestBody SmsNoticeDTO smsNoticeDTO) {
        smsNoticeService.batchSend(smsNoticeDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "send")
    @LoginRequired({Platform.center})
    @ApiOperation("管理端 -- 发送短信:ids/项目ID(数组)")
    public ResponseVO send(@RequestBody SmsNoticeDTO smsNoticeDTO) {
        smsNoticeService.send(smsNoticeDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "getListByPage")
    @LoginRequired({Platform.center})
    @ApiOperation("管理端 -- 发送短信记录:date/日期、name/搜索名称、pageNo、pageSize")
    public ResponseVO getListByPage(@RequestBody SmsNoticePageDTO smsNoticePageDTO) {
        return ResponseData.generateCreatedResponse(0, smsNoticeService.getListByPage(smsNoticePageDTO));
    }

}