Browse Source

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

small-tupu
菅振宇 7 months ago
parent
commit
08bcc1dacd
  1. 7
      gyxtp/src/api/api/article.js
  2. 20
      gyxtp/src/api/api/graph.js
  3. 9
      gyxtp/src/router/router.js
  4. 1950
      gyxtp/src/view/pointArticleInfo.vue
  5. 17
      gyxtp/src/view/pointInfo.vue
  6. 2
      gyxtp/src/view/small.vue
  7. 13
      ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java
  8. 14
      ruoyi-api/src/main/java/com/ruoyi/api/controller/TestXiaoTuPuController.java
  9. 7
      ruoyi-api/src/main/java/com/ruoyi/api/controller/ZhyArticleController.java
  10. 2
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/ZhyPointMapper.java
  11. 64
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/PointService.java
  12. 3
      ruoyi-api/src/main/resources/mapper/api/ZhyPointMapper.xml
  13. 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/ZhyArticleMapper.java
  14. 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/IZhyArticleService.java
  15. 5
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZhyArticleServiceImpl.java
  16. 5
      ruoyi-system/src/main/resources/mapper/system/ZhyArticleMapper.xml

7
gyxtp/src/api/api/article.js

@ -13,7 +13,12 @@ export const getArticleInfo = (id) => {
method: 'get',
});
};
export const getArticleInfo1 = (name) => {
return request({
url: '/api/article/getArticleInfo1/'+name,
method: 'get',
});
};
export const updateArticle = (params) => {
return request({

20
gyxtp/src/api/api/graph.js

@ -89,12 +89,6 @@ export const getKeyWorlds = () => {
});
};
export const getDocInfoBylinkIds = (param) => {
return request({
url: '/api/test/getDocInfoBylinkIds/'+param,
method: 'get',
});
};
export const getPointInfoByUUID = (param) => {
return request({
@ -109,6 +103,19 @@ export const getReInfoByNameAndType = (name,type) => {
method: 'get',
});
};
export const getDocInfoBylinkIds = (param) => {
return request({
url: '/api/test/getDocInfoBylinkIds/'+param,
method: 'get',
});
};
export const selectPointResById = (id) => {
return request({
url: '/api/test/selectPointResById/'+id,
method: 'get',
});
};
export const getheightLight = (param) => {
return request({
@ -117,3 +124,4 @@ export const getheightLight = (param) => {
});
};

9
gyxtp/src/router/router.js

@ -117,6 +117,15 @@ const routes = [
// component: () => import ("../views/graphPageNoJson.vue")
},
{
path: '/pointArticleInfo',
name: 'pointArticleInfo',
meta: {
title: '文章界面',
},
component: () => import('../view/pointArticleInfo.vue'),
// component: () => import ("../views/graphPageNoJson.vue")
},
{
path: '/small',
component: () => import('@/view/small.vue'),
},

1950
gyxtp/src/view/pointArticleInfo.vue

File diff suppressed because it is too large

17
gyxtp/src/view/pointInfo.vue

@ -45,12 +45,12 @@
v-for="(item) in tableData"
:key="item"
>
<div @click="goOtherInfo(item)" style="color: #373737;cursor: pointer">
<div style="color: #373737;cursor: pointer">
<div>
<div style="height: 1.5vw;margin-bottom: 7px;">
<img src="../assets/img2/book2.png"
style="height: 100%;object-fit: contain;float: left;margin-right: 0.8vw;">
<div style="margin-right: 2px; ">{{ Object.keys(item)[0] }}</div>
<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">
@ -145,7 +145,15 @@ export default {
};
},
methods: {
goArticle(row){
console.log(row[0].id)
this.$router.push({
path: '/pointArticleInfo',
query: {
id: row[0].id
}
})
},
},
mounted() {
const id = this.$route.params.id
@ -1116,5 +1124,8 @@ margin-top: 0.2vw;
.el-tree-node__expand-icon {
font-size: 1.2vw !important;
}
.articleName:hover{
color:rgb(7, 118, 255);
}
</style>

2
gyxtp/src/view/small.vue

@ -353,7 +353,7 @@ export default {
goArticle(row){
console.log(row.id)
this.$router.push({
path: '/articleInfo',
path: '/pointArticleInfo',
query: {
id: row.id
}

13
ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java

@ -12,6 +12,7 @@ import com.ruoyi.api.domain.*;
import com.ruoyi.api.mapper.ZhyDocApiMapper;
import com.ruoyi.api.service.impl.BuildService;
import com.ruoyi.api.service.impl.PdfUtil;
import com.ruoyi.api.service.impl.PointService;
import com.ruoyi.api.util.ReushToken;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -56,6 +57,8 @@ public class DocApiController extends BaseController {
@Autowired
BuildService staticBuildService;
@Autowired
PointService pointService;
@Autowired
static PythonService pythonService;
@Autowired
LuceneUtil luceneUtil;
@ -1668,9 +1671,6 @@ public class DocApiController extends BaseController {
taskInfo.setGroupId(0l);
taskInfo.setStatus(0);
zhyTaskInfoService.insertZhyTaskInfo(taskInfo);
// goPython(doc1.getDocTitle(),doc2.getDocTitle(),group0SearchItems);
}
}
for(int i=0;i<g02.size();i++){
@ -1926,8 +1926,13 @@ public void goPython(ZhyTaskInfo info, List<Map<String, Object>> searchItems,Str
map1.put("msg","正在构建'"+info.getName1()+"'图谱");
webSocketService.sendToUser(userId,gson.toJson(map1));
}
if(info.getName2()!=null){
staticBuildService.create(objMap);
}else{
String filePath = (String) objMap.get("url");
pointService.buildPoint(filePath);
}
staticBuildService.create(objMap);
} else if ("none".equals(functionName)) {
System.out.println("Python 返回:没有数据");
} else {

14
ruoyi-api/src/main/java/com/ruoyi/api/controller/TestXiaoTuPuController.java

@ -19,6 +19,8 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.ruoyi.common.constant.Constants.ARTICLE_PDF_DIR;
@RestController
@RequestMapping("/api/test")
public class TestXiaoTuPuController extends BaseController {
@ -210,6 +212,18 @@ public class TestXiaoTuPuController extends BaseController {
List<Map> a = zhyPointMapper.selectPointRelationshipByRids(LinkIds);
return a;
}
@GetMapping("selectPointResById/{id}")
public Map selectPointResById(@PathVariable("id")Integer id) throws IOException {
Map map = zhyPointMapper.selectPointResById(id);
System.out.println("2222222222");
System.out.println(map);
Object title = map.get("title");
if (title != null) {
String localUrl = ARTICLE_PDF_DIR+"/"+title.toString()+".pdf";
map.put("localUrl", localUrl);
}
return map;
}
@GetMapping("getPointInfoByUUID/{id}")
public List<Map> selectPointByUUID(@PathVariable("id")Integer id) {
List<Map> a = zhyPointMapper.selectPointByUUID(id);

7
ruoyi-api/src/main/java/com/ruoyi/api/controller/ZhyArticleController.java

@ -126,6 +126,13 @@ public class ZhyArticleController extends BaseController
return article;
}
@GetMapping("/getArticleInfo1/{name}")
public ZhyArticle getArticleInfo1(@PathVariable("name") String name)
{
ZhyArticle article=zhyArticleService.selectZhyArticleByName(name);
return article;
}
@GetMapping("/selectAticleByRelation")

2
ruoyi-api/src/main/java/com/ruoyi/api/mapper/ZhyPointMapper.java

@ -14,7 +14,7 @@ public interface ZhyPointMapper {
List<Map> selectPointResByNeo4jId(@Param("neo4jId") Integer neo4jId);
Map selectPointResById(@Param("id") Integer id);
List<Map> selectPointByType1(@Param("type1") String type1);
List<Map> selectPointRelationshipByRids(@Param("ids") List<Integer> ids);
List<Map> selectPointRelationshipByName(@Param("author") String author,@Param("keyword") String keyword,@Param("agency") String agency,@Param("title") String title);

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

@ -27,7 +27,10 @@ public class PointService {
Neo4jUtil neo4jUtil;
public void buildPoint(String url) throws IOException {
// String url="D:\\project\\gyx\\tupudata\\thesis\\thesis_results_20250914_201832.csv";
List<Map<String, String>> dataList = getCsvLine(url);
System.out.println("2222222222222222222222");
System.out.println(dataList);
Map<String,Integer> nameToId = new HashMap<>();
for (Map<String, String> record : dataList) {
List<Map<String, String>> relationshipList = new ArrayList<>();
@ -87,6 +90,7 @@ public class PointService {
relType = "相关作者";
} else if (authorStr != null && !authorStr.trim().isEmpty() &&
agencyStr != null && !agencyStr.trim().isEmpty()) {
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaa");
start = authorStr;
end = agencyStr;
relType = "相关机构";
@ -208,7 +212,7 @@ public class PointService {
List<String> keywords = new ArrayList<>();
// 1. 解析 keywords(字段名可根据 CSV 调整)
String keywordStr = record.get("searchword1");
String keywordStr = record.get("main_keyword");
if (keywordStr != null && !keywordStr.trim().isEmpty()) {
String[] keywordArray = keywordStr.split(";"); // 中文分号分隔
for (String kw : keywordArray) {
@ -276,33 +280,59 @@ public class PointService {
throw new FileNotFoundException("CSV file not found: " + csvFilePath);
}
// 2. 读取 CSV 文件(使用 GBK 编码)
List<Map<String, String>> dataList = new ArrayList<>();
String[] headers = null;
// 定义 CSV 格式
CSVFormat format = CSVFormat.DEFAULT
.withFirstRecordAsHeader()
.withIgnoreSurroundingSpaces(true)
.withTrim()
.withQuote('"')
.withEscape('\\')
.withIgnoreEmptyLines(true);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"))) {
String line;
int lineNumber = 0;
try (FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8); // ✅ 指定 GBK 编码
CSVParser csvParser = new CSVParser(isr, format)) {
while ((line = reader.readLine()) != null) {
lineNumber++;
for (CSVRecord record : csvParser) {
// 去除 BOM
if (lineNumber == 1 && line.startsWith("\uFEFF")) {
line = line.substring(1);
}
// 使用更安全的 split:保留引号内内容
String[] row = parseCsvLine(line); // 改用自定义解析方法
// 去除每个字段首尾空白
for (int i = 0; i < row.length; i++) {
row[i] = row[i].trim();
}
if (lineNumber == 1) {
headers = row;
continue;
}
// 转为 Map
Map<String, String> rowMap = new HashMap<>();
for (String header : csvParser.getHeaderNames()) {
rowMap.put(header, record.get(header));
for (int i = 0; i < headers.length && i < row.length; i++) {
String key = headers[i].trim();
String value = row[i];
if (Arrays.asList("main_keyword", "sub_keyword", "title", "authors", "keywords", "abstract", "url", "urls").contains(key)) {
rowMap.put(key, value);
}
}
dataList.add(rowMap);
}
} catch (IOException e) {
System.err.println("Error reading CSV file: " + e.getMessage());
throw e;
e.printStackTrace();
}
for (Map<String, String> data : dataList) {
String mainKeyword = data.get("main_keyword");
Pattern pattern = Pattern.compile("'([^']*)'");
Matcher matcher = pattern.matcher(mainKeyword);
while (matcher.find()) {
data.put("main_keyword", matcher.group(1));
}
}
return dataList;
}
private static String[] parseCsvLine(String line) {

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

@ -18,6 +18,9 @@
<select id="selectPointResByNeo4jId" resultType="map">
select * from zhy_point_relationship where relationship_id=#{neo4jId}
</select>
<select id="selectPointResById" resultType="map">
select * from zhy_point_relationship where id=#{id}
</select>
<select id="selectPointRelationshipByRids" resultType="map">
select * from zhy_point_relationship where relationship_id in
<foreach collection="ids" item="item" separator="," open="(" close=")">

2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ZhyArticleMapper.java

@ -19,7 +19,7 @@ public interface ZhyArticleMapper
*/
public ZhyArticle selectZhyArticleById(Long id);
public ZhyArticle selectZhyArticleByName(String name);
/**
* 查询文献管理列表

2
ruoyi-system/src/main/java/com/ruoyi/system/service/IZhyArticleService.java

@ -19,6 +19,8 @@ public interface IZhyArticleService
*/
public ZhyArticle selectZhyArticleById(Long id);
public ZhyArticle selectZhyArticleByName(String name);
/**
* 查询文献管理列表
*

5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZhyArticleServiceImpl.java

@ -31,6 +31,11 @@ public class ZhyArticleServiceImpl implements IZhyArticleService
return zhyArticleMapper.selectZhyArticleById(id);
}
@Override
public ZhyArticle selectZhyArticleByName(String name) {
return zhyArticleMapper.selectZhyArticleByName(name);
}
/**
* 查询文献管理列表
*

5
ruoyi-system/src/main/resources/mapper/system/ZhyArticleMapper.xml

@ -48,7 +48,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectZhyArticleVo"/>
where id = #{id}
</select>
<select id="selectZhyArticleByName" parameterType="String" resultMap="ZhyArticleResult">
<include refid="selectZhyArticleVo"/>
where name = #{name}
</select>
<insert id="insertZhyArticle" parameterType="ZhyArticle" useGeneratedKeys="true" keyProperty="id">
insert into zhy_article
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save