| | |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeNewEnum; |
| | | import cc.mrbird.febs.common.enumerates.ProductEnum; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | |
| | | mallProductBuy.setMateState(ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue()); |
| | | mallProductBuy.setNftTotal(mallProductNft.getPriceNft()); |
| | | mallProductBuy.setNftAva(mallProductNft.getPriceNft()); |
| | | mallProductBuy.setCycle(mallProductBuy.getCycle()); |
| | | mallProductBuy.setProfit(mallProductNft.getProfit()); |
| | | // mallProductBuy.setNftAva(BigDecimal.ZERO); |
| | | mallProductBuyMapper.insert(mallProductBuy); |
| | | //令牌 可用减少,冻结增加 |
| | |
| | | throw new FebsException("请输入正确的交易密码"); |
| | | } |
| | | BigDecimal nftCnt = outNFTDto.getNftCnt(); |
| | | BigDecimal remainder = nftCnt.remainder(BigDecimal.TEN); |
| | | if(remainder.compareTo(BigDecimal.ZERO) != 0){ |
| | | throw new FebsException("数量需要为10的倍数"); |
| | | } |
| | | |
| | | DataDictionaryCustom nftMinDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.NFT_MIN.getType(), |
| | | DataDictionaryEnum.NFT_MIN.getCode()); |
| | |
| | | mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_CONFIRM.getValue()); |
| | | mallProductSellRecordMapper.updateById(mallProductSellRecord); |
| | | |
| | | DataDictionaryCustom gsdInDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.FCM_GSD_IN.getType(), |
| | | DataDictionaryEnum.FCM_GSD_IN.getCode() |
| | | ); |
| | | BigDecimal gsdInPercent = new BigDecimal(gsdInDic.getValue()).multiply(AppContants.BASIC_PERCENT); |
| | | BigDecimal gsdIn = gsdInPercent.multiply(mallProductSellRecord.getNftCnt()).setScale(2,BigDecimal.ROUND_DOWN); |
| | | MallMemberAmount mallMemberAmount = mallMemberAmountMapper.selectByMemberId(memberId); |
| | | mallMemberAmount.setGsd(mallMemberAmount.getGsd().add(gsdIn)); |
| | | mallMemberAmountMapper.updateGsdById(mallMemberAmount); |
| | | |
| | | iMallMoneyFlowService.addMoneyFlow( |
| | | memberId, |
| | | gsdIn, |
| | | MoneyFlowTypeNewEnum.NFT_TRANS_GFD.getValue(), |
| | | null, |
| | | mallMember.getId(), |
| | | FlowTypeNewEnum.GSD.getValue(), |
| | | MoneyFlowTypeNewEnum.NFT_TRANS_GFD.getDescrition()); |
| | | |
| | | agentProducer.sendFcmOrderSellInsureMsg(sellRecordId); |
| | | return new FebsResponse().success(); |
| | | } |
| | |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | List<ApiOrderRecordListVo> objects = new ArrayList<>(); |
| | | apiOrderListDto.setMemberId(memberId); |
| | | // DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(DateUtil.date())); |
| | | // DataDictionaryCustom startTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // DataDictionaryEnum.YU_YUE_START_TIME.getType(), |
| | | // DataDictionaryEnum.YU_YUE_START_TIME.getCode() |
| | | // ); |
| | | // DateTime startTime = DateUtil.parseTime(startTimeDic.getValue()); |
| | | // DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // DataDictionaryEnum.YU_YUE_END_TIME.getType(), |
| | | // DataDictionaryEnum.YU_YUE_END_TIME.getCode() |
| | | // ); |
| | | // DateTime endTime = DateUtil.parseTime(endTimeDic.getValue()); |
| | | // if(nowTime.compareTo(startTime) >= 0 && nowTime.compareTo(endTime) <= 0){ |
| | | // IPage<ApiOrderRecordListVo> pageBuy = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize()); |
| | | // IPage<ApiOrderRecordListVo> apiOrderListVoIPageBuy = mallProductBuyRecordMapper.selectListInPage(pageBuy, apiOrderListDto); |
| | | // if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){ |
| | | // for(ApiOrderRecordListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){ |
| | | // objects.add(apiOrderListVo); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | IPage<ApiOrderRecordListVo> pageBuy = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize()); |
| | | IPage<ApiOrderRecordListVo> apiOrderListVoIPageBuy = mallProductBuyRecordMapper.selectListInPage(pageBuy, apiOrderListDto); |
| | | if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){ |
| | | for(ApiOrderRecordListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){ |
| | | objects.add(apiOrderListVo); |
| | | DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(DateUtil.date())); |
| | | DataDictionaryCustom startTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.YU_YUE_START_TIME.getType(), |
| | | DataDictionaryEnum.YU_YUE_START_TIME.getCode() |
| | | ); |
| | | DateTime startTime = DateUtil.parseTime(startTimeDic.getValue()); |
| | | DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.YU_YUE_END_TIME.getType(), |
| | | DataDictionaryEnum.YU_YUE_END_TIME.getCode() |
| | | ); |
| | | DateTime endTime = DateUtil.parseTime(endTimeDic.getValue()); |
| | | if(nowTime.compareTo(startTime) >= 0 && nowTime.compareTo(endTime) <= 0){ |
| | | IPage<ApiOrderRecordListVo> pageBuy = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize()); |
| | | IPage<ApiOrderRecordListVo> apiOrderListVoIPageBuy = mallProductBuyRecordMapper.selectListInPage(pageBuy, apiOrderListDto); |
| | | if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){ |
| | | for(ApiOrderRecordListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){ |
| | | objects.add(apiOrderListVo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // IPage<ApiOrderRecordListVo> pageBuy = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize()); |
| | | // IPage<ApiOrderRecordListVo> apiOrderListVoIPageBuy = mallProductBuyRecordMapper.selectListInPage(pageBuy, apiOrderListDto); |
| | | // if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){ |
| | | // for(ApiOrderRecordListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){ |
| | | // objects.add(apiOrderListVo); |
| | | // } |
| | | // } |
| | | IPage<ApiOrderRecordListVo> pageSell = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize()); |
| | | IPage<ApiOrderRecordListVo> apiOrderListVoIPageSell = mallProductSellRecordMapper.selectListInPage(pageSell, apiOrderListDto); |
| | | if(CollUtil.isNotEmpty(apiOrderListVoIPageSell.getRecords())){ |