| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.listener.event.IntegralEvent; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | import com.doumee.dao.web.dto.activity.ActivityReplyCommentDTO; |
| | | import com.doumee.dao.web.request.CommentApplyRequest; |
| | | import com.doumee.service.business.CommentService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.business.MemberService; |
| | | import com.doumee.service.business.ZanService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.collections4.MapUtils; |
| | |
| | | target.setType(Constants.ZERO); |
| | | |
| | | if (comment.getReplyId() != null){ |
| | | Comment reply = commentMapper.selectById(comment.getReplyId()); |
| | | Comment reply = commentMapper.selectJoinOne(Comment.class,new MPJLambdaWrapper<Comment>() |
| | | .selectAll(Comment.class) |
| | | .selectAs(Member::getNickname,Comment::getReplyMemberNikeName) |
| | | .leftJoin(Member.class,Member::getId,Comment::getMemberId) |
| | | .eq(Comment::getId,comment.getReplyId()) |
| | | ); |
| | | reply = Optional.ofNullable(reply).orElseThrow(() -> new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "回复目标不存在")); |
| | | target.setReplyId(reply.getId()); |
| | | target.setReplyMemberId(reply.getMemberId()); |
| | | target.setReplyMemberNikeName(reply.getReplyMemberNikeName()); |
| | | target.setCommentId(reply.getId()); |
| | | target.setCommentMemberId(reply.getMemberId()); |
| | | target.setType(Constants.ONE); |
| | |
| | | target.setMemberImgUrl(memberFile + member.getImgurl()); |
| | | } |
| | | } |
| | | IntegralEvent<Comment> integralEvent = new IntegralEvent(this,target, Constants.CoffeeBeanTask.POST_COMMENTS,memberId); |
| | | applicationEventPublisher.publishEvent(integralEvent); |
| | | target.setZanCount(Constants.ZERO); |
| | | target.setZanStatus(Constants.ZERO); |
| | | return target; |
| | |
| | | QueryWrapper<Comment> wrapper = new QueryWrapper<>(comment); |
| | | return commentMapper.selectList(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageData<Comment> findPage(PageWrap<Comment> pageWrap) { |
| | | IPage<Comment> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | |
| | | queryWrapper.eq(Comment::getStatus, Constants.ZERO); |
| | | queryWrapper.eq(Comment::getCommentId,pageWrap.getModel().getCommentId()); |
| | | IPage<ActivityReplyCommentDTO> result = commentJoinMapper.selectJoinPage(page, ActivityReplyCommentDTO.class, queryWrapper); |
| | | if (CollectionUtils.isEmpty(result.getRecords())){ |
| | | return PageData.from(result); |
| | | } |
| | | |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode(); |
| | | String memberFile = path + systemDictDataBiz.queryByCode(Constants.OSS, Constants.MEMBER_FILE).getCode(); |
| | | String commentFile = path + systemDictDataBiz.queryByCode(Constants.OSS, Constants.COMMENT_FILE).getCode(); |