package com.engine.kq.cmd.setupwizard;

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;

/**
 *
 */
public class GetSetupStepsCmd extends AbstractCommonCommand<Map<String, Object>> {

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

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

    @Override
    public Map<String, Object> execute(CommandContext commandContext) {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        boolean canInit = HrmUserVarify.checkUserRight("KQ:SetupWizard", user);//是否具有初始化的权限
        if (!canInit) {
            resultMap.put("status", "-1");
            resultMap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));//没有权限
            return resultMap;
        }
        List<Map<String,Object>> stepList = new ArrayList<Map<String,Object>>();
        Map<String,Object> stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(24803, user.getLanguage()));
        stepList.add(stepMap);//初始化班次

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(390221, user.getLanguage()));
        stepList.add(stepMap);//初始化考勤组

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(500272, user.getLanguage()));
        stepList.add(stepMap);//初始化考勤流程

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(28386, user.getLanguage()));
        stepList.add(stepMap);//初始化节假日

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(388881, user.getLanguage()));
        stepList.add(stepMap);//初始化加班规则

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(390004, user.getLanguage()));
        stepList.add(stepMap);//初始出差公出规则

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(388996, user.getLanguage()));
        stepList.add(stepMap);//初始化假期规则

        stepMap = new HashMap<String,Object>();
        stepMap.put("title",SystemEnv.getHtmlLabelName(390297, user.getLanguage()));
        stepList.add(stepMap);//初始化假期余额

        resultMap.put("items", stepList);
        return resultMap;
    }
}
