Browse Source

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

# Conflicts:
#	gyxtp/src/view/small.vue
small-tupu
hanyuqing 6 months ago
parent
commit
76450f076c
  1. 7
      gyxtp/src/api/api/graph.js
  2. 52
      gyxtp/src/view/small.vue
  3. 40
      ruoyi-api/src/main/java/com/ruoyi/api/controller/TestXiaoTuPuController.java
  4. 4
      ruoyi-api/src/main/java/com/ruoyi/api/mapper/ZhyPointMapper.java
  5. 7
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/PointService.java
  6. 7
      ruoyi-api/src/main/resources/mapper/api/ZhyPointMapper.xml

7
gyxtp/src/api/api/graph.js

@ -127,5 +127,10 @@ export const getheightLight = (param) => {
method: 'get',
});
};
export const getKeywordsByKeyword = (param) => {
return request({
url: '/api/test/getKeywordsByKeyword/'+param,
method: 'get',
});
};

52
gyxtp/src/view/small.vue

@ -141,7 +141,14 @@ import { demoData } from '@/assets/demo2.js'
import HeaderInfo from "@/components/UseAll/headerInfo.vue";
import leftInfo from "@/components/UseAll/leftInfo.vue";
import {getAllTitle, getDocInfo, getTitleBySamll} from "@/api/api/doc";
import {getDocInfoBylinkIds, getDomainGraphTest, getKeyWorlds, getpoinAll, getpoinByName} from "@/api/api/graph";
import {
getDocInfoBylinkIds,
getDomainGraphTest,
getKeywordsByKeyword,
getKeyWorlds,
getpoinAll,
getpoinByName
} from "@/api/api/graph";
import { Picture } from "@element-plus/icons-vue";
import { selectAticleByRelation } from '@/api/api/article'
@ -156,43 +163,6 @@ export default {
return {
chart: null,
words: [
{ name: '部署', value: 2 },
{ name: '运维', value: 2 },
{ name: '安全', value: 2 },
{ name: '测试', value: 2 },
{ name: '调试', value: 2 },
{ name: '日志', value: 2 },
{ name: '监控', value: 2 },
{ name: '性能', value: 2 },
{ name: '优化', value: 2 },
{ name: '缓存', value: 2 },
{ name: '架构', value: 3 },
{ name: '设计', value: 2 },
{ name: '需求', value: 2 },
{ name: '文档', value: 1 },
{ name: '会议', value: 1 },
{ name: '沟通', value: 1 },
{ name: '协作', value: 1 },
{ name: '脚本', value: 1 },
{ name: '自动化', value: 2 },
{ name: 'CI/CD', value: 2 },
{ name: '容器', value: 2 },
{ name: 'Docker', value: 2 },
{ name: 'Kubernetes', value: 2 },
{ name: '微服务', value: 3 },
{ name: 'API', value: 3 },
{ name: 'JSON', value: 1 },
{ name: 'HTTP', value: 2 },
{ name: '协议', value: 1 },
{ name: '加密', value: 1 },
{ name: '权限', value: 2 },
{ name: '登录', value: 2 },
{ name: '注册', value: 1 },
{ name: '用户', value: 2 },
{ name: '功能', value: 2 },
{ name: '模块', value: 1 }
],
getpoinName :"模糊综合评价方法",
// testoptions: {
@ -460,6 +430,10 @@ export default {
],
backgroundColor: 'rgba(255, 255, 255, 0.21)'
}
getKeywordsByKeyword(this.getpoinName).then(res=>{
this.words = res
})
this.chart.setOption(option)
},
randomColor() {
@ -633,6 +607,7 @@ export default {
text: node.text,
width: width,
height: height,
totalNum:totalNum,
color: this.getColor(node.type),
fontColor: '#fff',
styleClass:node.type=="keyword"?"nodeClassL1":"nodeClass"
@ -646,6 +621,7 @@ export default {
links:links
}
this.initChart()
this.$refs.graphRef.setJsonData(data);
})
}

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

