package com.neusoft.smart.pos.gateway.task;

import com.neusoft.smart.pos.framework.utils.SpringUtils;
import com.neusoft.smart.pos.redis.bean.DeviceVersionList;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;

@Slf4j
public class DevicePostRequest2XKTask extends AbstractDevicePostRequestTask {
	
	private RedisTemplate redisTemplate = SpringUtils.getBean("redisTemplate", RedisTemplate.class);
	
	@Override
	public void executeTask() {
		BoundHashOperations<String, String, DeviceVersionList> deviceMap = redisTemplate.boundHashOps("deviceVersionsMap");
		DeviceVersionList versions = deviceMap.get(this.serialno);
		this.updateStatusAndCreateHistory(versions);
	}
}
