package com.engine.kq.cmd.report4E;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQBalanceOfLeaveBiz;
import com.engine.kq.biz.KQLeaveRulesBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.log.KQLog;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

/**
 * 小e 我的假期情况
 */
public class GetBalanceInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
  private KQLog kqLog = new KQLog();
  private HttpServletRequest request;

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

	@Override
	public Map<String, Object> execute(CommandContext commandContext) {
		Map<String, Object> retmap = new HashMap<String, Object>();
		try{
      String resourceId = Util.null2String(params.get("resourceId"));
      User curUser = new User(Util.getIntValue(resourceId));
      List<Object> datas = KQBalanceOfLeaveBiz.getBalanceInfo(resourceId,curUser.getLanguage());
      kqLog.info("GetBalanceInfoCmd:params:"+params+":datas:"+datas);
      retmap.put("balanceinfo", datas);
      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;
	}

}
