From 55b620bb558b26630e71dbb8aa4b68906ecff2b9 Mon Sep 17 00:00:00 2001 From: mio <2190266250@qq.com> Date: Mon, 11 Dec 2023 22:16:10 +0800 Subject: [PATCH] update --- .../evento/controller/FeedbackController.java | 18 +++++++++++++++--- .../sast/evento/controller/UserController.java | 2 +- .../evento/interceptor/HttpInterceptor.java | 4 +++- .../sast/evento/mapper/FeedbackMapper.java | 2 +- .../sast/evento/service/FeedbackService.java | 2 +- .../service/impl/FeedbackServiceImpl.java | 2 +- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/java/sast/evento/controller/FeedbackController.java b/src/main/java/sast/evento/controller/FeedbackController.java index 03dc855..42d41e5 100644 --- a/src/main/java/sast/evento/controller/FeedbackController.java +++ b/src/main/java/sast/evento/controller/FeedbackController.java @@ -49,9 +49,21 @@ public String addFeedback(@RequestParam(required = false) String content, return null; } - String userIdStr = userProFile.getUserId(); - Integer userIdInt = Integer.valueOf(userIdStr); - return feedbackService.addFeedback(userIdInt, content, score, eventId); + return feedbackService.addFeedback(userProFile.getUserId(), content, score, eventId); + } + + @OperateLog("用户添加反馈") + @DefaultActionState(ActionState.LOGIN) + @GetMapping("/info") + public String addFeed(@RequestParam(required = false) String content, + @RequestParam Double score, + @RequestParam Integer eventId) { + UserProFile userProFile = HttpInterceptor.userProFileHolder.get(); + if (userProFile == null) { + return null; + } + + return feedbackService.addFeedback(userProFile.getUserId(), content, score, eventId); } @OperateLog("用户获取自己的反馈列表") diff --git a/src/main/java/sast/evento/controller/UserController.java b/src/main/java/sast/evento/controller/UserController.java index 56ce322..7d21af4 100644 --- a/src/main/java/sast/evento/controller/UserController.java +++ b/src/main/java/sast/evento/controller/UserController.java @@ -73,7 +73,7 @@ public List getSubscribed() { return eventService.getSubscribed(userIdInt); } - @OperateLog("报名活动") + @OperateLog("报名活动 / 取消报名") @DefaultActionState(ActionState.LOGIN) @GetMapping("/register") public String register(@RequestParam Integer eventId, diff --git a/src/main/java/sast/evento/interceptor/HttpInterceptor.java b/src/main/java/sast/evento/interceptor/HttpInterceptor.java index 0a33fd7..8b7f0e6 100644 --- a/src/main/java/sast/evento/interceptor/HttpInterceptor.java +++ b/src/main/java/sast/evento/interceptor/HttpInterceptor.java @@ -87,7 +87,9 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons } } } - UserProFile userProFile = sastLinkServiceCacheAble.getUserProFile(userId);//todo 等待对接sastLink +// UserProFile userProFile = sastLinkServiceCacheAble.getUserProFile(userId);//todo 等待对接sastLink + UserProFile userProFile = new UserProFile(); + userProFile.setUserId("mio"); userProFileHolder.set(userProFile); return true; } diff --git a/src/main/java/sast/evento/mapper/FeedbackMapper.java b/src/main/java/sast/evento/mapper/FeedbackMapper.java index fa45da7..e3e0f8d 100644 --- a/src/main/java/sast/evento/mapper/FeedbackMapper.java +++ b/src/main/java/sast/evento/mapper/FeedbackMapper.java @@ -13,6 +13,6 @@ @Repository public interface FeedbackMapper extends BaseMapper { - Integer addFeedback(@Param("userId") Integer userId, @Param("content") String content, @Param("score") Integer score, @Param("eventId") Integer eventId); + Integer addFeedback(@Param("userId") String userId, @Param("content") String content, @Param("score") Integer score, @Param("eventId") Integer eventId); } diff --git a/src/main/java/sast/evento/service/FeedbackService.java b/src/main/java/sast/evento/service/FeedbackService.java index 073fe4c..cbfd925 100644 --- a/src/main/java/sast/evento/service/FeedbackService.java +++ b/src/main/java/sast/evento/service/FeedbackService.java @@ -12,7 +12,7 @@ public interface FeedbackService { // 用户添加反馈 - String addFeedback(Integer userId, String content, Double score, Integer eventId); + String addFeedback(String userId, String content, Double score, Integer eventId); // 用户获取自己的反馈列表 List getListByUserId(Integer userId); diff --git a/src/main/java/sast/evento/service/impl/FeedbackServiceImpl.java b/src/main/java/sast/evento/service/impl/FeedbackServiceImpl.java index be26726..7c1c40b 100644 --- a/src/main/java/sast/evento/service/impl/FeedbackServiceImpl.java +++ b/src/main/java/sast/evento/service/impl/FeedbackServiceImpl.java @@ -27,7 +27,7 @@ public class FeedbackServiceImpl implements FeedbackService { // 用户添加反馈 @Override - public String addFeedback(Integer userId, String content, Double scoreDou, Integer eventId) { + public String addFeedback(String userId, String content, Double scoreDou, Integer eventId) { if (userId == null || eventId == null) { throw new LocalRunTimeException(ErrorEnum.PARAM_ERROR); }