Explorar el Código

升级fastjson2版本

AE86 hace 2 años
padre
commit
faf65d74f1

+ 6 - 20
dbsyncer-biz/src/main/java/org/dbsyncer/biz/checker/AbstractChecker.java

@@ -1,7 +1,5 @@
 package org.dbsyncer.biz.checker;
 package org.dbsyncer.biz.checker;
 
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import org.dbsyncer.biz.enums.SafeInfoEnum;
 import org.dbsyncer.biz.enums.SafeInfoEnum;
 import org.dbsyncer.common.snowflake.SnowflakeIdWorker;
 import org.dbsyncer.common.snowflake.SnowflakeIdWorker;
 import org.dbsyncer.common.util.CollectionUtils;
 import org.dbsyncer.common.util.CollectionUtils;
@@ -20,7 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.Assert;
 import org.springframework.util.Assert;
 
 
 import java.time.Instant;
 import java.time.Instant;
-import java.util.*;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @author AE86
  * @author AE86
@@ -75,14 +76,14 @@ public abstract class AbstractChecker implements Checker {
         // 过滤条件
         // 过滤条件
         String filterJson = params.get("filter");
         String filterJson = params.get("filter");
         if (StringUtil.isNotBlank(filterJson)) {
         if (StringUtil.isNotBlank(filterJson)) {
-            List<Filter> list = jsonToList(filterJson, Filter.class);
+            List<Filter> list = JsonUtil.jsonToArray(filterJson, Filter.class);
             model.setFilter(list);
             model.setFilter(list);
         }
         }
 
 
         // 转换配置
         // 转换配置
         String convertJson = params.get("convert");
         String convertJson = params.get("convert");
         if (StringUtil.isNotBlank(convertJson)) {
         if (StringUtil.isNotBlank(convertJson)) {
-            List<Convert> convert = jsonToList(convertJson, Convert.class);
+            List<Convert> convert = JsonUtil.jsonToArray(convertJson, Convert.class);
             model.setConvert(convert);
             model.setConvert(convert);
         }
         }
 
 
@@ -118,19 +119,4 @@ public abstract class AbstractChecker implements Checker {
         logger.info("params:{}", checkParams);
         logger.info("params:{}", checkParams);
     }
     }
 
 
-    private <T> List<T> jsonToList(String json, Class<T> valueType) {
-        JSONArray array = JsonUtil.parseArray(json);
-        if (null != array) {
-            List<T> list = new ArrayList<>();
-            int length = array.size();
-            for (int i = 0; i < length; i++) {
-                JSONObject obj = array.getJSONObject(i);
-                T t = JsonUtil.jsonToObj(obj.toString(), valueType);
-                list.add(t);
-            }
-            return list;
-        }
-        return Collections.EMPTY_LIST;
-    }
-
 }
 }

+ 16 - 14
dbsyncer-biz/src/main/java/org/dbsyncer/biz/checker/impl/tablegroup/TableGroupChecker.java

@@ -1,7 +1,5 @@
 package org.dbsyncer.biz.checker.impl.tablegroup;
 package org.dbsyncer.biz.checker.impl.tablegroup;
 
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import org.dbsyncer.biz.BizException;
 import org.dbsyncer.biz.BizException;
 import org.dbsyncer.biz.checker.AbstractChecker;
 import org.dbsyncer.biz.checker.AbstractChecker;
 import org.dbsyncer.biz.checker.ConnectorConfigChecker;
 import org.dbsyncer.biz.checker.ConnectorConfigChecker;
@@ -25,7 +23,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 import org.springframework.util.Assert;
 import org.springframework.util.Assert;
 
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @author AE86
  * @author AE86
