ClassNoticeController.java 2.44 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.classNotice.SendNotificationDTO;
import com.subsidy.model.ClassNoticeDO;
import com.subsidy.service.ClassNoticeService;
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 io.swagger.annotations.Api;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2022-01-21
 */
@RestController
@Api(tags = "课程通知")
@RequestMapping("/classNotice")
public class ClassNoticeController {

    @Autowired
    private ClassNoticeService classNoticeService;

    @PostMapping("addNotice")
        @ApiOperation("新增一个通知  classId noticeType isAuto noticeTime")
    public ResponseVO addNotice(@RequestBody ClassNoticeDO classNoticeDO){
        return ResponseData.generateCreatedResponse(0,classNoticeService.addNotice(classNoticeDO));
    }

    @PostMapping("updateNotice")
    @ApiOperation("修改一个通知 id noticeType isAuto noticeTime")
    public ResponseVO updateNotice(@RequestBody ClassNoticeDO classNoticeDO){
        return ResponseData.generateCreatedResponse(0,classNoticeService.updateNotice(classNoticeDO));
    }

    @PostMapping("deleteNotice")
    @ApiOperation("删除一个通知 id")
    public ResponseVO deleteNotice(@RequestBody ClassNoticeDO classNoticeDO){
        return ResponseData.generateCreatedResponse(0,classNoticeService.deleteNotice(classNoticeDO));
    }

    @PostMapping("queryClassNotices")
    @ApiOperation("查看某个课程的通知提醒  classId 课程id status 状态(待发送/已发送)")
    public ResponseVO queryClassNotices(@RequestBody ClassNoticeDO classNoticeDO){
        return ResponseData.generateCreatedResponse(0,classNoticeService.queryClassNotices(classNoticeDO));
    }

    @PostMapping("sendClassNotices")
    @ApiOperation("发送通知:classId/课程Id  sendType/发送类型(全部成员/未签到成员/未完课成员)")
    public ResponseVO sendClassNotices(@RequestBody SendNotificationDTO sendNotificationDTO) {
        classNoticeService.sendNotification(sendNotificationDTO);
        return ResponseData.generateCreatedResponse(0);
    }
}