init
This commit is contained in:
@@ -18,4 +18,6 @@ public interface AccountCashService extends IService<AccountCash> {
|
||||
void withdraw(WithdrawReq res);
|
||||
|
||||
Page<AccountCashAdminVo> pageAdmin(PageQuery pageQuery, AccountCashAdminVo bo);
|
||||
|
||||
void fail(Long id);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.ruoyi.cai.enums.AccountBusinessEnum;
|
||||
import com.ruoyi.cai.enums.AccountChangeEnum;
|
||||
import com.ruoyi.cai.ws.bean.Room;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 用户账户Service接口
|
||||
@@ -29,6 +30,9 @@ public interface AccountService extends IService<Account> {
|
||||
|
||||
void withdraw(Long userId, Long incomeCoin, Long traceId);
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
void withdrawFail(Long userId, Long incomeCoin, Long traceId);
|
||||
|
||||
void recharge(ConsumeLog consumeLog);
|
||||
|
||||
Page<AccountAdminVo> pageAdmin(PageQuery pageQuery, AccountAdminVo bo);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.ruoyi.cai.domain.AccountCash;
|
||||
import com.ruoyi.cai.domain.WithdrawExchange;
|
||||
import com.ruoyi.cai.dto.admin.vo.AccountCashAdminVo;
|
||||
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
||||
import com.ruoyi.cai.enums.AccountCashStatusEnum;
|
||||
import com.ruoyi.cai.manager.IdManager;
|
||||
import com.ruoyi.cai.mapper.AccountCashMapper;
|
||||
import com.ruoyi.cai.service.AccountCashService;
|
||||
@@ -16,10 +17,12 @@ import com.ruoyi.cai.service.AccountService;
|
||||
import com.ruoyi.cai.service.WithdrawExchangeService;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Service
|
||||
public class AccountCashServiceImpl extends ServiceImpl<AccountCashMapper, AccountCash> implements AccountCashService {
|
||||
@@ -61,4 +64,25 @@ public class AccountCashServiceImpl extends ServiceImpl<AccountCashMapper, Accou
|
||||
public Page<AccountCashAdminVo> pageAdmin(PageQuery pageQuery, AccountCashAdminVo bo) {
|
||||
return baseMapper.pageAdmin(pageQuery.build(),bo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(Long id) {
|
||||
AccountCash accountCash = this.getById(id);
|
||||
if(accountCash == null){
|
||||
return;
|
||||
}
|
||||
boolean update = this.update(Wrappers.lambdaUpdate(AccountCash.class)
|
||||
.set(AccountCash::getVerifyTime, LocalDateTime.now())
|
||||
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
|
||||
.set(AccountCash::getStatus, AccountCashStatusEnum.FAIL.getCode())
|
||||
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
|
||||
.eq(AccountCash::getId, id));
|
||||
if(!update){
|
||||
return;
|
||||
}
|
||||
accountService.withdrawFail(accountCash.getUserId(),accountCash.getWithdrawCoin(),accountCash.getTraceId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.ruoyi.cai.util.NumCaUtil;
|
||||
import com.ruoyi.cai.ws.bean.Room;
|
||||
import com.ruoyi.cai.ws.bean.RoomData;
|
||||
import com.ruoyi.cai.ws.bean.UserData;
|
||||
import com.ruoyi.cai.ws.cache.RoomDataCache;
|
||||
import com.ruoyi.cai.ws.constant.RoomStatusEnums;
|
||||
import com.ruoyi.cai.ws.service.RoomService;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
@@ -184,6 +183,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountChangeEnum.WITHDRAW,incomeCoin,traceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void withdrawFail(Long userId, Long incomeCoin, Long traceId){
|
||||
User user = userService.getById(userId);
|
||||
Account account = this.getByUserId(userId);
|
||||
if(account == null || user == null){
|
||||
throw new ServiceException("无效账号");
|
||||
}
|
||||
baseMapper.incsIncomeCoin(userId, incomeCoin);
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountChangeEnum.WITHDRAW_ROLLBACK,incomeCoin,traceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void recharge(ConsumeLog consumeLog){
|
||||
|
||||
Reference in New Issue
Block a user