提交 b97aaa2d 作者: 张小凤

Dyna(update)

上级 3913ca39
......@@ -121,4 +121,6 @@ public interface GambitDao {
ForumCountDO userMessage(Integer userAccountId);
ForumReviewVO selectForumReviewMessage(Integer dynamicId);
int replyCount(ForumReviewDO forumReviewDO);
}
package com.mmc.csf.release.entity.forum;
import com.mmc.csf.user.vo.UserAccountVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -50,6 +51,12 @@ public class ForumReviewDO implements Serializable {
@ApiModelProperty(value = "status",example = "true表示已评论 null 就没有评论")
private Boolean status;
@ApiModelProperty(value = "回复数量")
private Integer replyCount;
@ApiModelProperty(value = "用户信息")
private UserAccountVO userAccountVO;
}
package com.mmc.csf.release.service.gambit.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mmc.csf.common.util.page.PageResult;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.release.dao.DynamicDao;
......@@ -11,8 +13,12 @@ import com.mmc.csf.release.gambit.dto.ForumGambitDTO;
import com.mmc.csf.release.gambit.qo.*;
import com.mmc.csf.release.gambit.vo.ForumGambitVO;
import com.mmc.csf.release.service.gambit.GambitService;
import com.mmc.csf.user.vo.UserAccountVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.stream.Collectors;
......@@ -32,6 +38,12 @@ public class GambitServiceImpl implements GambitService {
@Autowired
private DynamicDao dynamicDao;
@Autowired
private RestTemplate restTemplate;
@Value("${iuav.userapp.url}")
private String userApp;
/**
* 添加话题
* @param forumGambitVO
......@@ -226,6 +238,14 @@ public class GambitServiceImpl implements GambitService {
allReviewQO.buildCurrentPage();
int count = gambitDao.allCommentListCount(allReviewQO);
List<ForumReviewDO> forumReviewDOS = gambitDao.allCommentList(allReviewQO);
for (ForumReviewDO forumReviewDO : forumReviewDOS) {
UserAccountVO info = info(forumReviewDO.getUserAccountId());
forumReviewDO.setUserAccountVO(info);
}
for (ForumReviewDO forumReviewDO : forumReviewDOS) {
int counts = gambitDao.replyCount(forumReviewDO);
forumReviewDO.setReplyCount(counts);
}
return PageResult.buildPage(pageNo,allReviewQO.getPageSize(),count,forumReviewDOS);
}
......@@ -239,5 +259,19 @@ public class GambitServiceImpl implements GambitService {
}
public UserAccountVO info(Integer userAccountId) {
String token = null;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(userAccountId.toString(), headers);
ResponseEntity<String> exchange = restTemplate.exchange(userApp + "/userapp/user-account/interiorInfo?userAccountId=" + userAccountId , HttpMethod.GET, entity, String.class);
Object body = exchange.getBody();
JSONObject jsonObject = JSONObject.parseObject((String) body);
JSONObject result1 = (JSONObject) jsonObject.get("result");
UserAccountVO userAccountVO = JSON.parseObject(result1.toJSONString(), UserAccountVO.class);
return userAccountVO;
}
}
......@@ -154,6 +154,16 @@
LIMIT 0,1
</select>
<select id="replyCount" resultType="java.lang.Integer" parameterType="com.mmc.csf.release.entity.forum.ForumReviewDO">
SELECT
count(*)
FROM
forum_review fr
WHERE
fr.dynamic_id = #{dynamicId}
AND fr.review_id = #{id}
</select>
<select id="selectResourceList" resultType="com.mmc.csf.release.entity.forum.ForumResourceDO">
select dynamic_id,resource_url,create_time,update_time,`type` from forum_resource where dynamic_id=#{dynamicId}
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论