From 110177681bc6e5bf1487df36201b71976c6e5407 Mon Sep 17 00:00:00 2001 From: PL <774412461@qq.com> Date: Fri, 30 Aug 2024 12:24:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=8A=9B=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/teammodel/service/impl/ChatMessageServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java index ba721a0..2b77d6c 100644 --- a/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/ChatMessageServiceImpl.java @@ -97,8 +97,9 @@ public class ChatMessageServiceImpl implements ChatMessageService { } return sseEmitter; } catch (Exception e) { - log.info(e.getStackTrace().toString()); - throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), e.getStackTrace().toString()); + log.info(Arrays.toString(e.getStackTrace())); + log.error("{}-{}", e.getMessage(), Arrays.toString(e.getStackTrace())); + throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), Arrays.toString(e.getStackTrace())); } } From 741330e678fd3c01334a29c3996880b6c3b8b107 Mon Sep 17 00:00:00 2001 From: "zhouj1203@hotmail.com" Date: Fri, 30 Aug 2024 13:41:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/service/impl/ExamServiceImpl.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java index 8bad3eb..f7b80d8 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java @@ -3,14 +3,9 @@ package cn.teammodel.controller.admin.service.impl; import cn.teammodel.common.ErrorCode; import cn.teammodel.config.exception.ServiceException; import cn.teammodel.controller.admin.service.ExamService; -import cn.teammodel.model.dto.admin.common.RGroupList; import cn.teammodel.model.dto.admin.exam.OverViewDto; -import cn.teammodel.model.entity.common.Exam; import cn.teammodel.repository.ExamRepository; import cn.teammodel.utils.GroupUtil; -import cn.teammodel.utils.SnowflakeIdGenerator; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; From 5efd36bce8692333ef3c8de4b98a1d375e41510f Mon Sep 17 00:00:00 2001 From: "zhouj1203@hotmail.com" Date: Fri, 30 Aug 2024 13:51:28 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/impl/CommonServiceImpl.java | 10 +++++++--- .../java/cn/teammodel/model/entity/common/Comment.java | 4 ++++ .../cn/teammodel/repository/CommentRepository.java | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java index 7a8451b..210f737 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/CommonServiceImpl.java @@ -112,7 +112,7 @@ public class CommonServiceImpl implements CommonService { @Override public Comment saveOrUpdateComment(Comment comment) { - List comments = commentRepository.findById(comment.getId(),comment.getSchool(),comment.getActivityType()); + List comments = commentRepository.findById(comment.getId(),comment.getSchool(),comment.getActivityType(),comment.getCode()); Comment existingComment = comments.stream().findFirst().orElse(null); if (existingComment != null) { // 如果评论对象存在,则进行更新操作 @@ -125,7 +125,11 @@ public class CommonServiceImpl implements CommonService { return commentRepository.save(existingComment); } else { // 如果评论对象不存在,则创建新的记录 - comment.setCode("Comment-"+ comment.getSchool()); + String formattedString = String.format("Comment-%s-%s-%s", + comment.getSchool(), + comment.getYear(), + comment.getSemester()); + comment.setCode(formattedString); comment.setCreateTime(Instant.now().toEpochMilli()); return commentRepository.save(comment); } @@ -141,6 +145,6 @@ public class CommonServiceImpl implements CommonService { @Override public List getCommentById(Comment comment) { - return commentRepository.findById(comment.getId(),comment.getSchool(),comment.getActivityType()); + return commentRepository.findById(comment.getId(),comment.getSchool(),comment.getActivityType(),comment.getCode()); } } diff --git a/src/main/java/cn/teammodel/model/entity/common/Comment.java b/src/main/java/cn/teammodel/model/entity/common/Comment.java index d0acbc5..ffc3667 100644 --- a/src/main/java/cn/teammodel/model/entity/common/Comment.java +++ b/src/main/java/cn/teammodel/model/entity/common/Comment.java @@ -28,6 +28,10 @@ public class Comment extends BaseItem { private int ttl = -1; private Long createTime; private Long updateTime; + @ApiModelProperty("学年") + private int year; + @ApiModelProperty("当前学年所处第几学期") + private int semester; @Data public static class ContentInfo { @ApiModelProperty("评论内容") diff --git a/src/main/java/cn/teammodel/repository/CommentRepository.java b/src/main/java/cn/teammodel/repository/CommentRepository.java index cddfcf4..9087efa 100644 --- a/src/main/java/cn/teammodel/repository/CommentRepository.java +++ b/src/main/java/cn/teammodel/repository/CommentRepository.java @@ -13,7 +13,7 @@ import java.util.List; @Repository public interface CommentRepository extends CosmosRepository { - @Query("select * from Comment as s where s.id = @id and s.pk = 'Comment' and s.school = @school and s.activityType = @activityType ") - List findById(@Param("id") String id, @Param("school") String school,@Param("activityType") String activityType); + @Query("select * from Comment as s where s.id = @id and s.pk = 'Comment' and s.school = @school and s.activityType = @activityType and s.code = @code ") + List findById(@Param("id") String id, @Param("school") String school,@Param("activityType") String activityType,@Param("code") String code); } From 9b99c7db2890e76f499de13b283d1322a93be215 Mon Sep 17 00:00:00 2001 From: "zhouj1203@hotmail.com" Date: Fri, 30 Aug 2024 14:51:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8C=85=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index c99e6b2..f004316 100644 --- a/pom.xml +++ b/pom.xml @@ -118,17 +118,17 @@ - + - + org.springframework.boot