package cn.wise.sc.energy.power.plant.business.task;

import cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo;
import cn.wise.sc.energy.power.plant.business.service.ICharacterParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author neo.shu
 * @since 2020/9/17 17:36
 */

@Service
public class TaskCacheDataService {

    @Autowired
    ICharacterParamService iCharacterParamService;

    @Cacheable(value = "hydroge-character", key = "#deviceId")
    public List<CharacterParamInfoVo> cacheHydrogeCha(String deviceId) {
        List<String> characterNames = new ArrayList<>();
        characterNames.add("机内氢压");
        characterNames.add("机内氢气湿度");
        characterNames.add("在线漏氢");
        characterNames.add("运行中H2纯度");
        List<CharacterParamInfoVo> characterParamInfoVos =
                iCharacterParamService.getCharacterByName(characterNames, "", deviceId);
        return characterParamInfoVos;
    }

    @Cacheable(value = "oil-character", key = "#deviceId")
    public List<CharacterParamInfoVo> cacheOilCPI(String deviceId) {
        List<String> characterNames = new ArrayList<>();

        //左上角
        characterNames.add("油氢压差");
        characterNames.add("空侧过滤器压降");
        characterNames.add("氢侧过滤器压降");
      /*
        characterNames.add("空侧交流密封油泵进出口压差");
        characterNames.add("空侧直流密封油泵进出口压差");
        characterNames.add("氢侧交流油泵进出口压差");
        characterNames.add("氢侧直流油泵进出口压差");*/

        //左下角
        characterNames.add("励端排油温度");
        characterNames.add("汽端排油温度");
        characterNames.add("集电环排油温度");
        characterNames.add("空冷出口温度");
        characterNames.add("氢冷出口温度");

        //右上角
        characterNames.add("空侧油泵出口压力");
        characterNames.add("氢侧油泵出口压力");

        //右下
        characterNames.add("密封油贮油箱液位");
        characterNames.add("氢侧油箱液位");
        characterNames.add("空侧过滤器压降");
        characterNames.add("氢侧密封油过滤器压降");
        characterNames.add("空侧交流密封油泵进出口压差");
        characterNames.add("氢侧交流油泵进出口压差");


        List<CharacterParamInfoVo> characterParamInfoVos =
                iCharacterParamService.getCharacterByName(characterNames, "", deviceId);
        return characterParamInfoVos;
    }

    @Cacheable(value = "index-character")
    public List<CharacterParamInfoVo> cacheIndexCPI() {
        List<String> characterNames = new ArrayList<>();
        //右上
        characterNames.add("定子A相电流");
        characterNames.add("定子B相电流");
        characterNames.add("定子C相电流");
        characterNames.add("定子CA线电压");
        characterNames.add("定子AB线电压");
        characterNames.add("定子CB线电压");
        //右中
        //characterNames.add("汽端座振X");
        characterNames.add("汽端轴振X");
        characterNames.add("汽端轴振Y");
        //characterNames.add("励端座振X");
        characterNames.add("励端轴振X");
        characterNames.add("励端轴振Y");
        //右下
        characterNames.add("汽端轴瓦温度1");
        characterNames.add("励端轴瓦温度1");
        characterNames.add("集电环轴瓦温度1");
        //左下
        characterNames.add("层间温度");
        characterNames.add("上层线圈出水温度");
        characterNames.add("下层线圈出水温度");
        //中间
        characterNames.add("转速1");
        characterNames.add("有功功率");
        List<CharacterParamInfoVo> characterParamInfoVos =
                iCharacterParamService.getCharacterByName(characterNames, "", "");
        return characterParamInfoVos;
    }

    @Cacheable(value = "water-character", key = "#deviceId")
    public List<CharacterParamInfoVo> cacheWaterCPI(String deviceId) {
        List<String> characterNames = new ArrayList<>();

        //左下 小时
        characterNames.add("定子冷却水流量");
        //characterNames.add("定子冷却水流量");

        //左上
        characterNames.add("定子线圈进出水压差1");
        characterNames.add("定子冷却水进出口差压1");
        characterNames.add("定子补水进出口水差压1");
        //右上
        characterNames.add("冷却水泵A出口压力1");
        characterNames.add("冷却水泵B出口压力1");
        //右下
        characterNames.add("水箱液位高");
        characterNames.add("水箱液位低");
        characterNames.add("氢水压差低");
        characterNames.add("定子水箱压力");

        List<CharacterParamInfoVo> characterParamInfoVos =
                iCharacterParamService.getCharacterByName(characterNames, "", deviceId);
        return characterParamInfoVos;
    }


}
