碎片兑换完善
This commit is contained in:
parent
114d560d66
commit
ed796d3228
@ -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 cn.hutool.core.util.StrUtil;
|
||||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
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.framework.web.controller.BaseController;
|
||||||
import com.red.circle.other.app.dto.clientobject.activity.LastWeekStarGiftUserRankCO;
|
import com.red.circle.other.app.dto.clientobject.activity.LastWeekStarGiftUserRankCO;
|
||||||
import com.red.circle.other.app.dto.clientobject.activity.UserRankCO;
|
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 com.red.circle.other.inner.model.dto.material.FragmentsBackpackDTO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
* @eo.groupName 活动服务.周星活动
|
* @eo.groupName 活动服务.周星活动
|
||||||
* @eo.path /activity/week-star
|
* @eo.path /activity/week-star
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/activity/week-star")
|
@RequestMapping(value = "/activity/week-star", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class WeekStarRestController extends BaseController {
|
public class WeekStarRestController extends BaseController {
|
||||||
@ -155,7 +155,7 @@ public class WeekStarRestController extends BaseController {
|
|||||||
* @eo.request-type formdata
|
* @eo.request-type formdata
|
||||||
*/
|
*/
|
||||||
@PostMapping("/exchange")
|
@PostMapping("/exchange")
|
||||||
public Long exchange(@Validated WeekStarExchangeCmd cmd) {
|
public Long exchange(@Validated @RequestBody WeekStarExchangeCmd cmd) {
|
||||||
return weekStarService.exchange(cmd);
|
return weekStarService.exchange(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class WeekStarExchangeExe {
|
|||||||
|
|
||||||
// 1. 校验碎片背包
|
// 1. 校验碎片背包
|
||||||
List<FragmentsBackpackDTO> backpackList = fragmentsBackpackClientApi
|
List<FragmentsBackpackDTO> backpackList = fragmentsBackpackClientApi
|
||||||
.listByUserIdByFragmentsIds(cmd.getReqUserId(), Set.of(cmd.getFragmentsId()))
|
.listByUserIdByFragmentsIds(cmd.getUserId(), Set.of(cmd.getFragmentsId()))
|
||||||
.getBody();
|
.getBody();
|
||||||
|
|
||||||
ResponseAssert.notEmpty(CommonErrorCode.DATA_ERROR, backpackList);
|
ResponseAssert.notEmpty(CommonErrorCode.DATA_ERROR, backpackList);
|
||||||
@ -84,23 +84,20 @@ public class WeekStarExchangeExe {
|
|||||||
|
|
||||||
// 2. 扣除碎片
|
// 2. 扣除碎片
|
||||||
fragmentsBackpackClientApi.decrFragments(
|
fragmentsBackpackClientApi.decrFragments(
|
||||||
cmd.getReqUserId(),
|
cmd.getUserId(),
|
||||||
Set.of(cmd.getFragmentsId()),
|
Set.of(cmd.getFragmentsId()),
|
||||||
needFragments
|
needFragments
|
||||||
);
|
);
|
||||||
|
|
||||||
// 发送奖品
|
// 发送奖品
|
||||||
sendPropsManager.sendGroup(SendRewardParam.builder()
|
sendPropsManager.sendGroup(SendRewardParam.builder()
|
||||||
.acceptUserId(cmd.getReqUserId())
|
.acceptUserId(cmd.getUserId())
|
||||||
.origin(SendPropsOrigin.EGG)
|
.origin(SendPropsOrigin.EGG)
|
||||||
.sysOrigin(SysOriginPlatformEnum.valueOf(cmd.getReqSysOrigin().getOrigin()))
|
.sysOrigin(SysOriginPlatformEnum.valueOf(cmd.getReqSysOrigin().getOrigin()))
|
||||||
.trackId(cmd.getPropsGroupId())
|
.trackId(cmd.getPropsGroupId())
|
||||||
.build(),
|
.build(),
|
||||||
getPrizeDescribes(rewardProps));
|
getPrizeDescribes(rewardProps));
|
||||||
|
|
||||||
// 4. 添加兑换记录 - 暂时不写
|
|
||||||
// TODO: 添加兑换记录
|
|
||||||
|
|
||||||
return 1L; // 返回兑换数量
|
return 1L; // 返回兑换数量
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 周星碎片兑换命令.
|
* 周星碎片兑换命令.
|
||||||
*
|
*
|
||||||
@ -14,6 +16,9 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WeekStarExchangeCmd extends AppExtCommand {
|
public class WeekStarExchangeCmd extends AppExtCommand {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 道具组ID.
|
* 道具组ID.
|
||||||
*/
|
*/
|
||||||
@ -26,4 +31,7 @@ public class WeekStarExchangeCmd extends AppExtCommand {
|
|||||||
@NotNull(message = "fragmentsId {not.null}")
|
@NotNull(message = "fragmentsId {not.null}")
|
||||||
private Long fragmentsId;
|
private Long fragmentsId;
|
||||||
|
|
||||||
|
@NotNull(message = "userId {not.null}")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user