@ -16,6 +16,7 @@ import java.lang.reflect.Type;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.ARTICLE_PDF_DIR;
@ -238,6 +239,45 @@ public class TestXiaoTuPuController extends BaseController {
return a;
}
@GetMapping("getKeywordsByKeyword/{keyName}")
public List<Map<String, Object>> getKeywordsByKeyword(@PathVariable("keyName") String keyName) {
List<Map> records = zhyPointMapper.getKeywordsByKeyword(keyName);
Map<String, Integer> keywordCount = new HashMap<>();
for (Map record : records) {
Object keywordObj = record.get("keywords");
if (keywordObj == null) continue;
String keywordsStr = keywordObj.toString().trim();
if (keywordsStr.isEmpty()) continue;
// 使用中文分号“;”拆分
String[] keywords = keywordsStr.split(";");
for (String keyword : keywords) {
keyword = keyword.trim();
if (!keyword.isEmpty()) {
keywordCount.put(keyword, keywordCount.getOrDefault(keyword, 0) + 1);
}
}
}
// 转换为 List 并排序:按 value 降序,取前 30
List<Map<String, Object>> result = keywordCount.entrySet().stream()
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) // 按 value 降序
.limit(30) // 只取前 30
.map(entry -> {
Map<String, Object> item = new HashMap<>();
item.put("name", entry.getKey());
item.put("value", entry.getValue());
return item;
})
.collect(Collectors.toList());
return result;
}

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

@ -12,12 +12,12 @@ public interface ZhyPointMapper {
List<Map> selectPointByUUID(@Param("uuid") Integer uuid);
List<Map> getKeywordsByKeyword(@Param("keyName") String keyName);
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);
int insertPoint(@Param("name") String name,@Param("uuid") Integer uuid,@Param("type1") String type1);
int insertPointReship(@Param("author") String author,@Param("keyword") String keyword,@Param("agency") String agency,@Param("relationship_id") Integer relationship_id,@Param("title") String title,@Param("url") String url);
int insertPointReship(@Param("author") String author,@Param("keyword") String keyword,@Param("agency") String agency,@Param("relationship_id") Integer relationship_id,@Param("title") String title,@Param("url") String url,@Param("guanjianzi") String guanjianzi);
}

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

@ -41,6 +41,7 @@ public class PointService {
List<String> keywords = new ArrayList<>(new LinkedHashSet<>(parsed.get("keyword")));
String title = record.get("title");
String urls = record.get("urls");
String guanjianzi = record.get("keywords");
relationshipList.addAll(cartesianProduct(authors, keywords, "author", "keyword"));
@ -116,7 +117,7 @@ public class PointService {
int reshipId = createReletionship(startNodeId,endNodeId,relType,data);
try {
zhyPointMapper.insertPointReship(authorStr,keywordStr,agencyStr,reshipId,title,urls);
zhyPointMapper.insertPointReship(authorStr,keywordStr,agencyStr,reshipId,title,urls,guanjianzi);
}catch (Exception e){
System.out.println("并发导致重复数据");
}
@ -139,6 +140,7 @@ public class PointService {
List<String> keywords = new ArrayList<>(new LinkedHashSet<>(parsed.get("keyword")));
String title = record.get("title");
String urls = record.get("urls");
String guanjianzi = record.get("keywords");
relationshipList.addAll(cartesianProduct(authors, keywords, "author", "keyword"));
@ -188,7 +190,6 @@ 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 = "相关机构";
@ -214,7 +215,7 @@ public class PointService {
int reshipId = createReletionship(startNodeId,endNodeId,relType,data);
try {
zhyPointMapper.insertPointReship(authorStr,keywordStr,agencyStr,reshipId,title,urls);
zhyPointMapper.insertPointReship(authorStr,keywordStr,agencyStr,reshipId,title,urls,guanjianzi);
}catch (Exception e){
System.out.println("并发导致重复数据");
}

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

@ -59,10 +59,13 @@
<insert id="insertPointReship">
INSERT INTO zhy_point_relationship
(author, keyword, agency, relationship_id, title, url)
(author, keyword, agency, relationship_id, title, url,keywords)
VALUES
(#{author}, #{keyword}, #{agency}, #{relationship_id}, #{title}, #{url})
(#{author}, #{keyword}, #{agency}, #{relationship_id}, #{title}, #{url},#{guanjianzi})
</insert>
<select id="getKeywordsByKeyword">
select * from zhy_point_relationship where keyword = #{param1} group by title
</select>

Loading…
Cancel
Save