You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.example.demo.serviceImpl.Wallet;
import com.example.demo.Util.BusinessException;import com.example.demo.domain.entity.UserGoldRecord;import com.example.demo.domain.entity.UserRegionWallet;import com.example.demo.domain.entity.UserWalletRecord;import com.example.demo.exception.SystemException;import com.example.demo.mapper.coin.WalletMapper;import com.example.demo.service.Wallet.WalletService;import lombok.RequiredArgsConstructor;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;
import java.math.BigDecimal;import java.util.List;
/** * @program: GOLD * @ClassName WalletServiceImpl * @description: * @author: huangqizhen * @create: 2026−03-06 13:53 * @Version 1.0 **/@Service@RequiredArgsConstructorpublic class WalletServiceImpl implements WalletService { @Autowired private WalletMapper walletMapper;
@Override public void updateUserGoldRecord(UserRegionWallet userRegionWallet) { BigDecimal currentPermanentGold = userRegionWallet.getCurrentPermanentGold(); if (currentPermanentGold == null|| currentPermanentGold.compareTo(BigDecimal.ZERO) <= 0) throw new SystemException("钱包金币传参错误"); if (userRegionWallet.getJwcode()!= null|| userRegionWallet.getWalletId() != null){ UserRegionWallet wallet = walletMapper.selectWallet(userRegionWallet.getJwcode(), userRegionWallet.getWalletId()); if (wallet == null){ throw new BusinessException("该用户钱包不存在"); } else { userRegionWallet.setCurrentPermanentGold(wallet.getCurrentPermanentGold().add(currentPermanentGold)); walletMapper.updateWallet(userRegionWallet); } } }
@Override public List<UserWalletRecord> selectUserWalletRecord(Integer jwcode, String orderCode) { if (jwcode == null){ throw new SystemException("精网号传参错误"); } return walletMapper.selectWalletRecord(jwcode, orderCode); }
@Override public void updateUserWalletRecord(Integer id) { walletMapper.updateWalletRecord(id); }}
|