From fa06bd64705ccc0e95eaf8818e583ba931118503 Mon Sep 17 00:00:00 2001
From: xc <xucheng@yyigou.com>
Date: Mon, 07 Dec 2020 10:44:10 +0800
Subject: [PATCH] 日志完整

---
 src/main/java/com/hbbh/adapter/covert/PointConvert.java         |   12 ----
 /dev/null                                                       |   55 ------------------
 src/main/java/com/hbbh/adapter/manager/impl/DataSourceImpl.java |   23 ++++++-
 src/main/java/com/hbbh/adapter/utils/SearchConditionUtil.java   |    1 
 src/main/java/com/hbbh/adapter/utils/EmptyUtils.java            |   55 ++++++++++++++++++
 5 files changed, 75 insertions(+), 71 deletions(-)

diff --git a/src/main/java/com/hbbh/adapter/covert/PointConvert.java b/src/main/java/com/hbbh/adapter/covert/PointConvert.java
index 71723cf..c55ebf8 100644
--- a/src/main/java/com/hbbh/adapter/covert/PointConvert.java
+++ b/src/main/java/com/hbbh/adapter/covert/PointConvert.java
@@ -1,7 +1,6 @@
 package com.hbbh.adapter.covert;
 import com.google.common.collect.Lists;
 
-import com.hbbh.adapter.dto.SMSDto;
 import com.hbbh.adapter.pojo.Point;
 import com.hbbh.adapter.pojo.golden.*;
 import com.hbbh.adapter.utils.DateUtil;
@@ -13,17 +12,6 @@
 import java.util.List;
 
 public class PointConvert {
-
-    public static SMSDto targetToSMSDto(MinPoint minPoint){
-        SMSDto sMSDto = new SMSDto();
-        sMSDto.setId(minPoint.getId());
-        sMSDto.setTagName(minPoint.getTagName());
-        sMSDto.setDesc(minPoint.getDesc());
-        sMSDto.setValueType(minPoint.getValueType());
-        sMSDto.setTagType(minPoint.getTagType());
-        //sMSDto.setTimestamp();
-        return sMSDto;
-    }
 
 
     public static List<Point> fullpointsToPointEntity(List<FullPoint> fullPoints) {
diff --git a/src/main/java/com/hbbh/adapter/dto/SMSDto.java b/src/main/java/com/hbbh/adapter/dto/SMSDto.java
deleted file mode 100644
index 6d8efaf..0000000
--- a/src/main/java/com/hbbh/adapter/dto/SMSDto.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.hbbh.adapter.dto;
-
-import com.rtdb.model.MinPoint;
-import lombok.Data;
-
-import java.io.Serializable;
-
-@Data
-@Deprecated
-public class SMSDto extends MinPoint implements Serializable {
-
-    private String tableName;
-}
diff --git a/src/main/java/com/hbbh/adapter/enums/StockoutBillEnum.java b/src/main/java/com/hbbh/adapter/enums/StockoutBillEnum.java
deleted file mode 100644
index 34aeeee..0000000
--- a/src/main/java/com/hbbh/adapter/enums/StockoutBillEnum.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.hbbh.adapter.enums;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 枚举类型
- *
- * @author
- */
-@Deprecated
-public enum StockoutBillEnum {
-
-    ysh("ysh", "已收货"),
-    dsh("dsh", "待收货"),
-    unviewed("unviewed", "待审核"),
-    reviewed("reviewed", "审核通过"),
-    qx("qx", "已取消"),
-    ;
-
-    private final String value;
-
-    private final String name;
-
-
-    StockoutBillEnum(String value, String name) {
-        this.value = value;
-        this.name = name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    private static Map<String, StockoutBillEnum> maps = new HashMap<>();
-
-    static {
-        for (StockoutBillEnum item : StockoutBillEnum.values()) {
-            maps.put(item.getValue(), item);
-        }
-    }
-
-    public static StockoutBillEnum getByType(final String value) {
-        if (value == null) {
-            return null;
-        }
-        return maps.get(value);
-    }
-
-}
diff --git a/src/main/java/com/hbbh/adapter/manager/impl/DataSourceImpl.java b/src/main/java/com/hbbh/adapter/manager/impl/DataSourceImpl.java
index 3fd6d76..97ad6ec 100644
--- a/src/main/java/com/hbbh/adapter/manager/impl/DataSourceImpl.java
+++ b/src/main/java/com/hbbh/adapter/manager/impl/DataSourceImpl.java
@@ -8,6 +8,7 @@
 import com.hbbh.adapter.manager.DataSource;
 import com.hbbh.adapter.pojo.Point;
 import com.hbbh.adapter.pojo.golden.*;
+import com.hbbh.adapter.utils.EmptyUtils;
 import com.hbbh.adapter.utils.SearchConditionUtil;
 import com.rtdb.enums.DataSort;
 import com.rtdb.model.Entity;
@@ -135,8 +136,25 @@
 
 
     public void insert(String flag, List<Point> point) {
-        log.info("golden 中 表 ----> {}  正在构建数据...");
+        if (EmptyUtils.isEmpty(flag)) {
+            log.info("golden 中 未获取到表信息 -->{}", flag);
+            return;
+        }
+        if (point.size()==0) {
+            log.info("golden 中 表 ----> {}  没有数据", flag);
+            return;
+        }
+
+        log.info("golden 中 表 ----> {}  正在构建数据...",flag);
         TableEnum byType = TableEnum.getByType(flag);
+
+        //TODO:部分表未介入
+        if (EmptyUtils.isEmpty(byType)){
+            log.info("golden 中 表 ----> {}  暂未介入adapter程序中", flag);
+            return;
+        }
+
+
 
         switch (byType) {
             case SMS:
@@ -169,9 +187,8 @@
                     ktnz2CPlcDao.saveAndFlush(data);
                 });
                 break;
-            default:
-                //TODO:剩下表构建
         }
+        log.info("golden 中 表 ----> {}  构建数据成功",flag);
 
     }
 }
