|
@@ -337,14 +337,14 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
|
|
|
|
|
List<LikeListVo> likes = articleTweetService.queryArticleLikes(articleTweetDto.getId());
|
|
List<LikeListVo> likes = articleTweetService.queryArticleLikes(articleTweetDto.getId());
|
|
|
|
|
|
|
|
- if(likes != null && likes.size() > 0){
|
|
|
|
|
|
|
+ if (likes != null && likes.size() > 0) {
|
|
|
Optional<LikeListVo> ownerLikes = likes.stream().filter(e -> e.getId().equals(articleTweetDto.getUserId())).findFirst();
|
|
Optional<LikeListVo> ownerLikes = likes.stream().filter(e -> e.getId().equals(articleTweetDto.getUserId())).findFirst();
|
|
|
- if(ownerLikes != null && ownerLikes.isPresent()){
|
|
|
|
|
|
|
+ if (ownerLikes != null && ownerLikes.isPresent()) {
|
|
|
result.setIsLike(1);
|
|
result.setIsLike(1);
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
result.setIsLike(0);
|
|
result.setIsLike(0);
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
result.setIsLike(0);
|
|
result.setIsLike(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -513,7 +513,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
//子级评论数据
|
|
//子级评论数据
|
|
|
List<ArticleCommentVo> childs = articleTweetService.queryCommentsByArticle(articleTweetDto.getId());
|
|
List<ArticleCommentVo> childs = articleTweetService.queryCommentsByArticle(articleTweetDto.getId());
|
|
|
|
|
|
|
|
- if(childs != null && childs.size() > 0){
|
|
|
|
|
|
|
+ if (childs != null && childs.size() > 0) {
|
|
|
for (ArticleCommentVo data : result.getPageList()) {
|
|
for (ArticleCommentVo data : result.getPageList()) {
|
|
|
List<ArticleCommentVo> comments = QueryTreeDatas(data.getId(), childs);
|
|
List<ArticleCommentVo> comments = QueryTreeDatas(data.getId(), childs);
|
|
|
data.setChildrens(comments);
|
|
data.setChildrens(comments);
|
|
@@ -575,6 +575,10 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
|
|
|
|
|
articleUserVo result = articleTweetService.queryUserInfo(articleTweetDto.getUserId());
|
|
articleUserVo result = articleTweetService.queryUserInfo(articleTweetDto.getUserId());
|
|
|
|
|
|
|
|
|
|
+ if(result != null){
|
|
|
|
|
+ String descript = "点击这里,填写简介";
|
|
|
|
|
+ result.setDescript(result.getDescript() == null ? descript : result.getDescript());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
jsonObject.put("code", ResultStatusCode.OK.getStatus());
|
|
jsonObject.put("code", ResultStatusCode.OK.getStatus());
|
|
|
jsonObject.put("message", "请求成功");
|
|
jsonObject.put("message", "请求成功");
|
|
@@ -615,8 +619,15 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
if (fileInfoList != null) {
|
|
if (fileInfoList != null) {
|
|
|
if (fileInfoList.size() > 1) {
|
|
if (fileInfoList.size() > 1) {
|
|
|
data.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
|
|
data.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
|
|
|
- } else if(fileInfoList.size() == 1){
|
|
|
|
|
- data.setVideo(fileInfoList.get(0).getUrl());
|
|
|
|
|
|
|
+ } else if (fileInfoList.size() == 1) {
|
|
|
|
|
+ String url = fileInfoList.get(0).getUrl();
|
|
|
|
|
+ if (!url.endsWith("jpg") && !url.endsWith("png")) {
|
|
|
|
|
+ data.setVideo(fileInfoList.get(0).getUrl());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ List<String> images = new ArrayList<>();
|
|
|
|
|
+ images.add(url);
|
|
|
|
|
+ data.setImages(images);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -663,8 +674,13 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
if (fileInfoList != null) {
|
|
if (fileInfoList != null) {
|
|
|
if (fileInfoList.size() > 1) {
|
|
if (fileInfoList.size() > 1) {
|
|
|
data.setImage(fileInfoList.get(0).getUrl());
|
|
data.setImage(fileInfoList.get(0).getUrl());
|
|
|
- } else if(fileInfoList.size() == 1){
|
|
|
|
|
- data.setVideo(fileInfoList.get(0).getUrl());
|
|
|
|
|
|
|
+ } else if (fileInfoList.size() == 1) {
|
|
|
|
|
+ String url = fileInfoList.get(0).getUrl();
|
|
|
|
|
+ if (!url.endsWith("jpg") && !url.endsWith("png")) {
|
|
|
|
|
+ data.setVideo(fileInfoList.get(0).getUrl());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ data.setImage(url);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -682,7 +698,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
/**
|
|
/**
|
|
|
* 相关推文
|
|
* 相关推文
|
|
|
*/
|
|
*/
|
|
|
- public String relatedTweets(){
|
|
|
|
|
|
|
+ public String relatedTweets() {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
|
if (articleTweetDto.getId() == null || articleTweetDto.getTownId() == null || articleTweetDto.getUserId() == null) {
|
|
if (articleTweetDto.getId() == null || articleTweetDto.getTownId() == null || articleTweetDto.getUserId() == null) {
|
|
@@ -703,8 +719,13 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
if (fileInfoList != null) {
|
|
if (fileInfoList != null) {
|
|
|
if (fileInfoList.size() > 1) {
|
|
if (fileInfoList.size() > 1) {
|
|
|
data.setImage(fileInfoList.get(0).getUrl());
|
|
data.setImage(fileInfoList.get(0).getUrl());
|
|
|
- } else if(fileInfoList.size() == 1){
|
|
|
|
|
- data.setVideo(fileInfoList.get(0).getUrl());
|
|
|
|
|
|
|
+ } else if (fileInfoList.size() == 1) {
|
|
|
|
|
+ String url = fileInfoList.get(0).getUrl();
|
|
|
|
|
+ if (!url.endsWith("jpg") && !url.endsWith("png")) {
|
|
|
|
|
+ data.setVideo(fileInfoList.get(0).getUrl());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ data.setImage(url);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -767,7 +788,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String successMessage =actionStr +"成功";
|
|
|
|
|
|
|
+ String successMessage = actionStr + "成功";
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
put("message", successMessage);
|
|
put("message", successMessage);
|
|
|
put("code", 200);
|
|
put("code", 200);
|
|
@@ -787,8 +808,8 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
ArticleCommentDto articleCommentDto = gson.fromJson(json.toString(), new TypeToken<ArticleCommentDto>() {
|
|
ArticleCommentDto articleCommentDto = gson.fromJson(json.toString(), new TypeToken<ArticleCommentDto>() {
|
|
|
}.getType());
|
|
}.getType());
|
|
|
|
|
|
|
|
- if(articleCommentDto.getArticleId() == null || Func.checkNull(articleCommentDto.getContent())
|
|
|
|
|
- || articleCommentDto.getParentId() == null || articleCommentDto.getUserId() == null){
|
|
|
|
|
|
|
+ if (articleCommentDto.getArticleId() == null || Func.checkNull(articleCommentDto.getContent())
|
|
|
|
|
+ || articleCommentDto.getParentId() == null || articleCommentDto.getUserId() == null) {
|
|
|
jsonObject.put("code", 500);
|
|
jsonObject.put("code", 500);
|
|
|
jsonObject.put("message", "参数不能为空");
|
|
jsonObject.put("message", "参数不能为空");
|
|
|
jsonObject.put("data", null);
|
|
jsonObject.put("data", null);
|
|
@@ -819,7 +840,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
articleComment.setStatus(1);
|
|
articleComment.setStatus(1);
|
|
|
|
|
|
|
|
int num = articleTweetService.insertArticleComment(articleComment);
|
|
int num = articleTweetService.insertArticleComment(articleComment);
|
|
|
- if(num <= 0){
|
|
|
|
|
|
|
+ if (num <= 0) {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
put("message", "评论失败");
|
|
put("message", "评论失败");
|
|
|
put("code", 500);
|
|
put("code", 500);
|
|
@@ -841,7 +862,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
*/
|
|
*/
|
|
|
public String followAuthor() throws ParseException {
|
|
public String followAuthor() throws ParseException {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
- if(articleTweetDto.getAuthorId() == null || articleTweetDto.getUserId() == null){
|
|
|
|
|
|
|
+ if (articleTweetDto.getAuthorId() == null || articleTweetDto.getUserId() == null) {
|
|
|
jsonObject.put("code", 500);
|
|
jsonObject.put("code", 500);
|
|
|
jsonObject.put("message", "作者ID或用户ID不能为空");
|
|
jsonObject.put("message", "作者ID或用户ID不能为空");
|
|
|
jsonObject.put("data", null);
|
|
jsonObject.put("data", null);
|
|
@@ -881,7 +902,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String successMessage =actionStr +"成功";
|
|
|
|
|
|
|
+ String successMessage = actionStr + "成功";
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
put("message", successMessage);
|
|
put("message", successMessage);
|
|
|
put("code", 200);
|
|
put("code", 200);
|
|
@@ -949,7 +970,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String successMessage =actionStr +"成功";
|
|
|
|
|
|
|
+ String successMessage = actionStr + "成功";
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
put("message", successMessage);
|
|
put("message", successMessage);
|
|
|
put("code", 200);
|
|
put("code", 200);
|