|
|
@@ -8,9 +8,9 @@ import com.middle.platform.data.biz.pojo.ProductPara;
|
|
|
import com.middle.platform.data.biz.utils.TsUtil;
|
|
|
import com.middle.platform.manage.api.pojo.ProductVo;
|
|
|
import com.middle.platform.redis.constant.CacheConstant;
|
|
|
+import com.middle.platform.redis.service.CacheService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.*;
|
|
|
@@ -25,7 +25,7 @@ public class DataService {
|
|
|
@Resource
|
|
|
private TaosMapper taosMapper;
|
|
|
@Resource
|
|
|
- private RedisTemplate<String, Object> redisTemplate;
|
|
|
+ private CacheService cacheService;
|
|
|
|
|
|
/**
|
|
|
* 源数据处理
|
|
|
@@ -34,10 +34,10 @@ public class DataService {
|
|
|
* @param payload
|
|
|
*/
|
|
|
public void rawData(String msgId, ProductVo productVo, Object payload) {
|
|
|
- Object o = redisTemplate.opsForValue().get(String.format(CacheConstant.TD_ORG_CACHE, productVo.getCode(), productVo.getGuid()));
|
|
|
+ Object o = cacheService.getKey(String.format(CacheConstant.TD_ORG_CACHE, productVo.getCode(), productVo.getGuid()));
|
|
|
if (Objects.isNull(o)) {
|
|
|
taosMapper.createOriginalTable(productVo.getGuid(), productVo.getCode());
|
|
|
- redisTemplate.opsForValue().set(String.format(CacheConstant.TD_ORG_CACHE, productVo.getCode(), productVo.getGuid()), true);
|
|
|
+ cacheService.setKey(String.format(CacheConstant.TD_ORG_CACHE, productVo.getCode(), productVo.getGuid()), true);
|
|
|
}
|
|
|
OriginalPara originalPara = new OriginalPara();
|
|
|
originalPara.setCode(productVo.getCode());
|
|
|
@@ -58,10 +58,10 @@ public class DataService {
|
|
|
*/
|
|
|
public void analyzeData(String msgId, ProductVo productVo, Object modData) {
|
|
|
log.info("解析后的数据:{}", modData);
|
|
|
- Object o = redisTemplate.opsForValue().get(String.format(CacheConstant.TD_CACHE, productVo.getCode(), productVo.getGuid()));
|
|
|
+ Object o = cacheService.getKey(String.format(CacheConstant.TD_CACHE, productVo.getCode(), productVo.getGuid()));
|
|
|
if (Objects.isNull(o)) {
|
|
|
taosMapper.createDeviceTable(productVo.getGuid(), productVo.getCode());
|
|
|
- redisTemplate.opsForValue().set(String.format(CacheConstant.TD_CACHE, productVo.getCode(), productVo.getGuid()), true);
|
|
|
+ cacheService.setKey(String.format(CacheConstant.TD_CACHE, productVo.getCode(), productVo.getGuid()), true);
|
|
|
}
|
|
|
if (modData instanceof JSONObject jsonObject) {
|
|
|
List<ProductPara> list = new ArrayList<>();
|