diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostHeatController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostHeatController.java new file mode 100644 index 0000000..d3fc87e --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostHeatController.java @@ -0,0 +1,105 @@ +package com.inspur.web.controller.community; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.community.domain.CommunityPostHeat; +import com.inspur.community.service.ICommunityPostHeatService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 社区帖子热度Controller + * + * @author inspur + * @date 2024-04-30 + */ +@RestController +@RequestMapping("/community/heat") +public class CommunityPostHeatController extends BaseController +{ + @Autowired + private ICommunityPostHeatService communityPostHeatService; + + /** + * 查询社区帖子热度列表 + */ + @PreAuthorize("@ss.hasPermi('community:heat:list')") + @GetMapping("/list") + public TableDataInfo list(CommunityPostHeat communityPostHeat) + { + startPage(); + List list = communityPostHeatService.selectCommunityPostHeatList(communityPostHeat); + return getDataTable(list); + } + + /** + * 导出社区帖子热度列表 + */ + @PreAuthorize("@ss.hasPermi('community:heat:export')") + @Log(title = "社区帖子热度", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CommunityPostHeat communityPostHeat) + { + List list = communityPostHeatService.selectCommunityPostHeatList(communityPostHeat); + ExcelUtil util = new ExcelUtil(CommunityPostHeat.class); + util.exportExcel(response, list, "社区帖子热度数据"); + } + + /** + * 获取社区帖子热度详细信息 + */ + @PreAuthorize("@ss.hasPermi('community:heat:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable("postId") String postId) + { + return success(communityPostHeatService.selectCommunityPostHeatByPostId(postId)); + } + + /** + * 新增社区帖子热度 + */ + @PreAuthorize("@ss.hasPermi('community:heat:add')") + @Log(title = "社区帖子热度", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CommunityPostHeat communityPostHeat) + { + return toAjax(communityPostHeatService.insertCommunityPostHeat(communityPostHeat)); + } + + /** + * 修改社区帖子热度 + */ + @PreAuthorize("@ss.hasPermi('community:heat:edit')") + @Log(title = "社区帖子热度", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CommunityPostHeat communityPostHeat) + { + return toAjax(communityPostHeatService.updateCommunityPostHeat(communityPostHeat)); + } + + /** + * 删除社区帖子热度 + */ + @PreAuthorize("@ss.hasPermi('community:heat:remove')") + @Log(title = "社区帖子热度", businessType = BusinessType.DELETE) + @DeleteMapping("/{postIds}") + public AjaxResult remove(@PathVariable String[] postIds) + { + return toAjax(communityPostHeatService.deleteCommunityPostHeatByPostIds(postIds)); + } +} + diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostLikeController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostLikeController.java new file mode 100644 index 0000000..395357a --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostLikeController.java @@ -0,0 +1,115 @@ +package com.inspur.web.controller.community; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.inspur.common.utils.SecurityUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.community.domain.CommunityPostLike; +import com.inspur.community.service.ICommunityPostLikeService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 社区点赞信息Controller + * + * @author inspur + * @date 2024-04-30 + */ +@RestController +@RequestMapping("/community/like") +public class CommunityPostLikeController extends BaseController +{ + @Autowired + private ICommunityPostLikeService communityPostLikeService; + + /** + * 查询社区点赞信息列表 + */ + @PreAuthorize("@ss.hasPermi('community:like:list')") + @GetMapping("/list") + public TableDataInfo list(CommunityPostLike communityPostLike) + { + startPage(); + List list = communityPostLikeService.selectCommunityPostLikeList(communityPostLike); + return getDataTable(list); + } + + /** + * 导出社区点赞信息列表 + */ + @PreAuthorize("@ss.hasPermi('community:like:export')") + @Log(title = "社区点赞信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CommunityPostLike communityPostLike) + { + List list = communityPostLikeService.selectCommunityPostLikeList(communityPostLike); + ExcelUtil util = new ExcelUtil(CommunityPostLike.class); + util.exportExcel(response, list, "社区点赞信息数据"); + } + + /** + * 获取社区点赞信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('community:like:query')") + @GetMapping(value = "/{userId}") + public AjaxResult getInfo(@PathVariable("userId") Long userId) + { + return success(communityPostLikeService.selectCommunityPostLikeByUserId(userId)); + } + + /** + * 新增社区点赞信息 + */ + @PreAuthorize("@ss.hasPermi('community:like:add')") + @Log(title = "社区点赞信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CommunityPostLike communityPostLike) + { + return toAjax(communityPostLikeService.insertCommunityPostLike(communityPostLike)); + } + + /** + * 修改社区点赞信息 + */ + @PreAuthorize("@ss.hasPermi('community:like:edit')") + @Log(title = "社区点赞信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CommunityPostLike communityPostLike) + { + return toAjax(communityPostLikeService.updateCommunityPostLike(communityPostLike)); + } + + /** + * 删除点赞信息 + */ +// @PreAuthorize("@ss.hasPermi('community:like:remove')") +// @Log(title = "社区点赞信息", businessType = BusinessType.DELETE) +// @DeleteMapping("/{userIds}") +// public AjaxResult remove(@PathVariable Long[] userIds) +// { +// return toAjax(communityPostLikeService.deleteCommunityPostLikeByUserIds(userIds)); +// } + @PreAuthorize("@ss.hasPermi('community:like:remove')") + @Log(title = "社区点赞信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{likePostId}") + public AjaxResult remove(@PathVariable String likePostId) + { + return toAjax(communityPostLikeService.deleteCommunityPostLikeByUserIdandPostId(SecurityUtils.getLoginUser().getUserId(), likePostId)); + } + + +} diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostReplyController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostReplyController.java new file mode 100644 index 0000000..6082f82 --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostReplyController.java @@ -0,0 +1,118 @@ +package com.inspur.web.controller.community; + + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.inspur.community.domain.CommunityComment; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.community.domain.CommunityPostReply; +import com.inspur.community.service.ICommunityPostReplyService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 社区帖子回复Controller + * + * @author inspur + * @date 2024-04-30 + */ +@RestController +@RequestMapping("/community/reply") +public class CommunityPostReplyController extends BaseController +{ + @Autowired + private ICommunityPostReplyService communityPostReplyService; + + /** + * 查询社区帖子回复列表 + */ + @PreAuthorize("@ss.hasPermi('community:reply:list')") + @GetMapping("/list") + public TableDataInfo list(CommunityPostReply communityPostReply) + { + startPage(); + List list = communityPostReplyService.selectCommunityPostReplyList(communityPostReply); + return getDataTable(list); + } + +// /** +// * 导出社区帖子回复列表 +// */ +// @PreAuthorize("@ss.hasPermi('community:reply:export')") +// @Log(title = "社区帖子回复", businessType = BusinessType.EXPORT) +// @PostMapping("/export") +// public void export(HttpServletResponse response, CommunityPostReply communityPostReply) +// { +// List list = communityPostReplyService.selectCommunityPostReplyList(communityPostReply); +// ExcelUtil util = new ExcelUtil(CommunityPostReply.class); +// util.exportExcel(response, list, "社区帖子回复数据"); +// } + + /** + * 获取社区帖子回复详细信息 + */ + @PreAuthorize("@ss.hasPermi('community:reply:query')") + @GetMapping(value = "/{replyId}") + public AjaxResult getInfo(@PathVariable("replyId") String replyId) + { + return success(communityPostReplyService.selectCommunityPostReplyByReplyId(replyId)); + } + + /** + * 新增社区帖子回复 + */ + @PreAuthorize("@ss.hasPermi('community:reply:add')") + @Log(title = "社区帖子回复", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CommunityPostReply communityPostReply) + { + if(communityPostReply.getParentReplyId() == null){ + communityPostReply.setParentReplyId("0"); + }else{ + CommunityPostReply reply = communityPostReplyService.selectCommunityPostReplyByReplyId(communityPostReply.getParentReplyId()); + if(reply.getRootReplyId() != null) { + communityPostReply.setRootReplyId(reply.getRootReplyId()); + }else{ + communityPostReply.setRootReplyId(reply.getReplyId()); + } + } + return toAjax(communityPostReplyService.insertCommunityPostReply(communityPostReply)); + } + + /** + * 修改社区帖子回复 + */ + @PreAuthorize("@ss.hasPermi('community:reply:edit')") + @Log(title = "社区帖子回复", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CommunityPostReply communityPostReply) + { + return toAjax(communityPostReplyService.updateCommunityPostReply(communityPostReply)); + } + + /** + * 删除社区帖子回复 + */ + @PreAuthorize("@ss.hasPermi('community:reply:remove')") + @Log(title = "社区帖子回复", businessType = BusinessType.DELETE) + @DeleteMapping("/{replyIds}") + public AjaxResult remove(@PathVariable String[] replyIds) + { + return toAjax(communityPostReplyService.deleteCommunityPostReplyByReplyIds(replyIds)); + } +} + diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostReportController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostReportController.java new file mode 100644 index 0000000..49f53a7 --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostReportController.java @@ -0,0 +1,105 @@ +package com.inspur.web.controller.community; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.inspur.common.annotation.Log; +import com.inspur.common.core.controller.BaseController; +import com.inspur.common.core.domain.AjaxResult; +import com.inspur.common.enums.BusinessType; +import com.inspur.community.domain.CommunityPostReport; +import com.inspur.community.service.ICommunityPostReportService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 社区帖子举报Controller + * + * @author inspur + * @date 2024-04-30 + */ +@RestController +@RequestMapping("/community/report") +public class CommunityPostReportController extends BaseController +{ + @Autowired + private ICommunityPostReportService communityPostReportService; + + /** + * 查询社区帖子举报列表 + */ + @PreAuthorize("@ss.hasPermi('community:report:list')") + @GetMapping("/list") + public TableDataInfo list(CommunityPostReport communityPostReport) + { + startPage(); + List list = communityPostReportService.selectCommunityPostReportList(communityPostReport); + return getDataTable(list); + } + + /** + * 导出社区帖子举报列表 + */ + @PreAuthorize("@ss.hasPermi('community:report:export')") + @Log(title = "社区帖子举报", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CommunityPostReport communityPostReport) + { + List list = communityPostReportService.selectCommunityPostReportList(communityPostReport); + ExcelUtil util = new ExcelUtil(CommunityPostReport.class); + util.exportExcel(response, list, "社区帖子举报数据"); + } + + /** + * 获取社区帖子举报详细信息 + */ + @PreAuthorize("@ss.hasPermi('community:report:query')") + @GetMapping(value = "/{reportId}") + public AjaxResult getInfo(@PathVariable("reportId") String reportId) + { + return success(communityPostReportService.selectCommunityPostReportByReportId(reportId)); + } + + /** + * 新增社区帖子举报 + */ + @PreAuthorize("@ss.hasPermi('community:report:add')") + @Log(title = "社区帖子举报", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CommunityPostReport communityPostReport) + { + return toAjax(communityPostReportService.insertCommunityPostReport(communityPostReport)); + } + + /** + * 修改社区帖子举报 + */ + @PreAuthorize("@ss.hasPermi('community:report:edit')") + @Log(title = "社区帖子举报", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CommunityPostReport communityPostReport) + { + return toAjax(communityPostReportService.updateCommunityPostReport(communityPostReport)); + } + + /** + * 删除社区帖子举报 + */ + @PreAuthorize("@ss.hasPermi('community:report:remove')") + @Log(title = "社区帖子举报", businessType = BusinessType.DELETE) + @DeleteMapping("/{reportIds}") + public AjaxResult remove(@PathVariable String[] reportIds) + { + return toAjax(communityPostReportService.deleteCommunityPostReportByReportIds(reportIds)); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityComment.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityComment.java new file mode 100644 index 0000000..7d925f3 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityComment.java @@ -0,0 +1,174 @@ +package com.inspur.community.domain; + +import com.inspur.common.annotation.Excel; + +import java.util.List; + +/** + * @Author zhangjunwen + * @create 2024/5/6 + */ +public class CommunityComment { + + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String replyId; + + /** 帖子id */ + @Excel(name = "帖子id") + private String postId; + + private Long userId; + + /** 回复用户名称 */ + @Excel(name = "回复用户名称") + private String userName; + + /** 回复内容 */ + @Excel(name = "回复内容") + private String replyContent; + + /** 回复时间 */ + @Excel(name = "回复时间") + private String replyTime; + + /** 父级回复id */ + @Excel(name = "父级回复id") + private String parentReplyId; + + /** 根回复id */ + @Excel(name = "根回复id") + private String rootReplyId; + + /** 状态:0 正常;1 封禁;2 删除 */ + @Excel(name = "状态:0 正常;1 封禁;2 删除") + private String status; + + /** 点赞数量 */ + @Excel(name = "点赞数量") + private Long likeNum; + + /** 头像 */ + private String avatar; + + /** 回复 */ + private List children; + + /** 点赞 */ + private boolean isLike; + + private String parentReplyUserName; + + public String getReplyId() { + return replyId; + } + + public void setReplyId(String replyId) { + this.replyId = replyId; + } + + public String getPostId() { + return postId; + } + + public void setPostId(String postId) { + this.postId = postId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getReplyContent() { + return replyContent; + } + + public void setReplyContent(String replyContent) { + this.replyContent = replyContent; + } + + public String getReplyTime() { + return replyTime; + } + + public void setReplyTime(String replyTime) { + this.replyTime = replyTime; + } + + public String getParentReplyId() { + return parentReplyId; + } + + public void setParentReplyId(String parentReplyId) { + this.parentReplyId = parentReplyId; + } + + public String getRootReplyId() { + return rootReplyId; + } + + public void setRootReplyId(String rootReplyId) { + this.rootReplyId = rootReplyId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Long getLikeNum() { + return likeNum; + } + + public void setLikeNum(Long likeNum) { + this.likeNum = likeNum; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + public boolean getIsLike() { + return isLike; + } + + public void setLike(boolean like) { + this.isLike = like; + } + + public String getParentReplyUserName() { + return parentReplyUserName; + } + + public void setParentReplyUserName(String parentReplyUserName) { + this.parentReplyUserName = parentReplyUserName; + } +} diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java new file mode 100644 index 0000000..5911242 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java @@ -0,0 +1,80 @@ +package com.inspur.community.domain; + +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 社区帖子热度对象 community_post_heat + * + * @author inspur + * @date 2024-04-30 + */ +public class CommunityPostHeat extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 帖子id */ + @Excel(name = "帖子id") + private String postId; + + /** 点赞数 */ + @Excel(name = "点赞数") + private Integer likes; + + /** 浏览数 */ + @Excel(name = "浏览数") + private Integer views; + + /** 回复数 */ + @Excel(name = "回复数") + private Integer replies; + + public void setPostId(String postId) + { + this.postId = postId; + } + + public String getPostId() + { + return postId; + } + public void setLikes(Integer likes) + { + this.likes = likes; + } + + public Integer getLikes() + { + return likes; + } + public void setViews(Integer views) + { + this.views = views; + } + + public Integer getViews() + { + return views; + } + public void setReplies(Integer replies) + { + this.replies = replies; + } + + public Integer getReplies() + { + return replies; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("postId", getPostId()) + .append("likes", getLikes()) + .append("views", getViews()) + .append("replies", getReplies()) + .toString(); + } +} diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostLike.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostLike.java new file mode 100644 index 0000000..d1d5d59 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostLike.java @@ -0,0 +1,69 @@ +package com.inspur.community.domain; + + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 社区点赞信息对象 community_post_like + * + * @author inspur + * @date 2024-04-30 + */ +public class CommunityPostLike extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 用户id */ + private Long userId; + + /** 点赞帖子id */ + private String likePostId; + + /** 点赞时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "点赞时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date likeTime; + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setLikePostId(String likePostId) + { + this.likePostId = likePostId; + } + + public String getLikePostId() + { + return likePostId; + } + public void setLikeTime(Date likeTime) + { + this.likeTime = likeTime; + } + + public Date getLikeTime() + { + return likeTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("likePostId", getLikePostId()) + .append("likeTime", getLikeTime()) + .toString(); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostReply.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostReply.java new file mode 100644 index 0000000..ca97740 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostReply.java @@ -0,0 +1,136 @@ +package com.inspur.community.domain; + +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 社区帖子回复对象 community_post_reply + * + * @author zhangjunwen + * @date 2024-04-30 + */ +public class CommunityPostReply extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String replyId; + + /** 帖子id */ + @Excel(name = "帖子id") + private String postId; + + /** 回复用户id */ + @Excel(name = "回复用户id") + private Long userId; + + /** 回复内容 */ + @Excel(name = "回复内容") + private String replyContent; + + /** 回复时间 */ + @Excel(name = "回复时间") + private String replyTime; + + /** 父级回复id */ + @Excel(name = "父级回复id") + private String parentReplyId; + + /** 根回复id */ + @Excel(name = "根回复id") + private String rootReplyId; + + /** 状态:0 正常;1 封禁;2 删除 */ + @Excel(name = "状态:0 正常;1 封禁;2 删除") + private String status; + + public void setReplyId(String replyId) + { + this.replyId = replyId; + } + + public String getReplyId() + { + return replyId; + } + public void setPostId(String postId) + { + this.postId = postId; + } + + public String getPostId() + { + return postId; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setReplyContent(String replyContent) + { + this.replyContent = replyContent; + } + + public String getReplyContent() + { + return replyContent; + } + public void setReplyTime(String replyTime) + { + this.replyTime = replyTime; + } + + public String getReplyTime() + { + return replyTime; + } + public void setParentReplyId(String parentReplyId) + { + this.parentReplyId = parentReplyId; + } + + public String getParentReplyId() + { + return parentReplyId; + } + public void setRootReplyId(String rootReplyId) + { + this.rootReplyId = rootReplyId; + } + + public String getRootReplyId() + { + return rootReplyId; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("replyId", getReplyId()) + .append("postId", getPostId()) + .append("userId", getUserId()) + .append("replyContent", getReplyContent()) + .append("replyTime", getReplyTime()) + .append("parentReplyId", getParentReplyId()) + .append("rootReplyId", getRootReplyId()) + .append("status", getStatus()) + .toString(); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostReport.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostReport.java new file mode 100644 index 0000000..5b35719 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostReport.java @@ -0,0 +1,136 @@ +package com.inspur.community.domain; + +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 社区帖子举报对象 community_post_report + * + * @author inspur + * @date 2024-04-30 + */ +public class CommunityPostReport extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 举报id */ + private String reportId; + + /** 举报用户id */ + @Excel(name = "举报用户id") + private Long reportUserId; + + /** 被举报内容id */ + @Excel(name = "被举报内容id") + private String reportContentId; + + /** 举报时间 */ + @Excel(name = "举报时间") + private String reportTime; + + /** 举报原因 */ + @Excel(name = "举报原因") + private String reportReason; + + /** 状态:0 未处理,1 已处理 */ + @Excel(name = "状态:0 未处理,1 已处理") + private String status; + + /** 举报类型:0 帖子,1 回复 */ + @Excel(name = "举报类型:0 帖子,1 回复") + private String reportType; + + /** 处理结果 */ + @Excel(name = "处理结果") + private String result; + + public void setReportId(String reportId) + { + this.reportId = reportId; + } + + public String getReportId() + { + return reportId; + } + public void setReportUserId(Long reportUserId) + { + this.reportUserId = reportUserId; + } + + public Long getReportUserId() + { + return reportUserId; + } + public void setReportContentId(String reportContentId) + { + this.reportContentId = reportContentId; + } + + public String getReportContentId() + { + return reportContentId; + } + public void setReportTime(String reportTime) + { + this.reportTime = reportTime; + } + + public String getReportTime() + { + return reportTime; + } + public void setReportReason(String reportReason) + { + this.reportReason = reportReason; + } + + public String getReportReason() + { + return reportReason; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setReportType(String reportType) + { + this.reportType = reportType; + } + + public String getReportType() + { + return reportType; + } + public void setResult(String result) + { + this.result = result; + } + + public String getResult() + { + return result; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("reportId", getReportId()) + .append("reportUserId", getReportUserId()) + .append("reportContentId", getReportContentId()) + .append("reportTime", getReportTime()) + .append("reportReason", getReportReason()) + .append("status", getStatus()) + .append("reportType", getReportType()) + .append("result", getResult()) + .toString(); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostHeatMapper.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostHeatMapper.java new file mode 100644 index 0000000..957a9b3 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostHeatMapper.java @@ -0,0 +1,71 @@ +package com.inspur.community.mapper; + +import java.util.List; +import com.inspur.community.domain.CommunityPostHeat; + +/** + * 社区帖子热度Mapper接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface CommunityPostHeatMapper +{ + /** + * 查询社区帖子热度 + * + * @param postId 社区帖子热度主键 + * @return 社区帖子热度 + */ + public CommunityPostHeat selectCommunityPostHeatByPostId(String postId); + + /** + * 查询社区帖子热度列表 + * + * @param communityPostHeat 社区帖子热度 + * @return 社区帖子热度集合 + */ + public List selectCommunityPostHeatList(CommunityPostHeat communityPostHeat); + + /** + * 新增社区帖子热度 + * + * @param communityPostHeat 社区帖子热度 + * @return 结果 + */ + public int insertCommunityPostHeat(CommunityPostHeat communityPostHeat); + + /** + * 修改社区帖子热度 + * + * @param communityPostHeat 社区帖子热度 + * @return 结果 + */ + public int updateCommunityPostHeat(CommunityPostHeat communityPostHeat); + + /** + * 浏览量加一 + */ + public int addViews(String postId); + + /** + * 回复量加一 + */ + public int addReplies(String postId); + + /** + * 删除社区帖子热度 + * + * @param postId 社区帖子热度主键 + * @return 结果 + */ + public int deleteCommunityPostHeatByPostId(String postId); + + /** + * 批量删除社区帖子热度 + * + * @param postIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCommunityPostHeatByPostIds(String[] postIds); +} diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostLikeMapper.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostLikeMapper.java new file mode 100644 index 0000000..aad0de4 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostLikeMapper.java @@ -0,0 +1,69 @@ +package com.inspur.community.mapper; + +import java.util.List; +import com.inspur.community.domain.CommunityPostLike; +import org.apache.ibatis.annotations.Param; + +/** + * 社区点赞信息Mapper接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface CommunityPostLikeMapper +{ + /** + * 查询社区点赞信息 + * + * @param userId 社区点赞信息主键 + * @return 社区点赞信息 + */ + public CommunityPostLike selectCommunityPostLikeByUserId(Long userId); + + /** + * 查询社区点赞信息列表 + * + * @param communityPostLike 社区点赞信息 + * @return 社区点赞信息集合 + */ + public List selectCommunityPostLikeList(CommunityPostLike communityPostLike); + + /** + * 根据postid统计点赞数 + */ + public long countCommunityPostLikeByLikePostId(String likePostId); + + /** + * 新增社区点赞信息 + * + * @param communityPostLike 社区点赞信息 + * @return 结果 + */ + public int insertCommunityPostLike(CommunityPostLike communityPostLike); + + /** + * 修改社区点赞信息 + * + * @param communityPostLike 社区点赞信息 + * @return 结果 + */ + public int updateCommunityPostLike(CommunityPostLike communityPostLike); + + /** + * 删除社区点赞信息 + * + * @param userId 社区点赞信息主键 + * @return 结果 + */ + public int deleteCommunityPostLikeByUserIdandPostId(@Param("userId")Long userId, + @Param("likePostId")String likePostId); + + /** + * 批量删除社区点赞信息 + * + * @param userIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCommunityPostLikeByUserIds(Long[] userIds); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostReplyMapper.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostReplyMapper.java new file mode 100644 index 0000000..3051b6b --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostReplyMapper.java @@ -0,0 +1,62 @@ +package com.inspur.community.mapper; + +import java.util.List; +import com.inspur.community.domain.CommunityPostReply; + +/** + * 社区帖子回复Mapper接口 + * + * @author zhangjunwen + * @date 2024-04-30 + */ +public interface CommunityPostReplyMapper +{ + /** + * 查询社区帖子回复 + * + * @param replyId 社区帖子回复主键 + * @return 社区帖子回复 + */ + public CommunityPostReply selectCommunityPostReplyByReplyId(String replyId); + + /** + * 查询社区帖子回复列表 + * + * @param communityPostReply 社区帖子回复 + * @return 社区帖子回复集合 + */ + public List selectCommunityPostReplyList(CommunityPostReply communityPostReply); + + /** + * 新增社区帖子回复 + * + * @param communityPostReply 社区帖子回复 + * @return 结果 + */ + public int insertCommunityPostReply(CommunityPostReply communityPostReply); + + /** + * 修改社区帖子回复 + * + * @param communityPostReply 社区帖子回复 + * @return 结果 + */ + public int updateCommunityPostReply(CommunityPostReply communityPostReply); + + /** + * 删除社区帖子回复 + * + * @param replyId 社区帖子回复主键 + * @return 结果 + */ + public int deleteCommunityPostReplyByReplyId(String replyId); + + /** + * 批量删除社区帖子回复 + * + * @param replyIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCommunityPostReplyByReplyIds(String[] replyIds); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostReportMapper.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostReportMapper.java new file mode 100644 index 0000000..2bc493d --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostReportMapper.java @@ -0,0 +1,62 @@ +package com.inspur.community.mapper; + +import java.util.List; +import com.inspur.community.domain.CommunityPostReport; + +/** + * 社区帖子举报Mapper接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface CommunityPostReportMapper +{ + /** + * 查询社区帖子举报 + * + * @param reportId 社区帖子举报主键 + * @return 社区帖子举报 + */ + public CommunityPostReport selectCommunityPostReportByReportId(String reportId); + + /** + * 查询社区帖子举报列表 + * + * @param communityPostReport 社区帖子举报 + * @return 社区帖子举报集合 + */ + public List selectCommunityPostReportList(CommunityPostReport communityPostReport); + + /** + * 新增社区帖子举报 + * + * @param communityPostReport 社区帖子举报 + * @return 结果 + */ + public int insertCommunityPostReport(CommunityPostReport communityPostReport); + + /** + * 修改社区帖子举报 + * + * @param communityPostReport 社区帖子举报 + * @return 结果 + */ + public int updateCommunityPostReport(CommunityPostReport communityPostReport); + + /** + * 删除社区帖子举报 + * + * @param reportId 社区帖子举报主键 + * @return 结果 + */ + public int deleteCommunityPostReportByReportId(String reportId); + + /** + * 批量删除社区帖子举报 + * + * @param reportIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCommunityPostReportByReportIds(String[] reportIds); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostHeatService.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostHeatService.java new file mode 100644 index 0000000..32691ba --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostHeatService.java @@ -0,0 +1,62 @@ +package com.inspur.community.service; + +import java.util.List; +import com.inspur.community.domain.CommunityPostHeat; + +/** + * 社区帖子热度Service接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface ICommunityPostHeatService +{ + /** + * 查询社区帖子热度 + * + * @param postId 社区帖子热度主键 + * @return 社区帖子热度 + */ + public CommunityPostHeat selectCommunityPostHeatByPostId(String postId); + + /** + * 查询社区帖子热度列表 + * + * @param communityPostHeat 社区帖子热度 + * @return 社区帖子热度集合 + */ + public List selectCommunityPostHeatList(CommunityPostHeat communityPostHeat); + + /** + * 新增社区帖子热度 + * + * @param communityPostHeat 社区帖子热度 + * @return 结果 + */ + public int insertCommunityPostHeat(CommunityPostHeat communityPostHeat); + + /** + * 修改社区帖子热度 + * + * @param communityPostHeat 社区帖子热度 + * @return 结果 + */ + public int updateCommunityPostHeat(CommunityPostHeat communityPostHeat); + + /** + * 批量删除社区帖子热度 + * + * @param postIds 需要删除的社区帖子热度主键集合 + * @return 结果 + */ + public int deleteCommunityPostHeatByPostIds(String[] postIds); + + /** + * 删除社区帖子热度信息 + * + * @param postId 社区帖子热度主键 + * @return 结果 + */ + public int deleteCommunityPostHeatByPostId(String postId); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostLikeService.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostLikeService.java new file mode 100644 index 0000000..5ac9e3f --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostLikeService.java @@ -0,0 +1,62 @@ +package com.inspur.community.service; + +import java.util.List; +import com.inspur.community.domain.CommunityPostLike; + +/** + * 社区点赞信息Service接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface ICommunityPostLikeService +{ + /** + * 查询社区点赞信息 + * + * @param userId 社区点赞信息主键 + * @return 社区点赞信息 + */ + public CommunityPostLike selectCommunityPostLikeByUserId(Long userId); + + /** + * 查询社区点赞信息列表 + * + * @param communityPostLike 社区点赞信息 + * @return 社区点赞信息集合 + */ + public List selectCommunityPostLikeList(CommunityPostLike communityPostLike); + + /** + * 新增社区点赞信息 + * + * @param communityPostLike 社区点赞信息 + * @return 结果 + */ + public int insertCommunityPostLike(CommunityPostLike communityPostLike); + + /** + * 修改社区点赞信息 + * + * @param communityPostLike 社区点赞信息 + * @return 结果 + */ + public int updateCommunityPostLike(CommunityPostLike communityPostLike); + + /** + * 批量删除社区点赞信息 + * + * @param userIds 需要删除的社区点赞信息主键集合 + * @return 结果 + */ + public int deleteCommunityPostLikeByUserIds(Long[] userIds); + + /** + * 删除社区点赞信息信息 + * + * @param userId 社区点赞信息主键 + * @return 结果 + */ + public int deleteCommunityPostLikeByUserIdandPostId(Long userId,String likePostId); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostReplyService.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostReplyService.java new file mode 100644 index 0000000..93e34b2 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostReplyService.java @@ -0,0 +1,63 @@ +package com.inspur.community.service; + +import java.util.List; + +import com.inspur.community.domain.CommunityComment; +import com.inspur.community.domain.CommunityPostReply; + +/** + * 社区帖子回复Service接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface ICommunityPostReplyService +{ + /** + * 查询社区帖子回复 + * + * @param replyId 社区帖子回复主键 + * @return 社区帖子回复 + */ + public CommunityPostReply selectCommunityPostReplyByReplyId(String replyId); + + /** + * 查询社区帖子回复列表 + * + * @param communityPostReply 社区帖子回复 + * @return 社区帖子回复集合 + */ + public List selectCommunityPostReplyList(CommunityPostReply communityPostReply); + + /** + * 新增社区帖子回复 + * + * @param communityPostReply 社区帖子回复 + * @return 结果 + */ + public int insertCommunityPostReply(CommunityPostReply communityPostReply); + + /** + * 修改社区帖子回复 + * + * @param communityPostReply 社区帖子回复 + * @return 结果 + */ + public int updateCommunityPostReply(CommunityPostReply communityPostReply); + + /** + * 批量删除社区帖子回复 + * + * @param replyIds 需要删除的社区帖子回复主键集合 + * @return 结果 + */ + public int deleteCommunityPostReplyByReplyIds(String[] replyIds); + + /** + * 删除社区帖子回复信息 + * + * @param replyId 社区帖子回复主键 + * @return 结果 + */ + public int deleteCommunityPostReplyByReplyId(String replyId); +} diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostReportService.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostReportService.java new file mode 100644 index 0000000..cbf5fbb --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostReportService.java @@ -0,0 +1,62 @@ +package com.inspur.community.service; + +import java.util.List; +import com.inspur.community.domain.CommunityPostReport; + +/** + * 社区帖子举报Service接口 + * + * @author inspur + * @date 2024-04-30 + */ +public interface ICommunityPostReportService +{ + /** + * 查询社区帖子举报 + * + * @param reportId 社区帖子举报主键 + * @return 社区帖子举报 + */ + public CommunityPostReport selectCommunityPostReportByReportId(String reportId); + + /** + * 查询社区帖子举报列表 + * + * @param communityPostReport 社区帖子举报 + * @return 社区帖子举报集合 + */ + public List selectCommunityPostReportList(CommunityPostReport communityPostReport); + + /** + * 新增社区帖子举报 + * + * @param communityPostReport 社区帖子举报 + * @return 结果 + */ + public int insertCommunityPostReport(CommunityPostReport communityPostReport); + + /** + * 修改社区帖子举报 + * + * @param communityPostReport 社区帖子举报 + * @return 结果 + */ + public int updateCommunityPostReport(CommunityPostReport communityPostReport); + + /** + * 批量删除社区帖子举报 + * + * @param reportIds 需要删除的社区帖子举报主键集合 + * @return 结果 + */ + public int deleteCommunityPostReportByReportIds(String[] reportIds); + + /** + * 删除社区帖子举报信息 + * + * @param reportId 社区帖子举报主键 + * @return 结果 + */ + public int deleteCommunityPostReportByReportId(String reportId); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostHeatServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostHeatServiceImpl.java new file mode 100644 index 0000000..10afe0b --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostHeatServiceImpl.java @@ -0,0 +1,94 @@ +package com.inspur.community.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.community.mapper.CommunityPostHeatMapper; +import com.inspur.community.domain.CommunityPostHeat; +import com.inspur.community.service.ICommunityPostHeatService; + +/** + * 社区帖子热度Service业务层处理 + * + * @author inspur + * @date 2024-04-30 + */ +@Service +public class CommunityPostHeatServiceImpl implements ICommunityPostHeatService +{ + @Autowired + private CommunityPostHeatMapper communityPostHeatMapper; + + /** + * 查询社区帖子热度 + * + * @param postId 社区帖子热度主键 + * @return 社区帖子热度 + */ + @Override + public CommunityPostHeat selectCommunityPostHeatByPostId(String postId) + { + return communityPostHeatMapper.selectCommunityPostHeatByPostId(postId); + } + + /** + * 查询社区帖子热度列表 + * + * @param communityPostHeat 社区帖子热度 + * @return 社区帖子热度 + */ + @Override + public List selectCommunityPostHeatList(CommunityPostHeat communityPostHeat) + { + return communityPostHeatMapper.selectCommunityPostHeatList(communityPostHeat); + } + + /** + * 新增社区帖子热度 + * + * @param communityPostHeat 社区帖子热度 + * @return 结果 + */ + @Override + public int insertCommunityPostHeat(CommunityPostHeat communityPostHeat) + { + return communityPostHeatMapper.insertCommunityPostHeat(communityPostHeat); + } + + /** + * 修改社区帖子热度 + * + * @param communityPostHeat 社区帖子热度 + * @return 结果 + */ + @Override + public int updateCommunityPostHeat(CommunityPostHeat communityPostHeat) + { + return communityPostHeatMapper.updateCommunityPostHeat(communityPostHeat); + } + + /** + * 批量删除社区帖子热度 + * + * @param postIds 需要删除的社区帖子热度主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostHeatByPostIds(String[] postIds) + { + return communityPostHeatMapper.deleteCommunityPostHeatByPostIds(postIds); + } + + /** + * 删除社区帖子热度信息 + * + * @param postId 社区帖子热度主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostHeatByPostId(String postId) + { + return communityPostHeatMapper.deleteCommunityPostHeatByPostId(postId); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java index f44d830..47f2e19 100644 --- a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java @@ -5,12 +5,15 @@ import java.util.List; import com.inspur.common.utils.SecurityUtils; import com.inspur.common.utils.uuid.IdUtils; +import com.inspur.community.domain.CommunityPostHeat; import com.inspur.community.domain.vo.CommunityPostInfoVO; +import com.inspur.community.mapper.CommunityPostHeatMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.inspur.community.mapper.CommunityPostInfoMapper; import com.inspur.community.domain.CommunityPostInfo; import com.inspur.community.service.ICommunityPostInfoService; +import org.springframework.transaction.annotation.Transactional; /** * 社区帖子信息Service业务层处理 @@ -23,6 +26,8 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService { @Autowired private CommunityPostInfoMapper communityPostInfoMapper; + @Autowired + private CommunityPostHeatMapper communityPostHeatMapper; /** * 查询社区帖子信息 @@ -54,13 +59,19 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService * @param communityPostInfo 社区帖子信息 * @return 结果 */ + @Transactional(rollbackFor = Exception.class) @Override public int insertCommunityPostInfo(CommunityPostInfo communityPostInfo) { communityPostInfo.setPostId(IdUtils.simpleUUID()); communityPostInfo.setPostTime(new Date()); communityPostInfo.setUserId(SecurityUtils.getUserId()); - return communityPostInfoMapper.insertCommunityPostInfo(communityPostInfo); + //热度榜单新增记录 + CommunityPostHeat postHeat = new CommunityPostHeat(); + postHeat.setPostId(communityPostInfo.getPostId()); + postHeat.setLikes(0); + postHeat.setViews(0); + return communityPostInfoMapper.insertCommunityPostInfo(communityPostInfo) & communityPostHeatMapper.insertCommunityPostHeat(postHeat); } /** @@ -81,9 +92,11 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService * @param postId * @return */ + @Transactional(rollbackFor = Exception.class) @Override public int addViews(String postId){ - return communityPostInfoMapper.addViews(postId); + //热度榜单浏览记录加一 + return communityPostInfoMapper.addViews(postId) & communityPostHeatMapper.addViews(postId); } /** diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostLikeServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostLikeServiceImpl.java new file mode 100644 index 0000000..8c83228 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostLikeServiceImpl.java @@ -0,0 +1,106 @@ +package com.inspur.community.service.impl; + +import java.util.Date; +import java.util.List; + +import com.inspur.common.utils.DateUtils; +import com.inspur.common.utils.SecurityUtils; +import com.inspur.community.mapper.CommunityPostHeatMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.community.mapper.CommunityPostLikeMapper; +import com.inspur.community.domain.CommunityPostLike; +import com.inspur.community.service.ICommunityPostLikeService; + +/** + * 社区点赞信息Service业务层处理 + * + * @author inspur + * @date 2024-04-30 + */ +@Service +public class CommunityPostLikeServiceImpl implements ICommunityPostLikeService +{ + @Autowired + private CommunityPostLikeMapper communityPostLikeMapper; + + @Autowired + private CommunityPostHeatMapper communityPostHeatMapper; + + /** + * 查询社区点赞信息 + * + * @param userId 社区点赞信息主键 + * @return 社区点赞信息 + */ + @Override + public CommunityPostLike selectCommunityPostLikeByUserId(Long userId) + { + return communityPostLikeMapper.selectCommunityPostLikeByUserId(userId); + } + + /** + * 查询社区点赞信息列表 + * + * @param communityPostLike 社区点赞信息 + * @return 社区点赞信息 + */ + @Override + public List selectCommunityPostLikeList(CommunityPostLike communityPostLike) + { + return communityPostLikeMapper.selectCommunityPostLikeList(communityPostLike); + } + + /** + * 新增社区点赞信息 + * + * @param communityPostLike 社区点赞信息 + * @return 结果 + */ + @Override + public int insertCommunityPostLike(CommunityPostLike communityPostLike) + { + communityPostLike.setUserId(SecurityUtils.getLoginUser().getUserId()); + communityPostLike.setLikeTime(new Date()); + //增加热度榜点赞记录加一 + + return communityPostLikeMapper.insertCommunityPostLike(communityPostLike); + } + + /** + * 修改社区点赞信息 + * + * @param communityPostLike 社区点赞信息 + * @return 结果 + */ + @Override + public int updateCommunityPostLike(CommunityPostLike communityPostLike) + { + return communityPostLikeMapper.updateCommunityPostLike(communityPostLike); + } + + /** + * 批量删除社区点赞信息 + * + * @param userIds 需要删除的社区点赞信息主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostLikeByUserIds(Long[] userIds) + { + return communityPostLikeMapper.deleteCommunityPostLikeByUserIds(userIds); + } + + /** + * 删除社区点赞信息信息 + * + * @param userId 社区点赞信息主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostLikeByUserIdandPostId(Long userId,String likePostId) + { + return communityPostLikeMapper.deleteCommunityPostLikeByUserIdandPostId(userId,likePostId); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostReplyServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostReplyServiceImpl.java new file mode 100644 index 0000000..7b8d48e --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostReplyServiceImpl.java @@ -0,0 +1,254 @@ +package com.inspur.community.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import com.inspur.common.core.domain.entity.SysUser; +import com.inspur.common.utils.DateUtils; +import com.inspur.common.utils.SecurityUtils; +import com.inspur.common.utils.uuid.IdUtils; +import com.inspur.community.domain.CommunityComment; +import com.inspur.community.domain.CommunityPostLike; +import com.inspur.community.mapper.CommunityPostHeatMapper; +import com.inspur.community.mapper.CommunityPostLikeMapper; +import com.inspur.system.mapper.SysUserMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.community.mapper.CommunityPostReplyMapper; +import com.inspur.community.domain.CommunityPostReply; +import com.inspur.community.service.ICommunityPostReplyService; +import org.springframework.transaction.annotation.Transactional; + +import javax.faces.application.Application; + +/** + * 社区帖子回复Service业务层处理 + * + * @author inspur + * @date 2024-04-30 + */ +@Service +public class CommunityPostReplyServiceImpl implements ICommunityPostReplyService +{ + @Autowired + private CommunityPostReplyMapper communityPostReplyMapper; + + @Autowired + private SysUserMapper sysUserMapper; + + @Autowired + private CommunityPostLikeMapper communityPostLikeMapper; + + @Autowired + private CommunityPostHeatMapper communityPostHeatMapper; + + /** + * 查询社区帖子回复 + * + * @param replyId 社区帖子回复主键 + * @return 社区帖子回复 + */ + @Override + public CommunityPostReply selectCommunityPostReplyByReplyId(String replyId) + { + return communityPostReplyMapper.selectCommunityPostReplyByReplyId(replyId); + } + + /** + * 查询社区帖子回复列表 + * + * @param communityPostReply 社区帖子回复 + * @return 社区帖子回复 + */ + @Override + public List selectCommunityPostReplyList(CommunityPostReply communityPostReply) + { + communityPostReply.setStatus("0"); + communityPostReply.setParentReplyId("0"); + List communityPostReplyList = communityPostReplyMapper.selectCommunityPostReplyList(communityPostReply); + List communityComments = new ArrayList<>(); + for (CommunityPostReply reply : communityPostReplyList) { + List childCommentList = new ArrayList<>(); + CommunityComment comment = new CommunityComment(); + comment.setUserId(reply.getUserId()); + comment.setReplyId(reply.getReplyId()); + comment.setReplyContent(reply.getReplyContent()); + comment.setParentReplyId(reply.getParentReplyId()); + comment.setUserId(reply.getUserId()); + comment.setReplyTime(reply.getReplyTime()); + Long userId = reply.getUserId(); + if(userId != null) { + SysUser user = sysUserMapper.selectUserById(userId); + comment.setUserName(user.getNickName()); + comment.setAvatar(user.getAvatar()); + } + //是否被点赞 + CommunityPostLike queryPostLike = new CommunityPostLike(); + queryPostLike.setUserId(SecurityUtils.getLoginUser().getUserId()); + queryPostLike.setLikePostId(reply.getReplyId()); + List likeList = communityPostLikeMapper.selectCommunityPostLikeList(queryPostLike); + if(likeList.size() > 0) { + comment.setLike(true); + } else { + comment.setLike(false); + } + comment.setLikeNum(communityPostLikeMapper.countCommunityPostLikeByLikePostId(reply.getReplyId())); + //添加子评论 + CommunityPostReply queryReply = new CommunityPostReply(); + queryReply.setStatus("0"); + queryReply.setRootReplyId(reply.getReplyId()); + List childrenReplyList = communityPostReplyMapper.selectCommunityPostReplyList(queryReply); + if(childrenReplyList.size() > 0){ + for (CommunityPostReply postReply : childrenReplyList) { + CommunityComment childComment = new CommunityComment(); + //添加用户信息 + Long childUserId = postReply.getUserId(); + if(childUserId != null){ + SysUser childUser = sysUserMapper.selectUserById(childUserId); + childComment.setUserId(childUser.getUserId()); + childComment.setUserName(childUser.getNickName()); + childComment.setAvatar(childUser.getAvatar()); + } + //添加是否被点赞 + CommunityPostLike queryChildPostLike = new CommunityPostLike(); + queryChildPostLike.setUserId(SecurityUtils.getLoginUser().getUserId()); + queryChildPostLike.setLikePostId(postReply.getReplyId()); + List childLikeList = communityPostLikeMapper.selectCommunityPostLikeList(queryChildPostLike); + if(childLikeList.size() > 0) { + childComment.setLike(true); + } else { + childComment.setLike(false); + } + childComment.setLikeNum(communityPostLikeMapper.countCommunityPostLikeByLikePostId(postReply.getReplyId())); + + if(!postReply.getParentReplyId().equals(postReply.getRootReplyId())){ + CommunityPostReply parentReply = communityPostReplyMapper.selectCommunityPostReplyByReplyId(postReply.getParentReplyId()); + SysUser parentUser = sysUserMapper.selectUserById(parentReply.getUserId()); + childComment.setParentReplyUserName(parentUser.getNickName()); + } + + childComment.setPostId(postReply.getPostId()); + childComment.setReplyId(postReply.getReplyId()); + childComment.setReplyContent(postReply.getReplyContent()); + childComment.setReplyTime(postReply.getReplyTime()); + childComment.setParentReplyId(postReply.getParentReplyId()); + childComment.setRootReplyId(postReply.getRootReplyId()); + childCommentList.add(childComment); + } + } + comment.setChildren(childCommentList); + communityComments.add(comment); + } + + return communityComments; + } + + /** + * 新增社区帖子回复 + * + * @param communityPostReply 社区帖子回复 + * @return 结果 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int insertCommunityPostReply(CommunityPostReply communityPostReply) + { + communityPostReply.setReplyId(IdUtils.simpleUUID()); + communityPostReply.setUserId(SecurityUtils.getLoginUser().getUserId()); + communityPostReply.setReplyTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS)); + //帖子热度回复量加一 + return communityPostReplyMapper.insertCommunityPostReply(communityPostReply) & communityPostHeatMapper.addReplies(communityPostReply.getPostId()); + } + + /** + * 修改社区帖子回复 + * + * @param communityPostReply 社区帖子回复 + * @return 结果 + */ + @Override + public int updateCommunityPostReply(CommunityPostReply communityPostReply) + { + return communityPostReplyMapper.updateCommunityPostReply(communityPostReply); + } + + /** + * 批量删除社区帖子回复 + * + * @param replyIds 需要删除的社区帖子回复主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostReplyByReplyIds(String[] replyIds) + { + return communityPostReplyMapper.deleteCommunityPostReplyByReplyIds(replyIds); + } + + /** + * 删除社区帖子回复信息 + * + * @param replyId 社区帖子回复主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostReplyByReplyId(String replyId) + { + return communityPostReplyMapper.deleteCommunityPostReplyByReplyId(replyId); + } + + /** + * 递归将评论连接 + */ + private List getCommentList(List communityPostReplyList, String parentReplyId){ + + if(communityPostReplyList.size() == 0){ + return new ArrayList<>(); + } + List commentList = new ArrayList<>(); + List list = new ArrayList<>(); +// list = communityPostReplyList.stream().filter(reply -> reply.getParentRepayId().equals(parentReplyId)).collect(Collectors.toList()); +// +// if(list.size() == 0){ +// return new ArrayList<>(); +// } +// +// for (CommunityPostReply communityPostReply : list) { +// CommunityComment comment = new CommunityComment(); +// comment.setReplyId(communityPostReply.getReplyId()); +// comment.setReplyContent(communityPostReply.getReplyContent()); +// comment.setReplyTime(communityPostReply.getReplyTime()); +// comment.setRootReplyId(communityPostReply.getRootReplyId()); +// comment.setParentRepayId(communityPostReply.getParentRepayId()); +// comment.setPostId(communityPostReply.getPostId()); +// comment.setUserId(communityPostReply.getUserId()); +// if(communityPostReply.getUserId() != null){ +// SysUser user = sysUserMapper.selectUserById(communityPostReply.getUserId()); +// if(user != null){ +// comment.setUserName(user.getNickName()); +// comment.setAvatar(user.getAvatar()); +// } +// }else{ +// comment.setUserName("匿名用户"); +// } +// +// if(communityPostReply.getUserId() != null){ +// CommunityPostLike query = new CommunityPostLike(); +// query.setLikePostId(communityPostReply.getReplyId()); +// query.setUserId(communityPostReply.getUserId()); +// List likeList = communityPostLikeMapper.selectCommunityPostLikeList(query); +// comment.setLikeNum((long) likeList.size()); +// if(likeList.size() > 0){ +// comment.setLike(true); +// }else { +// comment.setLike(false); +// } +// } +// comment.setChildren(getCommentList(communityPostReplyList, communityPostReply.getReplyId())); +// commentList.add(comment); +// } + return commentList; + } + +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostReportServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostReportServiceImpl.java new file mode 100644 index 0000000..d5eb0d5 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostReportServiceImpl.java @@ -0,0 +1,94 @@ +package com.inspur.community.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.community.mapper.CommunityPostReportMapper; +import com.inspur.community.domain.CommunityPostReport; +import com.inspur.community.service.ICommunityPostReportService; + +/** + * 社区帖子举报Service业务层处理 + * + * @author inspur + * @date 2024-04-30 + */ +@Service +public class CommunityPostReportServiceImpl implements ICommunityPostReportService +{ + @Autowired + private CommunityPostReportMapper communityPostReportMapper; + + /** + * 查询社区帖子举报 + * + * @param reportId 社区帖子举报主键 + * @return 社区帖子举报 + */ + @Override + public CommunityPostReport selectCommunityPostReportByReportId(String reportId) + { + return communityPostReportMapper.selectCommunityPostReportByReportId(reportId); + } + + /** + * 查询社区帖子举报列表 + * + * @param communityPostReport 社区帖子举报 + * @return 社区帖子举报 + */ + @Override + public List selectCommunityPostReportList(CommunityPostReport communityPostReport) + { + return communityPostReportMapper.selectCommunityPostReportList(communityPostReport); + } + + /** + * 新增社区帖子举报 + * + * @param communityPostReport 社区帖子举报 + * @return 结果 + */ + @Override + public int insertCommunityPostReport(CommunityPostReport communityPostReport) + { + return communityPostReportMapper.insertCommunityPostReport(communityPostReport); + } + + /** + * 修改社区帖子举报 + * + * @param communityPostReport 社区帖子举报 + * @return 结果 + */ + @Override + public int updateCommunityPostReport(CommunityPostReport communityPostReport) + { + return communityPostReportMapper.updateCommunityPostReport(communityPostReport); + } + + /** + * 批量删除社区帖子举报 + * + * @param reportIds 需要删除的社区帖子举报主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostReportByReportIds(String[] reportIds) + { + return communityPostReportMapper.deleteCommunityPostReportByReportIds(reportIds); + } + + /** + * 删除社区帖子举报信息 + * + * @param reportId 社区帖子举报主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostReportByReportId(String reportId) + { + return communityPostReportMapper.deleteCommunityPostReportByReportId(reportId); + } +} + diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml new file mode 100644 index 0000000..fbc37b2 --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + select post_id, likes, views, replies from community_post_heat + + + + + + + + insert into community_post_heat + + post_id, + likes, + views, + replies, + + + #{postId}, + #{likes}, + #{views}, + #{replies}, + + + + + update community_post_heat + + likes = #{likes}, + views = #{views}, + replies = #{replies}, + + where post_id = #{postId} + + + + + update community_post_heat set views = views + 1 where post_id = #{postId} + + + + + update community_post_heat set replies = replies + 1 where post_id = #{postId} + + + + delete from community_post_heat where post_id = #{postId} + + + + delete from community_post_heat where post_id in + + #{postId} + + + \ No newline at end of file diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostLikeMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostLikeMapper.xml new file mode 100644 index 0000000..8af3169 --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostLikeMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + select user_id, like_post_id, like_time from community_post_like + + + + + + + + + + + insert into community_post_like + + user_id, + like_post_id, + like_time, + + + #{userId}, + #{likePostId}, + #{likeTime}, + + + + + update community_post_like + + like_post_id = #{likePostId}, + like_time = #{likeTime}, + + where user_id = #{userId} + + + + delete from community_post_like where user_id = #{userId} and like_post_id = #{likePostId} + + + + delete from community_post_like where user_id in + + #{userId} + + + \ No newline at end of file diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReplyMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReplyMapper.xml new file mode 100644 index 0000000..b916e3a --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReplyMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + select reply_id, post_id, user_id, reply_content, reply_time, parent_reply_id, root_reply_id, status from community_post_reply + + + + + + + + insert into community_post_reply + + reply_id, + post_id, + user_id, + reply_content, + reply_time, + parent_reply_id, + root_reply_id, + status, + + + #{replyId}, + #{postId}, + #{userId}, + #{replyContent}, + #{replyTime}, + #{parentReplyId}, + #{rootReplyId}, + #{status}, + + + + + update community_post_reply + + post_id = #{postId}, + user_id = #{userId}, + reply_content = #{replyContent}, + reply_time = #{replyTime}, + parent_repay_id = #{parentReplyId}, + root_reply_id = #{rootReplyId}, + status = #{status}, + + where reply_id = #{replyId} + + + + delete from community_post_reply where reply_id = #{replyId} + + + + delete from community_post_reply where reply_id in + + #{replyId} + + + \ No newline at end of file diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReportMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReportMapper.xml new file mode 100644 index 0000000..285ee1f --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReportMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + select report_id, report_user_id, report_content_id, report_time, report_reason, status, report_type, result from community_post_report + + + + + + + + insert into community_post_report + + report_id, + report_user_id, + report_content_id, + report_time, + report_reason, + status, + report_type, + result, + + + #{reportId}, + #{reportUserId}, + #{reportContentId}, + #{reportTime}, + #{reportReason}, + #{status}, + #{reportType}, + #{result}, + + + + + update community_post_report + + report_user_id = #{reportUserId}, + report_content_id = #{reportContentId}, + report_time = #{reportTime}, + report_reason = #{reportReason}, + status = #{status}, + report_type = #{reportType}, + result = #{result}, + + where report_id = #{reportId} + + + + delete from community_post_report where report_id = #{reportId} + + + + delete from community_post_report where report_id in + + #{reportId} + + + \ No newline at end of file diff --git a/inspur-ui/src/api/community/heat.js b/inspur-ui/src/api/community/heat.js new file mode 100644 index 0000000..21536be --- /dev/null +++ b/inspur-ui/src/api/community/heat.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询社区帖子热度列表 +export function listHeat(query) { + return request({ + url: "/community/heat/list", + method: "get", + params: query, + }); +} + +// 查询社区帖子热度详细 +export function getHeat(postId) { + return request({ + url: "/community/heat/" + postId, + method: "get", + }); +} + +// 新增社区帖子热度 +export function addHeat(data) { + return request({ + url: "/community/heat", + method: "post", + data: data, + }); +} + +// 修改社区帖子热度 +export function updateHeat(data) { + return request({ + url: "/community/heat", + method: "put", + data: data, + }); +} + +// 删除社区帖子热度 +export function delHeat(postId) { + return request({ + url: "/community/heat/" + postId, + method: "delete", + }); +} diff --git a/inspur-ui/src/api/community/like.js b/inspur-ui/src/api/community/like.js new file mode 100644 index 0000000..8de61cf --- /dev/null +++ b/inspur-ui/src/api/community/like.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询社区点赞信息列表 +export function listLike(query) { + return request({ + url: "/community/like/list", + method: "get", + params: query, + }); +} + +// 查询社区点赞信息详细 +export function getLike(userId) { + return request({ + url: "/community/like/" + userId, + method: "get", + }); +} + +// 新增社区点赞信息 +export function addLike(data) { + return request({ + url: "/community/like", + method: "post", + data: data, + }); +} + +// 修改社区点赞信息 +export function updateLike(data) { + return request({ + url: "/community/like", + method: "put", + data: data, + }); +} + +// 删除社区点赞信息 +export function delLike(likePostId) { + return request({ + url: "/community/like/" + likePostId, + method: "delete", + }); +} diff --git a/inspur-ui/src/api/community/reply.js b/inspur-ui/src/api/community/reply.js new file mode 100644 index 0000000..1dd92e2 --- /dev/null +++ b/inspur-ui/src/api/community/reply.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询社区帖子回复列表 +export function listReply(query) { + return request({ + url: "/community/reply/list", + method: "get", + params: query, + }); +} + +// 查询社区帖子回复详细 +export function getReply(replyId) { + return request({ + url: "/community/reply/" + replyId, + method: "get", + }); +} + +// 新增社区帖子回复 +export function addReply(data) { + return request({ + url: "/community/reply", + method: "post", + data: data, + }); +} + +// 修改社区帖子回复 +export function updateReply(data) { + return request({ + url: "/community/reply", + method: "put", + data: data, + }); +} + +// 删除社区帖子回复 +export function delReply(replyId) { + return request({ + url: "/community/reply/" + replyId, + method: "delete", + }); +} diff --git a/inspur-ui/src/api/community/report.js b/inspur-ui/src/api/community/report.js new file mode 100644 index 0000000..16aa775 --- /dev/null +++ b/inspur-ui/src/api/community/report.js @@ -0,0 +1,44 @@ +import request from "@/utils/request"; + +// 查询社区帖子举报列表 +export function listReport(query) { + return request({ + url: "/community/report/list", + method: "get", + params: query, + }); +} + +// 查询社区帖子举报详细 +export function getReport(reportId) { + return request({ + url: "/community/report/" + reportId, + method: "get", + }); +} + +// 新增社区帖子举报 +export function addReport(data) { + return request({ + url: "/community/report", + method: "post", + data: data, + }); +} + +// 修改社区帖子举报 +export function updateReport(data) { + return request({ + url: "/community/report", + method: "put", + data: data, + }); +} + +// 删除社区帖子举报 +export function delReport(reportId) { + return request({ + url: "/community/report/" + reportId, + method: "delete", + }); +} diff --git a/inspur-ui/src/assets/icons/svg/comment.svg b/inspur-ui/src/assets/icons/svg/comment.svg new file mode 100644 index 0000000..bf19192 --- /dev/null +++ b/inspur-ui/src/assets/icons/svg/comment.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inspur-ui/src/assets/icons/svg/like.svg b/inspur-ui/src/assets/icons/svg/like.svg new file mode 100644 index 0000000..199799b --- /dev/null +++ b/inspur-ui/src/assets/icons/svg/like.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inspur-ui/src/views/community/comment/InputComponent.vue b/inspur-ui/src/views/community/comment/InputComponent.vue index fcb6852..d29a768 100644 --- a/inspur-ui/src/views/community/comment/InputComponent.vue +++ b/inspur-ui/src/views/community/comment/InputComponent.vue @@ -70,7 +70,7 @@ export default { }, //传入input框的默认值 toId: { - type: Number, + type: String, }, //类型,end(文章末尾处), comment(评论里), type: { diff --git a/inspur-ui/src/views/community/comment/Ipcomment.vue b/inspur-ui/src/views/community/comment/Ipcomment.vue index d217f2b..488f1fe 100644 --- a/inspur-ui/src/views/community/comment/Ipcomment.vue +++ b/inspur-ui/src/views/community/comment/Ipcomment.vue @@ -27,15 +27,15 @@ import { mapGetters } from "vuex"; import { getToken } from "@/utils/auth"; -// import { -// cmsListComment, -// cmsAddComment, -// } from "@/api/cms/comment" +import { listReply, getReply, addReply, delReply } from "@/api/community/reply"; import comment from "./comments.vue"; import Emoji from "@/components/Emoji"; export default { @@ -98,7 +95,7 @@ export default { userId: -1, content: "", }, - messageForm: {}, + replyForm: {}, // 总条数 total: 0, // 查询参数 @@ -110,13 +107,13 @@ export default { likeNum: null, content: null, type: null, - blogId: this.$route.query.id, + postId: this.$route.query.id, userId: null, delFlag: null, createBy: null, }, - messageFormRules: { - content: [ + replyFormRules: { + replyContent: [ { min: 0, max: 100, @@ -148,46 +145,40 @@ export default { methods: { // 表单重置 reset() { - this.messageForm = { - id: null, - parentId: null, - mainId: null, - likeNum: null, - content: null, - type: null, - blogId: this.$route.query.id, + this.replyForm = { + replyContent: null, + status: null, + postId: this.$route.query.id, + parentReplyId: null, + rootReplyId: null, userId: null, - delFlag: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, }; - this.resetForm("messageForm"); + this.resetForm("replyForm"); }, // 评论发表 publish() { let token = getToken(); - this.$refs.messageFormRef.validate(async (valid) => { + this.$refs.replyFormRef.validate(async (valid) => { if (!valid) return; if ( - this.messageForm.content == null || - this.messageForm.content == "" + this.replyForm.replyContent == null || + this.replyForm.replyContent == "" ) { this.$modal.msgError("评论内容不能为空!"); return; } if (token == null || token == "") { - this.messageForm.createBy = "匿名用户"; - this.messageForm.type = "0"; + // this.replyForm.createBy = "匿名用户"; + this.replyForm.status = "0"; } else { - this.messageForm.createBy = this.$store.getters.name; - this.messageForm.type = "0"; + // this.replyForm.createBy = this.$store.getters.name; + this.replyForm.status = "0"; } - cmsAddComment(this.messageForm).then((response) => { + console.log("aaa:", this.replyForm); + addReply(this.replyForm).then((response) => { this.$modal.msgSuccess("评论发表成功"); this.reset(); - this.getMessageList(); + this.listReply(); }); }); }, @@ -196,26 +187,27 @@ export default { */ commitComment(value) { this.reset(); - this.messageForm.content = value.inputComment; - this.messageForm.parentId = value.id; + console.log("接收的数据:", value); + this.replyForm.replyContent = value.inputComment; + this.replyForm.parentReplyId = value.id; let token = getToken(); - this.$refs.messageFormRef.validate(async (valid) => { + this.$refs.replyFormRef.validate(async (valid) => { if (!valid) return; if ( - this.messageForm.content == null || - this.messageForm.content == "" + this.replyForm.replyContent == null || + this.replyForm.replyContent == "" ) { this.$modal.msgError("评论内容不能为空!"); return; } if (token == null || token == "") { - this.messageForm.createBy = "匿名用户"; - this.messageForm.type = "1"; + // this.replyForm.createBy = "匿名用户"; + this.replyForm.status = "1"; } else { - this.messageForm.createBy = this.$store.getters.name; - this.messageForm.type = "1"; + // this.replyForm.createBy = this.$store.getters.name; + this.replyForm.status = "0"; } - cmsAddComment(this.messageForm).then((response) => { + addReply(this.replyForm).then((response) => { this.$modal.msgSuccess("评论发表成功"); this.reset(); this.getMessageList(); @@ -225,9 +217,41 @@ export default { // 获取评论列表 async getMessageList() { let token = getToken(); - if (token != null && token != "") { - this.queryParams.createBy = this.$store.getters.name; - } + // if (token != null && token != "") { + // this.queryParams.createBy = this.$store.getters.name; + // } + listReply(this.queryParams).then((response) => { + for (let i = 0; i < response.rows.length; i++) { + let mesInfo = response.rows[i]; + if (mesInfo.avatar != null && mesInfo.avatar != "") { + response.rows[i].avatar = + process.env.VUE_APP_BASE_API + mesInfo.avatar; + } + if (mesInfo.children != null && mesInfo.children != "") { + for (let j = 0; j < response.rows[i].children.length; j++) { + let children = response.rows[i].children; + if (children.avatar != null && children.avatar != "") { + response.rows[i].children[j].avatar = + process.env.VUE_APP_BASE_API + children.avatar; + } + } + } + if (mesInfo.children.length > 0) { + let chl = mesInfo.children; + for (let i = 0; i < chl.length; i++) { + console.log("mes:", chl[i]); + console.log("parent:", chl[i].parentReplyId); + console.log("root:", chl[i].rootReplyId); + console.log( + "69696:", + chl[i].parentReplyId != chl[i].rootReplyId + ); + } + } + } + this.messageList = response.rows; + this.total = response.total; + }); // cmsListComment(this.queryParams).then((response) => { // for (let i = 0; i < response.rows.length; i++) { // let mesInfo = response.rows[i]; @@ -254,23 +278,23 @@ export default { this.cursorIndexEnd = e.srcElement.selectionEnd; // 获取input输入框失去焦点时光标选中结束的位置 }, output(val) { - if (this.cursorIndexStart !== null && this.messageForm.content) { + if (this.cursorIndexStart !== null && this.replyForm.replyContent) { //如果 文本域获取了焦点, 则在光标位置处插入对应字段内容 - this.messageForm.content = - this.messageForm.content.substring(0, this.cursorIndexStart) + + this.replyForm.replyContent = + this.replyForm.replyContent.substring(0, this.cursorIndexStart) + val + - this.messageForm.content.substring(this.cursorIndexEnd); + this.replyForm.replyContent.substring(this.cursorIndexEnd); } else { // 如果 文本域未获取焦点, 则在字符串末尾处插入对应字段内容 - this.messageForm.content = this.messageForm.content - ? this.messageForm.content + this.replyForm.replyContent = this.replyForm.replyContent + ? this.replyForm.replyContent : "" + val; } }, //跳转到相应位置 to() { - if (this.$route.query.commentId != null) { - var toEl = document.getElementById(this.$route.query.commentId); + if (this.$route.query.id != null) { + var toEl = document.getElementById(this.$route.query.id); if (toEl != null) { if (toEl != null && toEl != "") { // toEl 为指定跳转到该位置的DOM节点 diff --git a/inspur-ui/src/views/community/comment/comments.vue b/inspur-ui/src/views/community/comment/comments.vue index 9b50ada..1416e1b 100644 --- a/inspur-ui/src/views/community/comment/comments.vue +++ b/inspur-ui/src/views/community/comment/comments.vue @@ -1,52 +1,93 @@ diff --git a/inspur-ui/src/views/community/forum/forumForm.vue b/inspur-ui/src/views/community/forum/forumForm.vue index ba78424..6a46bb2 100644 --- a/inspur-ui/src/views/community/forum/forumForm.vue +++ b/inspur-ui/src/views/community/forum/forumForm.vue @@ -1,35 +1,36 @@