|
|
@@ -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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|