Browse Source

Merge branch 'small-tupu' of http://124.70.32.114:3100/jianzhenyu/Changsha_tupu into hanyuqing

hanyuqing
hanyuqing 5 months ago
parent
commit
c24fadd341
  1. 22
      gyxtp/src/view/pointInfo.vue
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyPointController.java
  3. 31
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/PointService.java
  4. 4
      ruoyi-api/src/main/resources/mapper/api/ZhyPointMapper.xml

22
gyxtp/src/view/pointInfo.vue

@ -51,10 +51,18 @@
<img src="../assets/img2/book2.png"
style="height: 100%;object-fit: contain;float: left;margin-right: 0.8vw;">
<div class="articleName" style="margin-right: 2px; " @click="goArticle(item[Object.keys(item)[0]])">{{ Object.keys(item)[0] }}</div>
</div>
<div v-if="pointInfo.type=='author'" style="margin-left: 2vw;: 11px 0px;font-size: 1.1vw">
<div style="display: flex">
出处
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.source}}</span>
</div>
</div>
<div style="display: flex">
中心词
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.keyword}}</span>
@ -77,6 +85,12 @@
</div>
<div v-if="pointInfo.type=='agency'" style="margin-left: 2vw;: 11px 0px;font-size: 1.1vw">
<div style="display: flex">
出处
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.source}}</span>
</div>
</div>
<div style="display: flex">
中心词
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.keyword}}</span>
@ -98,6 +112,12 @@
</div>
<div v-if="pointInfo.type=='keyword'" style="margin-left: 2vw;: 11px 0px;font-size: 1.1vw">
<div style="display: flex">
出处
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.keyword" >{{c.source}}</span>
</div>
</div>
<div style="display: flex">
作者
<div v-for="c in item[Object.keys(item)[0]]" style="font-size: 1.1vw">
<span v-if="c.author">{{c.author}}</span>

2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyPointController.java

@ -122,7 +122,7 @@ public class ZhyPointController extends BaseController
for (int i = 0; i < headers.length && i < row.length; i++) {
String key = headers[i].trim();
// 只保留你需要的字段
if (Arrays.asList("ck", "main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
if (Arrays.asList("ck", "main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls","source").contains(key)) {
rowMap.put(key, row[i]);
}
}

31
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/PointService.java

@ -61,6 +61,7 @@ public class PointService {
map.put("title",articles.get(i).getName());
map.put("authors",formatAuthorsWithAgencies(authors,agencies));
map.put("urls","");
// map.put("source",articles.get(i).getSourceName());
if (articles.get(i).getKeywords()==null){
map.put("keywords","");
}else{
@ -212,9 +213,11 @@ public class PointService {
List<String> agencies = new ArrayList<>(new LinkedHashSet<>(parsed.get("agency")));
List<String> keywords = new ArrayList<>(new LinkedHashSet<>(parsed.get("keyword")));
String title = record.get("title");
String source = record.get("source");
String urls = record.get("urls");
String guanjianzi = record.get("keywords");
// 用于存储每个三元组对应的关系 ID
Map<String, List<Integer>> tripletToIds = new HashMap<>();
@ -247,6 +250,8 @@ public class PointService {
params.put("title", title);
params.put("url", urls);
params.put("guanjianzi", guanjianzi);
params.put("source", source);
params.put("source_data", getYear(source));
zhyPointMapper.insertPointReship(params);
Integer insertedId = Integer.valueOf(String.valueOf(params.get("id")));
rel.relationshipId = insertedId;
@ -254,6 +259,7 @@ public class PointService {
// 添加到 tripletToIds
tripletToIds.computeIfAbsent(tripletKey, k -> new ArrayList<>()).add(insertedId);
} catch (Exception e) {
System.out.println(e.getMessage());
System.out.println("并发导致重复数据");
}
}
@ -286,12 +292,15 @@ public class PointService {
params.put("title", title);
params.put("url", urls);
params.put("guanjianzi", guanjianzi);
params.put("source", source);
params.put("source_data", getYear(source));
zhyPointMapper.insertPointReship(params);
Integer insertedId = Integer.valueOf(String.valueOf(params.get("id")));
rel.relationshipId = insertedId;
tripletToIds.computeIfAbsent(tripletKey, k -> new ArrayList<>()).add(insertedId);
} catch (Exception e) {
System.out.println(e.getMessage());
System.out.println("并发导致重复数据");
}
}
@ -324,12 +333,14 @@ public class PointService {
params.put("title", title);
params.put("url", urls);
params.put("guanjianzi", guanjianzi);
params.put("source", source);
params.put("source_data", getYear(source));
zhyPointMapper.insertPointReship(params);
Integer insertedId = Integer.valueOf(String.valueOf(params.get("id")));
rel.relationshipId = insertedId;
tripletToIds.computeIfAbsent(tripletKey, k -> new ArrayList<>()).add(insertedId);
} catch (Exception e) {
System.out.println(e.getMessage());
System.out.println("并发导致重复数据");
}
}
@ -371,6 +382,22 @@ public class PointService {
}
}
public Integer getYear(String source){
// 定义匹配4位连续数字的正则表达式
Pattern pattern = Pattern.compile("\\d{4}");
Matcher matcher = pattern.matcher(source);
String year = null;
if (matcher.find()) {
year = matcher.group(); // 提取第一个匹配的4位数字
}
// 输出结果
if (year != null) {
return Integer.valueOf(year);
} else {
return null;
}
}
/**
* 生成两个列表的笛卡尔积并标记关系类型
*/
@ -559,7 +586,7 @@ public class PointService {
String key = headers[i].trim();
String value = row[i];
if (Arrays.asList("main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
if (Arrays.asList("main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls","source").contains(key)) {
rowMap.put(key, value);
}
}

4
ruoyi-api/src/main/resources/mapper/api/ZhyPointMapper.xml

@ -59,9 +59,9 @@
<insert id="insertPointReship" useGeneratedKeys="true" keyProperty="p.id">
INSERT INTO zhy_point_relationship
(author, keyword, agency, relationship_id, title, url,keywords)
(author, keyword, agency, relationship_id, title, url,keywords,source,source_data)
VALUES
(#{p.author}, #{p.keyword}, #{p.agency}, #{p.relationship_id}, #{p.title}, #{p.url}, #{p.guanjianzi})
(#{p.author}, #{p.keyword}, #{p.agency}, #{p.relationship_id}, #{p.title}, #{p.url}, #{p.guanjianzi},#{p.source},#{p.source_data})
</insert>
<insert id="insertPointReG" useGeneratedKeys="true" keyProperty="p.id">
INSERT INTO zhy_point_relationship_group

Loading…
Cancel
Save