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.oplogCtl");
var xlsx = require('node-xlsx');
var fs = require("fs");
class TrademarktransactionneedCtl extends CtlBase {
  constructor() {
    super(CtlBase.getServiceName(TrademarktransactionneedCtl));
    this.uploadCtl = system.getObject("web.uploadCtl");
  }
  async findAndCountAll(queryobj, obj, req) {
    obj.codepath = req.codepath;
    if (req.session.user) {
      obj.uid = req.session.user.id;
      obj.company_id = req.session.user.company_id;
    }
    if (req.codepath.indexOf("pmg") < 0 && req.companyid && req.companyid != "" && obj.search) {
      if(obj.company_id){
        obj.search.company_id = obj.company_id;
      }
    }
    var apps = await this.service.findAndCountAll(obj);
    return system.getResult2(apps, null);
  }

  async submitNeed(pobj,obj,req){
    try {
      return this.service.submitNeed(obj);
    } catch (error) {
      return {code:-1,msg:"操作失败"};
    }
  }
}
module.exports = TrademarktransactionneedCtl;
// var task = new TrademarktransactionCtl();
// task.excelCreate(null,{srckey:"25FftSH0MWN5_1552992588799.xlsx"},null).then(d=>{
//   console.log("ddddddddddddddddddddddddddddddddddddd");
//   console.log(d);
// })
