|
@@ -27,6 +27,8 @@ import com.ruoyi.system.service.ISysUserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -45,6 +47,9 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@RequestMapping("/community/article")
|
|
|
public class CommunityArticleController extends BaseController {
|
|
|
+
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(CommunityArticleController.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private ICommunityArticleService communityArticleService;
|
|
|
|
|
@@ -173,7 +178,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
rspData.setMsg("查询成功");
|
|
|
rspData.setRows(list);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return rspData;
|
|
@@ -187,7 +192,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
@Transactional
|
|
|
//@Anonymous
|
|
|
public AjaxResult article(@RequestBody CommunityArticle communityArticle) {
|
|
|
- System.out.println("communityArticle:" + communityArticle.toString());
|
|
|
+ log.info("communityArticle:{}", communityArticle.toString());
|
|
|
try {
|
|
|
if (communityArticle.getClassIds().isEmpty()) {
|
|
|
return AjaxResult.error("板块不能为空");
|
|
@@ -202,8 +207,8 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityReportController.adminReportPunish(SecurityUtils.getUserId());
|
|
|
// 获取当前时间
|
|
|
Date currentTime = new Date();
|
|
|
- System.out.println(reportTime);
|
|
|
- System.out.println(currentTime);
|
|
|
+ log.info(String.valueOf(reportTime));
|
|
|
+ log.info(String.valueOf(currentTime));
|
|
|
// 检查 reportTime 小于当前时间
|
|
|
if (currentTime.before(reportTime)) {
|
|
|
// 返回封号的提示
|
|
@@ -212,7 +217,6 @@ public class CommunityArticleController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
String title = communityArticle.getTitle();
|
|
|
String content = communityArticle.getContent();
|
|
|
boolean isSensitiveTitle = SensitiveWordUtil.containsSensitiveWord(title);
|
|
@@ -227,7 +231,8 @@ public class CommunityArticleController extends BaseController {
|
|
|
//检查附近是否是需要加水印
|
|
|
boolean isWaterMark = communityArticle.isWaterMark();
|
|
|
boolean isFillWater = communityArticle.isFillWater();
|
|
|
- if (isWaterMark) {
|
|
|
+ log.info("isWaterMark:{},isFillWater:{}", isWaterMark, isFillWater);
|
|
|
+ if (isWaterMark && null != communityArticle.getImages()) {
|
|
|
//获取用户名
|
|
|
String nickName = SecurityUtils.getLoginUser().getUser().getNickName();
|
|
|
// 添加水印
|
|
@@ -244,7 +249,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
new File(tempSourceFile),
|
|
|
new File(tempWatermarkFile),
|
|
|
"@" + nickName,
|
|
|
- "ACG爱好者社区"
|
|
|
+ "次元时代-ACG爱好者社区"
|
|
|
);
|
|
|
// 上传加水印的文件到OSS
|
|
|
String fileNameResult = OssUtils.uploadFile(tempWatermarkFile);
|
|
@@ -255,7 +260,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
communityArticleService.insertCommunityArticle(communityArticle);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("文章发布成功!");
|
|
@@ -270,7 +275,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
//@Anonymous
|
|
|
public AjaxResult editArticle(@RequestBody CommunityArticle communityArticle) {
|
|
|
try {
|
|
|
- System.out.println("communityArticle:" + communityArticle);
|
|
|
+ log.info("communityArticle:{}", communityArticle);
|
|
|
if (communityArticle.getClassIds().isEmpty()) {
|
|
|
return AjaxResult.error("板块不能为空");
|
|
|
}
|
|
@@ -292,7 +297,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
// e.printStackTrace();
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("文章发布成功!");
|
|
@@ -328,7 +333,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
return success("删除成功!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return error("删除失败!");
|
|
@@ -380,7 +385,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
//e.printStackTrace();
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityClasses);
|
|
@@ -418,7 +423,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
sumArray.add(oneObject); // 添加到 sumArray
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -467,7 +472,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
//新增评论
|
|
|
communityArticleService.sendComment(communityArticleComment);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
@@ -498,7 +503,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
//删除评论
|
|
|
communityArticleService.deleteComment(articleComment);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("删除评论成功!");
|
|
@@ -541,7 +546,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
// redisCache.setCacheList(CacheConstants.COMMUNITY_LIKE, communityLikeMapper.selectList(new QueryWrapper<CommunityLike>()));
|
|
|
// redisCache.expire(CacheConstants.COMMUNITY_LIKE, 24, TimeUnit.HOURS);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -595,7 +600,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
// redisCache.setCacheList(CacheConstants.COMMUNITY_ARTICLE_RECOMMEND, communityArticleRecommendMapper.selectList(new QueryWrapper<CommunityArticleRecommend>().eq("is_delete", false)));
|
|
|
// redisCache.expire(CacheConstants.COMMUNITY_ARTICLE_RECOMMEND, 24, TimeUnit.HOURS);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -639,7 +644,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
// redisCache.setCacheList(CacheConstants.COMMUNITY_COLLECT, communityArticleCollectMapper.selectList(new QueryWrapper<CommunityArticleCollect>()));
|
|
|
// redisCache.expire(CacheConstants.COMMUNITY_COLLECT, 24, TimeUnit.HOURS);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -693,7 +698,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
message = "取消点赞";
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -712,7 +717,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityCircles = communityArticleService.selectCommunityCircleList(classId);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityCircles);
|
|
@@ -761,7 +766,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -804,7 +809,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
msg = "已取关";
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -836,7 +841,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
// redisCache.setCacheList(CacheConstants.COMMUNITY_USER_LIKE, communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>()));
|
|
|
// redisCache.expire(CacheConstants.COMMUNITY_USER_LIKE, 24, TimeUnit.HOURS);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -862,7 +867,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(userId, isToken);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityUserInfoVo);
|
|
@@ -895,7 +900,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
// e.printStackTrace();
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -913,7 +918,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityUserInfoVos = communityArticleService.selectUsersByAccountOrName(SearchValue);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -935,7 +940,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityUserLikeVos = communityArticleService.selectCommunityUserLikeList(userId, userName, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -956,7 +961,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityUserLikeVos = communityArticleService.selectUserFansList(userId, userName, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -974,7 +979,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityUserLikeVos = communityArticleService.selectMutualAttention(SecurityUtils.getLoginUser().getUserId(), userName, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -1010,7 +1015,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityUserInfo.setBackImage(backImage);
|
|
|
communityUserInfoMapper.updateById(communityUserInfo);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("背景图片上传成功!");
|
|
@@ -1042,7 +1047,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityCollectionVos = communityCollectionService.selectUserCollection(userId, articleId, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityCollectionVos);
|
|
@@ -1088,7 +1093,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityCollection.setDelete(false);
|
|
|
communityCollectionService.save(communityCollection);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -1115,7 +1120,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityCollection.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
communityCollectionMapper.updateById(communityCollection);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("文章更新成功!");
|
|
@@ -1138,7 +1143,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityCollectionService.deleteCollectionById(collectionId);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("删除成功!");
|
|
@@ -1200,7 +1205,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
return AjaxResult.success("合集ID不属于当前登录用户!");
|
|
|
}
|
|
|
|
|
|
- System.out.println("communityCollections: " + communityCollections);
|
|
|
+ log.info("communityCollections: " + communityCollections);
|
|
|
//根据创建人ID,合集ID,文章ID保持唯一性 查询表如果没有则插入,有了则更新ID
|
|
|
List<CommunityCollectionArticle> communityCollectionArticles = communityCollectionArticleMapper.selectList(new QueryWrapper<CommunityCollectionArticle>()
|
|
|
.eq("create_by", userId)
|
|
@@ -1208,7 +1213,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
.and((wrapper) -> {
|
|
|
wrapper.ne("is_delete", 1).or().isNull("is_delete");
|
|
|
}));
|
|
|
- System.out.println("communityCollectionArticles: " + communityCollectionArticles);
|
|
|
+ log.info("communityCollectionArticles: " + communityCollectionArticles);
|
|
|
|
|
|
if (!communityCollectionArticles.isEmpty()) {
|
|
|
for (CommunityCollectionArticle communityCollectionArticle : communityCollectionArticles) {
|
|
@@ -1226,7 +1231,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
collectionArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
communityCollectionService.addArticleToCollection(collectionArticle);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -1250,7 +1255,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityCollectionService.deleteArticleToCollection(collectionId, articleId);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("文章删除成功!");
|
|
@@ -1279,7 +1284,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
jsonArray = communityCollectionService.selectArticleInfoInCollection(userId, collectionId, searchType);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(jsonArray);
|
|
@@ -1300,7 +1305,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
trendingTops = communityArticleMapper.selectTrendingTopByContent(content);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success("获取成功!", trendingTops);
|
|
@@ -1330,7 +1335,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
return AjaxResult.success("不能关注自己创建的合集/传参有误");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
|
|
@@ -1347,7 +1352,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityUserPromptVo = communityArticleService.selectCommunityUserPrompt(userId);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityUserPromptVo);
|
|
@@ -1367,7 +1372,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityArticleVos = communityArticleService.selectUserNoCo(userId, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityArticleVos);
|
|
@@ -1405,7 +1410,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityArticleVo.setRecommend(!Objects.isNull(recommend));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityArticleVos);
|
|
@@ -1445,7 +1450,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
communityArticleVo.setRecommend(!Objects.isNull(recommend));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
return AjaxResult.success(communityArticleVos);
|