6666
This commit is contained in:
parent
f365725ddc
commit
2bf75f99a5
@ -200,13 +200,13 @@ public class CaseClinicalArticleController {
|
||||
String userId = (String) httpServletRequest.getAttribute("userId");
|
||||
|
||||
if (userId == null) {
|
||||
return Response.error("操作失败");
|
||||
return Response.error("操作失败1");
|
||||
}
|
||||
|
||||
try {
|
||||
boolean res = caseClinicalArticleService.DeleteClinicalArticleComment(commentId,userId);
|
||||
if (!res){
|
||||
return Response.error("操作失败");
|
||||
return Response.error("操作失败2");
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
return Response.error(e.getMessage());
|
||||
|
||||
@ -208,22 +208,29 @@ public class CaseClinicalArticleService {
|
||||
// 获取文章数据
|
||||
CaseClinicalArticleModel article = caseClinicalArticleDao.selectById(comment.getArticleId());
|
||||
if (article == null) {
|
||||
System.out.println(111);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (article.getArticleStatus() != 1){
|
||||
System.out.println(222);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检测用户是否文章作者
|
||||
boolean isAuthor = checkUserIsArticleAuthor(String.valueOf(article.getArticleId()),userId);
|
||||
if (!isAuthor) {
|
||||
return false;
|
||||
// 检测是否本人的评论
|
||||
if (!Objects.equals(comment.getUserId(), Long.valueOf(userId))){
|
||||
// 检测用户是否文章作者
|
||||
boolean isAuthor = checkUserIsArticleAuthor(String.valueOf(article.getArticleId()),userId);
|
||||
if (!isAuthor) {
|
||||
System.out.println(333);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 删除评论
|
||||
int res = userCommentClinicalArticleDao.deleteById(comment.getCommentId());
|
||||
if (res <= 0){
|
||||
System.out.println(444);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return false;
|
||||
}
|
||||
@ -231,6 +238,7 @@ public class CaseClinicalArticleService {
|
||||
// 减少文章的统计字段
|
||||
boolean r = DecClinicalArticleStats(String.valueOf(comment.getArticleId()),2,1);
|
||||
if (!r){
|
||||
System.out.println(555);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return false;
|
||||
}
|
||||
@ -365,6 +373,7 @@ public class CaseClinicalArticleService {
|
||||
|
||||
if (Objects.equals(caseClinicalDoctor.getDoctorIden(), user.getUserIden())){
|
||||
isAuthor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user