package com.engine.kq.cmd.report;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.bean.RightMenu;
import com.engine.kq.bean.RightMenuType;
import weaver.general.Util;
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;

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

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

    @Override
    public Map<String, Object> execute(CommandContext commandContext) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        List<Object> rightMenuList = new ArrayList<Object>();//表示有权限可以看见的菜单List集合
        RightMenu rightMenu = null;

        rightMenu = new RightMenu(user.getLanguage(), RightMenuType.BTN_SHOW_NOACCOUNT, "showAll()", true);//不显示无账号人员
        rightMenuList.add(rightMenu);

        rightMenu = new RightMenu(user.getLanguage(), RightMenuType.BTN_SAVE_TEMPLETE, "saveTemplete()", true);//存为模板
        rightMenuList.add(rightMenu);

        rightMenu = new RightMenu(user.getLanguage(), RightMenuType.BTN_Export_Excel, "exportExcel()", true);//导出excel
        rightMenuList.add(rightMenu);

//        rightMenu = new RightMenu(user.getLanguage(), RightMenuType.BTN_SET_ORDER, "setOrder()", false);//设置默认排序
//        rightMenuList.add(rightMenu);

        if (HrmUserVarify.checkUserRight("KQReport:Format", user)) {
            rightMenu = new RightMenu(user.getLanguage(), RightMenuType.BTN_KQ_REPORT_FORMAT, "reportFormat", false);
            rightMenuList.add(rightMenu);
        }

        resultMap.put("btnMenu", rightMenuList);
        return resultMap;
    }

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

}
