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 IndexService {

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

  /**
   * @Author Sum1Dream
   * @methodName getHLTBalance
   * @Description // 查询余额
   * @Date 12:11 下午 2022/1/10
   * @Param [paramsObject: object, callBack]
   */
  public getHLTBalance(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'common/getHLTBalance?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  // 运营角色查询统计
  public getIndexCount(callBack) {
    this.http.get(environment.baseUrl + 'common/getIndexCount').subscribe(data => {
      callBack(data);
    });
  }

  // 运营角色查询折线图数据
  public getLineCount(callBack) {
    this.http.get(environment.baseUrl + 'common/getLineCount').subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName addHLTBalance
   * @Description // 新增余额
   * @Date 12:12 下午 2022/1/10
   * @Param
   */
  public addHLTBalance(params: object, callBack) {
    this.http.post(environment.baseUrl + 'common/addHLTBalance', params).subscribe(data => {
      callBack(data);
    });
  }

    /**
     * @Author Sum1Dream
     * @methodName addHLTBalance
     * @Description // 新增余额
     * @Date 12:12 下午 2022/1/10
     * @Param
     */
    public recharge(params: object, callBack) {
        this.http.post(environment.baseUrl + 'merStoreAccount/recharge', params).subscribe(data => {
            callBack(data);
        });
    }

    /**
     * @Author Sum1Dream
     * @methodName addHLTBalance
     * @Description // 新增余额
     * @Date 12:12 下午 2022/1/10
     * @Param
     */
    public getGasSelfBuiltStationList(params: object, callBack) {
        this.http.get(environment.baseUrl + 'highGas/getGasSelfBuiltStationList?' + this.common.getWhereCondition(params)).subscribe(data => {
            callBack(data);
        });
    }

  /**
   * @Author Sum1Dream
   * @methodName addHLTBalance
   * @Description // 新增余额
   * @Date 12:12 下午 2022/1/10
   * @Param
   */
  public setAmountsEarlyWarning(params: object, callBack) {
    this.http.post(environment.baseUrl + 'merStoreAccount/setAmountsEarlyWarning', params).subscribe(data => {
      callBack(data);
    });
  }

    /**
     * @Author Sum1Dream
     * @methodName queryCompanyAccountInfo2JD
     * @Description // 查询团油余额
     * @Date 12:12 下午 2022/1/10
     * @Param
     */
    public queryCompanyAccountInfo2JD(callBack) {
        this.http.get(environment.baseUrl + 'common/queryCompanyAccountInfo2JD').subscribe(data => {
            callBack(data);
        });
    }

  /**
   * @Author Sum1Dream
   * @methodName orderByIndex
   * @Description // 订单查询
   * @Date 4:39 下午 2022/1/10
   * @Param [code: number, callBack]
   */
  public orderByIndex(code: number, callBack) {
    this.http.get(environment.baseUrl + 'highOrder/orderByIndex?code=' + code).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName HLTOrderByIndex
   * @Description //查询汇联通订单
   * @Date 4:42 下午 2022/1/10
   * @Param [code: number, callBack]
   */
  public HLTOrderByIndex(code: number, callBack) {
    this.http.get(environment.baseUrl + 'highOrder/HLTOrderByIndex?code=' + code).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName rechargeOrderByIndex
   * @Description //TODO
   * @Date 4:44 下午 2022/1/10
   * @Param  [code: number, callBack]
   */
  public rechargeOrderByIndex(code: number, callBack) {
    this.http.get(environment.baseUrl + 'outRechargeOrder/rechargeOrderByIndex?code=' + code).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName HLTOrderByList
   * @Description // 查询列表
   * @Date 5:34 下午 2022/1/10
   * @Param
   */
  public HLTOrderByList(code: number, callBack) {
    this.http.get(environment.baseUrl + 'highOrder/HLTOrderByList?code=' + code).subscribe(data => {
      callBack(data);
    });
  }

  public exportHLTOrderByList(code: number, callBack) {
    this.http.get(environment.baseUrl + 'highOrder/exportHLTOrderByList?code=' + code).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName getAccount
   * @Description // 查询门店账户
   * @Date 10:00 2022/5/18
   * @Param
   */

  public getAccount(callBack) {
      this.http.get(environment.baseUrl + 'merStoreAccount/getAccount').subscribe(data => {
          callBack(data);
      });
  }

    /**
     * @Author Sum1Dream
     * @methodName getGasStatistical
     * @Description // 查询加油站统计
     * @Date 10:00 2022/5/18
     * @Param
     */
    public getGasStatistical(callBack) {
        this.http.post(environment.baseUrl + 'highGas/getGasStatistical', null).subscribe(data => {
            callBack(data);
        });
    }

  /**
   * @Author Sum1Dream
   * @methodName getGasStatistical
   * @Description // 查询加油站统计
   * @Date 10:00 2022/5/18
   * @Param
   */
  public getMerGasStatistical(callBack) {
    this.http.post(environment.baseUrl + 'highGas/getMerGasStatistical', null).subscribe(data => {
      callBack(data);
    });
  }

    /**
     * @Author Sum1Dream
     * @methodName getAccountRecordList
     * @Description // 查询门店账户流失记录
     * @Date 10:00 2022/5/18
     * @Param
     */

    public getAccountRecordList(paramsObject , callBack) {
        this.http.get(environment.baseUrl + 'merStoreAccount/getAccountRecordList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
            callBack(data);
        });
    }



}
