package com.engine.kq.cmd.balanceofleaverp;

import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
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 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 GetChangeTypeCmd extends AbstractCommonCommand<Map<String, Object>> {

    public GetChangeTypeCmd(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>();

        List<Map<String, Object>> groupList = new ArrayList<Map<String, Object>>();
        Map<String, Object> groupItem = new HashMap<String, Object>();
        List<Object> itemList = new ArrayList<Object>();
        HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
        SearchConditionItem searchConditionItem = null;
        HrmFieldBean hrmFieldBean = null;

        hrmFieldBean = new HrmFieldBean();
        hrmFieldBean.setFieldname("changeType");//类型
        hrmFieldBean.setFieldlabel("63");
        hrmFieldBean.setFieldhtmltype("5");
        hrmFieldBean.setType("1");
        searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
        List<SearchConditionOption> optionsList = new ArrayList<SearchConditionOption>();
        optionsList.add(new SearchConditionOption("All", SystemEnv.getHtmlLabelName(82857, user.getLanguage()),true));
        optionsList.add(new SearchConditionOption("Reduce", SystemEnv.getHtmlLabelName(390300, user.getLanguage())));
        optionsList.add(new SearchConditionOption("Add", SystemEnv.getHtmlLabelName(390301, user.getLanguage())));
        searchConditionItem.setOptions(optionsList);
        itemList.add(searchConditionItem);

        groupItem.put("items", itemList);
        groupList.add(groupItem);
        resultMap.put("condition", groupList);
        return resultMap;
    }
}
