var system = require("../../../system")
const CtlBase = require("../../ctlms.base");

class SaasnvoiceCtl extends CtlBase {
  constructor() {
    super();
    this.saasmerchantSve = system.getObject("service.merchant.saasmerchantSve");
  }

  /**
   * 发票信息管理
   * @param {*} pobj2 
   * @param {*} pobj2 
   * @param {*} req 
   */
  async merchantTitleAddrPage (pobj1, pobj2, req){
    try {
      return this.saasmerchantSve.merchantTitleAddrPage(pobj1);
    } catch (error) {
      console.log(error);
      return system.getResult(null, `系统错误`);
    }
  }

  /**
   * 发票信息修改 
   * @param {*} pobj2 
   * @param {*} pobj2 
   * @param {*} req 
   */
  async updateMerchantTitleAndAddr(pobj1, pobj2, req){
    try {
      if(!pobj1.id){
        return system.getResult(null,`参数错误 ID 不能为空`);
      }
      return this.saasmerchantSve.updateMerchantTitleAndAddr(pobj1);
    } catch (error) {
      console.log(error);
      return system.getResult(null, `系统错误`);
    }
  }

  /**
   * query invoice title&addr information
   * @param {*} pobj1 
   * @param {*} pobj2 
   * @param {*} req 
   */
  async queryInvoiceTitleAndAddr(pobj1, pobj2, req){
    try {
      return this.saasmerchantSve.queryInvoiceTitleAndAddr(pobj1);
    } catch (error) {
      console.log(error);
      return system.getResult(null, `系统错误`);
    }
  }

  /**
   * query invoice title&addr information
   * @param {*} pobj1 
   * @param {*} pobj2 
   * @param {*} req 
   */
  async updateOrSaveTitleAndAddr(pobj1, pobj2, req){
    try {
      return this.saasmerchantSve.updateOrSaveTitleAndAddr(pobj1);
    } catch (error) {
      console.log(error);
      return system.getResult(null, `系统错误`);
    }
  }
  


}

module.exports = SaasnvoiceCtl;