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