package com.tofly.watermeter.custom.controller;

import com.tofly.watermeter.custom.service.TimedTaskService;
import com.tofly.watermeter.custom.service.sxj.SynchronousAboutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "定时任务接口")
@RestController
@AllArgsConstructor
@RequestMapping("/timedTask")
public class TimedTaskContrloller {

    private final TimedTaskService timedTaskService;
    private final SynchronousAboutService synchronousAboutService;

    @ApiOperation("制水成本提醒")
    @PostMapping("/monthFill")
    @ApiImplicitParam(name = "thisWay", value = "0 月份  1 日", dataType = "long")
    public boolean monthFill(Long thisWay,Long menuId) {
        return timedTaskService.sendMsgAbout(thisWay,menuId);
    }

    @GetMapping("/sendWarnMsgAndSMS")
    @ApiOperation("报警消息与短信发送")
    public boolean sendWarnMsgAndSMS() {
        return timedTaskService.sendWarnMsgAndSMS();
    }

    @GetMapping("/performanceEvaluation")
    @ApiOperation("dma异常绩效评价")
    public boolean performanceEvaluation(){
        return timedTaskService.performanceEvaluation();
    }

    @GetMapping("/synInfo")
    @ApiOperation("同步已抄表未同步信息")
    public boolean synchronizingInformation(){
        return timedTaskService.synchronizingInformation();
    }

    @GetMapping("/synFoundationInfo")
    @ApiOperation("同步基础信息")
    public boolean synFoundationInfo(Integer flag, String yearMonth){
        return synchronousAboutService.synchronousReadMeter();
    }

}
