zhangjian 2 năm trước cách đây
mục cha
commit
3ef1ea7a93

+ 19 - 5
api/src/main/java/com/wx/application/gorse4j/Item.java

@@ -13,17 +13,20 @@ public class Item {
     private List<String> categories;
     private String timestamp;
     private String comment;
-
+    
+    private Integer score;
+    
     public Item() {
     }
 
-    public Item(String itemId, Boolean isHidden, List<String> labels, List<String> categories, String timestamp, String comment) {
+    public Item(String itemId, Boolean isHidden, List<String> labels, List<String> categories, String timestamp, String comment,Integer score) {
         this.itemId = itemId;
         this.isHidden = isHidden;
         this.labels = labels;
         this.categories = categories;
         this.timestamp = timestamp;
         this.comment = comment;
+        this.score = score;
     }
 
     @JsonProperty("ItemId")
@@ -56,16 +59,27 @@ public class Item {
         return comment;
     }
 
-    @Override
+    @JsonProperty("Score")
+    public Integer getScore() {
+		return score;
+	}
+
+	@Override
     public boolean equals(Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
         Item item = (Item) o;
-        return Objects.equals(itemId, item.itemId) && Objects.equals(isHidden, item.isHidden) && Objects.equals(labels, item.labels) && Objects.equals(categories, item.categories) && Objects.equals(timestamp, item.timestamp) && Objects.equals(comment, item.comment);
+        return Objects.equals(itemId, item.itemId) 
+        		&& Objects.equals(isHidden, item.isHidden) 
+        		&& Objects.equals(labels, item.labels) 
+        		&& Objects.equals(categories, item.categories) 
+        		&& Objects.equals(timestamp, item.timestamp) 
+        		&& Objects.equals(comment, item.comment)
+        		&& Objects.equals(score, item.score);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(itemId, isHidden, labels, categories, timestamp, comment);
+        return Objects.hash(itemId, isHidden, labels, categories, timestamp, comment, score);
     }
 }

+ 87 - 0
api/src/main/java/com/wx/application/nebula/graph/service/ImportGraphService.java

@@ -0,0 +1,87 @@
+package com.wx.application.nebula.graph.service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Vector;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.wx.application.core.entity.Entrys;
+import com.wx.application.core.entity.RiskUser;
+import com.wx.application.core.service.EntrysService;
+import com.wx.application.core.service.RiskUserService;
+import com.wx.application.nebula.graph.bean.NebulaVertex;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Service
+public class ImportGraphService {
+	
+	@Autowired
+    NebulaOperateService nebulaOperateService;
+	
+	@Autowired
+	RiskUserService riskUserService;
+	
+	@Autowired
+	EntrysService entrysService;
+	
+	public void iptUser() {
+		
+		List<RiskUser> riskUsers = riskUserService.queryList(new HashMap<>());
+		
+		List<NebulaVertex> list = new Vector<>();
+		
+		riskUsers.forEach(v-> {
+			NebulaVertex vertex = new NebulaVertex();
+			vertex.setTag("tag_252150072");
+			vertex.setVid(v.getFid());
+			
+			list.add(vertex);
+			
+			
+			if(list.size() > 2000) {
+				log.info("执行一次 节点导入 {}", list.size());
+				nebulaOperateService.insertTagAll("recom_gorse", "tag_252150072", list);
+				list.clear();
+			}
+		});
+		
+		if(list.size() > 0) {
+			log.info("执行一次 节点导入 {}", list.size());
+			nebulaOperateService.insertTagAll("recom_gorse", "tag_1412011336", list);
+			list.clear();
+		}
+	}
+	
+	public void iptentrys() {
+		
+		List<Entrys> entrys = entrysService.queryList(new HashMap<>());
+		
+		List<NebulaVertex> list = new Vector<>();
+		entrys.forEach(v-> {
+			NebulaVertex vertex = new NebulaVertex();
+			vertex.setTag("tag_1412011336");
+			vertex.setVid(v.getFid());
+			
+			list.add(vertex);
+			
+			if(list.size() > 2000) {
+				log.info("执行一次 节点导入 {}", list.size());
+				nebulaOperateService.insertTagAll("recom_gorse", "tag_1412011336", list);
+				list.clear();
+			}
+		});
+		
+		if(list.size() > 0) {
+			log.info("执行一次 节点导入 {}", list.size());
+			nebulaOperateService.insertTagAll("recom_gorse", "tag_1412011336", list);
+			list.clear();
+		}
+	}
+	
+	
+	
+}