package com.engine.kq.cmd.upgrade;

import com.api.browser.bean.SearchConditionItem;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

/**
 * 考勤报表数据升级 准备
 * @author pzy
 *
 */
public class GetUpgrade12Cmd extends AbstractCommonCommand<Map<String, Object>>{

	public GetUpgrade12Cmd(Map<String, Object> params, User user) {
		this.user = user;
		this.params = params;
	}

	@Override
	public BizLogContext getLogContext() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> execute(CommandContext commandContext) {
    Map<String,Object> retmap = new HashMap<String,Object>();
    String type = Util.null2String((String)params.get("type"));
    RecordSet rs = new RecordSet();
    String signSetCnt  = "0";
    List<Object> itemList = new ArrayList<Object>();
    KQUpgradeTabEnum kqUpgradeTabEnum = KQUpgradeTabEnum.Upgrade12;
    try {
      if(type.equalsIgnoreCase(kqUpgradeTabEnum.getTabtype())){
      }
      HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
      SearchConditionItem searchConditionItem = null;
      HrmFieldBean hrmFieldBean = null;

      hrmFieldBean = new HrmFieldBean();
      hrmFieldBean.setFieldname("startdate");
      hrmFieldBean.setFieldlabel("740");
      hrmFieldBean.setFieldhtmltype("3");
      hrmFieldBean.setType("2");
      hrmFieldBean.setIsFormField(true);
      hrmFieldBean.setViewAttr(3);
      hrmFieldBean.setRules("required|string");
      searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
      itemList.add(searchConditionItem);

      hrmFieldBean = new HrmFieldBean();
      hrmFieldBean.setFieldname("enddate");
      hrmFieldBean.setFieldlabel("740");
      hrmFieldBean.setFieldhtmltype("3");
      hrmFieldBean.setType("2");
      hrmFieldBean.setIsFormField(true);
      hrmFieldBean.setViewAttr(3);
      hrmFieldBean.setRules("required|string");
      searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
      itemList.add(searchConditionItem);
    } catch (Exception e) {
      writeLog(e);
    }
//    retmap.put("count", UpgradeUtil.formatMsg(kqUpgradeTabEnum, user.getLanguage(), signSetCnt) );
//    retmap.put("title", SystemEnv.getHtmlLabelName(kqUpgradeTabEnum.getTablabel(), user.getLanguage())+SystemEnv.getHtmlLabelName(17530, user.getLanguage()));
    retmap.put("itemList", itemList);
    retmap.put("status", "1");
    retmap.put("title", SystemEnv.getHtmlLabelName(17530,user.getLanguage()));

    return retmap;
	}

}
