Compare commits

...

2 Commits

Author SHA1 Message Date
0df46cc022 Merge branch 'master' of http://nas.zhengjl.com:10880/wan/recom-gorse 2023-05-29 15:03:08 +08:00
3ef1ea7a93 修bug 2023-05-29 15:03:03 +08:00
2 changed files with 106 additions and 5 deletions

View File

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

View File

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