|
|
@ -6,6 +6,7 @@ import com.qniao.dam.api.command.virtualaccount.user.request.UserCostChannelGift |
|
|
import com.qniao.dam.api.command.virtualaccount.user.request.UserCostIMGiftDto; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.request.UserCostIMGiftDto; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.CheckOneOnOneRtcConsumeVo; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.CheckOneOnOneRtcConsumeVo; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.CostGiftVo; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.CostGiftVo; |
|
|
|
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.FreezeOneOnOneRtcConsumeVo; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.UserConsumeVirtualAccountVo; |
|
|
import com.qniao.dam.api.command.virtualaccount.user.response.UserConsumeVirtualAccountVo; |
|
|
import com.qniao.dam.api.query.product.user.response.UserGetProductByCategoryVo; |
|
|
import com.qniao.dam.api.query.product.user.response.UserGetProductByCategoryVo; |
|
|
import com.qniao.dam.domain.aggregate.order.entity.Order; |
|
|
import com.qniao.dam.domain.aggregate.order.entity.Order; |
|
|
@ -368,4 +369,31 @@ public class VirtualAccountApplicationService extends BaseApplicationService { |
|
|
} |
|
|
} |
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public FreezeOneOnOneRtcConsumeVo freezeOneOnOneRtcConsume(Long userId, |
|
|
|
|
|
RtcChannelTypeEnum rtcChannelType) { |
|
|
|
|
|
FreezeOneOnOneRtcConsumeVo vo = new FreezeOneOnOneRtcConsumeVo(); |
|
|
|
|
|
UserGetProductByCategoryVo productSpec = null; |
|
|
|
|
|
if (RtcChannelTypeEnum.ONE_ON_ONE_VOICE.equals(rtcChannelType)) { |
|
|
|
|
|
//一对一语音 |
|
|
|
|
|
productSpec = productQueryService.getProductByCategory(ProductSubCategoryEnum.CHAT_VOICE_FEE.getValue()); |
|
|
|
|
|
} else if (RtcChannelTypeEnum.ONE_ON_ONE_VIDEO.equals(rtcChannelType)) { |
|
|
|
|
|
//一对一视频 |
|
|
|
|
|
productSpec = productQueryService.getProductByCategory(ProductSubCategoryEnum.CHAT_VIDEO_FEE.getValue()); |
|
|
|
|
|
} |
|
|
|
|
|
VirtualAccount virtualAccount = virtualAccountQueryService.queryBy(userId); |
|
|
|
|
|
Integer tradeBalance = productSpec.getUnitSellingPrice().intValue(); |
|
|
|
|
|
if (virtualAccount != null && virtualAccount.getBalance() >= tradeBalance) { |
|
|
|
|
|
Integer originalBalance = virtualAccount.getBalance(); |
|
|
|
|
|
virtualAccount.setTotalBalance(virtualAccount.getTotalBalance() - tradeBalance); |
|
|
|
|
|
virtualAccount.setBalance(originalBalance - tradeBalance); |
|
|
|
|
|
virtualAccount.setFrozenBalance(virtualAccount.getFrozenBalance() + tradeBalance); |
|
|
|
|
|
virtualAccountAggregate.edit(virtualAccount); |
|
|
|
|
|
vo.setFlag(true); |
|
|
|
|
|
vo.setFreezeBalance(tradeBalance); |
|
|
|
|
|
vo.setAvailableBalance(virtualAccount.getBalance()); |
|
|
|
|
|
vo.setUnitSellingPrice(productSpec.getUnitSellingPrice()); |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
|
|
|
} |
|
|
} |
|
|
} |