const TaskBase = require("../../task.base");
const system = require("../../../system");
var settings = require("../../../../config/settings");
class ZcbusinessTask extends TaskBase {
  constructor() {
    super(TaskBase.getServiceName(ZcbusinessTask));
    this.restclient = system.getObject("util.restClient");
    this.centerOrderUrl = settings.centerOrderUrl();
  }
  async beforeTask(params) {
    console.log("前置操作......", this.serviceName);
    //this.isThrough=true; 
    //console.log(this.cacheManager);
  }
  async subDoTask() {
    console.log("--------------");
    console.log("TestTask1.....");
    var obj = {
      "actionType": "taskpolicyneed2fq",
      "actionBody": {
        "limit": 100 //推送数据条数 默认100条
      }
    }
    try {
      var url = this.centerOrderUrl + "action/policy/springBoard";
      var zcinfo = await this.restclient.execPost(obj, url);
      console.log(zcinfo);
      var result = JSON.parse(zcinfo.stdout);
      console.log(result);
      return result;
    } catch (error) {
      console.log(error);
      return null;
    }
  }
}
module.exports = ZcbusinessTask;