package com.ld.igds.th.impl; import com.ld.igds.common.dto.THDto; import com.ld.igds.constant.RedisConst; import com.ld.igds.th.CoreThService; import com.ld.igds.util.RedisUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service(CoreThService.BEAN_ID) public class CoreThServiceImpl implements CoreThService { @Autowired private RedisUtil redisUtil; @Override public void setCacheTH(THDto data) { if (null == data.getThConf()) { data.setThConf("1"); } String tempKey = data.getSerId() + "_" + data.getThConf(); String key = RedisConst.buildKey(data.getCompanyId(), RedisConst.KEY_T_TH, tempKey); redisUtil.set(key, data, 3 * 60 * 60); } @Override public THDto getCacheTH(String companyId, String thSerId, String thConf) { if (null == thConf) thConf = "1"; String tempKey = thSerId + "_" + thConf; String key = RedisConst.buildKey(companyId, RedisConst.KEY_T_TH, tempKey); return (THDto) redisUtil.get(key); } }