package com.engine.kq.cmd.importlog;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;

import java.util.HashMap;
import java.util.Map;

public class SaveImportLogStatusCmd extends AbstractCommonCommand<Map<String, Object>>{
	
	
	public SaveImportLogStatusCmd(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>();
		String sql = "";
		RecordSet rs = new RecordSet();
		try {
			String pId = Util.null2String(params.get("pId"));
			String status = Util.null2String(params.get("status"));
			sql = "	update hrmimporthistory set status ='"+status+"' where id="+pId;
			rs.executeSql(sql);
			
			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() {
		// TODO Auto-generated method stub
		return null;
	}
}
