package com.sunyard.ssp.modules.monitor.transaction.controller;

import com.sunyard.ssp.common.Result;
import com.sunyard.ssp.modules.monitor.transaction.entity.StatisticalParam;
import com.sunyard.ssp.modules.monitor.transaction.service.TransactionService;
import com.sunyard.ssp.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Slf4j
@Api(description = "系统监控-交易监控", tags = "系统监控-交易监控")
@RequestMapping("/monitor/transaction")
@Transactional
public class TransactionController {

    @Autowired
    private TransactionService transactionService;

    @RequestMapping(value = "/getTransactionData", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "获得交易监控的数据")
    public Result<Object> getStaticInfo(@ModelAttribute StatisticalParam statisticalParam) {
        Object result = transactionService.getTransactionData(statisticalParam);
        return new ResultUtil<Object>().setData(result);
    }
}
