package com.engine.kq.wfset.util;

import com.engine.kq.log.KQLog;
import com.engine.portal.biz.nonstandardfunction.SysModuleInfoBiz;
import weaver.conn.RecordSet;

/**
 * 考勤非标包工具类
 */
public class KQ122Util {
  private KQLog kqLog = new KQLog();

  /**
   * 判断非标122是否开启
   * @return true 表示开启
   */
  public boolean is122Open(){
    RecordSet rs = new RecordSet();
    //checkNonstandardStatus这个方法查询很慢
    boolean hasOpened_122 = false;
    String getsql= "select * from kq_settings where main_key='kq122' ";
    rs.executeQuery(getsql);
    if(rs.next()){
      String main_val = rs.getString("main_val");
      if("1".equalsIgnoreCase(main_val)){
        hasOpened_122 = true;
      }
    }
    //122考勤只要是开启过就默认是新考勤了
    if(hasOpened_122){
      return true;
    }
    //后端考勤按钮启用表示开启了122非标
    boolean isOpen122 = SysModuleInfoBiz.checkNonstandardStatus("122");
    if(isOpen122){
      String up_122Sql = "update kq_settings set main_val='1' where main_key='kq122' ";
      rs.executeUpdate(up_122Sql);
    }

   // kqLog.info("SysModuleInfoBiz.checkMenuStatus:isOpen122::"+isOpen122);
    return isOpen122;
  }

}
