【feat】 getContentDocumnetLink获取LinkType
This commit is contained in:
parent
0c78cafc84
commit
47fead11ad
@ -1103,29 +1103,29 @@ public class CommonServiceImpl implements CommonService {
|
||||
@Override
|
||||
public ReturnT<String> getDocumentLink(String paramStr) throws Exception {
|
||||
String api = "ContentDocumentLink";
|
||||
// PartnerConnection partnerConnection = salesforceConnect.createConnect();
|
||||
PartnerConnection partnerConnection = salesforceConnect.createConnect();
|
||||
PartnerConnection connection = salesforceTargetConnect.createConnect();
|
||||
List<Map<String, Object>> list = customMapper.list("Id", "ContentDocument", "new_id is not null");
|
||||
// DescribeSObjectResult dsr = partnerConnection.describeSObject(api);
|
||||
// List<String> fields = customMapper.getFields(api).stream().map(String::toUpperCase).collect(Collectors.toList());
|
||||
// Field[] dsrFields = dsr.getFields();
|
||||
DescribeSObjectResult dsr = partnerConnection.describeSObject(api);
|
||||
List<String> fields = customMapper.getFields(api).stream().map(String::toUpperCase).collect(Collectors.toList());
|
||||
Field[] dsrFields = dsr.getFields();
|
||||
try {
|
||||
if (list != null && list.size() > 0) {
|
||||
// for (Map<String, Object> map : list) {
|
||||
// String contentDocumentId = (String) map.get("Id");
|
||||
// String sql = "SELECT Id, LinkedEntityId, LinkedEntity.Type, ContentDocumentId, Visibility, ShareType, SystemModstamp, IsDeleted FROM ContentDocumentLink where ContentDocumentId = '" + contentDocumentId + "'";
|
||||
// JSONArray objects = null;
|
||||
// try {
|
||||
// QueryResult queryResult = partnerConnection.queryAll(sql);
|
||||
// SObject[] records = queryResult.getRecords();
|
||||
// objects = DataUtil.toJsonArray(records, dsrFields);
|
||||
// saveOrUpdate(api, fields, records, objects, true);
|
||||
// } catch (Throwable e) {
|
||||
// log.error("getDocumentLink error api:{}, data:{}", api, JSON.toJSONString(objects), e);
|
||||
// TimeUnit.MINUTES.sleep(1);
|
||||
// return ReturnT.FAIL;
|
||||
// }
|
||||
// }
|
||||
for (Map<String, Object> map : list) {
|
||||
String contentDocumentId = (String) map.get("Id");
|
||||
String sql = "SELECT Id, LinkedEntityId, LinkedEntity.Type, ContentDocumentId, Visibility, ShareType, SystemModstamp, IsDeleted FROM ContentDocumentLink where ContentDocumentId = '" + contentDocumentId + "'";
|
||||
JSONArray objects = null;
|
||||
try {
|
||||
QueryResult queryResult = partnerConnection.queryAll(sql);
|
||||
SObject[] records = queryResult.getRecords();
|
||||
objects = DataUtil.toJsonArray(records, dsrFields);
|
||||
saveOrUpdate(api, fields, records, objects, true);
|
||||
} catch (Throwable e) {
|
||||
log.error("getDocumentLink error api:{}, data:{}", api, JSON.toJSONString(objects), e);
|
||||
TimeUnit.MINUTES.sleep(1);
|
||||
return ReturnT.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
//表内数据总量
|
||||
Integer count = customMapper.countBySQL(api, "where ShareType = 'V' and new_id = '0'");
|
||||
@ -1148,7 +1148,7 @@ public class CommonServiceImpl implements CommonService {
|
||||
QueryWrapper<DataObject> qw = new QueryWrapper<>();
|
||||
qw.eq("name", linkedEntityType);
|
||||
List<DataObject> objects = dataObjectService.list(qw);
|
||||
if (objects.size() > 0) {
|
||||
if (!objects.isEmpty()) {
|
||||
Map<String, Object> dMap = customMapper.getById("new_id", "ContentDocument", contentDocumentId);
|
||||
Map<String, Object> lMap = customMapper.getById("new_id", linkedEntityType, linkedEntityId);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user