|
@@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.exception.user.ProjectException;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.ip.AddressUtils;
|
|
|
import com.ruoyi.generator.domain.Community.CommunityArticleComment;
|
|
|
import com.ruoyi.generator.domain.Community.CommunityCommentLike;
|
|
|
import com.ruoyi.generator.domain.Community.CommunityCommentReply;
|
|
@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ExecutionException;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -83,6 +85,10 @@ public class CommunityCommentController extends BaseController {
|
|
|
CommunityArticleCommentVo commentVo = null;
|
|
|
|
|
|
for (CommunityArticleComment record : records) {
|
|
|
+ if (record.getAddress() == null){
|
|
|
+ record.setAddress("未知");
|
|
|
+ }
|
|
|
+
|
|
|
commentVo = new CommunityArticleCommentVo();
|
|
|
BeanUtils.copyProperties(record, commentVo);
|
|
|
commentVos.add(commentVo);
|
|
@@ -157,6 +163,9 @@ public class CommunityCommentController extends BaseController {
|
|
|
|
|
|
for (final CommunityCommentReply reply : replies) {
|
|
|
replyVo = new CommunityCommentReplyVo();
|
|
|
+ if (reply.getAddress() == null){
|
|
|
+ reply.setAddress("未知");
|
|
|
+ }
|
|
|
SysUser sysUser = sysUserService.selectUserById(reply.getUserId());
|
|
|
final Long parentReplyId = reply.getParentReplyId();
|
|
|
BeanUtils.copyProperties(reply, replyVo);
|
|
@@ -175,6 +184,8 @@ public class CommunityCommentController extends BaseController {
|
|
|
.eq("reply_id", replyVo.getId()));
|
|
|
replyVo.setLikeCount(commentLikes.size());
|
|
|
replyVo.setLike(commentLikes.stream().anyMatch(item -> SecurityUtils.getUserId().equals(item.getUserId())));
|
|
|
+
|
|
|
+
|
|
|
replyVos.add(replyVo);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -208,7 +219,19 @@ public class CommunityCommentController extends BaseController {
|
|
|
communityCommentReply.setDelete(false);
|
|
|
communityCommentReply.setCreateBy(userId);
|
|
|
communityCommentReply.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
+ String address = null;
|
|
|
+ try {
|
|
|
+ address = AddressUtils.getAddress();
|
|
|
+ } catch (ExecutionException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ communityCommentReply.setAddress(address);
|
|
|
communityCommentReplyService.save(communityCommentReply);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|