| | |
| | | //偏移时间 |
| | | DateTime dateTime = DateUtil.offsetDay(payTime, cycle); |
| | | int compare = DateUtil.compare(now, dateTime); |
| | | if(compare <= 0){ |
| | | if(compare >= 0){ |
| | | /** |
| | | * 更新买单状态 |
| | | * 收益生成一条卖单 |
| | |
| | | * 当前时间比结束时间大 |
| | | */ |
| | | if(nowTime.compareTo(endTime) >= 0){ |
| | | List<MallProductSellRecord> mallProductSellRecords = mallProductSellRecordMapper.selectListByState(ProductEnum.PRODUCT_MATE_STATE_PAY.getValue()); |
| | | List<MallProductSellRecord> mallProductSellRecords = mallProductSellRecordMapper.selectListByState( |
| | | ProductEnum.PRODUCT_MATE_STATE_PAY.getValue()); |
| | | if(CollUtil.isNotEmpty(mallProductSellRecords)){ |
| | | for(MallProductSellRecord mallProductSellRecord : mallProductSellRecords){ |
| | | /** |
| | |
| | | if(CollUtil.isEmpty(mallProductNfts)){ |
| | | return; |
| | | } |
| | | DateTime now = DateUtil.date(); |
| | | DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(DateUtil.date())); |
| | | DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.YU_YUE_END_TIME.getType(), |
| | | DataDictionaryEnum.YU_YUE_END_TIME.getCode() |
| | | ); |
| | | DateTime endTime = DateUtil.parseTime(endTimeDic.getValue()); |
| | | for(MallProductNft mallProductNft : mallProductNfts){ |
| | | Long nftId = mallProductNft.getId(); |
| | | List<MallProductBuy> mallProductBuys = mallProductBuyMapper.selectListByStateAndProductNFTId( |
| | |
| | | } |
| | | for(MallProductBuy mallProductBuy : mallProductBuys){ |
| | | /** |
| | | * 返回令牌 |
| | | * 预约记录超时 |
| | | * 当前时间比结束时间大 |
| | | */ |
| | | String orderNo = mallProductBuy.getOrderNo(); |
| | | mallProductBuy.setState(ProductEnum.PRODUCT_BUY_TIMEOUT.getValue()); |
| | | mallProductBuyMapper.updateById(mallProductBuy); |
| | | if(nowTime.compareTo(endTime) >= 0){ |
| | | /** |
| | | * 返回令牌 |
| | | * 预约记录超时 |
| | | */ |
| | | String orderNo = mallProductBuy.getOrderNo(); |
| | | /** |
| | | * 只要存在匹配记录,则不退回。 |
| | | */ |
| | | List<MallProductBuyRecord> mallProductBuyRecords = mallProductBuyRecordMapper.selectRecordListByBuyId(mallProductBuy.getId()); |
| | | if(CollUtil.isNotEmpty(mallProductBuyRecords)){ |
| | | continue; |
| | | } |
| | | 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; |
| | | 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()); |
| | | |
| | | |
| | | } |
| | | 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()); |
| | | } |
| | | } |
| | | } |