package com.jiayue.ipfcst.controller;

import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
import com.jiayue.ipfcst.common.data.service.BaseService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计查询系统版本
 *
 * @author zzy
 * @version 1.0
 * @since 2020/4/22 15:08
 */
@RestController
@RequestMapping("reportVersion")
@Slf4j
@PropertySource(value = {"classpath:META-INF\\build-info.properties"})
public class ReportVersionController {

  @Autowired
  BaseService baseService;

  @Value("${build.version}")
  private String version;

  /**
   * 获取系统用户
   *
   * @return 执行结果
   */
  @SneakyThrows
  @GetMapping
  public String get() {
    return this.version;
  }


  /**
   * 获取系统用户
   *
   * @return 执行结果
   */
  @SneakyThrows
  @GetMapping("/gs")
  public ResponseVO getGs() {
    return ResponseVO.success(baseService.getSysParameter("gs", "0"));
  }
}
