From 9c7c078432cb14ab64fe8227a0bd6bb3c111e6b0 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Wed, 24 Jul 2024 15:52:12 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E6=A0=B9=E6=8D=AE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=A7=AF=E5=88=86=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luoo/user/service/UserPointLogService.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java index 991882b..686c784 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserPointLogService.java @@ -57,7 +57,7 @@ public class UserPointLogService { public UserPointLogService(UserPointLogDao userPointLogDao, IdWorker idWorker, JwtUtil jwtUtil, - TaskPointService taskPointService, TaskPointDao taskPointDao, RabbitTemplate rabbitTemplate, + TaskPointDao taskPointDao, RabbitTemplate rabbitTemplate, UserInfoService userInfoService) { this.userPointLogDao = userPointLogDao; this.idWorker = idWorker; @@ -78,10 +78,16 @@ public class UserPointLogService { */ public void addByTask(String taskPointId, String token) { - TaskPoint taskPoint = taskPointDao.findById(taskPointId).get(); - UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token); + // 新手任务,只触发一次 + if (!userPointLogDao.findUserPointLogByUserIdAndTaskPointId(userLoginDto.getUserId(), + taskPointId).isEmpty()) { + return; + } + + TaskPoint taskPoint = taskPointDao.findById(taskPointId).get(); + UserPointLog userPointLog = UserPointLog.builder() .id(String.valueOf(idWorker.nextId())) .score(taskPoint.getScore()) @@ -143,7 +149,8 @@ public class UserPointLogService { * @param size 每页数量 * @return 用户积分列表 */ - public PageResult getUserPointLogList(String token, UserPointLogSearchDto userPointLogSearchDto, Integer page, + public PageResult getUserPointLogList(String token, + UserPointLogSearchDto userPointLogSearchDto, Integer page, Integer size) { // UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);