@@ -134,9 +136,9 @@ public class TableGroupChecker extends AbstractChecker {
         MetaInfo metaInfo = manager.getMetaInfo(connectorId, tableName);
         MetaInfo metaInfo = manager.getMetaInfo(connectorId, tableName);
         Assert.notNull(metaInfo, "无法获取连接器表信息.");
         Assert.notNull(metaInfo, "无法获取连接器表信息.");
         // 自定义主键
         // 自定义主键
-        if(StringUtil.isNotBlank(primaryKey) && !CollectionUtils.isEmpty(metaInfo.getColumn())){
-            for(Field field : metaInfo.getColumn()){
-                if(StringUtil.equals(field.getName(), primaryKey)){
+        if (StringUtil.isNotBlank(primaryKey) && !CollectionUtils.isEmpty(metaInfo.getColumn())) {
+            for (Field field : metaInfo.getColumn()) {
+                if (StringUtil.equals(field.getName(), primaryKey)) {
                     field.setPk(true);
                     field.setPk(true);
                     break;
                     break;
                 }
                 }
@@ -199,28 +201,28 @@ public class TableGroupChecker extends AbstractChecker {
      * @return
      * @return
      */
      */
     private void setFieldMapping(TableGroup tableGroup, String json) {
     private void setFieldMapping(TableGroup tableGroup, String json) {
-        JSONArray mapping = JsonUtil.parseArray(json);
-        if (null == mapping) {
+        List<Map> mappings = JsonUtil.parseList(json);
+        if (null == mappings) {
             throw new BizException("映射关系不能为空");
             throw new BizException("映射关系不能为空");
         }
         }
 
 
         final Map<String, Field> sMap = PickerUtil.convert2Map(tableGroup.getSourceTable().getColumn());
         final Map<String, Field> sMap = PickerUtil.convert2Map(tableGroup.getSourceTable().getColumn());
         final Map<String, Field> tMap = PickerUtil.convert2Map(tableGroup.getTargetTable().getColumn());
         final Map<String, Field> tMap = PickerUtil.convert2Map(tableGroup.getTargetTable().getColumn());
-        int length = mapping.size();
+        int length = mappings.size();
         List<FieldMapping> list = new ArrayList<>();
         List<FieldMapping> list = new ArrayList<>();
-        JSONObject row = null;
+        Map row = null;
         Field s = null;
         Field s = null;
         Field t = null;
         Field t = null;
         for (int i = 0; i < length; i++) {
         for (int i = 0; i < length; i++) {
-            row = mapping.getJSONObject(i);
-            s = sMap.get(row.getString("source"));
-            t = tMap.get(row.getString("target"));
+            row = mappings.get(i);
+            s = sMap.get(row.get("source"));
+            t = tMap.get(row.get("target"));
             if (null == s && null == t) {
             if (null == s && null == t) {
                 continue;
                 continue;
             }
             }
 
 
             if (null != t) {
             if (null != t) {
-                t.setPk(row.getBoolean("pk"));
+                t.setPk((Boolean) row.get("pk"));
             }
             }
             list.add(new FieldMapping(s, t));
             list.add(new FieldMapping(s, t));
         }
         }

+ 8 - 2
dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/ConnectorServiceImpl.java

@@ -18,7 +18,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
 import org.springframework.util.Assert;
 
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -52,7 +58,7 @@ public class ConnectorServiceImpl extends BaseServiceImpl implements ConnectorSe
         Connector connector = getConnector(id);
         Connector connector = getConnector(id);
         Assert.notNull(connector, "The connector id is invalid.");
         Assert.notNull(connector, "The connector id is invalid.");
 
 
-        Map params = JsonUtil.parseObject(JsonUtil.objToJson(connector.getConfig())).getInnerMap();
+        Map params = JsonUtil.parseMap(connector.getConfig());
         params.put(ConfigConstant.CONFIG_MODEL_NAME, connector.getName() + "(复制)");
         params.put(ConfigConstant.CONFIG_MODEL_NAME, connector.getName() + "(复制)");
         ConfigModel model = connectorChecker.checkAddConfigModel(params);
         ConfigModel model = connectorChecker.checkAddConfigModel(params);
         log(LogType.ConnectorLog.COPY, model);
         log(LogType.ConnectorLog.COPY, model);

+ 2 - 2
dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/DataSyncServiceImpl.java

@@ -90,7 +90,7 @@ public class DataSyncServiceImpl implements DataSyncService {
         if (null == bytes) {
         if (null == bytes) {
             if (prettyBytes) {
             if (prettyBytes) {
                 String json = (String) row.get(ConfigConstant.CONFIG_MODEL_JSON);
                 String json = (String) row.get(ConfigConstant.CONFIG_MODEL_JSON);
-                return JsonUtil.parseObject(json).toJavaObject(Map.class);
+                return JsonUtil.parseMap(json);
             }
             }
             return Collections.EMPTY_MAP;
             return Collections.EMPTY_MAP;
         }
         }
@@ -143,7 +143,7 @@ public class DataSyncServiceImpl implements DataSyncService {
             // 有修改同步值
             // 有修改同步值
             String retryDataParams = params.get("retryDataParams");
             String retryDataParams = params.get("retryDataParams");
             if (StringUtil.isNotBlank(retryDataParams)) {
             if (StringUtil.isNotBlank(retryDataParams)) {
-                JsonUtil.parseObject(retryDataParams).getInnerMap().forEach((k, v) -> binlogData.put(k, convertValue(binlogData.get(k), (String) v)));
+                JsonUtil.parseMap(retryDataParams).forEach((k, v) -> binlogData.put(k, convertValue(binlogData.get(k), (String) v)));
             }
             }
             writerBufferActuator.offer(new WriterRequest(tableGroupId, event, binlogData));
             writerBufferActuator.offer(new WriterRequest(tableGroupId, event, binlogData));
             monitor.removeData(metaId, messageId);
             monitor.removeData(metaId, messageId);

+ 3 - 3
dbsyncer-common/pom.xml

@@ -51,10 +51,10 @@
             <artifactId>commons-io</artifactId>
             <artifactId>commons-io</artifactId>
         </dependency>
         </dependency>
 
 
-        <!-- fastjson -->
+        <!-- fastjson2 -->
         <dependency>
         <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
         </dependency>
         </dependency>
 
 
     </dependencies>
     </dependencies>

+ 10 - 8
dbsyncer-common/src/main/java/org/dbsyncer/common/util/JsonUtil.java

@@ -1,16 +1,14 @@
 package org.dbsyncer.common.util;
 package org.dbsyncer.common.util;
 
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson2.JSON;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 public abstract class JsonUtil {
 public abstract class JsonUtil {
 
 
     public static String objToJson(Object obj) {
     public static String objToJson(Object obj) {
-        return JSON.toJSONString(obj, SerializerFeature.DisableCircularReferenceDetect);
+        return JSON.toJSONString(obj);
     }
     }
 
 
     public static <T> T jsonToObj(String json, Class<T> valueType) {
     public static <T> T jsonToObj(String json, Class<T> valueType) {
@@ -21,11 +19,15 @@ public abstract class JsonUtil {
         return JSON.parseArray(json, valueType);
         return JSON.parseArray(json, valueType);
     }
     }
 
 
-    public static JSONObject parseObject(String json) {
+    public static Map parseMap(Object obj) {
+        return parseMap(objToJson(obj));
+    }
+
+    public static Map parseMap(String json) {
         return JSON.parseObject(json);
         return JSON.parseObject(json);
     }
     }
 
 
-    public static JSONArray parseArray(String json) {
-        return JSON.parseArray(json);
+    public static List parseList(String json) {
+        return JSON.parseArray(json).toList(Map.class);
     }
     }
 }
 }

+ 7 - 8
dbsyncer-manager/src/main/java/org/dbsyncer/manager/template/PreloadTemplate.java

@@ -1,6 +1,5 @@
 package org.dbsyncer.manager.template;
 package org.dbsyncer.manager.template;
 
 
-import com.alibaba.fastjson.JSONObject;
 import org.dbsyncer.common.model.Paging;
 import org.dbsyncer.common.model.Paging;
 import org.dbsyncer.common.util.CollectionUtils;
 import org.dbsyncer.common.util.CollectionUtils;
 import org.dbsyncer.common.util.JsonUtil;
 import org.dbsyncer.common.util.JsonUtil;
@@ -85,7 +84,7 @@ public final class PreloadTemplate implements ApplicationListener<ContextRefresh
     }
     }
 
 
     public void reload(String json) {
     public void reload(String json) {
-        Map<String, JSONObject> map = JsonUtil.jsonToObj(json, Map.class);
+        Map<String, Map> map = JsonUtil.jsonToObj(json, Map.class);
         if (CollectionUtils.isEmpty(map)) {
         if (CollectionUtils.isEmpty(map)) {
             return;
             return;
         }
         }
@@ -105,16 +104,16 @@ public final class PreloadTemplate implements ApplicationListener<ContextRefresh
         launch();
         launch();
     }
     }
 
 
-    private void reload(Map<String, JSONObject> map, CommandEnum commandEnum) {
+    private void reload(Map<String, Map> map, CommandEnum commandEnum) {
         reload(map, commandEnum, commandEnum.getModelType());
         reload(map, commandEnum, commandEnum.getModelType());
     }
     }
 
 
-    private void reload(Map<String, JSONObject> map, CommandEnum commandEnum, String groupId) {
-        JSONObject config = map.get(groupId);
+    private void reload(Map<String, Map> map, CommandEnum commandEnum, String groupId) {
+        Map config = map.get(groupId);
         if (null == config) {
         if (null == config) {
             return;
             return;
         }
         }
-        Group group = JsonUtil.jsonToObj(config.toJSONString(), Group.class);
+        Group group = JsonUtil.jsonToObj(config.toString(), Group.class);
         if (null == group) {
         if (null == group) {
             return;
             return;
         }
         }
@@ -125,8 +124,8 @@ public final class PreloadTemplate implements ApplicationListener<ContextRefresh
         }
         }
 
 
         for (String e : index) {
         for (String e : index) {
-            JSONObject m = map.get(e);
-            ConfigModel model = (ConfigModel) commandEnum.getCommandExecutor().execute(new PreloadCommand(parser, m.toJSONString()));
+            Map m = map.get(e);
+            ConfigModel model = (ConfigModel) commandEnum.getCommandExecutor().execute(new PreloadCommand(parser, m.toString()));
             operationTemplate.execute(new OperationConfig(model, CommandEnum.OPR_ADD, commandEnum.getGroupStrategyEnum()));
             operationTemplate.execute(new OperationConfig(model, CommandEnum.OPR_ADD, commandEnum.getGroupStrategyEnum()));
             // Load tableGroups
             // Load tableGroups
             if (CommandEnum.PRELOAD_MAPPING == commandEnum) {
             if (CommandEnum.PRELOAD_MAPPING == commandEnum) {

+ 17 - 18
dbsyncer-parser/src/main/java/org/dbsyncer/parser/ParserFactory.java

@@ -1,7 +1,5 @@
 package org.dbsyncer.parser;
 package org.dbsyncer.parser;
 
 
-import com.alibaba.fastjson.JSONException;
-import com.alibaba.fastjson.JSONObject;
 import org.dbsyncer.cache.CacheService;
 import org.dbsyncer.cache.CacheService;
 import org.dbsyncer.common.event.RowChangedEvent;
 import org.dbsyncer.common.event.RowChangedEvent;
 import org.dbsyncer.common.model.AbstractConnectorConfig;
 import org.dbsyncer.common.model.AbstractConnectorConfig;
@@ -28,7 +26,13 @@ import org.dbsyncer.parser.enums.ConvertEnum;
 import org.dbsyncer.parser.event.FullRefreshEvent;
 import org.dbsyncer.parser.event.FullRefreshEvent;
 import org.dbsyncer.parser.logger.LogService;
 import org.dbsyncer.parser.logger.LogService;
 import org.dbsyncer.parser.logger.LogType;
 import org.dbsyncer.parser.logger.LogType;
-import org.dbsyncer.parser.model.*;
+import org.dbsyncer.parser.model.BatchWriter;
+import org.dbsyncer.parser.model.Connector;
+import org.dbsyncer.parser.model.FieldMapping;
+import org.dbsyncer.parser.model.Mapping;
+import org.dbsyncer.parser.model.Picker;
+import org.dbsyncer.parser.model.TableGroup;
+import org.dbsyncer.parser.model.Task;
 import org.dbsyncer.parser.strategy.FlushStrategy;
 import org.dbsyncer.parser.strategy.FlushStrategy;
 import org.dbsyncer.parser.strategy.ParserStrategy;
 import org.dbsyncer.parser.strategy.ParserStrategy;
 import org.dbsyncer.parser.util.ConvertUtil;
 import org.dbsyncer.parser.util.ConvertUtil;
@@ -176,21 +180,16 @@ public class ParserFactory implements Parser {
 
 
     @Override
     @Override
     public Connector parseConnector(String json) {
     public Connector parseConnector(String json) {
-        try {
-            JSONObject conn = JsonUtil.parseObject(json);
-            JSONObject config = (JSONObject) conn.remove("config");
-            Connector connector = JsonUtil.jsonToObj(conn.toString(), Connector.class);
-            Assert.notNull(connector, "Connector can not be null.");
-            String connectorType = config.getString("connectorType");
-            Class<?> configClass = ConnectorEnum.getConfigClass(connectorType);
-            AbstractConnectorConfig obj = (AbstractConnectorConfig) JsonUtil.jsonToObj(config.toString(), configClass);
-            connector.setConfig(obj);
-
-            return connector;
-        } catch (JSONException e) {
-            logger.error(e.getMessage());
-            throw new ParserException(e.getMessage());
-        }
+        Map conn = JsonUtil.parseMap(json);
+        Map config = (Map) conn.remove("config");
+        Connector connector = JsonUtil.jsonToObj(conn.toString(), Connector.class);
+        Assert.notNull(connector, "Connector can not be null.");
+        String connectorType = (String) config.get("connectorType");
+        Class<?> configClass = ConnectorEnum.getConfigClass(connectorType);
+        AbstractConnectorConfig obj = (AbstractConnectorConfig) JsonUtil.jsonToObj(config.toString(), configClass);
+        connector.setConfig(obj);
+
+        return connector;
     }
     }
 
 
     @Override
     @Override

+ 125 - 12
dbsyncer-parser/src/main/resources/Connector.json

@@ -1,15 +1,128 @@
 {
 {
-  "id": "100",
+  "config":{
+    "connectorType":"Mysql",
+    "password":"123",
+    "properties":{
+
+    },
+    "url":"jdbc:mysql://127.0.0.1:3305/test?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&verifyServerCertificate=false&autoReconnect=true&failOverReadOnly=false",
+    "username":"root"
+  },
+  "createTime":1670169249093,
+  "id":"1049111399101501440",
+  "name":"Mysql",
+  "table":[
+    {
+      "count":0,
+      "name":"aqi_stations",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"dbs_test03",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"ds1",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"ds1_copy1",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"mdt_partnerrole",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_big_table",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_big_table_copy1",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_file",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_mark",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_org",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_user",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_visit",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"nc_customer",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"product",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"product_copy",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"shop_goods",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"shop_goods_class",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"shop_goods_spec",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"tb_jy_visit",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"tb_jy_visit_copy1",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"vote_records",
+      "type":"TABLE"
+    },
+    {
+      "count":0,
+      "name":"my_view",
+      "type":"VIEW"
+    }
+  ],
   "type":"connector",
   "type":"connector",
-  "name": "人力资源系统",
-  "createTime": "2019-10-08 21:32:00",
-  "updateTime": "2019-10-08 21:35:00",
-  "table":["MY_USER", "T_MY_USER", "table_999"],
-  "config": {
-    "connectorType": "Mysql",
-    "driverClassName": "com.mysql.jdbc.Driver",
-    "url": "jdbc:mysql://127.0.0.1:3306/test?rewriteBatchedStatements=true&seUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&verifyServerCertificate=false",
-    "username": "root",
-    "password": "123"
-  }
+  "updateTime":1672237644641
 }
 }

+ 346 - 59
dbsyncer-parser/src/main/resources/Mapping.json

@@ -1,73 +1,360 @@
 {
 {
-  "id": "11111",
-  "type":"mapping",
-  "name": "人力资源系统_审计系统",
-  "createTime": "2019-10-08 21:32:00",
-  "updateTime": "2019-10-08 21:35:00",
-  "sourceConnectorId": "100",
-  "targetConnectorId": "666",
-  "sourceColumn":[
-    {
-      "name": "ID",
-      "typeName": "VARCHAR",
-      "type": 12,
-      "pk":true
-    }
+  "batchNum":1000,
+  "convert":[
+
   ],
   ],
-  "targetColumn":[
-    {
-      "name": "ID",
-      "typeName": "VARCHAR",
-      "type": 12,
-      "pk":true
-    }
+  "createTime":1671809807457,
+  "filter":[
+
   ],
   ],
+  "id":"1055992399609860096",
+  "listener":{
+    "banDelete":false,
+    "banInsert":false,
+    "banUpdate":false,
+    "cron":"*/30 * * * * ?",
+    "delete":"D",
+    "eventFieldName":"",
+    "insert":"I",
+    "listenerType":"log",
+    "update":"U"
+  },
+  "metaId":"1055992399609860097",
+  "model":"increment",
+  "name":"同步测试",
   "params":{
   "params":{
-    "ORACLE_ROW_ID":"RID"
+
   },
   },
-  "filter": [
+  "readNum":10000,
+  "sourceColumn":[
+    {
+      "name":"id",
+      "pk":true,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_cust_id",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_type",
+      "pk":false,
+      "type":1,
+      "typeName":"CHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_user_id",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_day",
+      "pk":false,
+      "type":1,
+      "typeName":"CHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_lat",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_lng",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
     {
     {
-      "name": "AGE",
-      "operation": "and",
-      "filter": ">",
-      "value": "0"
+      "name":"start_distance",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
     },
     },
     {
     {
-      "name": "NAME",
-      "operation": "or",
-      "filter": "=",
-      "value": "hello"
+      "name":"end_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_lat",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_lng",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_distance",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_status",
+      "pk":false,
+      "type":1,
+      "typeName":"CHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"pre_end_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"create_by",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"create_by_name",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"create_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"update_by",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"update_by_name",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"update_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"version",
+      "pk":false,
+      "type":4,
+      "typeName":"INT",
+      "unmodifiabled":false
+    },
+    {
+      "name":"is_del",
+      "pk":false,
+      "type":4,
+      "typeName":"INT",
+      "unmodifiabled":false
     }
     }
   ],
   ],
-  "convert": [
+  "sourceConnectorId":"1049111399101501440",
+  "targetColumn":[
+    {
+      "name":"id",
+      "pk":true,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
     {
     {
-      "name":"NAME",
-      "convertName":"替换",
-      "convertCode":"REPLACE",
-      "args":"A,B"
+      "name":"visit_cust_id",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_type",
+      "pk":false,
+      "type":1,
+      "typeName":"CHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_user_id",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_day",
+      "pk":false,
+      "type":1,
+      "typeName":"CHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_lat",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_lng",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"start_distance",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_lat",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_lng",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"end_distance",
+      "pk":false,
+      "type":8,
+      "typeName":"DOUBLE",
+      "unmodifiabled":false
+    },
+    {
+      "name":"visit_status",
+      "pk":false,
+      "type":1,
+      "typeName":"CHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"pre_end_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"create_by",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"create_by_name",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"create_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"update_by",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"update_by_name",
+      "pk":false,
+      "type":12,
+      "typeName":"VARCHAR",
+      "unmodifiabled":false
+    },
+    {
+      "name":"update_time",
+      "pk":false,
+      "type":93,
+      "typeName":"DATETIME",
+      "unmodifiabled":false
+    },
+    {
+      "name":"version",
+      "pk":false,
+      "type":4,
+      "typeName":"INT",
+      "unmodifiabled":false
+    },
+    {
+      "name":"is_del",
+      "pk":false,
+      "type":4,
+      "typeName":"INT",
+      "unmodifiabled":false
     }
     }
   ],
   ],
-  "plugin": {
-    "name":"用户信息转换插件",
-    "className": "com.xx.hr.convert.MyImpl"
-  },
-  "model":"full",
-  "listener": {
-    "listenerType": "Polling",
-    "period": 30,
-    "eventFieldName": "MyEvent",
-    "update": [
-      "U",
-      "M"
-    ],
-    "insert": [
-      "I"
-    ],
-    "delete": [
-      "D"
-    ]
-  },
-  "metaId":"1",
-  "readNum": 10000,
-  "batchNum": 200
+  "targetConnectorId":"1049111399101501440",
+  "threadNum":32,
+  "type":"mapping",
+  "updateTime":1673452598774
 }
 }

+ 720 - 66
dbsyncer-parser/src/main/resources/TableGroup.json

@@ -1,81 +1,735 @@
 {
 {
-  "id":"tableGroupId_0",
-  "type":"tableGroup",
-  "name": "tableGroup",
-  "createTime": "2019-10-08 21:32:00",
-  "updateTime": "2019-10-08 21:35:00",
-  "mappingId": "11111",
-  "sourceTable":{
-    "name":"MY_USER",
-    "column":[
-      {
-        "name": "ID",
-        "typeName": "VARCHAR",
-        "type": 12,
-        "pk":true
-      }
-    ]
-  },
-  "targetTable":{
-    "name":"T_MY_USER",
-    "column":[
-      {
-        "name": "ID",
-        "typeName": "VARCHAR",
-        "type": 12,
-        "pk":true
-      }
-    ]
+  "command":{
+    "QUERY_CURSOR":"SELECT `id`, `visit_cust_id`, `visit_type`, `visit_user_id`, `visit_day`, `start_time`, `start_lat`, `start_lng`, `start_distance`, `end_time`, `end_lat`, `end_lng`, `end_distance`, `visit_status`, `pre_end_time`, `create_by`, `create_by_name`, `create_time`, `update_by`, `update_by_name`, `update_time`, `version`, `is_del` FROM `tb_jy_visit` ORDER BY `id` LIMIT ?",
+    "DELETE":"DELETE FROM `tb_jy_visit_copy1` WHERE `id`=?",
+    "QUERY":"SELECT `id`, `visit_cust_id`, `visit_type`, `visit_user_id`, `visit_day`, `start_time`, `start_lat`, `start_lng`, `start_distance`, `end_time`, `end_lat`, `end_lng`, `end_distance`, `visit_status`, `pre_end_time`, `create_by`, `create_by_name`, `create_time`, `update_by`, `update_by_name`, `update_time`, `version`, `is_del` FROM `tb_jy_visit` WHERE `id` > ? ORDER BY `id` LIMIT ?",
+    "QUERY_COUNT":"SELECT COUNT(1) FROM (SELECT 1 FROM `tb_jy_visit` GROUP BY `id`) DBSYNCER_T",
+    "INSERT":"INSERT INTO `tb_jy_visit_copy1`(`id`, `visit_cust_id`, `visit_type`, `visit_user_id`, `visit_day`, `start_time`, `start_lat`, `start_lng`, `start_distance`, `end_time`, `end_lat`, `end_lng`, `end_distance`, `visit_status`, `pre_end_time`, `create_by`, `create_by_name`, `create_time`, `update_by`, `update_by_name`, `update_time`, `version`, `is_del`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+    "UPDATE":"UPDATE `tb_jy_visit_copy1` SET `visit_cust_id`=?,`visit_type`=?,`visit_user_id`=?,`visit_day`=?,`start_time`=?,`start_lat`=?,`start_lng`=?,`start_distance`=?,`end_time`=?,`end_lat`=?,`end_lng`=?,`end_distance`=?,`visit_status`=?,`pre_end_time`=?,`create_by`=?,`create_by_name`=?,`create_time`=?,`update_by`=?,`update_by_name`=?,`update_time`=?,`version`=?,`is_del`=? WHERE `id`=?",
+    "QUERY_COUNT_EXIST":"SELECT COUNT(1) FROM `tb_jy_visit_copy1` WHERE `id` = ?"
   },
   },
+  "convert":[
+
+  ],
+  "createTime":1672238741208,
   "fieldMapping":[
   "fieldMapping":[
     {
     {
       "source":{
       "source":{
-        "name": "ID",
-        "typeName": "VARCHAR",
-        "type": 12,
-        "pk":true
+        "name":"id",
+        "pk":true,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
       },
       },
       "target":{
       "target":{
-        "name": "ID",
-        "typeName": "VARCHAR",
-        "type": 12,
-        "pk":true
+        "name":"id",
+        "pk":true,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
       }
       }
-    }
-  ],
-  "command":{
-    "QUERY":"SELECT * FROM MY_USER where name = ?",
-    "INSERT":"INSERT INTO MY_USER(id,name)values(?,?)",
-    "UPDATE":"UPDATE MY_USER set name=? where MY_USER.id=?",
-    "DELETE":"DELETE MY_USER WHERE MY_USER.id=?"
-  },
-  "params":{
-    "ORACLE_ROW_ID":"RID"
-  },
-  "filter": [
+    },
     {
     {
-      "name": "AGE",
-      "operation": "and",
-      "filter": ">",
-      "value": "0"
+      "source":{
+        "name":"visit_cust_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"visit_cust_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      }
     },
     },
     {
     {
-      "name": "NAME",
-      "operation": "or",
-      "filter": "=",
-      "value": "hello"
-    }
-  ],
-  "convert": [
+      "source":{
+        "name":"visit_type",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"visit_type",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"visit_user_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"visit_user_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"visit_day",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"visit_day",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"start_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"start_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"start_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"start_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"start_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"start_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"start_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"start_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"end_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"end_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"end_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"end_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"end_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"end_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"visit_status",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"visit_status",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"pre_end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"pre_end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"create_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"create_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"create_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"create_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"create_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"create_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"update_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"update_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"update_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"update_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"update_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"update_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      }
+    },
+    {
+      "source":{
+        "name":"version",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"version",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      }
+    },
     {
     {
-      "name":"NAME",
-      "convertName":"替换",
-      "convertCode":"REPLACE",
-      "args":"A,B"
+      "source":{
+        "name":"is_del",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      },
+      "target":{
+        "name":"is_del",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      }
     }
     }
   ],
   ],
-  "plugin": {
-    "name":"用户信息转换插件",
-    "className": "com.xx.hr.convert.MyImpl"
-  }
+  "filter":[
+
+  ],
+  "id":"1057791478157414400",
+  "index":1,
+  "mappingId":"1055992399609860096",
+  "name":"tableGroup",
+  "params":{
+
+  },
+  "sourceTable":{
+    "column":[
+      {
+        "name":"id",
+        "pk":true,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_cust_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_type",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_user_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_day",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_status",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"pre_end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"create_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"create_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"create_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"update_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"update_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"update_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"version",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      },
+      {
+        "name":"is_del",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      }
+    ],
+    "count":0,
+    "name":"tb_jy_visit",
+    "primaryKey":"",
+    "type":"TABLE"
+  },
+  "targetTable":{
+    "column":[
+      {
+        "name":"id",
+        "pk":true,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_cust_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_type",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_user_id",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_day",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"start_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_lat",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_lng",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"end_distance",
+        "pk":false,
+        "type":8,
+        "typeName":"DOUBLE",
+        "unmodifiabled":false
+      },
+      {
+        "name":"visit_status",
+        "pk":false,
+        "type":1,
+        "typeName":"CHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"pre_end_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"create_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"create_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"create_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"update_by",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"update_by_name",
+        "pk":false,
+        "type":12,
+        "typeName":"VARCHAR",
+        "unmodifiabled":false
+      },
+      {
+        "name":"update_time",
+        "pk":false,
+        "type":93,
+        "typeName":"DATETIME",
+        "unmodifiabled":false
+      },
+      {
+        "name":"version",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      },
+      {
+        "name":"is_del",
+        "pk":false,
+        "type":4,
+        "typeName":"INT",
+        "unmodifiabled":false
+      }
+    ],
+    "count":0,
+    "name":"tb_jy_visit_copy1",
+    "primaryKey":"",
+    "type":"TABLE"
+  },
+  "type":"tableGroup",
+  "updateTime":1673452597645
 }
 }

+ 9 - 12
dbsyncer-parser/src/main/test/ConnectorParserTest.java

@@ -1,5 +1,3 @@
-import com.alibaba.fastjson.JSONException;
-import com.alibaba.fastjson.JSONObject;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FileUtils;
 import org.dbsyncer.common.model.AbstractConnectorConfig;
 import org.dbsyncer.common.model.AbstractConnectorConfig;
 import org.dbsyncer.common.util.JsonUtil;
 import org.dbsyncer.common.util.JsonUtil;
@@ -12,6 +10,7 @@ import org.junit.Test;
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URL;
+import java.util.Map;
 
 
 /**
 /**
  * @author AE86
  * @author AE86
@@ -21,17 +20,17 @@ import java.net.URL;
 public class ConnectorParserTest {
 public class ConnectorParserTest {
 
 
     @Test
     @Test
-    public void testConnector() throws IOException, JSONException {
+    public void testConnector() throws IOException {
         String json = readJson("Connector.json");
         String json = readJson("Connector.json");
         System.out.println(json);
         System.out.println(json);
 
 
         // 解析基本信息
         // 解析基本信息
-        JSONObject conn = JsonUtil.parseObject(json);
-        JSONObject config = (JSONObject) conn.remove("config");
+        Map conn = JsonUtil.parseMap(json);
+        Map config = (Map) conn.remove("config");
         Connector connector = JsonUtil.jsonToObj(conn.toString(), Connector.class);
         Connector connector = JsonUtil.jsonToObj(conn.toString(), Connector.class);
 
 
         // 解析配置
         // 解析配置
-        String connectorType = config.getString("connectorType");
+        String connectorType = (String) config.get("connectorType");
         Class<?> configClass = ConnectorEnum.getConfigClass(connectorType);
         Class<?> configClass = ConnectorEnum.getConfigClass(connectorType);
         Object obj = JsonUtil.jsonToObj(config.toString(), configClass);
         Object obj = JsonUtil.jsonToObj(config.toString(), configClass);
         connector.setConfig((AbstractConnectorConfig) obj);
         connector.setConfig((AbstractConnectorConfig) obj);
@@ -39,23 +38,21 @@ public class ConnectorParserTest {
     }
     }
 
 
     @Test
     @Test
-    public void testMapping() throws IOException, JSONException {
+    public void testMapping() throws IOException {
         String json = readJson("Mapping.json");
         String json = readJson("Mapping.json");
         System.out.println(json);
         System.out.println(json);
 
 
         // 解析基本信息
         // 解析基本信息
-        JSONObject map = JsonUtil.parseObject(json);
-        Mapping mapping = JsonUtil.jsonToObj(map.toString(), Mapping.class);
+        Mapping mapping = JsonUtil.jsonToObj(json, Mapping.class);
         System.out.println(mapping);
         System.out.println(mapping);
     }
     }
 
 
     @Test
     @Test
-    public void testTableGroup() throws IOException, JSONException {
+    public void testTableGroup() throws IOException {
         String json = readJson("TableGroup.json");
         String json = readJson("TableGroup.json");
         System.out.println(json);
         System.out.println(json);
         // 解析基本信息
         // 解析基本信息
-        JSONObject group = JsonUtil.parseObject(json);
-        TableGroup tableGroup = JsonUtil.jsonToObj(group.toString(), TableGroup.class);
+        TableGroup tableGroup = JsonUtil.jsonToObj(json, TableGroup.class);
         System.out.println(tableGroup);
         System.out.println(tableGroup);
     }
     }
 
 

+ 5 - 5
pom.xml

@@ -51,7 +51,7 @@
         <postgresql.version>42.3.3</postgresql.version>
         <postgresql.version>42.3.3</postgresql.version>
         <postgis-jdbc.version>2.5.1</postgis-jdbc.version>
         <postgis-jdbc.version>2.5.1</postgis-jdbc.version>
         <kafka.version>0.9.0.0</kafka.version>
         <kafka.version>0.9.0.0</kafka.version>
-        <fastjson.version>1.2.75</fastjson.version>
+        <fastjson2.version>2.0.22</fastjson2.version>
         <protobuf.version>3.21.1</protobuf.version>
         <protobuf.version>3.21.1</protobuf.version>
         <log4j2.version>2.17.1</log4j2.version>
         <log4j2.version>2.17.1</log4j2.version>
         <junit.version>4.12</junit.version>
         <junit.version>4.12</junit.version>
@@ -116,11 +116,11 @@
                 <version>${commons-io.version}</version>
                 <version>${commons-io.version}</version>
             </dependency>
             </dependency>
 
 
-            <!-- fastjson -->
+            <!-- fastjson2 -->
             <dependency>
             <dependency>
-                <groupId>com.alibaba</groupId>
-                <artifactId>fastjson</artifactId>
-                <version>${fastjson.version}</version>
+                <groupId>com.alibaba.fastjson2</groupId>
+                <artifactId>fastjson2</artifactId>
+                <version>${fastjson2.version}</version>
             </dependency>
             </dependency>
 
 
             <!-- protobuf -->
             <!-- protobuf -->