进出入完善组织机构并加入导入人员和机构功能
554325746@qq.com
2019-08-07 07a66e53d2b4126c2004870d81a379d8ef0071da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
-module(syncDB_sqlite3).
-compile(export_all).
-include("esqltool.hrl").
 
test() ->
  lager:start(),
  io:format("start test ~n"),
%%  sqlite3 syncDb.db .dump>back`date +%Y-%m-%d_%T`.sql
 
  ok.
 
test1() ->
  startNode('NodeName', ' ', 'DeviceId', 'ClusterId', 'ClusterName'),
  ok.
test2() ->
  {Id, 'test33'} = person_info_feature_esql:create_personFeature([], 'test33'),
  io:format("test Id is ~p ", [Id]),
  person_info_feature_esql:add_personFea('test33', Id, yyy, url, id),
  ok.
test3() ->
  test(),
  startNode('NodeName', ' ', 'DeviceId', 'ClusterId', 'ClusterName'),
  {Id, 'test33'} = person_info_feature_esql:create_personFeature([], 'test33'),
  sys_o_tables_esql:add_sys_table(Id, 'cluid', 'test33', "", 'person', 1, "2018-01-01 01:01:01", '2018-11-01 01:01:01'),
  io:format("test Id is ~p ", [Id]),
  person_info_feature_esql:add_personFea("", Id, "yyy", url, id),
  %startNode("NodeName", ' ', "DeviceId", "ClusterId", "ClusterName"),
  ok.
 
setCNode(CNode) ->
  Ret = mochiglobal:put('cNodeName', CNode),
  case Ret of
    ok ->
      Res = [{atomic, ok}];
    _ ->
      Res = [{aborted, notok}]
  end,
  Res.
 
sendMessage() ->
  Nodes = [node() | nodes()],
  io:format("sendMessage ~p", [Nodes]),
  Res = syncTool:rpcSendMessToCNode(Nodes, {call, 'update', 1}),
  case Res of
    null ->
      io:format("send ok"),
      Ret = [{atomic, ok}];
    _ ->
      io:format("send error"),
      Ret = [{aborted, notok}]
  end,
  Ret.
 
