修改Storm初始化执行逻辑
This commit is contained in:
@@ -3,7 +3,7 @@ package com.zdjizhi.bolt;
|
||||
import cn.hutool.log.Log;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
import com.zdjizhi.utils.general.TransFormTypeMap;
|
||||
import com.zdjizhi.utils.general.TransFormMap;
|
||||
import org.apache.storm.task.TopologyContext;
|
||||
import org.apache.storm.topology.BasicOutputCollector;
|
||||
import org.apache.storm.topology.OutputFieldsDeclarer;
|
||||
@@ -32,7 +32,7 @@ public class CompletionMapBolt extends BaseBasicBolt {
|
||||
try {
|
||||
String message = tuple.getString(0);
|
||||
if (StringUtil.isNotBlank(message)) {
|
||||
basicOutputCollector.emit(new Values(TransFormTypeMap.dealCommonMessage(message)));
|
||||
basicOutputCollector.emit(new Values(TransFormMap.dealCommonMessage(message)));
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("处理原始日志下发过程异常,异常信息:" + e);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TransFormMap {
|
||||
String param = strings[3];
|
||||
functionSet(function, jsonMap, appendToKeyName, appendTo, name, param);
|
||||
}
|
||||
return JSONObject.toJSONString(jsonMap);
|
||||
return JsonMapper.toJsonString(jsonMap);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("解析补全日志信息过程异常,异常信息:" + e + "\n" + message);
|
||||
return "";
|
||||
|
||||
@@ -46,8 +46,7 @@ public class TransFormObject {
|
||||
*/
|
||||
public static String dealCommonMessage(String message) {
|
||||
try {
|
||||
// Object object = JsonMapper.fromJsonString(message, mapObject.getClass());
|
||||
Object object = JSONObject.parseObject(message, mapObject.getClass());
|
||||
Object object = JsonMapper.fromJsonString(message, mapObject.getClass());
|
||||
for (String[] strings : jobList) {
|
||||
//用到的参数的值
|
||||
Object name = JsonParseUtil.getValue(object, strings[0]);
|
||||
@@ -61,8 +60,7 @@ public class TransFormObject {
|
||||
String param = strings[3];
|
||||
functionSet(function, object, appendToKeyName, appendTo, name, param);
|
||||
}
|
||||
// return JsonMapper.toJsonString(object);
|
||||
return JSONObject.toJSONString(object);
|
||||
return JsonMapper.toJsonString(object);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("解析补全日志信息过程异常,异常信息:" + e + "\n" + message);
|
||||
return "";
|
||||
|
||||
@@ -38,7 +38,6 @@ public class TransFormTypeMap {
|
||||
public static String dealCommonMessage(String message) {
|
||||
try {
|
||||
Map<String, Object> jsonMap = (Map<String, Object>) JsonMapper.fromJsonString(message, Map.class);
|
||||
// Map<String, Object> jsonMap = JsonTypeUtils.typeTransform((Map<String, Object>) JsonMapper.fromJsonString(message, Map.class));
|
||||
for (String[] strings : jobList) {
|
||||
//用到的参数的值
|
||||
Object name = JsonParseUtil.getValue(jsonMap, strings[0]);
|
||||
@@ -52,7 +51,7 @@ public class TransFormTypeMap {
|
||||
String param = strings[3];
|
||||
functionSet(function, jsonMap, appendToKeyName, appendTo, name, param);
|
||||
}
|
||||
return JSONObject.toJSONString(JsonTypeUtils.typeTransform(jsonMap));
|
||||
return JsonMapper.toJsonString(JsonTypeUtils.typeTransform(jsonMap));
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("解析补全日志信息过程异常,异常信息:" + e + "\n" + message);
|
||||
return "";
|
||||
|
||||
@@ -134,12 +134,13 @@ public class JsonTypeUtils {
|
||||
* @return Long value
|
||||
*/
|
||||
private static long checkLongValue(Object value) {
|
||||
|
||||
Long longVal = TypeUtils.castToLong(value);
|
||||
|
||||
if (longVal == null) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
// return longVal.longValue();
|
||||
return longVal;
|
||||
}
|
||||
|
||||
@@ -176,11 +177,10 @@ public class JsonTypeUtils {
|
||||
private static int getIntValue(Object value) {
|
||||
|
||||
Integer intVal = TypeUtils.castToInt(value);
|
||||
|
||||
if (intVal == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// return intVal.intValue();
|
||||
return intVal;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ public class TypeUtils {
|
||||
throw new FlowWriteException("can not cast to long, value : " + value);
|
||||
}
|
||||
|
||||
public static long longValue(BigDecimal decimal) {
|
||||
private static long longValue(BigDecimal decimal) {
|
||||
if (decimal == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user