From 996e977aa35d318bf9dc92e878261a2bd93b58b4 Mon Sep 17 00:00:00 2001 From: Kris <2893855659@qq.com> Date: Thu, 19 Jun 2025 11:35:20 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90feat=E3=80=91=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=A1=A8=E7=BB=93=E6=9E=84=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E5=AD=98=E9=87=8F=E6=95=B0=E6=8D=AE=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommonServiceImpl.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/celnet/datadump/service/impl/CommonServiceImpl.java b/src/main/java/com/celnet/datadump/service/impl/CommonServiceImpl.java index f1ec2f2..7ed5ce1 100644 --- a/src/main/java/com/celnet/datadump/service/impl/CommonServiceImpl.java +++ b/src/main/java/com/celnet/datadump/service/impl/CommonServiceImpl.java @@ -234,8 +234,8 @@ public class CommonServiceImpl implements CommonService { for (DataObject dataObject : dataObjects) { DataObject update = new DataObject(); TimeUnit.MILLISECONDS.sleep(1); + String api = dataObject.getName(); try { - String api = dataObject.getName(); log.info("dump apis: {}", api); XxlJobLogger.log("dump apis: {}", api); // 检测表是否存在 不存在创建 @@ -310,14 +310,16 @@ public class CommonServiceImpl implements CommonService { if (StringUtils.isNotBlank(dataObject.getBlobField())) { fileService.dumpFile(dataObject.getName(), dataObject.getBlobField(), true); } - update.setDataWork(0); } catch (Throwable e) { + String message = e.getMessage(); + 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); + //异常错误,移除所有线程 + salesforceExecutor.remove(futures.toArray(new Future[]{})); throw new RuntimeException(e); } finally { - if (dataObject != null) { - update.setDataLock(0); - dataObjectService.updateById(update); - } + update.setDataLock(0); + dataObjectService.updateById(update); } } // 等待当前所有线程执行完成 @@ -809,6 +811,8 @@ public class CommonServiceImpl implements CommonService { List> list = Lists.newArrayList(); DescribeSObjectResult dsr = connection.describeSObject(apiName); String label = dsr.getLabel(); + boolean isCustomObject = dsr.isCustom(); // 自定义对象才支持新增字段 + boolean isUpdateable = dsr.isUpdateable(); // 对象本身是否可修改 List fieldList = Lists.newArrayList(); List fields = Lists.newArrayList(); String blobField = null; @@ -1006,6 +1010,9 @@ public class CommonServiceImpl implements CommonService { update.setName(apiName); update.setLastUpdateDate(endCreateDate); update.setBlobField(blobField); + if(!isCustomObject && !isUpdateable){ + update.setIsEditable(false); + } dataObjectService.saveOrUpdate(update); } } finally { @@ -1023,7 +1030,13 @@ public class CommonServiceImpl implements CommonService { } log.info("打印所有待同步表:" +apis.toString()); for (String api : apis) { - checkApi(api, true); + try { + checkApi(api, true); + }catch (Exception e){ + String message = e.getMessage(); + 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); + } } return ReturnT.SUCCESS; }