畅捷通同步信息唯一键增加数据表id

畅捷通报表
YXY 1 year ago
parent 75dd0d70e1
commit 5b95cde03c

@ -354,7 +354,7 @@ public abstract class SyncAccountsJobAbstract {
//实际返回数据 //实际返回数据
rows = response.getRows(); rows = response.getRows();
if (!CollectionUtils.isEmpty(rows)) { if (!CollectionUtils.isEmpty(rows)) {
Map<String, String> existKeyMap = getExistKeyMap(cjtRequest, response.getColumns(), rows, context.getCjt()); Map<String, String> existKeyMap = getExistKeyMap(cjtRequest, response.getColumns(), rows, context.getCjt(),addRecordRequest);
//批量同步飞书 //批量同步飞书
List<String> errorCodeList = syncLarkBatch(response.getColumns(), rows, existKeyMap, addRecordRequest, context.getCjt(),context.getAsynchronous()); List<String> errorCodeList = syncLarkBatch(response.getColumns(), rows, existKeyMap, addRecordRequest, context.getCjt(),context.getAsynchronous());
if (!CollectionUtils.isEmpty(errorCodeList)) { if (!CollectionUtils.isEmpty(errorCodeList)) {
@ -374,7 +374,7 @@ public abstract class SyncAccountsJobAbstract {
} }
} }
private List<String> getUniqueKey(List<String> keyList, List<List<String>> rows, String cjt) { private List<String> getUniqueKey(List<String> keyList, List<List<String>> rows, String cjt, LarkTableRequest addRecordRequest ) {
//组成唯一键的集合 //组成唯一键的集合
List<String> uniqueFields = getUniqueFields(cjt); List<String> uniqueFields = getUniqueFields(cjt);
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
@ -386,7 +386,7 @@ public abstract class SyncAccountsJobAbstract {
midList.add(row.get(i)); midList.add(row.get(i));
} }
} }
String uniqueKey = String.join("_", midList).toUpperCase(); String uniqueKey = String.join("_", midList).toUpperCase() + addRecordRequest.getAppTable();
result.add(uniqueKey); result.add(uniqueKey);
} }
} }
@ -396,11 +396,11 @@ public abstract class SyncAccountsJobAbstract {
/** /**
* 使key * 使key
*/ */
protected Map<String, String> getExistKeyMap(CJTRequest req, List<String> keyList, List<List<String>> rows, String cjt) { protected Map<String, String> getExistKeyMap(CJTRequest req, List<String> keyList, List<List<String>> rows, String cjt, LarkTableRequest addRecordRequest) {
if (CollectionUtils.isEmpty(rows)) { if (CollectionUtils.isEmpty(rows)) {
return new HashMap<>(); return new HashMap<>();
} }
List<String> uniqueKeyList = getUniqueKey(keyList, rows, cjt); List<String> uniqueKeyList = getUniqueKey(keyList, rows, cjt,addRecordRequest);
if (CollectionUtils.isEmpty(uniqueKeyList)) { if (CollectionUtils.isEmpty(uniqueKeyList)) {
return new HashMap<>(); return new HashMap<>();
} }
@ -456,7 +456,7 @@ public abstract class SyncAccountsJobAbstract {
} }
body.put(larkLabel, this.changeValueType(value, cjtSyncTypeRelation)); body.put(larkLabel, this.changeValueType(value, cjtSyncTypeRelation));
} }
uniqueKey = String.join("_", uniqueKeyList).toUpperCase(); uniqueKey = String.join("_", uniqueKeyList).toUpperCase()+addRecordRequest.getAppTable();
if (repeatMap.containsKey(uniqueKey)) { if (repeatMap.containsKey(uniqueKey)) {
continue; continue;
} }

Loading…
Cancel
Save