var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const logCtl = system.getObject("web.common.oplogCtl");
const md5 = require("MD5");
const uuidv4 = require('uuid/v4');
const crypto = require('crypto');

var cacheBaseComp = null;
class TcompanytaxCtl extends CtlBase {
  constructor() {
    super("tax", CtlBase.getServiceName(TcompanytaxCtl));
    this.redisClient = system.getObject("util.redisClient");
  }

  async taxPage(pobj, pobj2, req, res) {
    let loginInfo = req.loginUser || {};
    let month = this.trim(pobj.month);
    if(month) {
      month = Number(month.replace("-", ""));
    }
    let condition = {
      currentPage: pobj.currentPage,
      pageSize: pobj.pageSize,
      month: month || 0,
      companyId: loginInfo.user.companyId,
    }

    try {
      var page = await this.service.pageByCondition(condition);
      return system.getResultSuccess(page);
    } catch (error) {
      console.log(error);
      return system.getResult(-1, `服务异常`);
    }
  }
}
module.exports = TcompanytaxCtl;