Browse Source

特征验证

丁云鹏 11 months ago
parent
commit
f4a88ff6ef

+ 16 - 3
recommend-feature-produce/src/main/java/com/tzld/piaoquan/recommend/feature/produce/FeatureDiff.java

@@ -84,10 +84,23 @@ public class FeatureDiff {
                 Map<String, String> metaFeatureMap = JSONUtils.fromJson(map.get("metafeaturemap"), new TypeToken<Map<String, String>>() {
                 }, Collections.emptyMap());
                 for (Map.Entry<String, String> e : tableToCol.entrySet()) {
-                    if (StringUtils.equals(map.get(e.getValue()), metaFeatureMap.get(e.getKey()))) {
-                        continue;
+                    Map<String, String> offline = JSONUtils.fromJson(map.get(e.getValue()), new TypeToken<Map<String, String>>() {
+                    }, Collections.emptyMap());
+
+                    Map<String, String> online = JSONUtils.fromJson(metaFeatureMap.get(e.getKey()), new TypeToken<Map<String,
+                            String>>() {
+                    }, Collections.emptyMap());
+
+
+                    if (offline.size() != online.size()) {
+                        return true;
+                    }
+
+                    for (Map.Entry<String, String> offlineE : offline.entrySet()) {
+                        if (!StringUtils.equals(online.get(offlineE.getKey()), offlineE.getKey())) {
+                            return true;
+                        }
                     }
-                    return true;
                 }
                 return false;
             }