package com.gyee.runeconomy.controller.monitor;/*
@author   谢生杰
@date   2023/4/3-17:15
*/

import com.gyee.common.model.StringUtils;
import com.gyee.common.vo.monitor.AgcVo;
import com.gyee.runeconomy.dto.R;
import com.gyee.runeconomy.dto.ResultMsg;
import com.gyee.runeconomy.service.monitor.AgcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/agc")
@Api(value = "agc监视", tags = "agc监视")
public class AgcController {
    @Resource
    private AgcService agcService;

    /**
     * agc监视
     *
     * @return
     */
    @GetMapping("/monitor")
    @ResponseBody
    @ApiOperation(value = "AGC监视", notes = "AGC监视")
    public R monitor(@RequestParam(value = "type", required = true) String type,
                     @RequestParam(value = "company", required = true) String company) throws Exception {

        List<AgcVo> resultList = agcService.monitor(company, type);
        if (StringUtils.isNotNull(resultList)) {
            return R.data(ResultMsg.ok(resultList));
        } else {
            return R.error(ResultMsg.error());
        }
    }
}
