springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
@@ -1,9 +1,7 @@ package com.panzhihua.applets.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO; import com.panzhihua.common.model.dtos.neighbor.*; import com.panzhihua.common.model.dtos.shop.*; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; @@ -68,6 +66,60 @@ return communityService.neighborDetailByApp(neighborCircleAppDTO); } @ApiOperation(value = "分页查询用户邻里圈列表" , response = ComActNeighborCircleAppVO.class) @PostMapping("neighbor/user/page") public R neighborExamineByApp(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) { Long userId = this.getLoginUserInfo().getUserId(); if(userId == null){ return R.fail("请先登录"); } neighborCircleAppDTO.setUserId(userId); return communityService.neighborExamineByApp(neighborCircleAppDTO); } @ApiOperation(value = "邻里圈点赞") @PostMapping("neighbor/fabulous") public R neighborFabulousByApp(@RequestBody ComActNeighborFabulousAppDTO fabulousAppDTO) { Long userId = this.getLoginUserInfo().getUserId(); if(userId == null){ return R.fail("请先登录"); } fabulousAppDTO.setUserId(userId); return communityService.neighborFabulousByApp(fabulousAppDTO); } @ApiOperation(value = "邻里圈转发") @PostMapping("neighbor/forward") public R neighborForwardByApp(@RequestBody ComActNeighborForwardAppDTO forwardAppDTO) { Long userId = this.getLoginUserInfo().getUserId(); if(userId == null){ return R.fail("请先登录"); } forwardAppDTO.setUserId(userId); return communityService.neighborForwardByApp(forwardAppDTO); } @ApiOperation(value = "邻里圈评论") @PostMapping("neighbor/comment") public R neighborCommentByApp(@RequestBody ComActNeighborCommentAppDTO commentAppDTO) { Long userId = this.getLoginUserInfo().getUserId(); if(userId == null){ return R.fail("请先登录"); } commentAppDTO.setUserId(userId); return communityService.neighborCommentByApp(commentAppDTO); } @ApiOperation(value = "邻里圈回复") @PostMapping("neighbor/reply") public R neighborReplyByApp(@RequestBody ComActNeighborReplyAppDTO replyAppDTO) { Long userId = this.getLoginUserInfo().getUserId(); if(userId == null){ return R.fail("请先登录"); } replyAppDTO.setUserId(userId); return communityService.neighborReplyByApp(replyAppDTO); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleAppDTO.java
@@ -25,4 +25,7 @@ @ApiModelProperty(value = "社区id",hidden = true) private Long communityId; @ApiModelProperty(value = "用户id",hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleDetailAppDTO.java
@@ -25,4 +25,7 @@ @ApiModelProperty(value = "评论分页-每页记录数",example = "10") private Long pageSize = 10L; @ApiModelProperty(value = "评论排序方式(1.倒序 2.顺序)",example = "10") private Integer order = 1; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCommentAppDTO.java
New file @@ -0,0 +1,27 @@ package com.panzhihua.common.model.dtos.neighbor; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @auther lyq * @create 2021-04-14 15:02:14 * @describe 邻里圈评论请求参数 */ @Data @ApiModel("邻里圈评论请求参数") public class ComActNeighborCommentAppDTO { @ApiModelProperty("邻里圈id") private Long circleId; @ApiModelProperty("邻里圈评论内容") private String content; @ApiModelProperty(value = "用户id",hidden = true) private Long userId; @ApiModelProperty(value = "用户手机号",hidden = true) private String phone; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborFabulousAppDTO.java
New file @@ -0,0 +1,33 @@ package com.panzhihua.common.model.dtos.neighbor; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @auther lyq * @create 2021-04-14 15:02:14 * @describe 邻里圈点赞请求参数 */ @Data @ApiModel("邻里圈点赞请求参数") public class ComActNeighborFabulousAppDTO { @ApiModelProperty("邻里圈点赞类型(1.邻里圈 2.评论 3.回复)") private Integer type = 1; @ApiModelProperty("邻里圈点赞业务id") private Long serviceId; @ApiModelProperty(value = "用户id",hidden = true) private Long userId; /** * 邻里圈点赞类型(1.邻里圈 2.评论 3.回复) */ public interface type{ int llq = 1; int pl = 2; int hf = 3; } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborForwardAppDTO.java
New file @@ -0,0 +1,21 @@ package com.panzhihua.common.model.dtos.neighbor; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @auther lyq * @create 2021-04-14 15:02:14 * @describe 邻里圈转发请求参数 */ @Data @ApiModel("邻里圈转发请求参数") public class ComActNeighborForwardAppDTO { @ApiModelProperty("邻里圈id") private Long circleId; @ApiModelProperty(value = "用户id",hidden = true) private Long userId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborReplyAppDTO.java
New file @@ -0,0 +1,41 @@ package com.panzhihua.common.model.dtos.neighbor; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @auther lyq * @create 2021-04-14 15:02:14 * @describe 邻里圈回复请求参数 */ @Data @ApiModel("邻里圈回复请求参数") public class ComActNeighborReplyAppDTO { @ApiModelProperty("邻里圈id") private Long circleId; @ApiModelProperty("回复类型(1.评论 2.回复)") private Integer type; @ApiModelProperty("业务id(当type为1时,这里是评论的id,当type=2时,这里是回复的id)") private Long serviceId; @ApiModelProperty("邻里圈回复内容") private String content; @ApiModelProperty(value = "用户id",hidden = true) private Long userId; @ApiModelProperty(value = "用户手机号",hidden = true) private String phone; /** * 回复类型(1.评论 2.回复) */ public interface type{ int pl = 1; int hf = 2; } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ComActNeighborCircleAppVO.java
@@ -69,4 +69,10 @@ @ApiModelProperty("近3天浏览量") private Integer lastViewsNum; /** * 驳回原因 */ @ApiModelProperty("驳回原因") private String refuseReason; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ComActNeighborCircleCommentReplyAppVO.java
@@ -28,6 +28,9 @@ @ApiModelProperty("回复用户名称") private Long userName; @ApiModelProperty("回复用户头像url") private Long userHeadUrl; @ApiModelProperty("回复内容") private String replyContent; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -5,9 +5,7 @@ import com.panzhihua.common.model.dtos.advertisement.ComOpsAdvDTO; import com.panzhihua.common.model.dtos.advertisement.PageComOpsAdvDTO; import com.panzhihua.common.model.dtos.community.*; import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO; import com.panzhihua.common.model.dtos.neighbor.*; import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO; import com.panzhihua.common.model.dtos.shop.*; import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO; @@ -2265,4 +2263,51 @@ @PostMapping("/neighbor/neighborDetailByApp") R neighborDetailByApp(@RequestBody ComActNeighborCircleDetailAppDTO neighborCircleAppDTO); /** * 用户查询邻里圈列表 * @param neighborCircleAppDTO 请求参数 * @return 邻里圈列表 */ @PostMapping("/neighbor/neighborExamineByApp") R neighborExamineByApp(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO); /** * 邻里圈点赞 * @param fabulousAppDTO 请求参数 * @return 点赞结果 */ @PostMapping("/neighbor/neighborFabulousByApp") R neighborFabulousByApp(@RequestBody ComActNeighborFabulousAppDTO fabulousAppDTO); /** * 邻里圈转发 * @param forwardAppDTO 请求参数 * @return 转发结果 */ @PostMapping("/neighbor/neighborForwardByApp") R neighborForwardByApp(@RequestBody ComActNeighborForwardAppDTO forwardAppDTO); /** * 邻里圈评论 * @param commentAppDTO 请求参数 * @return 评论结果 */ @PostMapping("/neighbor/neighborCommentByApp") R neighborCommentByApp(@RequestBody ComActNeighborCommentAppDTO commentAppDTO); /** * 邻里圈回复 * @param replyAppDTO 请求参数 * @return 回复结果 */ @PostMapping("/neighbor/neighborReplyByApp") R neighborReplyByApp(@RequestBody ComActNeighborReplyAppDTO replyAppDTO); /** * 定时任务更新邻里圈近3天评论数/点赞数/浏览量 * @return 执行结果 */ @PostMapping("/neighbor/timeTaskCircleFlow") R timedTaskNeighborCircleRecord(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/NeighborApi.java
@@ -1,8 +1,6 @@ package com.panzhihua.service_community.api; import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO; import com.panzhihua.common.model.dtos.neighbor.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.service.ComActNeighborCircleService; import lombok.extern.slf4j.Slf4j; @@ -42,9 +40,73 @@ return comActNeighborCircleService.addNeighborByApp(addNeighborCircleAppDTO); } /** * 查询邻里圈详情 * @param neighborCircleAppDTO 请求参数 * @return 邻里圈详情 */ @PostMapping("neighborDetailByApp") public R neighborDetailByApp(@RequestBody ComActNeighborCircleDetailAppDTO neighborCircleAppDTO) { return comActNeighborCircleService.neighborDetailByApp(neighborCircleAppDTO); } /** * 用户查询邻里圈列表 * @param neighborCircleAppDTO 请求参数 * @return 邻里圈列表 */ @PostMapping("neighborExamineByApp") public R neighborExamineByApp(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) { return comActNeighborCircleService.neighborExamineByApp(neighborCircleAppDTO); } /** * 邻里圈点赞 * @param fabulousAppDTO 请求参数 * @return 点赞结果 */ @PostMapping("neighborFabulousByApp") public R neighborFabulousByApp(@RequestBody ComActNeighborFabulousAppDTO fabulousAppDTO) { return comActNeighborCircleService.neighborFabulousByApp(fabulousAppDTO); } /** * 邻里圈转发 * @param forwardAppDTO 请求参数 * @return 转发结果 */ @PostMapping("neighborForwardByApp") public R neighborForwardByApp(@RequestBody ComActNeighborForwardAppDTO forwardAppDTO) { return comActNeighborCircleService.neighborForwardByApp(forwardAppDTO); } /** * 邻里圈评论 * @param commentAppDTO 请求参数 * @return 评论结果 */ @PostMapping("neighbor/comment") public R neighborCommentByApp(@RequestBody ComActNeighborCommentAppDTO commentAppDTO) { return comActNeighborCircleService.neighborCommentByApp(commentAppDTO); } /** * 邻里圈回复 * @param replyAppDTO 请求参数 * @return 回复结果 */ @PostMapping("neighbor/reply") public R neighborReplyByApp(@RequestBody ComActNeighborReplyAppDTO replyAppDTO) { return comActNeighborCircleService.neighborReplyByApp(replyAppDTO); } /** * 定时任务更新邻里圈近3天评论数/点赞数/浏览量 * @return 执行结果 */ @PostMapping("neighbor/timeTaskCircleFlow") public R timeTaskCircleFlow() { return comActNeighborCircleService.timeTaskCircleFlow(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleCommentDAO.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleCommentAppVO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleCommentDO; @@ -24,8 +25,14 @@ ",cancc.create_at,cancc.is_release,su.nick_name as userName,su.image_url as userHeadUrl " + " from com_act_neighbor_circle_comment as cancc " + " left join sys_user as su on su.user_id = cancc.user_id" + " where cancc.circle_id = #{circleId} order by cancc.create_at desc" + " where cancc.circle_id = #{neighborCircleAppDTO.circleId} and cancc.status = 1" + "<if test='neighborCircleAppDTO.order != null and neighborCircleAppDTO.order == 1'>" + " order by cancc.create_at desc" + " </if> " + "<if test='neighborCircleAppDTO.order != null and neighborCircleAppDTO.order == 2'>" + " order by cancc.create_at asc" + " </if> " + " </script>") IPage<ComActNeighborCircleCommentAppVO> pageNeighborCommentByApp(Page page, @Param("circleId") Long circleId); IPage<ComActNeighborCircleCommentAppVO> pageNeighborCommentByApp(Page page, @Param("neighborCircleAppDTO") ComActNeighborCircleDetailAppDTO neighborCircleAppDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleCommentReplyDAO.java
@@ -1,8 +1,13 @@ package com.panzhihua.service_community.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleCommentReplyAppVO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleCommentReplyDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; /** * @auther lyq @@ -12,4 +17,15 @@ @Mapper public interface ComActNeighborCircleCommentReplyDAO extends BaseMapper<ComActNeighborCircleCommentReplyDO> { @Select("<script> " + "select reply.id,reply.comment_id, reply.reply_content,reply.fabulous_num " + ",reply.create_at,reply.is_release,su1.nick_name as userName " + ",su1.image_url as userHeadUrl,su2.nick_name as parentUserName " + " from com_act_neighbor_circle_comment_reply as reply" + " left join sys_user su1 on su1.user_id = reply.user_id " + " left join sys_user su2 on su2.user_id = reply.parent_user_id " + " where reply.comment_id = #{commentId} order by create_at desc limit 2" + " </script>") List<ComActNeighborCircleCommentReplyAppVO> getCircleCommentReplyList(@Param("commentId") Long commentId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java
@@ -85,4 +85,11 @@ @Select("select * from sys_user where user_id=#{userId}") AdministratorsUserVO selectUserByUserId(@Param("userId") Long userId); @Select("<script> " + "select id,release_content,release_images,status,create_at,comment_num,fabulous_num,forward_num,views_num,refuse_reason " + " from com_act_neighbor_circle as canc " + " where canc.release_id = #{userId} order by create_at desc" + " </script>") IPage<ComActNeighborCircleAppVO> neighborExamineByApp(Page page,@Param("userId") Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActNeighborCircleCommentDO.java
@@ -66,6 +66,14 @@ */ private Integer isRelease; /** * 是否是作者评论(1.是 2.否) */ public interface isRelease{ int yes = 1; int no = 2; } @Override public String toString() { return "ComActNeighborCircleCommentDO{" + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActNeighborCircleCommentReplyDO.java
@@ -38,7 +38,7 @@ /** * 上级回复id */ private Long panentId; private Long parentId; /** * 上级回复用户id @@ -71,13 +71,18 @@ */ private Integer isRelease; /** * 状态(1.显示 2.隐藏) */ private Integer status; @Override public String toString() { return "ComActNeighborCircleCommentReplyDO{" + "id=" + id + ", circleId=" + circleId + ", commentId=" + commentId + ", panentId=" + panentId + ", parentId=" + parentId + ", parentUserId=" + parentUserId + ", userId=" + userId + ", replyContent=" + replyContent + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActNeighborCircleDO.java
@@ -111,6 +111,16 @@ */ private Integer lastViewsNum; /** * 发布状态(1.待审核 2.显示 3.隐藏 4.驳回) */ public interface status{ int dsh = 1; int xs = 2; int yc = 3; int bh = 4; } @Override public String toString() { return "ComActNeighborCircleDO{" + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActNeighborCircleFabulousDO.java
@@ -1,8 +1,6 @@ package com.panzhihua.service_community.model.dos; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import java.io.Serializable; @@ -33,6 +31,11 @@ private Integer type; /** * 邻里圈id */ private Long circleId; /** * 点赞上级id */ private Long parentId; @@ -50,13 +53,23 @@ /** * 点赞时间 */ @TableField(fill = FieldFill.INSERT) private Date createAt; /** * 修改时间 */ @TableField(fill = FieldFill.UPDATE) private Date updateAt; /** * 有效状态(1.有效 2.取消) */ public interface isEffective{ int yes = 1; int no = 2; } @Override public String toString() { return "ComActNeighborCircleFabulousDO{" + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActNeighborCircleService.java
@@ -1,10 +1,7 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO; import com.panzhihua.common.model.dtos.neighbor.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.neighbor.AddNeighborCircleAdminVO; import com.panzhihua.common.model.vos.neighbor.EditNeighborCircleAdminVO; @@ -59,4 +56,45 @@ */ R changeStatusByAdmin(EditNeighborCircleAdminVO editNeighborCircleAdminVO); /** * 用户查询邻里圈列表 * @param neighborCircleAppDTO 请求参数 * @return 邻里圈列表 */ R neighborExamineByApp(ComActNeighborCircleAppDTO neighborCircleAppDTO); /** * 邻里圈点赞 * @param fabulousAppDTO 请求参数 * @return 点赞结果 */ R neighborFabulousByApp(ComActNeighborFabulousAppDTO fabulousAppDTO); /** * 邻里圈转发 * @param forwardAppDTO 请求参数 * @return 转发结果 */ R neighborForwardByApp(ComActNeighborForwardAppDTO forwardAppDTO); /** * 邻里圈评论 * @param commentAppDTO 请求参数 * @return 评论结果 */ R neighborCommentByApp(ComActNeighborCommentAppDTO commentAppDTO); /** * 邻里圈回复 * @param replyAppDTO 请求参数 * @return 回复结果 */ R neighborReplyByApp(ComActNeighborReplyAppDTO replyAppDTO); /** * 定时任务更新邻里圈近3天评论数/点赞数/浏览量 * @return 执行结果 */ R timeTaskCircleFlow(); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
@@ -1,30 +1,30 @@ package com.panzhihua.service_community.service.impl; import java.util.Date; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO; import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO; import com.panzhihua.common.model.dtos.neighbor.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.neighbor.AddNeighborCircleAdminVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleCommentAppVO; import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleDetailAppVO; import com.panzhihua.common.model.vos.neighbor.*; import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.ComActNeighborCircleCommentDAO; import com.panzhihua.common.model.vos.neighbor.EditNeighborCircleAdminVO; import com.panzhihua.common.model.vos.user.AdministratorsUserVO; import com.panzhihua.service_community.dao.ComActNeighborCircleCommentReplyDAO; import com.panzhihua.service_community.dao.ComActNeighborCircleDAO; import com.panzhihua.service_community.dao.ComActNeighborCircleFabulousDAO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleCommentDO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleCommentReplyDO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleFabulousDO; import com.panzhihua.service_community.service.ComActNeighborCircleBrowseService; import com.panzhihua.service_community.service.ComActNeighborCircleService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; @@ -42,6 +42,10 @@ private ComActNeighborCircleBrowseService comActNeighborCircleBrowseService; @Resource private ComActNeighborCircleCommentDAO comActNeighborCircleCommentDAO; @Resource private ComActNeighborCircleCommentReplyDAO comActNeighborCircleCommentReplyDAO; @Resource private ComActNeighborCircleFabulousDAO comActNeighborCircleFabulousDAO; /** * 分页查询邻里圈列表 @@ -81,27 +85,29 @@ } } /** * 查看邻里圈详情 * @param neighborCircleAppDTO 请求参数 * @return 邻里圈详情 */ @Override public R neighborDetailByApp(ComActNeighborCircleDetailAppDTO neighborCircleAppDTO){ //添加邻里圈浏览记录 comActNeighborCircleBrowseService.addBrowseRecord(neighborCircleAppDTO.getCircleId(),neighborCircleAppDTO.getUserId()); //查询邻里圈详情 ComActNeighborCircleDetailAppVO circleDetailAppVO = this.baseMapper.neighborDetailByApp(neighborCircleAppDTO.getCircleId()); //查询邻里圈下评论列表 IPage<ComActNeighborCircleCommentAppVO> circleCommentAppPage = comActNeighborCircleCommentDAO.pageNeighborCommentByApp( new Page(neighborCircleAppDTO.getPageNum(),neighborCircleAppDTO.getPageSize()),neighborCircleAppDTO.getCircleId()); new Page(neighborCircleAppDTO.getPageNum(),neighborCircleAppDTO.getPageSize()),neighborCircleAppDTO); if(!circleCommentAppPage.getRecords().isEmpty()){ for (ComActNeighborCircleCommentAppVO circleCommentVo:circleCommentAppPage.getRecords()) { //查询评论下评论回复 List<ComActNeighborCircleCommentReplyAppVO> commentReplyAppVOS = comActNeighborCircleCommentReplyDAO.getCircleCommentReplyList(circleCommentVo.getId()); if(!commentReplyAppVOS.isEmpty()){ circleCommentVo.setCircleCommentReplyAppList(commentReplyAppVOS); } } } return R.ok(circleDetailAppVO); } @@ -149,4 +155,203 @@ this.baseMapper.updateById(neighborCircleDO); return R.ok(); } /** * 用户查询邻里圈列表 * @param neighborCircleAppDTO 请求参数 * @return 邻里圈列表 */ @Override public R neighborExamineByApp(ComActNeighborCircleAppDTO neighborCircleAppDTO){ IPage<ComActNeighborCircleAppVO> neighborCircleIPage = this.baseMapper.neighborExamineByApp( new Page<>(neighborCircleAppDTO.getPageNum(),neighborCircleAppDTO.getPageSize()),neighborCircleAppDTO.getUserId()); return R.ok(neighborCircleIPage); } /** * 邻里圈点赞 * @param fabulousAppDTO 请求参数 * @return 点赞结果 */ @Override @Transactional(rollbackFor = Exception.class) public R neighborFabulousByApp(ComActNeighborFabulousAppDTO fabulousAppDTO){ ComActNeighborCircleFabulousDO circleFabulousDO = new ComActNeighborCircleFabulousDO(); circleFabulousDO.setUserId(fabulousAppDTO.getUserId()); circleFabulousDO.setType(fabulousAppDTO.getType()); circleFabulousDO.setParentId(fabulousAppDTO.getServiceId()); //判断点赞类型 if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.llq)){ //增加邻里圈点赞数量 ComActNeighborCircleDO neighborCircleDO = this.baseMapper.selectById(fabulousAppDTO.getServiceId()); if(neighborCircleDO != null){ neighborCircleDO.setFabulousNum(neighborCircleDO.getFabulousNum() + 1); this.baseMapper.updateById(neighborCircleDO); circleFabulousDO.setCircleId(neighborCircleDO.getId()); } //添加邻里圈浏览记录 comActNeighborCircleBrowseService.addBrowseRecord(fabulousAppDTO.getServiceId(),fabulousAppDTO.getUserId()); }else if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.pl)){ //增加邻里圈评论点赞数量 ComActNeighborCircleCommentDO circleCommentDO = comActNeighborCircleCommentDAO.selectById(fabulousAppDTO.getServiceId()); if(circleCommentDO != null){ circleCommentDO.setFabulousNum(circleCommentDO.getFabulousNum() + 1); comActNeighborCircleCommentDAO.updateById(circleCommentDO); circleFabulousDO.setCircleId(circleCommentDO.getCircleId()); } }else if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.hf)){ //增加邻里圈评论回复点赞数量 ComActNeighborCircleCommentReplyDO circleCommentReplyDO = comActNeighborCircleCommentReplyDAO.selectById(fabulousAppDTO.getServiceId()); if(circleCommentReplyDO != null){ circleCommentReplyDO.setFabulousNum(circleCommentReplyDO.getFabulousNum() + 1); comActNeighborCircleCommentReplyDAO.updateById(circleCommentReplyDO); circleFabulousDO.setCircleId(circleCommentReplyDO.getCircleId()); } } if(comActNeighborCircleFabulousDAO.insert(circleFabulousDO) > 0){ return R.ok(); }else{ return R.fail("点赞失败"); } } /** * 邻里圈转发 * @param forwardAppDTO 请求参数 * @return 转发结果 */ @Override public R neighborForwardByApp(ComActNeighborForwardAppDTO forwardAppDTO){ //添加邻里圈浏览记录 comActNeighborCircleBrowseService.addBrowseRecord(forwardAppDTO.getCircleId(),forwardAppDTO.getUserId()); ComActNeighborCircleDO circleDO = this.baseMapper.selectById(forwardAppDTO.getCircleId()); if(circleDO == null){ return R.fail("没有找到邻里圈"); } circleDO.setForwardNum(circleDO.getForwardNum() + 1); if(this.baseMapper.updateById(circleDO) > 0){ return R.ok(); }else{ return R.fail("转发失败"); } } /** * 邻里圈评论 * @param commentAppDTO 请求参数 * @return 评论结果 */ @Override @Transactional(rollbackFor = Exception.class) public R neighborCommentByApp(ComActNeighborCommentAppDTO commentAppDTO){ ComActNeighborCircleCommentDO circleCommentDO = new ComActNeighborCircleCommentDO(); //查询邻里圈更新邻里圈评论数量 ComActNeighborCircleDO neighborCircleDO = this.baseMapper.selectById(commentAppDTO.getCircleId()); if(neighborCircleDO == null){ return R.fail("没有找到邻里圈"); } neighborCircleDO.setCommentNum(neighborCircleDO.getCommentNum() + 1); neighborCircleDO.setReplyAt(new Date()); this.baseMapper.updateById(neighborCircleDO); circleCommentDO.setCircleId(commentAppDTO.getCircleId()); circleCommentDO.setUserId(commentAppDTO.getUserId()); circleCommentDO.setUserPhone(commentAppDTO.getPhone()); circleCommentDO.setContent(commentAppDTO.getContent()); if(neighborCircleDO.getReleaseId().equals(commentAppDTO.getUserId())){ circleCommentDO.setIsRelease(ComActNeighborCircleCommentDO.isRelease.yes); } if(comActNeighborCircleCommentDAO.insert(circleCommentDO) > 0){ return R.ok(); }else{ return R.fail("评论失败"); } } /** * 邻里圈回复 * @param replyAppDTO 请求参数 * @return 回复结果 */ @Override public R neighborReplyByApp(ComActNeighborReplyAppDTO replyAppDTO){ ComActNeighborCircleCommentReplyDO circleCommentReplyDO = new ComActNeighborCircleCommentReplyDO(); //查询邻里圈更新邻里圈评论数量 ComActNeighborCircleDO neighborCircleDO = this.baseMapper.selectById(replyAppDTO.getCircleId()); if(neighborCircleDO == null){ return R.fail("没有找到邻里圈"); } neighborCircleDO.setCommentNum(neighborCircleDO.getCommentNum() + 1); neighborCircleDO.setReplyAt(new Date()); this.baseMapper.updateById(neighborCircleDO); circleCommentReplyDO.setCircleId(replyAppDTO.getCircleId()); circleCommentReplyDO.setUserId(replyAppDTO.getUserId()); circleCommentReplyDO.setReplyContent(replyAppDTO.getContent()); if(neighborCircleDO.getReleaseId().equals(replyAppDTO.getUserId())){ circleCommentReplyDO.setIsRelease(1); } //判断回复类型 if(replyAppDTO.getType().equals(ComActNeighborReplyAppDTO.type.pl)){ //查询评论信息 ComActNeighborCircleCommentDO circleCommentDO = comActNeighborCircleCommentDAO.selectById(replyAppDTO.getServiceId()); if(circleCommentDO != null){ circleCommentReplyDO.setCommentId(replyAppDTO.getServiceId()); circleCommentReplyDO.setParentId(0L); circleCommentReplyDO.setParentUserId(circleCommentDO.getUserId()); } }else if(replyAppDTO.getType().equals(ComActNeighborReplyAppDTO.type.hf)){ //查询上级回复信息 ComActNeighborCircleCommentReplyDO parentCommentReplyDO = comActNeighborCircleCommentReplyDAO.selectById(replyAppDTO.getServiceId()); if(parentCommentReplyDO != null){ circleCommentReplyDO.setCommentId(parentCommentReplyDO.getCommentId()); circleCommentReplyDO.setParentId(parentCommentReplyDO.getId()); circleCommentReplyDO.setParentUserId(parentCommentReplyDO.getUserId()); } } if(comActNeighborCircleCommentReplyDAO.insert(circleCommentReplyDO) > 0){ return R.ok(); }else{ return R.fail("回复失败"); } } @Override public R timeTaskCircleFlow(){ Date oldDate = DateUtils.addDay(new Date(),-3); //查询所有状态正常的邻里圈 List<ComActNeighborCircleDO> circleDOList = this.baseMapper.selectList( new QueryWrapper<ComActNeighborCircleDO>().lambda().eq(ComActNeighborCircleDO::getStatus,ComActNeighborCircleDO.status.xs)); if(!circleDOList.isEmpty()){ //遍历查询到的邻里圈,更新邻里圈内近3天的评论数,点赞数,浏览量 for (ComActNeighborCircleDO neighborCircleDO:circleDOList) { //查询邻里圈近3天的评论数 int commentCount = comActNeighborCircleCommentDAO.selectCount( new QueryWrapper<ComActNeighborCircleCommentDO>().lambda().eq(ComActNeighborCircleCommentDO::getCircleId,neighborCircleDO.getId())); //查询邻里圈近3天的评论回复数 int commentReplyCount = comActNeighborCircleCommentReplyDAO.selectCount( new QueryWrapper<ComActNeighborCircleCommentReplyDO>().lambda() .eq(ComActNeighborCircleCommentReplyDO::getCircleId,neighborCircleDO.getId())); //查询邻里圈近3天的点赞数 int fabulousCount = comActNeighborCircleFabulousDAO.selectCount(new QueryWrapper<ComActNeighborCircleFabulousDO>() .lambda().eq(ComActNeighborCircleFabulousDO::getCircleId,neighborCircleDO.getId()) .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes)); //查询邻里圈近3天的浏览量 } } return R.ok(); } } springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/NeighborCircleJobHandler.java
New file @@ -0,0 +1,37 @@ package com.panzhihua.timejob.jobhandler; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.service.community.CommunityService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import javax.annotation.Resource; /** * @auther lyq * @create 2021-04-28 09:21:45 * @describe 邻里圈相关 */ @Slf4j @Component public class NeighborCircleJobHandler { @Resource private CommunityService communityService; /** * 定时任务更新邻里圈近3天评论数/点赞数/浏览量 * @return 刷新个数 * @throws Exception 出现的异常 */ @XxlJob("timedtaskpartybuildingstatusJobHandler") public ReturnT<String> timedtaskpartybuildingstatusJobHandler(String param) throws Exception { log.info("定时任务更新邻里圈近3天评论数/点赞数/浏览量"); R r=communityService.timedTaskNeighborCircleRecord(); log.info("执行结果【{}】",r.toString()); return ReturnT.SUCCESS; } }