package com.engine.kq.biz;

import com.engine.kq.log.KQLog;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;

public class KQFormatThread extends com.weaver.util.threadPool.entity.LocalRunnable {
  private String id;
  private String resourceid;
  private String kqdate;
  private KQLog kqLog = new KQLog();

  @Override
  public void execute() {
    RecordSet rs = new RecordSet();
    //更新已处理的记录
    String key = this.kqdate+ "|"+ this.resourceid;
    try {
      kqLog.info("执行KQFormatThread this.resourceid=="+this.resourceid+"this.kqdate=="+this.kqdate);
      KQFormatData kqFormatData = new KQFormatData();
      kqFormatData.formatKqDate(this.resourceid, this.kqdate);

      boolean isremove = KQFormatJob.kqformatIds.remove(key);
      if(isremove){
        rs.executeUpdate("update kq_format_pool set status=1 where id=?",this.id);
      }
    } catch (Exception e) {
      KQFormatJob.kqformatIds.remove(key);
      kqLog.info(e);
      writeLog(e);
    }
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getResourceid() {
    return resourceid;
  }

  public void setResourceid(String resourceid) {
    this.resourceid = resourceid;
  }

  public String getKqdate() {
    return kqdate;
  }

  public void setKqdate(String kqdate) {
    this.kqdate = kqdate;
  }
}
