KKSU
2023-11-30 1ce0aef813257a1c8949371fb1fbf3df7a3e87d7
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
@@ -281,21 +281,23 @@
        BigDecimal nftFeePercent = ObjectUtil.isEmpty(nftFeeDic) ? new BigDecimal(20) : new BigDecimal(nftFeeDic.getValue());
        nftFeePercent = nftFeePercent.divide(new BigDecimal(100),4,BigDecimal.ROUND_DOWN);
        BigDecimal nftFee = nftCnt.multiply(nftFeePercent);
        BigDecimal nftCntAva = nftCnt.subtract(nftFee);
        DataDictionaryCustom fcmPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.FCM_PRICE.getType(),
                DataDictionaryEnum.FCM_PRICE.getCode());
        BigDecimal fcmPrice = ObjectUtil.isEmpty(fcmPriceDic) ? new BigDecimal(2) : new BigDecimal(fcmPriceDic.getValue());
        BigDecimal fcmFeeCnt = nftFee.divide(fcmPrice, 2, BigDecimal.ROUND_DOWN);
        if(BigDecimal.ZERO.compareTo(mallMemberAmount.getTrendsNft()) >= 0
            || fcmFeeCnt.compareTo(mallMemberAmount.getFcmCntAva()) > 0){
            throw new FebsException("手续费不足");
        }
        String orderNo = MallUtils.getOrderNum("NFT");
        MallProductSell mallProductSell = new MallProductSell();
        mallProductSell.setMemberId(memberId);
        mallProductSell.setOrderNo(orderNo);
        mallProductSell.setNftTotal(nftCnt);
        mallProductSell.setNftCnt(nftCntAva);
        mallProductSell.setNftCntAva(nftCntAva);
        mallProductSell.setNftCnt(nftCnt);
        mallProductSell.setNftCntAva(nftCnt);
        mallProductSell.setNftFee(nftFee);
        mallProductSell.setFcmFee(fcmFeeCnt);
        mallProductSell.setState(ProductEnum.PRODUCT_SELL_ON_GOING.getValue());
@@ -309,7 +311,7 @@
        mallMemberAmountMapper.updateFcmCntAvaById(mallMemberAmountFcm);
        MallMemberAmount mallMemberAmountFrozenNFT = mallMemberAmountMapper.selectByMemberId(memberId);
        mallMemberAmountFrozenNFT.setFrozenNft(mallMemberAmountFrozenNFT.getFrozenNft().add(nftCntAva));
        mallMemberAmountFrozenNFT.setFrozenNft(mallMemberAmountFrozenNFT.getFrozenNft().add(nftCnt));
        mallMemberAmountMapper.updateFrozenNftById(mallMemberAmountFrozenNFT);
        iMallMoneyFlowService.addMoneyFlow(
                memberId,
@@ -327,15 +329,6 @@
                mallMember.getId(),
                FlowTypeNewEnum.FCM_COIN.getValue(),
                MoneyFlowTypeNewEnum.NFT_OUT_FEE_FCM.getDescrition());
        iMallMoneyFlowService.addMoneyFlow(
                memberId,
                nftFee.negate(),
                MoneyFlowTypeNewEnum.NFT_OUT_FEE.getValue(),
                orderNo,
                mallMember.getId(),
                FlowTypeNewEnum.NFT.getValue(),
                MoneyFlowTypeNewEnum.NFT_OUT_FEE.getDescrition());
        agentProducer.sendFcmNFTExchangeMsg(fcmFeeCnt.toString());
        return new FebsResponse().success();
    }