add_deviceInfo(UUid, DevId, NodeId, ClusterID, FatherNodeName) ->
  if
    UUid == " " ->
      ID = syncTool:getUUIDString();
    UUid == "" ->
      ID = syncTool:getUUIDString();
    true ->
      ID = UUid
  end,
  UpdateTime = syncTool:getTimeStr(),
  CreateUser = node(),
  StrUuid = syncTool:change2Str(ID),
  StrNodeId = syncTool:change2Str(NodeId),
  StrDevId = syncTool:change2Str(DevId),
  StrClusterID = syncTool:change2Str(ClusterID),
  StrCreateUser = syncTool:change2Str(CreateUser),
  StrFatherNodeName = syncTool:change2Str(FatherNodeName),
 
  Sql = ["INSERT OR REPLACE INTO device_info (father_node, uuid, node_id, device_id, cluster_id, update_time, create_by)
             VALUES ('" ++ StrFatherNodeName ++ "', '" ++ StrUuid ++ "', '" ++ StrNodeId ++ "', '" ++
    StrDevId ++ "', '" ++ StrClusterID ++ "', '" ++
    UpdateTime ++ "', '" ++ StrCreateUser ++ "');"],
  Ret = executeSqlLocalyAndSaveToCacheAndSendSql(Sql),
  if
    Ret == {atomic, ok} ->
      Result = {atomic, ok};
    true ->
      Result = {aborted, error}
  end,
  Result.
 
downloadDeviceAndClustInfoDb() ->
  {ok, Binary} = file:read_file("/sdcard/security_database/sync_database.db"),
  Binary.
 
downloadDeviceAndClustInfoDb(FatherNodeName) ->
  Binary = rpc:call(FatherNodeName, syncDB_sqlite3, downloadDeviceAndClustInfoDb, []),
  file:write_file("/sdcard/security_database/sync_database.db", Binary).
 
startNode(NodeName, FatherNodeName, DeviceId, ClusterId, ClusterName) ->
  esqlite3Tool:createSqlCacheTable(),
  esqlite3Tool:createDeviceInfoAndClusterInfoTables(),
  if
    FatherNodeName == ' ' -> %%创建集群
      device_info_esql:add_deviceInfo(DeviceId, DeviceId, NodeName, ClusterId, FatherNodeName),
      clusterInfo_esql:add_ClusterInfo(ClusterId, ClusterName),
      syncToolEsql:getAndExecuteOthNodeSqlCache();
    true -> %%加入集群
%%        downloadDeviceAndClustInfoDb(FatherNodeName),
      SqlFileContent = rpc:call(FatherNodeName, esqlite3Tool, readDbSql, []), %% 拷贝库到本地执行
      esqlite3Tool:getDbSql(SqlFileContent),
      device_info_esql:add_deviceInfo(DeviceId, DeviceId, NodeName, ClusterId, FatherNodeName),
      clusterInfo_esql:add_ClusterInfo(ClusterId, ClusterName)
  end,
%%  StrUuid = syncTool:getUUIDString(),
%%  StrCreateUser = syncTool:change2Str(node()),
%%  StrTimestamp = syncTool:getTimestampStr(),
%%  Func = "test",
%%  InSql = ["INSERT INTO SqlCache (uuid, func, sql, create_by,create_time) values (\"", StrUuid, "\",\"",
%%    Func, "\" ,\"select count(*) from sqlite_master;\",\"", StrCreateUser, "\",\"", StrTimestamp, "\");"],
%%  spawn(node(), syncToolEsql, saveSqlToCache, [InSql]),
  Maps = device_info_esql:findAllDeviceList(),
  syncToolEsql:connectAllNode(Maps),
%%  esqltool:executeSqlLocalyAndSaveToCacheAndSendSql("INSERT OR REPLACE INTO cache (id) VALUES( '1')"),
  {atomic, ok}.
 
modifyCluName(CluId, CluName) ->
  io:format("modifyCluName CluId is ~p,CluName is ~p~n", [CluId, CluName]),
  Tmp = clusterInfo_esql:update_ClusterInfo(CluId, CluName),
  case Tmp of
    {atomic, ok} ->
      RET = [{atomic, ok}];
    _ ->
      RET = [{aborted, message}]
  end,
  io:format("modifyCluName Ret is ~p~n", [RET]),
  RET.
 
removeNode() ->
  BerPid = mochiglobal:get(?ESQLDBKEY),
  case BerPid of
    undefined ->
      io:format("BerPid is ~p ", [BerPid]),
      Res = {error, false};
    _ ->
      io:format("BerPid is ~p ", [BerPid]),
%%      os:cmd(["rm -f ", BerPid]),
%%      os:cmd(["rm -f ", database_name:getCacheDatabaseName()]),
%%      #todo rpc
      Res = {atomic, ok}
  end,
  Res.
 
findAllNode() ->
  Res = device_info_esql:findDeviceOnlineList([node() | nodes()]),
  io:format("Res is ~p", [Res]),
  Res.
 
%%  创建底库
%% 创建底库 表类型,表名,同步状态,黑白名单
createDatabase(TableType, TableName, SyncType, BwType, StartTime, EndTime) ->
  io:format("createDatabase ~p ~p ~p ~p ~p ~p ~n", [TableType, TableName, SyncType, BwType, StartTime, EndTime]),
  if
    TableType == 'person' ->
%%      Ret = person_info:create_personInfo(element(1, Tup), element(2, Tup)),
%%      Ret2 = person_info_feature:create_personFeature(element(1, Tup), element(2, Tup)),
 
      {Id, TableName} = person_info_feature_esql:create_personFeature(nodes(), TableName),
      person_info_esql:create_personInfo(nodes(), Id),
%%      todo
      Ret = sys_o_tables_esql:add_sys_table(Id, "", TableName, "", TableType, BwType, StartTime, EndTime),
      PerRet = [{atomic, ok}],
      io:format("Ret ~p ~n", [Ret]);
    TableType == 'car' ->
      PerRet = {},
      todo;
    true ->
      PerRet = [{aborted, {'tableType_error', TableType}}],
      io:format("Error ~p ~n", [TableType])
  end,
  io:format("PerRet ~p ~n", [PerRet]),
  PerRet.
 
updateDatabase(Uuid, TableType, TableName, SyncType, BwType, StartTime, EndTime) ->
  io:format("createDatabase ~p ~p ~p ~p ~p ~p ~n", [TableType, TableName, SyncType, BwType, StartTime, EndTime]),
  [sys_o_tables_esql:update_sys_tableRec(Uuid, TableType, TableName, SyncType, BwType, StartTime, EndTime)].
 
deleteDatabase(TableType, TableName) ->
  io:format("deleteDatabase ~p ~p  ~n", [TableType, TableName]),
  UuidTabName = sys_o_tables_esql:searchUuidWithTabName(TableName),
  [sys_o_tables_esql:del_sys_table(UuidTabName, TableType)].
 
findAllDatabase() ->
  sys_o_tables_esql:findAllSysTableInfo().
 
addPersonData(TableName, PersonName, Age, Sex, IdCard, PhoneNum, Img, UUID, Feature) ->
  UuidTabName = sys_o_tables_esql:searchUuidWithTabName(TableName),
  case UuidTabName of
    "" ->
      Ret = {aborted, {add_error, tableNotExits}};
    _ ->
%%  优先级? 先加人的信息还是人的特征
      case UUID of
        "" ->
          PerNum = 0;
        _ ->
          Persons = person_info_feature_esql:findPersonFea(UuidTabName, UUID),
          PerNum = length(Persons)
      end,
      if
        PerNum =< 0 ->
%%      无此id则添加
          Ret = addPersonDataWithUuid(UuidTabName, syncTool:change2Str(PersonName), syncTool:change2Str(Age),
            syncTool:change2Str(Sex), syncTool:change2Str(IdCard), syncTool:change2Str(PhoneNum), syncTool:change2Str(Img)
            , syncTool:change2Str(UUID), syncTool:change2Str(Feature));
        PerNum > 0 ->
%%      有此id则进行更新
          Ret = updatePersonDataWithUuid(UuidTabName, syncTool:change2Str(PersonName), syncTool:change2Str(Age),
            syncTool:change2Str(Sex), syncTool:change2Str(IdCard), syncTool:change2Str(PhoneNum), syncTool:change2Str(Img)
            , syncTool:change2Str(UUID), syncTool:change2Str(Feature));
        true ->
          Ret = ''
      end
  end,
  Ret.
 
addPersonDataWithUuid(UuidTabName, PersonName, Age, Sex, IdCard, PhoneNum, Img, UUID, Feature) ->
  if
    UUID == '' ->
      io:format("UUID is ~p ~n", [UUID]),
      ID = syncTool:getUUIDString();
    true ->
      ID = UUID
  end,
  case UuidTabName of
    "" ->
      Ret = {aborted, {add_error, tableNotExits}};
    _ ->
%%  优先级? 先加人的信息还是人的特征
      Uid = person_info_feature_esql:add_personFea(ID, UuidTabName, Feature, Img, IdCard),
      if
        Uid == '' ->
          Ret = {aborted, {add_error, Feature}};
        true ->
          Ret = person_info_esql:add_personInfo(UuidTabName, Uid, PersonName, Age, Sex, IdCard, PhoneNum)
      end
  end,
  io:format("Ret ~p ~n", [Ret]),
  Ret.
 
 
delPersonData(TableName, PersonId) ->
  io:format("TableName is ~p, PersonId is ~p", [TableName, PersonId]),
  UuidTabName = sys_o_tables_esql:searchUuidWithTabName(TableName),
  case UuidTabName of
    "" ->
      io:format("error tableNotExits ~p", [TableName]),
      Ret = {aborted, {del_error, tableNotExits}};
    _ ->
      io:format("~p will delete data id is ~p", [UuidTabName, PersonId]),
      Ret = delPersonDataWithUuid(UuidTabName, PersonId)
  end,
  [Ret].
 
delPersonDataWithUuid(TableNameUuid, PersonId) ->
  DelRet = person_info_feature_esql:del_personFea(TableNameUuid, PersonId),
  if
    DelRet == {atomic, ok} ->
      Ret = person_info_esql:del_personInfo(TableNameUuid, PersonId);
    true ->
      Ret = {aborted, {del_error, {TableNameUuid, PersonId}}}
  end,
  io:format("Ret ~p ~n", [Ret]),
  Ret.
 
updatePersonData(TableName, PersonName, Age, Sex, IdCard, PhoneNum, Img, UUID, Feature) ->
  UuidTabName = sys_o_tables_esql:searchUuidWithTabName(TableName),
  case UuidTabName of
    "" ->
      Ret = {aborted, {add_error, tableNotExits}};
    _ ->
      Ret = updatePersonDataWithUuid(UuidTabName, syncTool:change2Str(PersonName), syncTool:change2Str(Age),
        syncTool:change2Str(Sex), syncTool:change2Str(IdCard), syncTool:change2Str(PhoneNum),
        syncTool:change2Str(Img), syncTool:change2Str(UUID), syncTool:change2Str(Feature))
  end,
  Ret.
 
updatePersonDataWithUuid(Tableuuid, PersonName, Age, Sex, IdCard, PhoneNum, Img, UUID, Feature) ->
  R1 = person_info_feature_esql:upd_personFea(UUID, Tableuuid, Feature, Img),
  case R1 of
    '' ->
      Res = '';
    _ ->
      R2 = person_info_esql:upd_personInfo(Tableuuid, UUID, PersonName, Age, Sex, IdCard, PhoneNum),
      case R2 of
        '' -> Res = '';
        _ -> Res = UUID
      end
  end,
  Res.
 
loopAddPersonData(TableName, []) ->
  [];
loopAddPersonData(TableName, [Value | T]) ->
  PersonId = element(1, Value),
  IdCard = element(2, Value),
  PersonPic = element(3, Value),
  PersonFea = element(4, Value),
  Persons = person_info_feature_esql:findPersonFea(TableName, PersonId),
  PerNum = length(Persons),
 
  if
    PerNum =< 0 ->
%%      无此id则添加
      Tmp = addPersonDataWithUuid(TableName, "", "", "", IdCard, "", PersonPic, PersonId, PersonFea),
      case Tmp of
        '' ->
%%          添加失败
          io:format("Tmp is null ~p", [Tmp]),
          Result = [{"PersonId", PersonId}, {"Result", "-1"}, {"msg", "error"}];
        {aborted, Message} ->
%%          添加失败
          io:format("Tmp is aborted ~p", [Message]),
          Result = [{"PersonId", PersonId}, {"Result", "-1"}, {"msg", "error"}];
        _ ->
%%          添加成功
          io:format("add ~p ok,~p", [PersonId, Tmp]),
          Result = [{"PersonId", PersonId}, {"Result", "0"}, {"msg", "sucess"}]
      end;
    PerNum > 0 ->
%%      有此id则进行更新
      Ret = updatePersonDataWithUuid(TableName, "", "", "", IdCard, "", PersonPic, PersonId, PersonFea),
      case Ret of
        '' ->
%%          更新失败
          Result = [{"PersonId", PersonId}, {"Result", "-1"}, {"msg", "error"}];
        _ ->
%%          更新成功
          Result = [{"PersonId", PersonId}, {"Result", "1"}, {"msg", "sucess"}]
      end;
    true -> Result = [{"PersonId", PersonId}, {"Result", "-1"}, {"msg", "error"}]
  end,
  [Result | loopAddPersonData(TableName, T)].
 
addPersonDatas(TableId, PersonLists) ->
%%todo
  io:format("TableId is ~p, PersonLists is ~p", [TableId, PersonLists]),
  TmpRes = sys_o_tables_esql:tableIsExist(TableId),
  case TmpRes of
    true ->
      io:format("loopAddPersonData"),
      Res = loopAddPersonData(TableId, PersonLists);
    false ->
      io:format("Table is not is Exist ~p", [TableId]),
      Res = [[{"Result", "0"}, {"msg", "notexist"}]];
    error ->
      io:format("addPersonDatas is error ~p", [TableId]),
      Res = [[{"Result", "-1"}, {"msg", "error"}]]
  end,
  Res.
 
 
loadFaceFeaData(TableName) ->
  UuidTabName = sys_o_tables_esql:searchUuidWithTabName(TableName),
  person_info_feature_esql:loadFaceFeaData(UuidTabName).
 
loadFaceFeaData2(TableName) ->
  UuidTabName = sys_o_tables_esql:searchUuidWithTabName(TableName),
  person_info_esql:findAllpersonInfoNotFea(UuidTabName).
 
 
%%todo
 
 
searchSignalTabHavePerUid(PersonId, []) ->
  [];
searchSignalTabHavePerUid(PersonId, [TN | T]) ->
  io:format("table rec is  ~p ", [TN]),
  [TabUuidTup | Tmp] = TN,
  [CluTup | Tmp1] = Tmp,
  [TableNameTup | Tmp2] = Tmp1,
  TableUUid = syncTool:change2Str(element(2, TabUuidTup)),
  TableName = element(2, TableNameTup),
  Records = person_info_esql:findPersonInfo(TableUUid, PersonId),
  case Records of
    [] ->
      TemMaps = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "uuid"=>"null"};
    _ ->
      [TRco | TRecords] = Records,
      [PerUid | PerTemp] = TRco,
      io:format("TRco is  ~p ", [TRco]),
      TemMaps = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "uuid"=>element(2, PerUid)}
  end,
  [maps:to_list(TemMaps) | searchSignalTabHavePerUid(PersonId, T)].
 
