通过XML入库操作 EsbmMessageProcessor 03
logger.debug("req_timestamp date format:" + req_timestamp);
long req_date = 0l;
if (req_timestamp == null || req_timestamp.trim().isEmpty())
{
req_date = System.currentTimeMillis();
}
else
{
req_date = Tools.stringFormatDate(req_timestamp).getTime();
}
logger.debug("rsp_timestamp date format:" + rsp_timestamp);
Date rsp_date = null;
if (rsp_timestamp == null || req_timestamp.trim().isEmpty())
{
rsp_date = new Date();
}
else
{
rsp_date = Tools.stringFormatDate(rsp_timestamp);
}
logger.debug("duration:" + (rsp_date.getTime() - req_date));
int duration = (int) (rsp_date.getTime() - req_date);
propertiesValue.put("duration", String.valueOf(duration));
// partition_id 是取响应时间月日,直接在代码存入不在properties文件中配置
propertiesValue.put("partition_id", Tools.getMMDD(rsp_date));
propertiesValue.put("seq_id", Tools.getSeq_id_DFX());
return propertiesValue;
}
/**
* 提供原始报文解析
*
* @param doc
* @param interfaceMap
* @return
*/
public static Map<String, String> getMatchValue(Document doc,
Map<Object, Object> interfaceMap)
{
return getMatchValue(doc, interfaceMap, null);
}
public static Map<String, String> getMatchValue(Document doc,
Map<Object, Object> interfaceMap, Map<Object, Object> namespaceMap)
{
XPath xPath = null;
Node node = null;
Iterator<Map.Entry<Object, Object>> iterator = interfaceMap.entrySet()
.iterator();
String value = null;
Map.Entry<Object, Object> entry = null;
String xpathStr = null;
Map<String, String> propertiesValue = new Hashtable<String, String>(
interfaceMap.size());
while (iterator.hasNext())
{
// 对应的数据库的字段
entry = iterator.next();
// 数据库字段对应的XPath 字符串
xpathStr = (String) entry.getValue();
if (null == xpathStr || xpathStr.trim().equals(""))
{
value = "";
}
else
{