diff --git a/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java b/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java index 60e7f87..ffa7b43 100644 --- a/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java +++ b/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java @@ -878,10 +878,10 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { continue; } Map m = customMapper.getById("new_id", reference_to, value); - if (m != null && !m.isEmpty()) { + if (!m.isEmpty() && m.get("new_id") != null) { account.put(field, m.get("new_id")); }else { - message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + reference_to + "的数据:"+ map.get(field) +"不存在!"; + message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + reference_to + "的数据:"+ map.get(field) +"异常!"; List> maps = new ArrayList<>(); Map linkMap = new HashMap<>(); linkMap.put("key", "is_update"); @@ -1336,10 +1336,10 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { } Map m = customMapper.getById("new_id", reference_to, data.get(j - 1).get(dataField.getField()).toString()); - if (m != null && !m.isEmpty()) { + if (!m.isEmpty() && m.get("new_id") != null) { account.put(dataField.getField(), m.get("new_id")); }else { - message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(dataField.getField()) +"不存在!"; + message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(dataField.getField()) +"异常!"; log.info(message); break; } @@ -1353,6 +1353,12 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { } } if (message!=null){ + List> maps = new ArrayList<>(); + Map linkMap1 = new HashMap<>(); + linkMap1.put("key", "error_message"); + linkMap1.put("value", message); + maps.add(linkMap1); + customMapper.updateById(api, maps, data.get(j-1).get("Id").toString()); continue; } if (dataObject.getIsEditable()) { @@ -1454,12 +1460,12 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { for (int j = 1; j <= size; j++) { JSONObject account = new JSONObject(); - for (DataField dataField : list) { + String message = null; + for (DataField dataField : list) { if ("Owner_Type".equals(dataField.getField()) || "Id".equals(dataField.getField())){ continue; } - if (dataField.getIsCreateable() !=null && dataField.getIsCreateable()) { if ("reference".equals(dataField.getSfType()) && data.get(j - 1).get(dataField.getField()) != null){ //引用类型 @@ -1485,7 +1491,7 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { if (m != null && !m.isEmpty()) { account.put(dataField.getField(), m.get("new_id")); }else { - String message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(dataField.getField()) +"不存在!"; + message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(dataField.getField()) +"异常!"; EmailUtil.send("DataDump ERROR", message); log.info(message); return; @@ -1498,7 +1504,16 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { } } } + } + if (message!=null){ + List> maps = new ArrayList<>(); + Map linkMap1 = new HashMap<>(); + linkMap1.put("key", "error_message"); + linkMap1.put("value", message); + maps.add(linkMap1); + customMapper.updateById(api, maps, data.get(j-1).get("Id").toString()); + continue; } ids[j-1] = data.get(j-1).get("Id").toString(); diff --git a/src/main/java/com/celnet/datadump/service/impl/DataImportNewServiceImpl.java b/src/main/java/com/celnet/datadump/service/impl/DataImportNewServiceImpl.java index 7dc8990..33f8c7e 100644 --- a/src/main/java/com/celnet/datadump/service/impl/DataImportNewServiceImpl.java +++ b/src/main/java/com/celnet/datadump/service/impl/DataImportNewServiceImpl.java @@ -856,10 +856,10 @@ public class DataImportNewServiceImpl implements DataImportNewService { continue; } Map m = customMapper.getById("new_id", reference_to, value); - if (m != null && !m.isEmpty()) { + if (!m.isEmpty() && m.get("new_id") != null) { account.setField(field, m.get("new_id")); }else { - message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + reference_to + "的数据:"+ map.get(field) +"不存在!"; + message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + reference_to + "的数据:"+ map.get(field) +"异常!"; List> maps = new ArrayList<>(); Map linkMap = new HashMap<>(); linkMap.put("key", "is_update"); @@ -1038,8 +1038,10 @@ public class DataImportNewServiceImpl implements DataImportNewService { int j = 0; try { for (Map map : mapList) { + SObject account = new SObject(); account.setType(api); + String message = null; //给对象赋值 for (DataField dataField : list) { String field = dataField.getField(); @@ -1071,11 +1073,10 @@ public class DataImportNewServiceImpl implements DataImportNewService { continue; } Map m = customMapper.getById("new_id", reference_to, value); - if (m != null && !m.isEmpty()) { + if (!m.isEmpty() && m.get("new_id") != null) { account.setField(field, m.get("new_id")); }else { - String message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + reference_to + "的数据:"+ map.get(field) +"不存在!"; - EmailUtil.send("DataDump ERROR", message); + message = "对象类型:" + api + "的数据:"+ map.get("Id") +"的引用对象:" + reference_to + "的数据:"+ map.get(field) +"异常!"; log.info(message); break; } @@ -1088,6 +1089,15 @@ public class DataImportNewServiceImpl implements DataImportNewService { } } } + if (message!=null){ + List> maps = new ArrayList<>(); + Map linkMap1 = new HashMap<>(); + linkMap1.put("key", "error_message"); + linkMap1.put("value", message); + maps.add(linkMap1); + customMapper.updateById(api, maps, map.get("Id").toString()); + continue; + } if (dataObject.getIsEditable()){ account.setField("old_owner_id__c", map.get("OwnerId")); account.setField("old_sfdc_id__c", map.get("Id")); @@ -3495,10 +3505,10 @@ public class DataImportNewServiceImpl implements DataImportNewService { continue; } Map m = customMapper.getById("new_id", reference_to, value); - if (m != null && !m.isEmpty()) { + if (!m.isEmpty() && m.get("new_id") != null) { account.setField(field, m.get("new_id")); }else { - message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(field) +"不存在!"; + message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(field) +"异常!"; log.info(message); break; } @@ -3512,6 +3522,12 @@ public class DataImportNewServiceImpl implements DataImportNewService { } } if (message!=null){ + List> maps = new ArrayList<>(); + Map linkMap1 = new HashMap<>(); + linkMap1.put("key", "error_message"); + linkMap1.put("value", message); + maps.add(linkMap1); + customMapper.updateById(api, maps, data.get(j-1).get("Id").toString()); continue; } if (dataObject.getIsEditable()){ @@ -3724,10 +3740,10 @@ public class DataImportNewServiceImpl implements DataImportNewService { continue; } Map m = customMapper.getById("new_id", reference_to, value); - if (m != null && !m.isEmpty()) { + if (!m.isEmpty() && m.get("new_id") != null) { account.setField(field, m.get("new_id")); }else { - message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(field) +"不存在!"; + message = "对象类型:" + api + "的数据:"+ data.get(j - 1).get("Id") +"的引用对象:" + reference_to + "的数据:"+ data.get(j - 1).get(field) +"异常!"; log.info(message); break; } @@ -3741,6 +3757,12 @@ public class DataImportNewServiceImpl implements DataImportNewService { } } if (message != null){ + List> maps = new ArrayList<>(); + Map linkMap1 = new HashMap<>(); + linkMap1.put("key", "error_message"); + linkMap1.put("value", message); + maps.add(linkMap1); + customMapper.updateById(api, maps, data.get(j-1).get("Id").toString()); continue; } if (dataObject.getIsEditable()){