%% 判断集群内某人是否存在
singlePersonIsExists(PersonId) ->
  TableLists = sys_o_tables_esql:findAllSysTableInfo(),
  Res = searchSignalTabHavePerUid(syncTool:change2Str(PersonId), TableLists),
%%  io:format("singlePersonIsExists Res is ~p~n", [Res]),
  Res.
 
 
testFunc2(NewPerId, OldId, Idcard, PerPicUrl, PerFea, []) ->
  [];
testFunc2(NewPerId, OldId, Idcard, PerPicUrl, PerFea, [TableRec | T]) ->
  io:format("table is  ~p ~n", [TableRec]),
  [TabNameTup | Tmp] = TableRec,
  [CluTup | Tmp1] = Tmp,
  [TableNameTup | Tmp2] = Tmp1,
  TableUUid = syncTool:change2Str(element(2, TabNameTup)),
  TableName = syncTool:change2Str(element(2, TableNameTup)),
  OldRecords = person_info_esql:findPersonInfo(TableUUid, OldId),
 
  case OldRecords of
    [] ->
%%      old not have rec
%%      ResRetMaps = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"notexist", "oldId"=>OldId},
      NewRecords = person_info_esql:findPersonInfo(TableUUid, NewPerId),
      case NewRecords of
        [] ->
          io:format("~p have no newId ~p ~n", [TableUUid, NewPerId]),
