package com.engine.kq.cmd.grouplocation;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.cmd.group.GetGroupFormCmd;
import java.util.HashMap;
import java.util.Map;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

public class GetGroupLocationListCmd extends AbstractCommonCommand<Map<String, Object>> {

	public GetGroupLocationListCmd(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>();
		RecordSet rs = new RecordSet();
		String sql = "";
		try{			
			//必要的权限判断
      if(!HrmUserVarify.checkUserRight("HrmKQGroup:Add",user)) {
        retmap.put("status", "-1");
        retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
        return retmap;
      }
      String locationname = Util.null2String(params.get("locationname"));

      GetGroupFormCmd getGroupFormCmd = new GetGroupFormCmd(params, user);
			//主要用于 显示定制列以及 表格 每页展示记录数选择
			String sessionkey = getGroupFormCmd.getKQLocationList(locationname);
			retmap.put("sessionkey", sessionkey);
			retmap.put("status", "1");
		}catch (Exception e) {
			retmap.put("status", "-1");
			retmap.put("message",  SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
			writeLog(e);
		}
		return retmap;
	}

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

}
