package com.engine.kq.cmd.shiftmanagement;

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.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

/**
 * 获取班次管理查询条件条件
 * @author pzy
 *
 */
public class GetShiftManagementSearchConditionCmd extends AbstractCommonCommand<Map<String, Object>>{

	public GetShiftManagementSearchConditionCmd(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>();
    List<Map<String,Object>> grouplist = new ArrayList<Map<String,Object>>();
    Map<String,Object> groupitem = null;
    List<Object> itemlist = null;
    if(!HrmUserVarify.checkUserRight("KQClass:Management",user)) {
      retmap.put("status", "-1");
      retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
      return retmap;
    }
    try{

      HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
      SearchConditionItem searchConditionItem = null;
      HrmFieldBean hrmFieldBean = null;
      itemlist = new ArrayList<Object>();
      hrmFieldBean = new HrmFieldBean();
      hrmFieldBean.setFieldname("serial");
      hrmFieldBean.setFieldlabel("125818");
      hrmFieldBean.setFieldhtmltype("1");
      hrmFieldBean.setType("1");
      hrmFieldBean.setIsQuickSearch(true);
      searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
      searchConditionItem.setViewAttr(2);
      itemlist.add(searchConditionItem);
      retmap.put("status", "1");
      retmap.put("conditions", itemlist);
    }catch (Exception e) {
      retmap.put("status", "-1");
      retmap.put("message",  SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
      writeLog(e);
    }
    return retmap;
	}

}