%%      new not have rec
          ResRetMaps1 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"notexist", "oldId"=>OldId};
        _ ->
%%      new  have rec
          io:format("~p have newId ~p ~n", [TableUUid, NewPerId]),
%%        del new And old ,Add new
          DelNewPerIdRet = delPersonDataWithUuid(TableUUid, NewPerId),
          case DelNewPerIdRet of
            [{atomic, ok}] ->
%%         add new
              AddNewRet = addPersonDataWithUuid(TableUUid, "", "", "", Idcard, "", PerPicUrl, NewPerId, PerFea),
              case AddNewRet of
                {aborted, Message} ->
                  ResRetMaps112 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId};
                '' ->
                  ResRetMaps112 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId};
                _ ->
                  ResRetMaps112 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"true", "oldId"=>OldId}
              end,
              ResRetMaps11 = ResRetMaps112;
            _ ->
              ResRetMaps11 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId}
          end,
          ResRetMaps1 = ResRetMaps11
      end,
      ResRetMaps = ResRetMaps1;
    _ ->
%%      old have rec
      io:format("~p have no OldId ~p ~n", [TableUUid, OldId]),
%%      search new
      NewRecords = person_info_esql:findPersonInfo(TableUUid, NewPerId),
      case NewRecords of
        [] ->
