xiaoyong931011
2022-12-23 c070371c7af738dbcfcf045b9fcc2c7342972323
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -255,6 +255,15 @@
        mallMemberVo.setScore(wallet.getScore());
        mallMemberVo.setPrizeScore(wallet.getPrizeScore());
        mallMemberVo.setTotalCost(mallOrderInfoMapper.selectTotalAmount(id));
        //提现冻结金额
        BigDecimal froBalance = mallMoneyFlowMapper.selectSumAmountByStatusAndMemberId(MallMoneyFlow.STATUS_ING, id);
        mallMemberVo.setFroBalance(froBalance);
        //剩余保证金
        BigDecimal avaAmount = mallMemberStarBuyMapper.selectSumAvaAmountByStatusAndMemberId(1,id);
        mallMemberVo.setAvaAmount(avaAmount);
        String accountLevel = mallMemberVo.getAccountLevel();
        Integer memberLevelCode = MemberAccountLevelEnum.NORMAL.getMemberLevelCode(accountLevel);
        mallMemberVo.setAccountLevelCode(memberLevelCode);
        return new FebsResponse().success().data(mallMemberVo);
    }
@@ -326,7 +335,7 @@
        MyTeamVo myTeamVo = new MyTeamVo();
        myTeamVo.setTeam(list);
        myTeamVo.setMyAchieve(this.baseMapper.selectAchieveByMemberId(mallMember.getInviteId(), 1));
        myTeamVo.setMyAchieve(mallOrderInfoMapper.selectTotalAmount(memberId));
        myTeamVo.setMyTeamAchieve(this.baseMapper.selectAchieveByMemberId(mallMember.getInviteId(), 2));
        myTeamVo.setMyTeamCnt(this.baseMapper.selectAllChildAgentListByInviteId(mallMember.getInviteId()).size());
        return new FebsResponse().success().data(myTeamVo);
@@ -385,11 +394,34 @@
        }
        walletService.reduceBalance(transferDto.getAmount(), memberId);
        String orderNo = MallUtils.getOrderNum("T");
        this.addMoneyFlow(memberId, transferDto.getAmount().negate(), MoneyFlowTypeEnum.TRANSFER.getValue(), orderNo, null, null, mallMember.getId(), null, FlowTypeEnum.BALANCE.getValue());
        String orderNo = MallUtils.getOrderNum("NZ");
//        this.addMoneyFlow(memberId, transferDto.getAmount().negate(), MoneyFlowTypeEnum.TRANSFER.getValue(), orderNo, null, null, mallMember.getId(), null, FlowTypeEnum.BALANCE.getValue());
        //生成流水
        Long outFlowId = mallMoneyFlowService.addMoneyFlow(
                memberId,
                orderNo,
                transferDto.getAmount().negate(),
                MallMoneyFlowTypeEnum.WITHDRAW_INSIDE.getCode(),
                MallMoneyFlow.STATUS_SUCCESS,
                MallMoneyFlow.IS_RETURN_Y,
                memberId,
                FlowTypeEnum.BALANCE.getValue(),
                MallMoneyFlowTypeEnum.WITHDRAW_INSIDE.getName()
        );
        walletService.addBalance(transferDto.getAmount(), mallMember.getId());
        this.addMoneyFlow(mallMember.getId(), transferDto.getAmount(), MoneyFlowTypeEnum.TRANSFER.getValue(), orderNo, null, null, memberId, null, FlowTypeEnum.BALANCE.getValue());
        //生成流水
        Long inFlowId = mallMoneyFlowService.addMoneyFlow(
                mallMember.getId(),
                orderNo,
                transferDto.getAmount(),
                MallMoneyFlowTypeEnum.WITHDRAW_INSIDE.getCode(),
                MallMoneyFlow.STATUS_SUCCESS,
                MallMoneyFlow.IS_RETURN_Y,
                mallMember.getId(),
                FlowTypeEnum.BALANCE.getValue(),
                MallMoneyFlowTypeEnum.WITHDRAW_INSIDE.getName()
        );
//        this.addMoneyFlow(mallMember.getId(), transferDto.getAmount(), MoneyFlowTypeEnum.TRANSFER.getValue(), orderNo, null, null, memberId, null, FlowTypeEnum.BALANCE.getValue());
    }
    @Override
@@ -430,14 +462,8 @@
    public BigDecimal canMoney() {
        Long memberId = LoginUserUtil.getLoginUser().getId();
        MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
        BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId);
        BigDecimal canMoney = wallet.getCommission();
        if (profit != null) {
            if(canMoney.compareTo(BigDecimal.ZERO) > 0) {
                canMoney = canMoney.subtract(profit);
            }
        }
        BigDecimal canMoney = wallet.getBalance();
        canMoney = canMoney.compareTo(BigDecimal.ZERO) > 0 ? canMoney : BigDecimal.ZERO;
        return canMoney;
    }
@@ -582,11 +608,7 @@
    public FebsResponse updateMemberBank(UpdateMemberBankDto updateMemberBankDto) {
        Long id = updateMemberBankDto.getId();
        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(id);
        mallMemberBank.setName(updateMemberBankDto.getName());
        mallMemberBank.setIdType(updateMemberBankDto.getIdType());
        mallMemberBank.setIdCardNum(updateMemberBankDto.getIdCardNum());
        mallMemberBank.setBankNo(updateMemberBankDto.getBankNo());
        mallMemberBank.setPhone(updateMemberBankDto.getPhone());
        mallMemberBankMapper.updateById(mallMemberBank);
        return new FebsResponse().success();
    }
@@ -672,7 +694,7 @@
        //产生用户升级会员等级记录
        MallMemberStarBuy mallMemberStarBuy = new MallMemberStarBuy();
        mallMemberStarBuy.setMemberId(mallMember.getId());
        mallMemberStarBuy.setBuyCode(MallUtils.getLogisticsNum("ms"));
        mallMemberStarBuy.setBuyCode(MallUtils.getLogisticsNum("MS"));
        mallMemberStarBuy.setStarName(buyStarDescription);
        mallMemberStarBuy.setStarCode(buyStarCode);
        mallMemberStarBuy.setAmount(buyStarPriceBigDecimal);