后台增加礼物赠送
This commit is contained in:
parent
a51c252b36
commit
527a0b916d
@ -10,6 +10,7 @@ import com.red.circle.console.app.service.admin.UserAccountService;
|
|||||||
import com.red.circle.console.inner.error.ConsoleErrorCode;
|
import com.red.circle.console.inner.error.ConsoleErrorCode;
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.other.inner.endpoint.live.RoomManagerClient;
|
import com.red.circle.other.inner.endpoint.live.RoomManagerClient;
|
||||||
|
import com.red.circle.other.inner.endpoint.material.gift.GiftBackpackClient;
|
||||||
import com.red.circle.other.inner.endpoint.material.props.*;
|
import com.red.circle.other.inner.endpoint.material.props.*;
|
||||||
import com.red.circle.other.inner.endpoint.user.user.SysUserProfileClient;
|
import com.red.circle.other.inner.endpoint.user.user.SysUserProfileClient;
|
||||||
import com.red.circle.other.inner.enums.material.BadgeBackpackExpireTypeEnum;
|
import com.red.circle.other.inner.enums.material.BadgeBackpackExpireTypeEnum;
|
||||||
@ -69,6 +70,7 @@ public class PropsGiveServiceImpl implements PropsGiveService {
|
|||||||
private final PropsNobleVipClient propsNobleVipClient;
|
private final PropsNobleVipClient propsNobleVipClient;
|
||||||
private final RoomThemeBackpackClient roomThemeBackpackClient;
|
private final RoomThemeBackpackClient roomThemeBackpackClient;
|
||||||
private final PropsCommodityStoreClient propsCommodityStoreClient;
|
private final PropsCommodityStoreClient propsCommodityStoreClient;
|
||||||
|
private final GiftBackpackClient giftBackpackClient;
|
||||||
private final UserAccountService userAccountService;
|
private final UserAccountService userAccountService;
|
||||||
private final PropCouponClient propCouponClient;
|
private final PropCouponClient propCouponClient;
|
||||||
|
|
||||||
@ -109,6 +111,7 @@ public class PropsGiveServiceImpl implements PropsGiveService {
|
|||||||
.setType(cmd.getType())
|
.setType(cmd.getType())
|
||||||
.setSecondaryType(cmd.getSecondaryType())
|
.setSecondaryType(cmd.getSecondaryType())
|
||||||
.setContent(cmd.getContent())
|
.setContent(cmd.getContent())
|
||||||
|
.setQuantity(cmd.getQuantity())
|
||||||
.setSysOrigin(cmd.getSysOrigin())
|
.setSysOrigin(cmd.getSysOrigin())
|
||||||
.setReceiverAccounts(cmd.getReceiverAccounts())
|
.setReceiverAccounts(cmd.getReceiverAccounts())
|
||||||
.setVipOrigin(cmd.getVipOrigin())
|
.setVipOrigin(cmd.getVipOrigin())
|
||||||
@ -127,7 +130,7 @@ public class PropsGiveServiceImpl implements PropsGiveService {
|
|||||||
ResponseAssert.isFalse(UserErrorCode.USER_INFO_NOT_FOUND, StringUtils.isBlank(sysOrigin));
|
ResponseAssert.isFalse(UserErrorCode.USER_INFO_NOT_FOUND, StringUtils.isBlank(sysOrigin));
|
||||||
|
|
||||||
// 后台赠送道具校验权限
|
// 后台赠送道具校验权限
|
||||||
if (!"BADGE".equals(cmd.getType())) {
|
if (!"BADGE".equals(cmd.getType()) && !"GIFT".equals(cmd.getType())) {
|
||||||
checkUserAccountAlias(cmd);
|
checkUserAccountAlias(cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -165,6 +168,10 @@ public class PropsGiveServiceImpl implements PropsGiveService {
|
|||||||
propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays(), Long.valueOf(cmd.getContent()));
|
propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays(), Long.valueOf(cmd.getContent()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Objects.equals(cmd.getType(), PropsActivityRewardEnum.GIFT.name())) {
|
||||||
|
handleGift(cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Objects.equals(cmd.getType(), PropsActivityRewardEnum.GOLD.name())) {
|
if (Objects.equals(cmd.getType(), PropsActivityRewardEnum.GOLD.name())) {
|
||||||
handleGold(cmd);
|
handleGold(cmd);
|
||||||
return;
|
return;
|
||||||
@ -388,6 +395,21 @@ public class PropsGiveServiceImpl implements PropsGiveService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleGift(PropsGiveUserCmd cmd) {
|
||||||
|
Long giftId = DataTypeUtils.toLong(cmd.getContent());
|
||||||
|
ResponseAssert.isFalse(ConsoleErrorCode.RESOURCES_SHELF_NOT_EXISTENT,
|
||||||
|
Objects.isNull(giftId) || Objects.equals(giftId, 0L));
|
||||||
|
|
||||||
|
Integer quantity = Objects.nonNull(cmd.getQuantity())
|
||||||
|
? cmd.getQuantity()
|
||||||
|
: cmd.getExchangeDays();
|
||||||
|
ResponseAssert.isFalse(ConsoleErrorCode.NUMBER_VIOLATION_ERROR,
|
||||||
|
Objects.isNull(quantity) || quantity <= 0);
|
||||||
|
|
||||||
|
ResponseAssert.requiredSuccess(
|
||||||
|
giftBackpackClient.incrGift(cmd.getReceiverId(), giftId, quantity));
|
||||||
|
}
|
||||||
|
|
||||||
private void isUserNormal(Long userId) {
|
private void isUserNormal(Long userId) {
|
||||||
UserProfileDTO userProfile = ResponseAssert.requiredSuccess(
|
UserProfileDTO userProfile = ResponseAssert.requiredSuccess(
|
||||||
userProfileClient.getByUserId(userId));
|
userProfileClient.getByUserId(userId));
|
||||||
|
|||||||
@ -41,6 +41,11 @@ public class PropsGiveUserCmd extends Command {
|
|||||||
@NotNull(message = "exchangeDays required.")
|
@NotNull(message = "exchangeDays required.")
|
||||||
private Integer exchangeDays;
|
private Integer exchangeDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物数量.
|
||||||
|
*/
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 道具类型.
|
* 道具类型.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user