| | |
| | | private final MallProductSellRecordMapper mallProductSellRecordMapper; |
| | | private final MallProductNftMapper mallProductNftMapper; |
| | | private final AgentProducer agentProducer; |
| | | private final MallMemberAmountMapper mallMemberAmountMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void timeGetOrderBuyCancel() { |
| | | /** |
| | | * nft产品周期到期的已完成买单变成卖单 |
| | | * 计算收益,本金 |
| | | */ |
| | | List<MallProductNft> mallProductNfts = mallProductNftMapper.selectList(null); |
| | | if(CollUtil.isEmpty(mallProductNfts)){ |
| | | return; |
| | | } |
| | | DateTime now = DateUtil.date(); |
| | | for(MallProductNft mallProductNft : mallProductNfts){ |
| | | Long nftId = mallProductNft.getId(); |
| | | List<MallProductBuy> mallProductBuys = mallProductBuyMapper.selectListByStateAndProductNFTId( |
| | | ProductEnum.PRODUCT_BUY_ON_GOING.getValue(), |
| | | nftId, |
| | | ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue()); |
| | | if(CollUtil.isEmpty(mallProductBuys)){ |
| | | continue; |
| | | } |
| | | for(MallProductBuy mallProductBuy : mallProductBuys){ |
| | | /** |
| | | * 返回令牌 |
| | | * 预约记录超时 |
| | | */ |
| | | String orderNo = mallProductBuy.getOrderNo(); |
| | | mallProductBuy.setState(ProductEnum.PRODUCT_BUY_TIMEOUT.getValue()); |
| | | mallProductBuyMapper.updateById(mallProductBuy); |
| | | |
| | | Long memberId = mallProductBuy.getMemberId(); |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectByOrderAndType(orderNo, |
| | | MoneyFlowTypeNewEnum.TOKEN_BUY_FROZEN.getValue(), |
| | | FlowTypeNewEnum.TOKEN.getValue(), |
| | | memberId); |
| | | if(ObjectUtil.isEmpty(mallMoneyFlow)){ |
| | | continue; |
| | | } |
| | | BigDecimal absAmount = mallMoneyFlow.getAmount().abs(); |
| | | MallMemberAmount mallMemberAmount = mallMemberAmountMapper.selectByMemberId(memberId); |
| | | mallMemberAmount.setTokenAva(mallMemberAmount.getTokenAva().add(absAmount)); |
| | | mallMemberAmount.setTokenFrozen(mallMemberAmount.getTokenFrozen().subtract(absAmount)); |
| | | mallMemberAmountMapper.updateTokenAvaAndTokenFrozenById(mallMemberAmount); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | memberId, |
| | | absAmount, |
| | | MoneyFlowTypeNewEnum.TOKEN_BUY_FROZEN_RETURN.getValue(), |
| | | orderNo, |
| | | null, |
| | | FlowTypeNewEnum.TOKEN.getValue(), |
| | | MoneyFlowTypeNewEnum.TOKEN_BUY_FROZEN_RETURN.getDescrition()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void insertSell(Long memberId,BigDecimal nftCnt,BigDecimal nftCntAva, |
| | | BigDecimal nftFee,BigDecimal fcmFeeCnt){ |
| | | String orderNo = MallUtils.getOrderNum("NFT"); |