|
|
@ -109,8 +109,8 @@ public abstract class OdooAbstrackob {
|
|
|
|
LarkTableRelation tableRelation = context.getTableRelation();
|
|
|
|
LarkTableRelation tableRelation = context.getTableRelation();
|
|
|
|
LarkTableRequest larkRequest = new LarkTableRequest(companyRelation.getAppId(), companyRelation.getSecret(), tableRelation.getToAppToken(), tableRelation.getToTableId());
|
|
|
|
LarkTableRequest larkRequest = new LarkTableRequest(companyRelation.getAppId(), companyRelation.getSecret(), tableRelation.getToAppToken(), tableRelation.getToTableId());
|
|
|
|
//待创建关联关系
|
|
|
|
//待创建关联关系
|
|
|
|
List<ErpLarkRelation> waitCreateRelation = new ArrayList<>();
|
|
|
|
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
|
|
|
|
List<ErpLarkRelation> waitCreateRelation = new ArrayList<>();
|
|
|
|
dateList = getDate(context, pageMap, errorList);
|
|
|
|
dateList = getDate(context, pageMap, errorList);
|
|
|
|
List<JSONObject> midDateList = dateList.stream().map(r -> {
|
|
|
|
List<JSONObject> midDateList = dateList.stream().map(r -> {
|
|
|
|
return (JSONObject)JSONObject.toJSON(r);
|
|
|
|
return (JSONObject)JSONObject.toJSON(r);
|
|
|
@ -121,15 +121,16 @@ public abstract class OdooAbstrackob {
|
|
|
|
sync(jsonObject, errorList, relationMap, larkRequest,waitCreateRelation);
|
|
|
|
sync(jsonObject, errorList, relationMap, larkRequest,waitCreateRelation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(waitCreateRelation)){
|
|
|
|
|
|
|
|
erpLarkRelationMapper.batchInsert(waitCreateRelation);
|
|
|
|
|
|
|
|
}
|
|
|
|
pageMap.put(PAGE_OFFSET_KEY,pageMap.get(PAGE_OFFSET_KEY) + PAGE_SIZE);
|
|
|
|
pageMap.put(PAGE_OFFSET_KEY,pageMap.get(PAGE_OFFSET_KEY) + PAGE_SIZE);
|
|
|
|
} while (dateList == null || (CollectionUtils.isNotEmpty(dateList) && dateList.size() == PAGE_SIZE));
|
|
|
|
} while (dateList == null || (CollectionUtils.isNotEmpty(dateList) && dateList.size() == PAGE_SIZE));
|
|
|
|
if (!CollectionUtils.isEmpty(errorList)) {
|
|
|
|
if (!CollectionUtils.isEmpty(errorList)) {
|
|
|
|
String errorKey = String.join(",", errorList);
|
|
|
|
String errorKey = String.join(",", errorList);
|
|
|
|
throw new RuntimeException(String.format("存在同步失败的记录 %s", errorKey));
|
|
|
|
throw new RuntimeException(String.format("存在同步失败的记录 %s", errorKey));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CollectionUtils.isNotEmpty(waitCreateRelation)){
|
|
|
|
|
|
|
|
erpLarkRelationMapper.batchInsert(waitCreateRelation);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void sync(JSONObject jsonObject, List<String> errorList
|
|
|
|
private void sync(JSONObject jsonObject, List<String> errorList
|
|
|
|