package com.muchinfo.mtp3common.vo;

import com.muchinfo.mtp3common.utils.SerialNumberUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author liu.bingbing
 * @Title: Calculator
 * @Company: 多元世纪
 * @date 2018年2月26日 下午3:45:29
 * @Description:
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class Calculator extends Thread {

	public Object obj = null;
	public Long uuid;
	public int funccode = 0;
	private Long outTime = 10000l;

	public Calculator() {
	}

	public Calculator(Long uuid) {
		this.uuid = uuid;
	}

	public Calculator(Long uuid, Long outTime) {
		this.uuid = uuid;
		this.outTime = outTime;
	}

	/**
	 * 当调用接口后，服务与账户服务有交互，则账户服务会反回UUID相同的"FunCode_Trade_AccountCommandRsp"回应
	 * 此时须使用此构造函数，缓存funccode, 用于MoneyQueueListener的FunCode_Trade_AccountCommandRsp监听处处理；
	 *
	 * @param uuid
	 * @param funccode
	 */
	public Calculator(Long uuid, int funccode) {
		this.uuid = uuid;
		this.funccode = funccode;
	}

	@Override
	public void run() {
		obj = SerialNumberUtils.getMessageMap(uuid);
		if (obj instanceof Integer) {
			obj = null;
		}
		SerialNumberUtils.removeMessageMap(uuid);
	}

}
