瀏覽代碼

mapper 时间格式处理
kafka条数设置为1条

pms 2 年之前
父節點
當前提交
e7de2be66e

+ 1 - 1
mainFactory/src/main/java/org/bfkj/protocol/MyKafKa.java

@@ -30,7 +30,7 @@ public class MyKafKa {
         if (!connectConfigMaps.containsKey("group.id")) {
             connectConfigMaps.put("group.id", "groupid" + (String.format("%s", library_id)));
         }
-        connectConfigMaps.put("max.poll.records", 50);
+        connectConfigMaps.put("max.poll.records", 1);
         connectConfigMaps.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
         connectConfigMaps.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
 

+ 2 - 0
mainFactory/src/main/java/org/bfkj/utils/MapTools.java

@@ -2,6 +2,7 @@ package org.bfkj.utils;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.util.JSONPObject;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import org.dom4j.DocumentException;
@@ -365,6 +366,7 @@ public class MapTools implements Serializable {
         ObjectMapper mapper = new ObjectMapper();
         try {
             mapper.registerModule(new JavaTimeModule());
+            mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false); //关闭
             return mapper.writeValueAsString(mapStr);
         } catch (JsonProcessingException e) {
             return null;