diff --git a/src/main/java/com/hbbh/adapter/utils/EmptyUtils.java b/src/main/java/com/hbbh/adapter/utils/EmptyUtils.java
new file mode 100644
index 0000000..43bcbe6
--- /dev/null
+++ b/src/main/java/com/hbbh/adapter/utils/EmptyUtils.java
@@ -0,0 +1,55 @@
+package com.hbbh.adapter.utils;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * <pre>
+ *     author: Blankj
+ *     blog  : http://blankj.com
+ *     time  : 2016/9/28
+ *     desc  : 判空相关工具类
+ * </pre>
+ */
+public class EmptyUtils {
+
+    private EmptyUtils() {
+        throw new UnsupportedOperationException("u can't instantiate me...");
+    }
+
+    /**
+     * 判断对象是否为空
+     *
+     * @param obj 对象
+     * @return {@code true}: 为空<br>{@code false}: 不为空
+     */
+    public static boolean isEmpty(Object obj) {
+        if (obj == null) {
+            return true;
+        }
+        if (obj instanceof String && obj.toString().length() == 0) {
+            return true;
+        }
+        if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
+            return true;
+        }
+        if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
+            return true;
+        }
+        if (obj instanceof Map && ((Map) obj).isEmpty()) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 判断对象是否非空
+     *
+     * @param obj 对象
+     * @return {@code true}: 非空<br>{@code false}: 空
+     */
+    public static boolean isNotEmpty(Object obj) {
+        return !isEmpty(obj);
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/hbbh/adapter/utils/SearchConditionUtil.java b/src/main/java/com/hbbh/adapter/utils/SearchConditionUtil.java
index 41a3d80..edf599f 100644
--- a/src/main/java/com/hbbh/adapter/utils/SearchConditionUtil.java
+++ b/src/main/java/com/hbbh/adapter/utils/SearchConditionUtil.java
@@ -1,6 +1,5 @@
 package com.hbbh.adapter.utils;
 
-import com.hbbh.adapter.dto.SMSDto;
 import com.rtdb.model.SearchCondition;
 import com.rtdb.model.SearchConditionTotal;
 

--
Gitblit v1.9.1