【feat】增对TaskRelation和EventRelation。新增处理

This commit is contained in:
Kris 2025-07-04 11:01:03 +08:00
parent 006ceba211
commit 1ebbd67a73
2 changed files with 20 additions and 21 deletions

View File

@ -586,6 +586,9 @@ public class CommonServiceImpl implements CommonService {
fields.add("Who.type");
fields.add("What.type");
}
if ("TaskRelation".equals(api) || "EventRelation".equals(api)) {
fields.add("Relation.type");
}
DataObject dataObject = dataObjectService.getById(api);
if (dataObject != null && StringUtils.isNotBlank(dataObject.getExtraField())) {
fields.addAll(Arrays.asList(StringUtils.split(dataObject.getExtraField().replaceAll(StringUtils.SPACE, StringUtils.EMPTY), ",")));
@ -817,6 +820,7 @@ public class CommonServiceImpl implements CommonService {
log.info("check api:{}", apiName);
try {
boolean hasCreatedDate = false;
PartnerConnection connection = salesforceConnect.createConnect();
DataObject dataObject = dataObjectService.getById(apiName);
Date now = new Date();
@ -826,8 +830,6 @@ public class CommonServiceImpl implements CommonService {
List<Map<String, Object>> list = Lists.newArrayList();
DescribeSObjectResult dsr = connection.describeSObject(apiName);
String label = dsr.getLabel();
boolean isCustomObject = dsr.isCustom(); // 自定义对象才支持新增字段
boolean isUpdateable = dsr.isUpdateable(); // 对象本身是否可修改
List<DataField> fieldList = Lists.newArrayList();
List<String> fields = Lists.newArrayList();
String blobField = null;
@ -951,6 +953,14 @@ public class CommonServiceImpl implements CommonService {
list.add(LinkedMap1);
}
if ("TaskRelation".equals(apiName) || "EventRelation".equals(apiName)){
Map<String, Object> LinkedMap = Maps.newHashMap();
LinkedMap.put("type", "varchar(18)");
LinkedMap.put("comment", "relationId关联对象");
LinkedMap.put("name", "Relation_Type__c");
list.add(LinkedMap);
}
if ("ContentDocumentLink".equals(apiName)){
//文档关联表新增关联对象字段
Map<String, Object> LinkedMap = Maps.newHashMap();
@ -1025,9 +1035,6 @@ public class CommonServiceImpl implements CommonService {
update.setName(apiName);
update.setLastUpdateDate(endCreateDate);
update.setBlobField(blobField);
if(!isCustomObject && !isUpdateable){
update.setIsEditable(false);
}
dataObjectService.saveOrUpdate(update);
}
} finally {

View File

@ -767,23 +767,15 @@ public class DataImportNewServiceImpl implements DataImportNewService {
}
}
} else {
if (api.equals("Task") || api.equals("Event")) {
if ("WhatId_Type__c".equals(field) || "WhoId_Type__c".equals(field)){
Map<String, Object> m = customMapper.getById("new_id", String.valueOf(map.get(field)), value);
if (m != null && !m.isEmpty()) {
account.setField(field, m.get("new_id"));
}else {
String message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!";
EmailUtil.send("DataDump ERROR", message);
log.info(message);
return;
}
if ("WhatId_Type__c".equals(field) || "WhoId_Type__c".equals(field) || "Relation_Type__c".equals(field)){
Map<String, Object> m = customMapper.getById("new_id", String.valueOf(map.get(field)), value);
if (m != null && !m.isEmpty()) {
account.setField(field, m.get("new_id"));
}else {
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {
account.setField(field, DataUtil.localDataToSfData(dataField.getSfType(), value));
}else {
account.setField(field, map.get(field));
}
String message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!";
EmailUtil.send("DataDump ERROR", message);
log.info(message);
return;
}
}else {
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {