From ed796d3228953bba02779b970e2703679f28d984 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 15 Jan 2026 16:48:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A2=8E=E7=89=87=E5=85=91=E6=8D=A2=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/activity/{room => }/WeekStarRestController.java | 8 ++++---- .../other/app/command/activity/WeekStarExchangeExe.java | 9 +++------ .../other/app/dto/cmd/activity/WeekStarExchangeCmd.java | 8 ++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) rename rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/{room => }/WeekStarRestController.java (95%) diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/room/WeekStarRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/WeekStarRestController.java similarity index 95% rename from rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/room/WeekStarRestController.java rename to rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/WeekStarRestController.java index 973576c6..a04d4665 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/room/WeekStarRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/WeekStarRestController.java @@ -1,9 +1,8 @@ -package com.red.circle.other.adapter.app.activity.room; +package com.red.circle.other.adapter.app.activity; import cn.hutool.core.util.StrUtil; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.common.business.dto.cmd.AppExtCommand; -import com.red.circle.framework.dto.ResultResponse; import com.red.circle.framework.web.controller.BaseController; import com.red.circle.other.app.dto.clientobject.activity.LastWeekStarGiftUserRankCO; import com.red.circle.other.app.dto.clientobject.activity.UserRankCO; @@ -21,6 +20,7 @@ import java.util.Set; import com.red.circle.other.inner.model.dto.material.FragmentsBackpackDTO; import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.*; * @eo.groupName 活动服务.周星活动 * @eo.path /activity/week-star */ -@RequestMapping("/activity/week-star") +@RequestMapping(value = "/activity/week-star", produces = MediaType.APPLICATION_JSON_VALUE) @RestController @RequiredArgsConstructor public class WeekStarRestController extends BaseController { @@ -155,7 +155,7 @@ public class WeekStarRestController extends BaseController { * @eo.request-type formdata */ @PostMapping("/exchange") - public Long exchange(@Validated WeekStarExchangeCmd cmd) { + public Long exchange(@Validated @RequestBody WeekStarExchangeCmd cmd) { return weekStarService.exchange(cmd); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/WeekStarExchangeExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/WeekStarExchangeExe.java index 1ee4fb6d..c47844f5 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/WeekStarExchangeExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/WeekStarExchangeExe.java @@ -49,7 +49,7 @@ public class WeekStarExchangeExe { // 1. 校验碎片背包 List backpackList = fragmentsBackpackClientApi - .listByUserIdByFragmentsIds(cmd.getReqUserId(), Set.of(cmd.getFragmentsId())) + .listByUserIdByFragmentsIds(cmd.getUserId(), Set.of(cmd.getFragmentsId())) .getBody(); ResponseAssert.notEmpty(CommonErrorCode.DATA_ERROR, backpackList); @@ -84,23 +84,20 @@ public class WeekStarExchangeExe { // 2. 扣除碎片 fragmentsBackpackClientApi.decrFragments( - cmd.getReqUserId(), + cmd.getUserId(), Set.of(cmd.getFragmentsId()), needFragments ); // 发送奖品 sendPropsManager.sendGroup(SendRewardParam.builder() - .acceptUserId(cmd.getReqUserId()) + .acceptUserId(cmd.getUserId()) .origin(SendPropsOrigin.EGG) .sysOrigin(SysOriginPlatformEnum.valueOf(cmd.getReqSysOrigin().getOrigin())) .trackId(cmd.getPropsGroupId()) .build(), getPrizeDescribes(rewardProps)); - // 4. 添加兑换记录 - 暂时不写 - // TODO: 添加兑换记录 - return 1L; // 返回兑换数量 } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/WeekStarExchangeCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/WeekStarExchangeCmd.java index ce635f28..d316b824 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/WeekStarExchangeCmd.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/WeekStarExchangeCmd.java @@ -5,6 +5,8 @@ import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serial; + /** * 周星碎片兑换命令. * @@ -14,6 +16,9 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = false) public class WeekStarExchangeCmd extends AppExtCommand { + @Serial + private static final long serialVersionUID = 1L; + /** * 道具组ID. */ @@ -26,4 +31,7 @@ public class WeekStarExchangeCmd extends AppExtCommand { @NotNull(message = "fragmentsId {not.null}") private Long fragmentsId; + @NotNull(message = "userId {not.null}") + private Long userId; + }