| | |
| | | } |
| | | |
| | | |
| | | DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser(); |
| | | Long memberIdOut = dappMemberEntityOut.getId(); |
| | | // DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser(); |
| | | Long memberIdOut = LoginUserUtil.getAppUser().getId(); |
| | | //判断账户是否限制 |
| | | |
| | | |
| | | DappMemberEntity dappMemberEntityOut = dappMemberDao.selectById(memberIdOut); |
| | | Integer withdrawAble = dappMemberEntityOut.getWithdrawAble(); |
| | | if(2 == withdrawAble){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017")); |
| | | } |
| | | //判断双方是否是会员 |
| | | if(ObjectUtil.isEmpty(dappMemberEntityOut.getInviteId())){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_002")); |
| | |
| | | if(balance.compareTo(totalProfitOut) > 0){ |
| | | BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount(); |
| | | //用户总收益率 |
| | | BigDecimal divide = totalProfitOut.divide(totalAmount); |
| | | BigDecimal divide = totalProfitOut.divide(totalAmount,4,BigDecimal.ROUND_DOWN); |
| | | //提现条件收益率 |
| | | DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode()); |
| | | BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()); |
| | |
| | | if(BigDecimal.ZERO.compareTo(balance) >= 0){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_001")); |
| | | } |
| | | DataDictionaryCustom withDrawDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_MAX.getType() |
| | | , DataDictionaryEnum.WITHDRAW_MAX.getCode()); |
| | | BigDecimal withDrawMax = withDrawDic.getValue() == null ? new BigDecimal("100") : new BigDecimal(withDrawDic.getValue()); |
| | | if(withDrawMax.compareTo(balance) > 0){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_003")); |
| | | } |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | if(balance.compareTo(availableAmount) > 0){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_002")); |
| | | } |
| | | |
| | | DappMemberEntity dappMemberEntityOut = dappMemberDao.selectById(memberId); |
| | | //判断账户是否限制 |
| | | Integer withdrawAble = dappMemberEntityOut.getWithdrawAble(); |
| | | if(2 == withdrawAble){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017")); |
| | | } |
| | | //验证资金密码 |
| | | Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferOutsideDto.getTransferCode(), memberId); |
| | | if(!aBoolean){ |
| | |
| | | if(balance.compareTo(totalProfit) >= 0){ |
| | | BigDecimal totalAmount = dappWalletCoinEntity.getTotalAmount(); |
| | | //用户总收益率 |
| | | BigDecimal divide = totalProfit.divide(totalAmount); |
| | | BigDecimal divide = totalProfit.divide(totalAmount,4,BigDecimal.ROUND_DOWN); |
| | | //提现条件收益率 |
| | | DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode()); |
| | | BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()); |
| | |
| | | } |
| | | |
| | | //余额减少冻结增加 |
| | | Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(memberId, balance); |
| | | Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(dappWalletCoinEntity.getId(), balance); |
| | | if(1 != count){ |
| | | throw new FebsException(MessageSourceUtils.getString("balance_err_002")); |
| | | } |
| | |
| | | return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001")); |
| | | } |
| | | @Override |
| | | public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit) { |
| | | public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit,long id) { |
| | | //计算盈利分成 |
| | | BigDecimal profitSharingTotal = BigDecimal.ZERO; |
| | | if(BigDecimal.ZERO.compareTo(totalProfit)>=0){ |
| | | return profitSharingTotal; |
| | | } |
| | | if(CollUtil.isNotEmpty(refererIdList)){ |
| | | String LEVEL_IB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_IB.getCode()); |
| | | if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){ |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8); |
| | | dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7); |
| | | dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7); |
| | | dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7); |
| | | dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7); |
| | | dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7); |
| | | dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | profitSharingTotal = profitSharingTotal.add(multiply); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit) { |
| | | BigDecimal multiply = totalProfit.multiply(new BigDecimal(0.05)); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity( |
| | | multiply.negate(), "系统", 9); |
| | | public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit,long id) { |
| | | if(BigDecimal.ZERO.compareTo(totalProfit)>=0){ |
| | | return BigDecimal.ZERO; |
| | | } |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(65L, |
| | | totalProfit, "系统", 9,id); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | return multiply; |
| | | return totalProfit; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | String num = StrUtil.subSuf("01234",1); |
| | | System.out.print(num); |
| | | DateTime date = DateUtil.date(); |
| | | DateTime endTime = DateUtil.parseTimeToday("09:08:03"); |
| | | if(DateUtil.compare(date,endTime)>=0){ |
| | | // |
| | | System.out.print(endTime); |
| | | } |
| | | } |
| | | |
| | | private String isIdentity(List<String> refererIds,String levelCode){ |