import { Injectable } from '@angular/core';
import {HttpClient} from  '@angular/common/http';
import {CommonsService} from '../commons.service';
import {environment} from '../../../environments/environment';

@Injectable({
  providedIn: 'root'
})
export class OilPriceOfficialService {

  constructor(
      private http: HttpClient,
      private common: CommonsService
  ) { }


  /**
   * 修改油品国标价价格
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public updateOilPriceOfficial(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'gasOilPriceOfficial/updateOilPriceOfficial', paramsObject).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询油品国标价列表
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public getOilPriceOfficialList(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'gasOilPriceOfficial/getOilPriceOfficialList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询油品国标价详情
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public getOilPriceOfficialDetail(regionId: number, oilNo: number, callBack) {
    this.http.get(environment.baseUrl + 'gasOilPriceOfficial/getOilPriceOfficialDetail?regionId=' + regionId + '&oilNo=' + oilNo).subscribe(data => {
      callBack(data);
    });
  }

}
