package com.rongwei.savecheck.controller;


import com.rongwei.rwcommon.base.R;
import com.rongwei.sfcommon.sys.service.AspAnnouncementBoardLargeScreenService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;

/**
 * 大屏接口
 */
@RestController
@RequestMapping("largescreen")
@Slf4j
public class LargeScreenController {
    @Autowired
    private AspAnnouncementBoardLargeScreenService aspAnnouncementBoardLargeScreenService;

    /**
     * 公告栏数据定时生成
     */
    @Scheduled(cron = "0 0 8 ? * *")
    @PostMapping("/bulletinBoardData")
    public R bulletinBoardData() {
        log.info("公告栏数据定时生成");
        aspAnnouncementBoardLargeScreenService.announcement();
        return R.ok();
    }

    @PostMapping("/bulletinBoardDataByTenantId")
    public R bulletinBoardDataByTenantId(@RequestBody String tenantid) {
        log.info("手动数据生成");
        aspAnnouncementBoardLargeScreenService.announcementByTenantId(tenantid);
        return R.ok();
    }

}
