package com.jiayue.ipfcst.console.controller;

import com.jiayue.ipfcst.common.core.exception.BusinessException;
import com.jiayue.ipfcst.console.service.QREnvironmentDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author tl
 * @CreateTime 2021/9/14 9:36
 */
@RestController
public class QREnvironmentDataController {

  @Autowired
  private QREnvironmentDataService qrEnvironmentDataService;

  @GetMapping("/qrCode/realPower/{startTime}/{endTime}")
  public void generateRealPowerCode(HttpServletResponse response,
                                    @PathVariable("startTime") Long startTime,
                                    @PathVariable("endTime") Long endTime){
    try {
      qrEnvironmentDataService.generateRealPowerCode(response,startTime,endTime);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (BusinessException e) {
      e.printStackTrace();
    }
  }
}