%%      new not have rec
          DelNewPerIdRet = [{atomic, ok}];
        _ ->
%%      new  have rec
          io:format("~p have no newId ~p ~n", [TableUUid, NewPerId]),
%%        del new And old ,Add new
          DelNewPerIdRet = delPersonDataWithUuid(TableUUid, NewPerId),
          io:format("~p  ~p will delete oldId record~n", [TableUUid, OldId])
      end,
      case DelNewPerIdRet of
        [{atomic, ok}] ->
%%         add new, del old
          AddNewRet = addPersonDataWithUuid(TableUUid, "", "", "", Idcard, "", PerPicUrl, NewPerId, PerFea),
          case AddNewRet of
            {aborted, Message} ->
              ResRetMaps21 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId};
            '' ->
              ResRetMaps21 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId};
            _ ->
              DelOldRet = delPersonDataWithUuid(TableUUid, OldId),
              io:format("~p  ~p will delete oldId record,Ret is ~p~n", [TableUUid, OldId, DelOldRet]),
              case DelOldRet of
                {atomic, ok} ->
                  ResRetMaps211 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"true", "oldId"=>OldId};
                _ ->
                  ResRetMaps211 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId}
              end,
              ResRetMaps21 = ResRetMaps211
          end,
          ResRetMaps2 = ResRetMaps21;
        _ ->
          ResRetMaps2 = #{"tableName"=>TableName, "tableUuid"=>TableUUid, "result"=>"false", "oldId"=>OldId}
      end,
      ResRetMaps = ResRetMaps2
  end,
  [maps:to_list(ResRetMaps) | testFunc2(NewPerId, OldId, Idcard, PerPicUrl, PerFea, T)].
 
singlePersonUpdate(NewPerId, OldId, Idcard, PerPicUrl, PerFea) ->
  io:format("NewPerId is ~p, OldId is ~p, Idcard is ~p, PerPicUrl is ~p, PerFea is ~p,~n",
    [NewPerId, OldId, Idcard, PerPicUrl, PerFea]),
  TableLists = sys_o_tables_esql:findAllSysTableInfo(),
  testFunc2(syncTool:change2Str(NewPerId), syncTool:change2Str(OldId), syncTool:change2Str(Idcard),
    syncTool:change2Str(PerPicUrl), syncTool:change2Str(PerFea), TableLists).