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

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

  /**
   * 查询汇总
   * @param paramObject
   * @param callBack
   */
  queryChecking(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrder/queryChecking?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询汇总明细
   * @param paramObject
   * @param callBack
   */
  queryCheckingDetail(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrder/queryCheckingDetail?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 导出交易结算汇总
   * @param paramObject
   * @param callBack
   */
  exportChecking(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrder/exportChecking?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 导出汇总明细
   * @param paramObject
   * @param callBack
   */
  exportCheckingDetail(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrder/exportCheckingDetail?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }
}
