Compare commits
2 Commits
e7209d9684
...
bc9ed880ff
Author | SHA1 | Date | |
---|---|---|---|
bc9ed880ff | |||
723992f663 |
@ -247,7 +247,7 @@ public class DataImportBatchServiceImpl implements DataImportBatchService {
|
|||||||
maxIndex.ne("name", api);
|
maxIndex.ne("name", api);
|
||||||
Map<String, Object> map = dataObjectService.getMap(maxIndex);
|
Map<String, Object> map = dataObjectService.getMap(maxIndex);
|
||||||
//如果必填lookup字段没有值,跳过
|
//如果必填lookup字段没有值,跳过
|
||||||
update.setDataIndex(Integer.parseInt(map.get("data_index").toString()+1));
|
update.setDataIndex(Integer.parseInt(map.get("data_index").toString()) + 1);
|
||||||
dataObjectService.updateById(update);
|
dataObjectService.updateById(update);
|
||||||
String message = "api:" + api + "的引用对象:" + reference + "不存在数据!";
|
String message = "api:" + api + "的引用对象:" + reference + "不存在数据!";
|
||||||
String format = String.format("数据导入 error, api name: %s, \nparam: %s, \ncause:\n%s", api, com.alibaba.fastjson2.JSON.toJSONString(param, DataDumpParam.getFilter()), message);
|
String format = String.format("数据导入 error, api name: %s, \nparam: %s, \ncause:\n%s", api, com.alibaba.fastjson2.JSON.toJSONString(param, DataDumpParam.getFilter()), message);
|
||||||
@ -538,13 +538,6 @@ public class DataImportBatchServiceImpl implements DataImportBatchService {
|
|||||||
if (m != null && !m.isEmpty()) {
|
if (m != null && !m.isEmpty()) {
|
||||||
account.put(field, m.get("new_id"));
|
account.put(field, m.get("new_id"));
|
||||||
}else {
|
}else {
|
||||||
QueryWrapper<DataObject> maxIndex = new QueryWrapper<>();
|
|
||||||
maxIndex.select("IFNULL(max(data_index),0) as data_index");
|
|
||||||
maxIndex.ne("name", api);
|
|
||||||
Map<String, Object> mapTo = dataObjectService.getMap(maxIndex);
|
|
||||||
//如果必填lookup字段没有值,跳过
|
|
||||||
update.setDataIndex(Integer.parseInt(mapTo.get("data_index").toString()+1));
|
|
||||||
dataObjectService.updateById(update);
|
|
||||||
String message = "对象类型:" + api + "的数据:"+ m.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!"; String format = String.format("数据导入 error, api name: %s, \nparam: %s, \ncause:\n%s", api, com.alibaba.fastjson2.JSON.toJSONString(param, DataDumpParam.getFilter()), message);
|
String message = "对象类型:" + api + "的数据:"+ m.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!"; String format = String.format("数据导入 error, api name: %s, \nparam: %s, \ncause:\n%s", api, com.alibaba.fastjson2.JSON.toJSONString(param, DataDumpParam.getFilter()), message);
|
||||||
EmailUtil.send("DataDump ERROR", format);
|
EmailUtil.send("DataDump ERROR", format);
|
||||||
log.info(message);
|
log.info(message);
|
||||||
@ -553,7 +546,9 @@ public class DataImportBatchServiceImpl implements DataImportBatchService {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {
|
if (map.get(field) != null && StringUtils.isNotBlank(dataField.getSfType())) {
|
||||||
account.put(field, DataUtil.localDataToSfData(dataField.getSfType(), String.valueOf(map.get(field))));
|
|
||||||
|
|
||||||
|
account.put(field, DataUtil.localBulkDataToSfData(dataField.getSfType(), String.valueOf(map.get(field))));
|
||||||
}else {
|
}else {
|
||||||
account.put(field, map.get(field));
|
account.put(field, map.get(field));
|
||||||
}
|
}
|
||||||
|
@ -758,13 +758,6 @@ public class DataImportNewServiceImpl implements DataImportNewService {
|
|||||||
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 {
|
}else {
|
||||||
QueryWrapper<DataObject> maxIndex = new QueryWrapper<>();
|
|
||||||
maxIndex.select("IFNULL(max(data_index),0) as data_index");
|
|
||||||
maxIndex.ne("name", api);
|
|
||||||
Map<String, Object> mapTo = dataObjectService.getMap(maxIndex);
|
|
||||||
//如果必填lookup字段没有值,跳过
|
|
||||||
update.setDataIndex(Integer.parseInt(mapTo.get("data_index").toString()) +1);
|
|
||||||
dataObjectService.updateById(update);
|
|
||||||
String message = "对象类型:" + api + "的数据:"+ m.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!"; String format = String.format("数据导入 error, api name: %s, \nparam: %s, \ncause:\n%s", api, com.alibaba.fastjson2.JSON.toJSONString(param, DataDumpParam.getFilter()), message);
|
String message = "对象类型:" + api + "的数据:"+ m.get("Id") +"的引用对象:" + dataField.getReferenceTo() + "的数据:"+ map.get(field) +"不存在!"; String format = String.format("数据导入 error, api name: %s, \nparam: %s, \ncause:\n%s", api, com.alibaba.fastjson2.JSON.toJSONString(param, DataDumpParam.getFilter()), message);
|
||||||
EmailUtil.send("DataDump ERROR", format);
|
EmailUtil.send("DataDump ERROR", format);
|
||||||
log.info(message);
|
log.info(message);
|
||||||
|
@ -309,9 +309,8 @@ public class DataImportServiceImpl implements DataImportService {
|
|||||||
maxIndex.select("IFNULL(max(data_index),0) as data_index");
|
maxIndex.select("IFNULL(max(data_index),0) as data_index");
|
||||||
maxIndex.ne("name", api);
|
maxIndex.ne("name", api);
|
||||||
Map<String, Object> map = dataObjectService.getMap(maxIndex);
|
Map<String, Object> map = dataObjectService.getMap(maxIndex);
|
||||||
|
|
||||||
//如果必填lookup字段没有值,跳过
|
//如果必填lookup字段没有值,跳过
|
||||||
update.setDataIndex(Integer.parseInt(map.get("data_index").toString()+1));
|
update.setDataIndex(Integer.parseInt(map.get("data_index").toString()) + 1);
|
||||||
dataObjectService.updateById(update);
|
dataObjectService.updateById(update);
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
|
@ -169,11 +169,12 @@ public class FileManagerServiceImpl implements FileManagerService {
|
|||||||
for (Map<String, Object> map1 : poll) {
|
for (Map<String, Object> map1 : poll) {
|
||||||
if ("FILE_DOWNLOAD_URL".equals(map1.get("code"))) {
|
if ("FILE_DOWNLOAD_URL".equals(map1.get("code"))) {
|
||||||
downloadUrl = (String) map1.get("value");
|
downloadUrl = (String) map1.get("value");
|
||||||
}else {
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(downloadUrl)) {
|
||||||
EmailUtil.send("DumpFile ERROR", "文件下载失败!下载地址未配置");
|
EmailUtil.send("DumpFile ERROR", "文件下载失败!下载地址未配置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
String url = downloadUrl + String.format(Const.SF_RICH_TEXT_FILE_URL, objectApi, recordId, fieldApi, fieldId);
|
String url = downloadUrl + String.format(Const.SF_RICH_TEXT_FILE_URL, objectApi, recordId, fieldApi, fieldId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -307,11 +308,12 @@ public class FileManagerServiceImpl implements FileManagerService {
|
|||||||
for (Map<String, Object> map1 : poll) {
|
for (Map<String, Object> map1 : poll) {
|
||||||
if ("FILE_UPLOAD_URL".equals(map1.get("code"))) {
|
if ("FILE_UPLOAD_URL".equals(map1.get("code"))) {
|
||||||
uploadUrl = (String) map1.get("value");
|
uploadUrl = (String) map1.get("value");
|
||||||
}else {
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(uploadUrl)) {
|
||||||
EmailUtil.send("UploadFile ERROR", "文件上传失败!上传地址未配置");
|
EmailUtil.send("UploadFile ERROR", "文件上传失败!上传地址未配置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 拼接url
|
// 拼接url
|
||||||
String url = uploadUrl + String.format(Const.SF_UPLOAD_RICH_TEXT_FILE_URL, objectApi, recordId);
|
String url = uploadUrl + String.format(Const.SF_UPLOAD_RICH_TEXT_FILE_URL, objectApi, recordId);
|
||||||
|
@ -139,11 +139,12 @@ public class FileServiceImpl implements FileService {
|
|||||||
for (Map<String, Object> map1 : poll) {
|
for (Map<String, Object> map1 : poll) {
|
||||||
if ("FILE_DOWNLOAD_URL".equals(map1.get("code"))) {
|
if ("FILE_DOWNLOAD_URL".equals(map1.get("code"))) {
|
||||||
downloadUrl = (String) map1.get("value");
|
downloadUrl = (String) map1.get("value");
|
||||||
}else {
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(downloadUrl)) {
|
||||||
EmailUtil.send("DumpFile ERROR", "文件下载失败!下载地址未配置");
|
EmailUtil.send("DumpFile ERROR", "文件下载失败!下载地址未配置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log.info("dump file api:{}, field:{}", api, field);
|
log.info("dump file api:{}, field:{}", api, field);
|
||||||
PartnerConnection connect = salesforceConnect.createConnect();
|
PartnerConnection connect = salesforceConnect.createConnect();
|
||||||
String token = connect.getSessionHeader().getSessionId();
|
String token = connect.getSessionHeader().getSessionId();
|
||||||
@ -431,17 +432,17 @@ public class FileServiceImpl implements FileService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uploadFile(String api, String field, Boolean singleThread) {
|
public void uploadFile(String api, String field, Boolean singleThread) {
|
||||||
|
|
||||||
String uploadUrl = null;
|
String uploadUrl = null;
|
||||||
List<Map<String, Object>> poll = customMapper.list("code,value","org_config",null);
|
List<Map<String, Object>> poll = customMapper.list("code,value","org_config",null);
|
||||||
for (Map<String, Object> map1 : poll) {
|
for (Map<String, Object> map1 : poll) {
|
||||||
if ("FILE_UPLOAD_URL".equals(map1.get("code"))) {
|
if ("FILE_UPLOAD_URL".equals(map1.get("code"))) {
|
||||||
uploadUrl = (String) map1.get("value");
|
uploadUrl = (String) map1.get("value");
|
||||||
}else {
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(uploadUrl)) {
|
||||||
EmailUtil.send("UploadFile ERROR", "文件上传失败!上传地址未配置");
|
EmailUtil.send("UploadFile ERROR", "文件上传失败!上传地址未配置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
log.info("upload file api:{}, field:{}", api, field);
|
log.info("upload file api:{}, field:{}", api, field);
|
||||||
PartnerConnection connect = salesforceTargetConnect.createConnect();
|
PartnerConnection connect = salesforceTargetConnect.createConnect();
|
||||||
@ -618,12 +619,12 @@ public class FileServiceImpl implements FileService {
|
|||||||
for (Map<String, Object> map1 : poll) {
|
for (Map<String, Object> map1 : poll) {
|
||||||
if ("FILE_UPLOAD_URL".equals(map1.get("code"))) {
|
if ("FILE_UPLOAD_URL".equals(map1.get("code"))) {
|
||||||
uploadUrl = (String) map1.get("value");
|
uploadUrl = (String) map1.get("value");
|
||||||
}else {
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(uploadUrl)) {
|
||||||
EmailUtil.send("UploadFile ERROR", "文件上传失败!上传地址未配置");
|
EmailUtil.send("UploadFile ERROR", "文件上传失败!上传地址未配置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
log.info("upload file api:{}, field:{}", api, field);
|
log.info("upload file api:{}, field:{}", api, field);
|
||||||
PartnerConnection connect = salesforceTargetConnect.createConnect();
|
PartnerConnection connect = salesforceTargetConnect.createConnect();
|
||||||
String token = connect.getSessionHeader().getSessionId();
|
String token = connect.getSessionHeader().getSessionId();
|
||||||
|
@ -392,6 +392,39 @@ public class DataUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object localBulkDataToSfData(String fieldType, String data) throws ParseException {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
|
Date date;
|
||||||
|
//date转Calendar类型
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
switch (fieldType) {
|
||||||
|
case "int":
|
||||||
|
return Integer.parseInt(data);
|
||||||
|
case "double":
|
||||||
|
case "currency":
|
||||||
|
case "percent":
|
||||||
|
return new BigDecimal(data);
|
||||||
|
case "boolean":
|
||||||
|
return Boolean.valueOf(data);
|
||||||
|
case "date":
|
||||||
|
return data+"T08:00:00Z";
|
||||||
|
case "datetime":
|
||||||
|
try {
|
||||||
|
date = sd.parse(data);
|
||||||
|
}catch (ParseException e){
|
||||||
|
//解决当时间秒为0时,转换秒精度丢失问题
|
||||||
|
date = sd.parse(data+":00");
|
||||||
|
}
|
||||||
|
calendar.setTime(date);
|
||||||
|
return calendar;
|
||||||
|
case "time":
|
||||||
|
return adjustHour(data);
|
||||||
|
default:
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Object localDataToSfData(String fieldType, String data) throws ParseException {
|
public static Object localDataToSfData(String fieldType, String data) throws ParseException {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
|
Loading…
Reference in New Issue
Block a user