运维社区运维贴子热度功能

This commit is contained in:
zhangjunwen 2024-05-08 10:24:13 +08:00
parent 259dfbb71c
commit f715da35c8
11 changed files with 243 additions and 108 deletions

View File

@ -31,6 +31,8 @@ public class CommunityPostHeat extends BaseEntity
@Excel(name = "回复数")
private Integer replies;
private CommunityPostInfo communityPostInfo;
public void setPostId(String postId)
{
this.postId = postId;
@ -68,6 +70,14 @@ public class CommunityPostHeat extends BaseEntity
return replies;
}
public CommunityPostInfo getCommunityPostInfo() {
return communityPostInfo;
}
public void setCommunityPostInfo(CommunityPostInfo communityPostInfo) {
this.communityPostInfo = communityPostInfo;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -66,6 +66,7 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService
communityPostInfo.setPostId(IdUtils.simpleUUID());
communityPostInfo.setPostTime(new Date());
communityPostInfo.setUserId(SecurityUtils.getUserId());
communityPostInfo.setStatus("0");
//热度榜单新增记录
CommunityPostHeat postHeat = new CommunityPostHeat();
postHeat.setPostId(communityPostInfo.getPostId());

View File

@ -9,20 +9,35 @@
<result property="likes" column="likes" />
<result property="views" column="views" />
<result property="replies" column="replies" />
<association property="communityPostInfo" column="post_id" javaType="CommunityPostInfo" resultMap="CommunityPostInfoResult"/>
</resultMap>
<resultMap type="CommunityPostInfo" id="CommunityPostInfoResult">
<result property="postId" column="post_id" />
<result property="postType" column="post_type" />
<result property="omField" column="om_field" />
<result property="omIndustry" column="om_industry" />
<result property="postTitle" column="post_title" />
<result property="postContent" column="post_content" />
<result property="postTime" column="post_time" />
<result property="userId" column="user_id" />
<result property="lastEditTime" column="last_edit_time" />
<result property="views" column="views"/>
<result property="status" column="status" />
</resultMap>
<sql id="selectCommunityPostHeatVo">
select post_id, likes, views, replies from community_post_heat
select a.post_id, a.likes, a.views, a.replies,b.post_id,b.post_type,b.om_field,b.om_industry,b.post_title,b.post_content,b.post_time,b.user_id,b.last_edit_time,b.views,b.status from community_post_heat a
left join community_post_info b on a.post_id = b.post_id
</sql>
<select id="selectCommunityPostHeatList" parameterType="CommunityPostHeat" resultMap="CommunityPostHeatResult">
<include refid="selectCommunityPostHeatVo"/>
<where>
where b.status = '0'
<if test="postId != null and postId != ''"> and post_id = #{postId}</if>
<if test="likes != null "> and likes = #{likes}</if>
<if test="views != null "> and views = #{views}</if>
<if test="replies != null "> and replies = #{replies}</if>
</where>
order by a.views * 0.4 + a.replies * 0.6 desc
</select>
<select id="selectCommunityPostHeatByPostId" parameterType="String" resultMap="CommunityPostHeatResult">

View File

@ -26,7 +26,7 @@
<select id="selectCommunityPostInfoList" parameterType="CommunityPostInfo" resultMap="CommunityPostInfoResult">
<include refid="selectCommunityPostInfoVo"/>
<where>
where a.status = '0'
<if test="postType != null and postType != ''"> and post_type = #{postType}</if>
<if test="omField != null and omField != ''"> and om_field = #{omField}</if>
<if test="omIndustry != null and omIndustry != ''"> and om_industry = #{omIndustry}</if>
@ -37,7 +37,6 @@
<if test="lastEditTime != null "> and last_edit_time = #{lastEditTime}</if>
<if test="views != null "> and views = #{views}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
</where>
order by post_time desc
</select>

View File

@ -1,6 +1,6 @@
import request from "@/utils/request";
// 查询社区子热度列表
// 查询社区子热度列表
export function listHeat(query) {
return request({
url: "/community/heat/list",
@ -9,7 +9,7 @@ export function listHeat(query) {
});
}
// 查询社区子热度详细
// 查询社区子热度详细
export function getHeat(postId) {
return request({
url: "/community/heat/" + postId,
@ -17,7 +17,7 @@ export function getHeat(postId) {
});
}
// 新增社区子热度
// 新增社区子热度
export function addHeat(data) {
return request({
url: "/community/heat",
@ -26,7 +26,7 @@ export function addHeat(data) {
});
}
// 修改社区子热度
// 修改社区子热度
export function updateHeat(data) {
return request({
url: "/community/heat",
@ -35,7 +35,7 @@ export function updateHeat(data) {
});
}
// 删除社区子热度
// 删除社区子热度
export function delHeat(postId) {
return request({
url: "/community/heat/" + postId,

View File

@ -1,6 +1,6 @@
import request from "@/utils/request";
// 查询社区子信息列表
// 查询社区子信息列表
export function listCommunityInfo(query) {
return request({
url: "/community/info/list",
@ -9,7 +9,7 @@ export function listCommunityInfo(query) {
});
}
// 查询社区子信息详细
// 查询社区子信息详细
export function getCommunityInfo(postId) {
return request({
url: "/community/info/" + postId,
@ -17,7 +17,7 @@ export function getCommunityInfo(postId) {
});
}
// 新增社区子信息
// 新增社区子信息
export function addCommunityInfo(data) {
return request({
url: "/community/info",
@ -26,7 +26,7 @@ export function addCommunityInfo(data) {
});
}
// 修改社区子信息
// 修改社区子信息
export function updateCommunityInfo(data) {
return request({
url: "/community/info",
@ -43,7 +43,7 @@ export function addViews(postId) {
});
}
// 删除社区子信息
// 删除社区子信息
export function delCommunityInfo(postId) {
return request({
url: "/community/info/" + postId,

View File

@ -1,6 +1,6 @@
import request from "@/utils/request";
// 查询社区子回复列表
// 查询社区子回复列表
export function listReply(query) {
return request({
url: "/community/reply/list",
@ -9,7 +9,7 @@ export function listReply(query) {
});
}
// 查询社区子回复详细
// 查询社区子回复详细
export function getReply(replyId) {
return request({
url: "/community/reply/" + replyId,
@ -17,7 +17,7 @@ export function getReply(replyId) {
});
}
// 新增社区子回复
// 新增社区子回复
export function addReply(data) {
return request({
url: "/community/reply",
@ -26,7 +26,7 @@ export function addReply(data) {
});
}
// 修改社区子回复
// 修改社区子回复
export function updateReply(data) {
return request({
url: "/community/reply",
@ -35,7 +35,7 @@ export function updateReply(data) {
});
}
// 删除社区子回复
// 删除社区子回复
export function delReply(replyId) {
return request({
url: "/community/reply/" + replyId,

View File

@ -1,6 +1,6 @@
import request from "@/utils/request";
// 查询社区子举报列表
// 查询社区子举报列表
export function listReport(query) {
return request({
url: "/community/report/list",
@ -9,7 +9,7 @@ export function listReport(query) {
});
}
// 查询社区子举报详细
// 查询社区子举报详细
export function getReport(reportId) {
return request({
url: "/community/report/" + reportId,
@ -17,7 +17,7 @@ export function getReport(reportId) {
});
}
// 新增社区子举报
// 新增社区子举报
export function addReport(data) {
return request({
url: "/community/report",
@ -26,7 +26,7 @@ export function addReport(data) {
});
}
// 修改社区子举报
// 修改社区子举报
export function updateReport(data) {
return request({
url: "/community/report",
@ -35,7 +35,7 @@ export function updateReport(data) {
});
}
// 删除社区子举报
// 删除社区子举报
export function delReport(reportId) {
return request({
url: "/community/report/" + reportId,

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715131643042" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4317" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M360.725 33c3.526 1.457 7.052 2.909 10.575 4.374 24.202 10.07 48.704 19.484 72.535 30.362 36.75 16.774 71.604 37.031 104.774 60.142 26.75 18.64 51.616 39.576 75.127 62.087 8.946 8.564 17.269 17.852 25.224 27.354 11.313 13.515 22.512 27.179 32.88 41.417 16.44 22.572 30.486 46.615 41.868 72.193 9.157 20.583 17.27 41.491 22.289 63.505 1.506 6.607 2.988 13.217 4.803 21.235 22.57-30.853 27.756-66.112 34.339-102.473 12.856 20.155 25.33 38.876 36.948 58.113 19.011 31.48 37.17 63.487 51.968 97.194 10.17 23.167 20.189 46.494 28.429 70.384 7.825 22.688 14.158 45.995 19.464 69.411 4.837 21.353 8.16 43.128 8.012 65.212-0.008 1.095 0.677 2.192 1.04 3.287v28.275c-0.367 5.083-0.316 10.237-1.177 15.235-3.069 17.82-5.747 35.75-9.874 53.332-6.161 26.25-17.03 50.81-31.715 73.345-9.397 14.419-20.491 27.767-31.257 41.251-12.39 15.518-27.201 28.644-43.358 40.07-14.476 10.239-29.266 20.104-44.455 29.242-21.161 12.732-43.663 22.72-68 30.057 0.362-1.721 0.494-3.108 0.943-4.385 0.256-0.727-0.038-1.391-0.884-1.995 3.78-2.514 7.52-5.092 11.223-7.714 9.023-6.387 17.294-13.725 24.214-22.4 6.013-7.538 12.209-15.001 17.456-23.061 8.202-12.599 14.272-26.329 17.712-41.003 2.305-9.83 3.801-19.853 5.514-29.815 0.482-2.794 0.453-5.675 0.658-8.517v-15.806c-0.203-0.613-0.585-1.226-0.58-1.838 0.082-12.346-1.774-24.519-4.475-36.456-2.963-13.09-6.5-26.12-10.87-38.804-4.602-13.355-10.197-26.396-15.877-39.347-8.265-18.843-18.406-36.737-29.023-54.335-6.488-10.754-13.455-21.22-20.634-32.488-3.677 20.327-6.573 40.039-19.178 57.287-1.013-4.483-1.841-8.178-2.682-11.872-2.804-12.306-7.334-23.994-12.448-35.501-6.357-14.3-14.2-27.74-23.381-40.359-5.791-7.96-12.046-15.598-18.364-23.153-4.442-5.313-9.09-10.505-14.086-15.293-13.13-12.584-27.017-24.288-41.957-34.708-18.524-12.92-37.99-24.245-58.513-33.622-13.31-6.081-26.993-11.345-40.51-16.974-1.966-0.819-3.936-1.63-5.905-2.445h-1.823c2.422 5.634 5.001 11.206 7.237 16.915 5.352 13.666 9.691 27.673 12.132 42.149 1.853 10.98 3.211 22.066 4.24 33.156 0.716 7.715 1.045 15.546 0.599 23.27-1.31 22.64-5.744 44.64-14.715 65.61-7.112 16.63-16.064 32.158-27.791 45.931-7.035 8.261-14.661 16.02-22.068 23.96-0.871 0.934-2.038 1.592-3.418 2.645-9.25-20.868-19.72-40.931-33.244-60.231-0.746 3.928-1.463 7.05-1.916 10.21-1.707 11.923-5.19 23.362-9.133 34.7-5.79 16.647-13.894 32.063-24.987 45.738-4.47 5.51-10.332 9.877-14.917 15.309-3.614 4.28-6.848 9.116-9.181 14.197-4.825 10.504-7.04 21.814-8.917 33.158l-0.338 2.063c-0.528 3.25-0.448 6.599-0.698 9.898-0.033 0.422-0.378 0.821-0.579 1.231v24.319c0.404 2.901 0.709 5.82 1.23 8.7 1.621 8.97 2.588 18.146 5.19 26.827 2.969 9.909 6.878 19.636 11.374 28.962 5.008 10.388 11.799 19.73 19.437 28.488 12.581 14.425 27.58 25.594 44.386 34.512a198.767 198.767 0 0 0 6.817 3.451c-9.097 0.587-18.404 1.198-27.916 1.832-0.197-0.284-0.353-0.777-0.596-0.823-11.847-2.27-23.729-4.365-35.549-6.763-33.377-6.77-65.133-18.109-95.23-34.062-30.092-15.952-56.95-35.931-79.477-61.735-13.677-15.665-25.836-32.376-34.804-50.96-8.05-16.682-15.05-34.08-20.366-51.805-4.659-15.53-6.391-31.942-9.295-47.987-0.932-5.152-1.478-10.374-2.201-15.564v-43.5c0.36-0.734 0.978-1.448 1.036-2.204 0.449-5.901 0.305-11.89 1.25-17.705 3.502-21.524 7.41-43.074 16.572-63.002 4.178-9.089 9.969-17.74 16.44-25.396 8.21-9.716 18.708-17.527 26.71-27.384 19.863-24.463 34.374-52.038 44.742-81.817 7.06-20.28 13.297-40.742 16.354-62.07 0.81-5.652 2.095-11.237 3.43-18.264 24.216 34.524 42.964 70.413 59.527 107.742 2.47-1.884 4.56-3.06 6.12-4.732 13.263-14.204 26.918-28.082 39.515-42.86 20.998-24.637 37.028-52.413 49.763-82.159 16.064-37.512 24.004-76.865 26.348-117.362 0.8-13.818 0.21-27.827-1.07-41.626-1.844-19.838-4.276-39.669-7.593-59.31-4.371-25.893-12.142-50.95-21.725-75.394-4.003-10.213-8.62-20.18-12.959-30.258h3.265z" fill="#E50404" p-id="4318"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -106,7 +106,7 @@
<el-col :span="8">
<el-form-item
prop="postType"
label="子类型"
label="子类型"
>
<el-select
v-model="form.postType"
@ -231,7 +231,7 @@ export default {
postType: [
{
required: true,
message: "子类型不能为空",
message: "子类型不能为空",
trigger: "change",
},
],
@ -267,7 +267,7 @@ export default {
/** 查询文章管理列表 */
getList() {},
/**发布子 */
/**发布子 */
releaseForm() {
this.$refs["form"].validate((valid) => {
if (valid) {

View File

@ -147,7 +147,7 @@
slot="header"
class="attributes"
>
<b>子热度榜</b>
<b>子热度榜</b>
</div>
<ul
class=" forum-type-ul"
@ -155,12 +155,11 @@
>
<li
class=" forum-type-li"
v-for="cmsType in typeList"
:key="cmsType.typeId"
@click="selectType(cmsType)"
:class="cmsType.typeId === typeId? 'activeType':''"
v-for="heat in heatList"
:key="heat.postId"
@click="clickHeat(heat)"
>
<div style="display: flex;align-items: center">
<!-- <div style="display: flex;align-items: center">
<el-image
style="width: 28px;height: 28px; border-radius: 50%; margin-right: 10px"
lazy
@ -181,7 +180,7 @@
style="width: 28px;height: 28px; border-radius: 50%; margin-right: 10px"
lazy
:src="cmsType.typePic"
v-show="cmsType.typePicType == '1'"
v-show="heat.typePicType == '1'"
>
<div
slot="error"
@ -193,9 +192,11 @@
></i>
</div>
</el-image>
{{cmsType.typeName}}
</div>
<div>{{cmsType.blogNum}}</div>
{{heat.typeName}}
</div> -->
<svg-icon icon-class="heat" />
<div style="text-align:left">{{heat.communityPostInfo.postTitle}}</div>
<div></div>
</li>
</ul>
<div
@ -220,22 +221,20 @@
slot="header"
class="attributes"
>
<b>标签</b>
<b>贴子类型标签</b>
</div>
<div class="tags">
<div
class=" tag-item"
v-for="tag in tagList"
:key="tag.tagId"
@click="selectTag(tag)"
:class="tag.tagId === tagId? 'activeTag':''"
v-for="tag in dict.type.post_type"
:key="tag.value"
@click="selectPostTag(tag)"
>
<div class="sjx-outer">
<div class="sjx-inner"></div>
</div>
<div class="tag">
{{tag.tagName}}
{{tag.blogNum}}
{{tag.label}}
</div>
</div>
</div>
@ -261,15 +260,92 @@
slot="header"
class="attributes"
>
<b>最新推荐</b>
<b>贴子行业类型</b>
</div>
<div class="tags">
<div
class=" tag-item"
v-for="tag in dict.type.community_industry"
:key="tag.value"
@click="selectIndustryTag(tag)"
>
<div
class="sjx-outer"
style="border-right-color:red"
>
<div
class="sjx-inner"
style="border-right-color:red"
></div>
</div>
<div
class=" recommend-forum l-text"
v-for="forum in recommendList"
:key="forum.id"
@click="getForumInfo(forum.postId)"
class="tag"
style="background-color:red;border-color:red"
>
<a class="recommend-a">{{forum.title}}</a>
{{tag.label}}
</div>
</div>
</div>
<div
class="more"
@click="dealTag"
>
<i
v-if="moreTag"
class="el-icon-arrow-down"
></i>
<i
v-else
class="el-icon-arrow-up"
></i>
</div>
</el-card>
<el-card
style="background-color: rgba(255,255,255,0.9)"
class=" right-item"
>
<div
slot="header"
class="attributes"
>
<b>贴子领域类型</b>
</div>
<div class="tags">
<div
class=" tag-item"
v-for="tag in dict.type.community_industry"
:key="tag.value"
@click="selectFieldTag(tag)"
>
<div
class="sjx-outer"
style="border-right-color:green"
>
<div
class="sjx-inner"
style="border-right-color:green"
></div>
</div>
<div
class="tag"
style="background-color:green;border-color:green"
>
{{tag.label}}
</div>
</div>
</div>
<div
class="more"
@click="dealTag"
>
<i
v-if="moreTag"
class="el-icon-arrow-down"
></i>
<i
v-else
class="el-icon-arrow-up"
></i>
</div>
</el-card>
</el-col>
@ -294,11 +370,13 @@ import {
CommunityInfo,
addViews,
} from "@/api/community/info";
import { listHeat, getHeat } from "@/api/community/heat";
export default {
name: "forum",
components: {
forumForm,
},
dicts: ["post_type", "community_field", "community_industry"],
data() {
return {
totalcount: 100,
@ -309,12 +387,12 @@ export default {
},
intro: "",
forumList: [],
typeList: [],
tagList: [],
fullTypeList: [],
heatList: [],
tagTypeList: [],
fullheatList: [],
fullTagList: [],
recommendList: [],
selectMethod: "全部子",
selectMethod: "全部子",
typeId: -1,
tagId: -1,
selected: false,
@ -350,10 +428,11 @@ export default {
window.addEventListener("resize", this.screenAdapter);
},
mounted() {
this.getHeatList();
this.getForumList();
// this.$nextTick(function () {
// //
// this.getTypeList()
// this.getheatList()
// this.getForumList();
// this.getTagList()
// this.getRecommendList()
@ -384,6 +463,10 @@ export default {
let loadingInstance = Loading.service({
target: ".left-item",
});
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
listCommunityInfo(this.queryParams)
.then((response) => {
this.forumList = response.rows;
@ -419,26 +502,29 @@ export default {
});
},
//
async getTypeList() {
getForumDetail(this.$route.query.id).then((response) => {
for (let i = 0; i < response.types.length; i++) {
let typeInfo = response.types[i];
if (typeInfo.typePic.length > 0) {
response.types[i].typePic =
process.env.VUE_APP_BASE_API + typeInfo.typePic;
}
}
const { data: res } = response;
this.fullTypeList = response.types;
this.typeList = response.types.slice(0, 4);
async getHeatList() {
listHeat(this.queryParams).then((response) => {
this.heatList = response.rows;
});
// getForumDetail(this.$route.query.id).then((response) => {
// for (let i = 0; i < response.types.length; i++) {
// let typeInfo = response.types[i];
// if (typeInfo.typePic.length > 0) {
// response.types[i].typePic =
// process.env.VUE_APP_BASE_API + typeInfo.typePic;
// }
// }
// const { data: res } = response;
// this.fullheatList = response.types;
// this.heatList = response.types.slice(0, 4);
// });
},
//
async getTagList() {
getForumDetail(this.$route.query.id).then((response) => {
const { data: res } = response;
this.fullTagList = response.tags;
this.tagList = response.tags.slice(0, 6);
this.tagTypeList = response.tags.slice(0, 6);
});
},
//
@ -459,37 +545,62 @@ export default {
handleSizeChange(newSize) {
this.queryInfo.pagesize = newSize;
},
//
async selectType(cmsType) {
//
async clickHeat(heat) {
this.getForumInfo(heat.postId);
},
//
async selectPostTag(tag) {
this.queryParams.postType = tag.value;
let loadingInstance = Loading.service({
target: ".left-item",
});
this.typeId = cmsType.typeId;
cmsListByTypeId(this.typeId)
listCommunityInfo(this.queryParams)
.then((response) => {
this.blogList = this.picSrc(response.rows);
this.total = response.total;
// this.totalcount = res.data.totalElements
this.selectMethod = "分类: " + cmsType.typeName;
this.selected = true;
this.selectMethod = tag.label + "的贴子";
this.forumList = response.rows;
this.total = response.total;
})
.finally(() => {
loadingInstance.close();
});
},
//
async selectTag(tag) {
selectIndustryTag(tag) {
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
this.queryParams.omIndustry = tag.value;
let loadingInstance = Loading.service({
target: ".left-item",
});
this.tagId = tag.tagId;
cmsListByTagId(this.tagId)
listCommunityInfo(this.queryParams)
.then((response) => {
this.blogList = this.picSrc(response.rows);
this.total = response.total;
// this.totalcount = res.data.totalElements
this.selectMethod = "标签: " + tag.tagName;
this.selected = true;
this.selectMethod = tag.label + "的贴子";
this.forumList = response.rows;
this.total = response.total;
})
.finally(() => {
loadingInstance.close();
});
},
selectFieldTag(tag) {
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
this.queryParams.omField = tag.value;
let loadingInstance = Loading.service({
target: ".left-item",
});
listCommunityInfo(this.queryParams)
.then((response) => {
this.selected = true;
this.selectMethod = tag.label + "的贴子";
this.forumList = response.rows;
this.total = response.total;
})
.finally(() => {
loadingInstance.close();
@ -498,20 +609,18 @@ export default {
//
updateForumList() {
this.selected = false;
this.typeId = -1;
this.tagId = -1;
this.selectMethod = "全部博客";
this.selectMethod = "全部贴子";
this.getForumList();
},
//
async getFullTagList() {
this.tagList = this.fullTagList;
this.tagTypeList = this.fullTagList;
},
async dealType() {
if (this.moreType) {
this.typeList = this.fullTypeList;
this.heatList = this.fullheatList;
} else {
this.typeList = this.fullTypeList.slice(0, 4);
this.heatList = this.fullheatList.slice(0, 4);
}
this.moreType = !this.moreType;
},
@ -671,9 +780,9 @@ export default {
margin-bottom: 20px;
}
.forum-type-li:first-child {
/* .forum-type-li:first-child {
border-top: 1px solid rgba(179, 216, 255, 0.5);
}
} */
.forum-type-li {
border-bottom: 1px solid rgba(179, 216, 255, 0.5);
@ -705,7 +814,7 @@ export default {
flex-wrap: wrap;
align-items: center;
margin: 15px 13px 0;
border-bottom: 1px solid rgba(179, 216, 255, 0.5);
border-bottom: 1px solid rgba(250, 255, 179, 0.5);
}
.tag-item {