大数据段优化

main
张平 2023-11-30 16:25:53 +08:00
parent f310a63c7d
commit e6dee5bf27
2 changed files with 21 additions and 15 deletions

View File

@ -63,7 +63,7 @@ public class Cn2011 implements Reply {
realTimeData.setF_turbidity(v); realTimeData.setF_turbidity(v);
else if(ckey.equals("DataTime")) else if(ckey.equals("DataTime"))
realTimeData.setF_time(v); realTimeData.setF_time(v);
else if(ckey.equals("f_raw_data")) else if(ckey.equals("rawData"))
realTimeData.setF_raw_data(v); realTimeData.setF_raw_data(v);
} }
BaseResult result=realTimeDataService.insert(realTimeData); BaseResult result=realTimeDataService.insert(realTimeData);

View File

@ -80,23 +80,29 @@ public class AnalysisUtil {
String[] cpArry = s.split(";"); String[] cpArry = s.split(";");
for (String ss:cpArry){ for (String ss:cpArry){
//以逗号分隔 //以逗号分隔
String[] c = ss.split(","); if(!ss.startsWith("rawData")){
for (String s1:c){ String[] c = ss.split(",");
//此处已经是单值 xxx=xxx for (String s1:c){
String[] split = s1.split("="); //此处已经是单值 xxx=xxx
String key=""; String[] split = s1.split("=");
String value=""; String key="";
key=split[0]; String value="";
if (split.length==2){ key=split[0];
//不是key=value的格式 if (split.length==2){
//不是key=value的格式
// throw new AnalysisException(2701,"解析报文出错报文cp段的值不是key=value形式"); // throw new AnalysisException(2701,"解析报文出错报文cp段的值不是key=value形式");
value=split[1]; value=split[1];
}
//特殊处理 ##1234QN=20180210154956000
if(key.endsWith("QN")&&!"QN".equals(key.split("QN")[0]))
key="QN";
resultMap.put(key,value);
} }
//特殊处理 ##1234QN=20180210154956000 }else {
if(key.endsWith("QN")&&!"QN".equals(key.split("QN")[0])) String[] split = ss.split("=");
key="QN"; resultMap.put(split[0],split[1]);
resultMap.put(key,value);
} }
} }
return resultMap; return resultMap;
} }