package org.ts.ddcs.DataSaveProcesser;


import org.ts.ddcs.DataTemplate.DataTemplateInterface;
import org.ts.ddcs.Entity.CommandEntity;
import org.ts.ddcs.Log.LogHelper;
import org.ts.ddcs.Tool.BytesHelp;
import org.ts.ddcs.Worker.DataProcess;
import org.ts.ddcs.Worker.DataProcessHolder;
import org.ts.ddcs.utils.GBConstants;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.concurrent.LinkedBlockingQueue;

@SuppressWarnings("all")
public class DataSaveProcesserSzyC87 extends DataSaveProcesser {
    @Override
    public void Save(DataTemplateInterface dataTemplateInterface) {
        super.Save(dataTemplateInterface);
        String rtucode = BytesHelp.byte2HexStr(dataTemplateInterface.RtuCode());
        LogHelper.info("SAVE:" + rtucode +" "+dataTemplateInterface.GetFeture());
        LogHelper.info(dataTemplateInterface.getDataInfo());

        RedisTemplate redisTemplate = DataProcessHolder.newInstance().dataProcess.redisTemplate;
        HashOperations<String, String, String> opsHash = redisTemplate.opsForHash();

        String settingInfo  = BytesHelp.byte2HexStr(dataTemplateInterface.GetContent());

        opsHash.put(rtucode, GBConstants.BASE_KEY_SETTING,settingInfo);


        //DataProcess.CommandComplete(rtucode);

       // DataProcessHolder.newInstance().dataProcess.SubmitRelayManageTask(dataTemplateInterface);

       // DataProcess.DownloadNotify(rtucode);

    }
}
