package com.engine.kq.cmd.group;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 获取考勤组管理tab页签
 * @author pzy
 *
 */
public class GetMainTabsCmd extends AbstractCommonCommand<Map<String, Object>>{

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

	@Override
	public Map<String, Object> execute(CommandContext commandContext) {
		Map<String,Object> retmap = new HashMap<String,Object>();
		try {
			if(!HrmUserVarify.checkUserRight("HrmKQGroup:Add",user)) {
				retmap.put("status", "-1");
				retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
				return retmap;
			}

			List<Map<String,Object>> tabs = new ArrayList<Map<String,Object>>();
			Map<String,Object> tab = null;

			tab = new HashMap<String, Object>();
			tab.put("key", "1");
			tab.put("title", SystemEnv.getHtmlLabelName(390221,user.getLanguage()));
			tabs.add(tab);
			
			tab = new HashMap<String, Object>();
			tab.put("key", "2");
			tab.put("title", SystemEnv.getHtmlLabelName(515128,user.getLanguage()));
			tabs.add(tab);

			retmap.put("status", "1");
			retmap.put("tabs", tabs);
		} catch (Exception e) {
			writeLog(e);
			retmap.put("status", "-1");
			retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
		}
		return retmap;
	}

	@Override
	public BizLogContext getLogContext() {
		return null;
	}

}
