Skip to content

Commit 3f9c454

Browse files
committed
Merge branch 'dev' into main
2 parents a843ce0 + 51f64f3 commit 3f9c454

41 files changed

Lines changed: 12863 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 工程简介
2+
3+
4+
5+
# 延伸阅读
6+
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.fzu</groupId>
6+
<artifactId>demo</artifactId>
7+
<version>1.0</version>
8+
<name>paperSearch</name>
9+
<description>Demo project for Spring Boot</description>
10+
11+
<properties>
12+
<java.version>1.8</java.version>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
15+
<spring-boot.version>2.3.7.RELEASE</spring-boot.version>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>org.springframework.boot</groupId>
21+
<artifactId>spring-boot-starter-jdbc</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-starter-web</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.mybatis.spring.boot</groupId>
29+
<artifactId>mybatis-spring-boot-starter</artifactId>
30+
<version>2.1.4</version>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>mysql</groupId>
35+
<artifactId>mysql-connector-java</artifactId>
36+
<scope>runtime</scope>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.projectlombok</groupId>
40+
<artifactId>lombok</artifactId>
41+
<optional>true</optional>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot-starter-test</artifactId>
46+
<scope>test</scope>
47+
<exclusions>
48+
<exclusion>
49+
<groupId>org.junit.vintage</groupId>
50+
<artifactId>junit-vintage-engine</artifactId>
51+
</exclusion>
52+
</exclusions>
53+
</dependency>
54+
<dependency>
55+
<groupId>com.alibaba</groupId>
56+
<artifactId>fastjson</artifactId>
57+
<version>1.2.46</version>
58+
</dependency>
59+
<!--分页插件 pagehelper -->
60+
<dependency>
61+
<groupId>com.github.pagehelper</groupId>
62+
<artifactId>pagehelper-spring-boot-starter</artifactId>
63+
<!-- 特别注意版本问题 -->
64+
<version>1.2.3</version>
65+
</dependency>
66+
</dependencies>
67+
68+
<dependencyManagement>
69+
<dependencies>
70+
<dependency>
71+
<groupId>org.springframework.boot</groupId>
72+
<artifactId>spring-boot-dependencies</artifactId>
73+
<version>${spring-boot.version}</version>
74+
<type>pom</type>
75+
<scope>import</scope>
76+
</dependency>
77+
</dependencies>
78+
</dependencyManagement>
79+
80+
<build>
81+
82+
<plugins>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-compiler-plugin</artifactId>
86+
<version>3.8.1</version>
87+
<configuration>
88+
<source>1.8</source>
89+
<target>1.8</target>
90+
<encoding>UTF-8</encoding>
91+
</configuration>
92+
93+
</plugin>
94+
<plugin>
95+
<groupId>org.springframework.boot</groupId>
96+
<artifactId>spring-boot-maven-plugin</artifactId>
97+
<version>2.3.7.RELEASE</version>
98+
<configuration>
99+
<mainClass>com.fzu.PaperSearchApplication</mainClass>
100+
</configuration>
101+
<executions>
102+
<execution>
103+
<id>repackage</id>
104+
<goals>
105+
<goal>repackage</goal>
106+
</goals>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
</plugins>
111+
<resources>
112+
<resource>
113+
<directory>src/main/java</directory>
114+
<includes>
115+
<include>**/*.properties</include>
116+
<include>**/*.xml</include>
117+
</includes>
118+
<filtering>false</filtering>
119+
</resource>
120+
<resource>
121+
<directory>src/main/resources</directory>
122+
<includes>
123+
<include>**/*.yml</include>
124+
<include>**/*.xml</include>
125+
</includes>
126+
<filtering>false</filtering>
127+
</resource>
128+
</resources>
129+
</build>
130+
131+
</project>
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
package com.fzu;
2+
3+
import com.alibaba.fastjson.JSONArray;
4+
import com.alibaba.fastjson.JSONObject;
5+
6+
import com.fzu.pojo.Paper;
7+
import com.fzu.service.PaperService;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.boot.ApplicationArguments;
10+
import org.springframework.boot.ApplicationRunner;
11+
import org.springframework.stereotype.Component;
12+
13+
import java.io.File;
14+
import java.util.ArrayList;
15+
import java.util.Collections;
16+
import java.util.List;
17+
import java.util.Scanner;
18+
19+
//@Component
20+
public class ApplicationRunnerImpl implements ApplicationRunner {
21+
// @Autowired
22+
PaperService paperService;
23+
public List<Paper> cvprJsonParse() {
24+
List<Paper> paperList=new ArrayList<>();
25+
String dir=System.getProperty("user.dir");
26+
System.out.println(dir);
27+
File file=new File(dir+"/src/main/resources/论文数据/1");
28+
if(file.exists()){
29+
File []child=file.listFiles();
30+
for(int i=0;i<child.length;i++){
31+
Paper paper=new Paper();
32+
String json=jsonRead(child[i]);
33+
json=json.replace(";","");
34+
JSONObject jsonObject=JSONObject.parseObject(json);
35+
String title=jsonObject.getString("title");
36+
String abstractContent=jsonObject.getString("abstract");
37+
if (abstractContent==null)abstractContent="暂无";
38+
if(abstractContent.length()>=150){
39+
abstractContent=abstractContent.substring(0,150);
40+
}
41+
String link=jsonObject.getString("doiLink");
42+
String meet="CVPR";
43+
Integer year=Integer.valueOf(jsonObject.getString("publicationYear"));
44+
List<String> keywordList=new ArrayList<>();
45+
JSONArray keywords= jsonObject.getJSONArray("keywords");
46+
if(keywords!=null){
47+
for(int j=0;j<keywords.size();j++){
48+
JSONObject keyword=keywords.getJSONObject(j);
49+
JSONArray jsonArray=keyword.getJSONArray("kwd");
50+
for(int k=0;k<jsonArray.size();k++){
51+
keywordList.add(jsonArray.getString(k));
52+
}
53+
}
54+
}
55+
else {
56+
keywordList.add(" ");
57+
}
58+
List<String> authorList=new ArrayList<>();
59+
JSONArray authors=jsonObject.getJSONArray("authors");
60+
if(authors!=null){
61+
for(int j=0;j<authors.size();j++){
62+
JSONObject author=authors.getJSONObject(j);
63+
authorList.add(author.getString("name"));
64+
}
65+
}
66+
else{
67+
authorList.add(" ");
68+
}
69+
paper.setTitle(title);
70+
paper.setAbstractContent(abstractContent);
71+
paper.setAuthor(authorList);
72+
paper.setKeywords(keywordList);
73+
paper.setLink(link);
74+
paper.setMeet(meet);
75+
paper.setYear(year);
76+
paperList.add(paper);
77+
System.out.println(paper.toString());
78+
}
79+
}
80+
else{
81+
System.out.println("文件不存在");
82+
}
83+
return paperList;
84+
}
85+
public List<Paper> iccvJsonParse(){
86+
List<Paper> paperList=new ArrayList<>();
87+
String dir=System.getProperty("user.dir");
88+
System.out.println(dir);
89+
File file=new File(dir+"/src/main/resources/论文数据/3");
90+
if(file.exists()){
91+
File []child=file.listFiles();
92+
for(int i=0;i<child.length;i++){
93+
Paper paper=new Paper();
94+
String json=jsonRead(child[i]);
95+
json=json.replace(";","");
96+
JSONObject jsonObject=JSONObject.parseObject(json);
97+
String title=jsonObject.getString("title");
98+
String abstractContent=jsonObject.getString("abstract");
99+
if (abstractContent==null)abstractContent="暂无";
100+
if(abstractContent.length()>=150){
101+
abstractContent=abstractContent.substring(0,150);
102+
}
103+
String link=jsonObject.getString("doiLink");
104+
String meet="ICCV";
105+
Integer year=Integer.valueOf(jsonObject.getString("publicationYear"));
106+
List<String> keywordList=new ArrayList<>();
107+
JSONArray keywords= jsonObject.getJSONArray("keywords");
108+
if(keywords!=null){
109+
for(int j=0;j<keywords.size();j++){
110+
JSONObject keyword=keywords.getJSONObject(j);
111+
JSONArray jsonArray=keyword.getJSONArray("kwd");
112+
for(int k=0;k<jsonArray.size();k++){
113+
keywordList.add(jsonArray.getString(k));
114+
}
115+
}
116+
}
117+
else {
118+
keywordList.add(" ");
119+
}
120+
List<String> authorList=new ArrayList<>();
121+
JSONArray authors=jsonObject.getJSONArray("authors");
122+
if(authors!=null){
123+
for(int j=0;j<authors.size();j++){
124+
JSONObject author=authors.getJSONObject(j);
125+
authorList.add(author.getString("name"));
126+
}
127+
}
128+
else{
129+
authorList.add(" ");
130+
}
131+
paper.setTitle(title);
132+
paper.setAbstractContent(abstractContent);
133+
paper.setAuthor(authorList);
134+
paper.setKeywords(keywordList);
135+
paper.setLink(link);
136+
paper.setMeet(meet);
137+
paper.setYear(year);
138+
paperList.add(paper);
139+
System.out.println(paper.toString());
140+
}
141+
}
142+
else{
143+
System.out.println("文件不存在");
144+
}
145+
return paperList;
146+
}
147+
public List<Paper> eccvJsonParse(){
148+
List<Paper> paperList=new ArrayList<>();
149+
String dir=System.getProperty("user.dir");
150+
System.out.println(dir);
151+
File file=new File(dir+"/src/main/resources/论文数据/2");
152+
if(file.exists()){
153+
File []child=file.listFiles();
154+
for(int i=0;i<child.length;i++){
155+
Paper paper=new Paper();
156+
String json=jsonRead(child[i]);
157+
json=json.replace(";","");
158+
JSONObject jsonObject=JSONObject.parseObject(json);
159+
String title=jsonObject.getString("论文名称");
160+
String abstractContent=jsonObject.getString("摘要");
161+
if (abstractContent==null)abstractContent="暂无";
162+
if(abstractContent.length()>=150){
163+
abstractContent=abstractContent.substring(0,150);
164+
}
165+
String link=jsonObject.getString("原文链接");
166+
String author="未知";
167+
String meet="ECCV";
168+
List<String> keywordList=new ArrayList<>();
169+
JSONArray jsonArray=jsonObject.getJSONArray("关键词");
170+
if(jsonArray!=null){
171+
for(int j=0;j<jsonArray.size();j++){
172+
keywordList.add(jsonArray.getString(j));
173+
}
174+
}
175+
else{
176+
keywordList.add(" ");
177+
}
178+
List<String> authorList=new ArrayList<>();
179+
authorList.add(author);
180+
String year=jsonObject.getString("发布时间");
181+
year=year.substring(year.length()-4,year.length());
182+
paper.setTitle(title);
183+
paper.setMeet(meet);
184+
paper.setLink(link);
185+
paper.setYear(Integer.valueOf(year));
186+
paper.setAbstractContent(abstractContent);
187+
paper.setAuthor(authorList);
188+
paper.setKeywords(keywordList);
189+
paperList.add(paper);
190+
System.out.println(paper.toString());
191+
}
192+
}
193+
return paperList;
194+
}
195+
public String jsonRead(File file){
196+
Scanner scanner = null;
197+
StringBuilder buffer = new StringBuilder();
198+
try {
199+
scanner = new Scanner(file, "utf-8");
200+
while (scanner.hasNextLine()) {
201+
buffer.append(scanner.nextLine());
202+
}
203+
} catch (Exception e) {
204+
205+
} finally {
206+
if (scanner != null) {
207+
scanner.close();
208+
}
209+
}
210+
return buffer.toString();
211+
}
212+
@Override
213+
public void run(ApplicationArguments args) throws Exception {
214+
215+
/* System.out.println("开始上传...");
216+
List<Paper> totalList=new ArrayList<>();
217+
List<Paper>papers=new ArrayList<>();
218+
papers=cvprJsonParse();
219+
for (Paper paper : papers) {
220+
totalList.add(paper);
221+
}
222+
System.out.println("CVPR");
223+
papers=iccvJsonParse();
224+
for (Paper paper : papers) {
225+
totalList.add(paper);
226+
}
227+
System.out.println("ECCV");
228+
papers=eccvJsonParse();
229+
for (Paper paper : papers) {
230+
totalList.add(paper);
231+
}
232+
233+
234+
for (Paper paper : totalList) {
235+
paperService.uploadPaper(paper);
236+
}*/
237+
238+
239+
}
240+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.fzu;
2+
3+
import org.mybatis.spring.annotation.MapperScan;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
7+
import org.springframework.context.annotation.PropertySource;
8+
9+
@SpringBootApplication()
10+
//@PropertySource("application.yml")
11+
public class PaperSearchApplication {
12+
13+
public static void main(String[] args) {
14+
SpringApplication.run(PaperSearchApplication.class, args);
15+
/*System.out.println("上传完成!!!");*/
16+
}
17+
18+
}

0 commit comments

Comments
 (0)