【feat】增对TaskRelation和EventRelation。新增处理
This commit is contained in:
parent
006ceba211
commit
1ebbd67a73
@ -586,6 +586,9 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
fields.add("Who.type");
|
fields.add("Who.type");
|
||||||
fields.add("What.type");
|
fields.add("What.type");
|
||||||
}
|
}
|
||||||
|
if ("TaskRelation".equals(api) || "EventRelation".equals(api)) {
|
||||||
|
fields.add("Relation.type");
|
||||||
|
}
|
||||||
DataObject dataObject = dataObjectService.getById(api);
|
DataObject dataObject = dataObjectService.getById(api);
|
||||||
if (dataObject != null && StringUtils.isNotBlank(dataObject.getExtraField())) {
|
if (dataObject != null && StringUtils.isNotBlank(dataObject.getExtraField())) {
|
||||||
fields.addAll(Arrays.asList(StringUtils.split(dataObject.getExtraField().replaceAll(StringUtils.SPACE, StringUtils.EMPTY), ",")));
|
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);
|
log.info("check api:{}", apiName);
|
||||||
try {
|
try {
|
||||||
boolean hasCreatedDate = false;
|
boolean hasCreatedDate = false;
|
||||||
|
|
||||||
PartnerConnection connection = salesforceConnect.createConnect();
|
PartnerConnection connection = salesforceConnect.createConnect();
|
||||||
DataObject dataObject = dataObjectService.getById(apiName);
|
DataObject dataObject = dataObjectService.getById(apiName);
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
@ -826,8 +830,6 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
List<Map<String, Object>> list = Lists.newArrayList();
|
List<Map<String, Object>> list = Lists.newArrayList();
|
||||||
DescribeSObjectResult dsr = connection.describeSObject(apiName);
|
DescribeSObjectResult dsr = connection.describeSObject(apiName);
|
||||||
String label = dsr.getLabel();
|
String label = dsr.getLabel();
|
||||||
boolean isCustomObject = dsr.isCustom(); // 自定义对象才支持新增字段
|
|
||||||
boolean isUpdateable = dsr.isUpdateable(); // 对象本身是否可修改
|
|
||||||
List<DataField> fieldList = Lists.newArrayList();
|
List<DataField> fieldList = Lists.newArrayList();
|
||||||
List<String> fields = Lists.newArrayList();
|
List<String> fields = Lists.newArrayList();
|
||||||
String blobField = null;
|
String blobField = null;
|
||||||
@ -951,6 +953,14 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
list.add(LinkedMap1);
|
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)){
|
if ("ContentDocumentLink".equals(apiName)){
|
||||||
//文档关联表新增关联对象字段
|
//文档关联表新增关联对象字段
|
||||||
Map<String, Object> LinkedMap = Maps.newHashMap();
|
Map<String, Object> LinkedMap = Maps.newHashMap();
|
||||||
@ -1025,9 +1035,6 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
update.setName(apiName);
|
update.setName(apiName);
|
||||||
update.setLastUpdateDate(endCreateDate);
|
update.setLastUpdateDate(endCreateDate);
|
||||||
update.setBlobField(blobField);
|
update.setBlobField(blobField);
|
||||||
if(!isCustomObject && !isUpdateable){
|
|
||||||
update.setIsEditable(false);
|
|
||||||
}
|
|
||||||
dataObjectService.saveOrUpdate(update);
|
dataObjectService.saveOrUpdate(update);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -767,23 +767,15 @@ public class DataImportNewServiceImpl implements DataImportNewService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (api.equals("Task") || api.equals("Event")) {
|
if ("WhatId_Type__c".equals(field) || "WhoId_Type__c".equals(field) || "Relation_Type__c".equals(field)){
|
||||||
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);
|
||||||
Map<String, Object> m = customMapper.getById("new_id", String.valueOf(map.get(field)), value);
|
if (m != null && !m.isEmpty()) {
|
||||||
if (m != null && !m.isEmpty()) {
|
account.setField(field, m.get("new_id"));
|
||||||
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;
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {
|
String message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!";
|
||||||
account.setField(field, DataUtil.localDataToSfData(dataField.getSfType(), value));
|
EmailUtil.send("DataDump ERROR", message);
|
||||||
}else {
|
log.info(message);
|
||||||
account.setField(field, map.get(field));
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {
|
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user