|
@@ -1,6 +1,7 @@
|
|
|
package com.hb.proj.gather.business;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -11,6 +12,7 @@ import com.hb.proj.gather.model.SingleCombPO;
|
|
|
import com.hb.proj.gather.model.SingleInsertPO;
|
|
|
import com.hb.proj.gather.model.WellParamVO;
|
|
|
import com.hb.proj.gather.rep.GatherDataRepService;
|
|
|
+import com.hb.proj.gather.rep.RedisRepComponent;
|
|
|
import com.hb.xframework.util.ApplicationContextUtils;
|
|
|
|
|
|
/**
|
|
@@ -42,7 +44,7 @@ public class DataTransRepSingleTask implements Runnable{
|
|
|
logger.info("未找到参数配置{}_{}",singleCombPO.getDevSerial(),pcode);
|
|
|
continue;
|
|
|
}
|
|
|
- insPOItm=new SingleInsertPO(paramConfig.getParamId(),gatherDatas.get(pcode),singleCombPO.getGatherTime());
|
|
|
+ insPOItm=new SingleInsertPO(pcode,paramConfig.getParamId(),gatherDatas.get(pcode),singleCombPO.getGatherTime());
|
|
|
DataTransUtils.transSingle(insPOItm, paramConfig);
|
|
|
insPOs.add(insPOItm);
|
|
|
|
|
@@ -50,9 +52,22 @@ public class DataTransRepSingleTask implements Runnable{
|
|
|
|
|
|
logger.info("单值数据转换完:{}",insPOs.size());
|
|
|
|
|
|
+ RedisRepComponent repRedis=ApplicationContextUtils.getBean("redisRepComponent", RedisRepComponent.class);
|
|
|
+
|
|
|
+ repRedis.put(paramConfig.getWellId(), buildRedisDatas(insPOs));
|
|
|
+
|
|
|
GatherDataRepService repService=ApplicationContextUtils.getBean("gatherDataRepService", GatherDataRepService.class);
|
|
|
|
|
|
repService.save(insPOs); //入库
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private Map<String,String> buildRedisDatas(List<SingleInsertPO> insPOs) {
|
|
|
+ Map<String,String> rtn=new HashMap<>(insPOs.size());
|
|
|
+ for(SingleInsertPO po : insPOs) {
|
|
|
+ rtn.put(po.getParamCode(), String.valueOf(po.getDataVal()));
|
|
|
+ }
|
|
|
+ return rtn;
|
|
|
+ }
|
|
|
|
|
|
}
|