| | |
| | | private final DappOnHookAwardDao dappOnHookAwardDao; |
| | | private final DappWalletService dappWalletService; |
| | | private final DappOnHookDoneDao dappOnHookDoneDao; |
| | | private final MemberCoinWithdrawDao memberCoinWithdrawDao; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void memberCoinInsideMessage(Long withdrawId) { |
| | | MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectById(withdrawId); |
| | | if(ObjectUtil.isEmpty(memberCoinWithdrawEntity)){ |
| | | return; |
| | | } |
| | | memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_YES); |
| | | memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity); |
| | | //转出账户,总额减少,冻结减少 |
| | | BigDecimal amount = memberCoinWithdrawEntity.getAmount().setScale(4,BigDecimal.ROUND_DOWN); |
| | | Long memberIdOut = memberCoinWithdrawEntity.getMemberId(); |
| | | DappWalletCoinEntity dappWalletCoinEntityOut = dappWalletCoinDao.selectByMemberId(memberIdOut); |
| | | dappWalletCoinDao.delTotalAndDelFrozenById(dappWalletCoinEntityOut.getId(),amount); |
| | | |
| | | String isInside = memberCoinWithdrawEntity.getIsInside(); |
| | | String content = ""; |
| | | Integer type = 0; |
| | | if(MemberCoinWithdrawEntity.ISINSIDE_NO.equals(isInside)){ |
| | | content = "提现"; |
| | | type = 2; |
| | | }else{ |
| | | content = "转账"; |
| | | type = 4; |
| | | } |
| | | //转出账户生成一条账户资金变化记录 |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityOut = new DappAccountMoneyChangeEntity(memberIdOut, |
| | | dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN), |
| | | amount.negate(), |
| | | dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).subtract(amount), |
| | | content, |
| | | type); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityOut); |
| | | |
| | | //转入账户,总额增加,余额增加 |
| | | //转账 |
| | | if(MemberCoinWithdrawEntity.ISINSIDE_YES.equals(isInside)){ |
| | | String addressIn = memberCoinWithdrawEntity.getAddress(); |
| | | DappMemberEntity dappMemberEntityIn = dappMemberDao.selectMemberInfoByInviteId(addressIn); |
| | | if(ObjectUtil.isEmpty(dappMemberEntityIn)){ |
| | | return; |
| | | } |
| | | DappWalletCoinEntity dappWalletCoinEntityIn = dappWalletCoinDao.selectByMemberId(dappMemberEntityIn.getId()); |
| | | Integer countIn = dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntityIn.getId(), memberCoinWithdrawEntity.getAmount()); |
| | | if(1 != countIn){ |
| | | return; |
| | | } |
| | | //生成流水记录 |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityIn = new DappAccountMoneyChangeEntity(dappMemberEntityIn.getId(), |
| | | dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN), |
| | | amount, |
| | | dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).add(amount), |
| | | "转账", |
| | | 4); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityIn); |
| | | } |
| | | } |
| | | |
| | | private String getProfitCase(String identity,BigDecimal balance){ |
| | | //匹配会员等级获取对应的收益率 |
| | | List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.LEVEL_MB.getType()); |