From f215f23bae13f1e6984c38b5893103a184c3c534 Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Thu, 21 Dec 2023 14:07:25 +0800 Subject: [PATCH] 富文本框输入版本变化 --- src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 152 insertions(+), 0 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java index 02474a5..5b392b1 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java @@ -2,20 +2,30 @@ import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.entity.QueryRequest; +import cc.mrbird.febs.common.enumerates.FlowTypeNewEnum; +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.LoginUserUtil; +import cc.mrbird.febs.common.utils.MallUtils; import cc.mrbird.febs.mall.conversion.MallProductNftConversion; +import cc.mrbird.febs.mall.dto.AdminBuyRecordPayDto; import cc.mrbird.febs.mall.dto.AdminMallProductNftDto; import cc.mrbird.febs.mall.dto.AdminPickSellRecordDtoDto; import cc.mrbird.febs.mall.dto.MallNewsInfoDto; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; +import cc.mrbird.febs.mall.service.IMallMoneyFlowService; import cc.mrbird.febs.mall.service.IMallNewsInfoService; import cc.mrbird.febs.mall.vo.*; +import cc.mrbird.febs.rabbit.producter.AgentProducer; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -41,6 +51,9 @@ private final MallProductSellMapper mallProductSellMapper; private final MallProductSellRecordMapper mallProductSellRecordMapper; private final MallProductBuyRecordMapper mallProductBuyRecordMapper; + private final IMallMoneyFlowService mallMoneyFlowService; + private final AgentProducer agentProducer; + private final MallMemberSpeakMapper mallMemberSpeakMapper; @Override public IPage<AdminMallNewsInfoVo> getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request) { @@ -198,6 +211,17 @@ } @Override + public IPage<MallProductBuyRecord> getBuyRecordList(MallProductBuy mallProductBuy, QueryRequest request) { + if(ObjectUtil.isNotEmpty(mallProductBuy.getAccountLogin())){ + String accountLogin = mallProductBuy.getAccountLogin(); + + } + Page<MallProductBuyRecord> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<MallProductBuyRecord> mallProductBuyRecordIPage = mallProductNftMapper.getBuyRecordList(page, mallProductBuy); + return mallProductBuyRecordIPage; + } + + @Override public IPage<AdminMallProductSellVo> getSellList(MallProductSell mallProductSell, QueryRequest request) { Page<AdminMallProductSellVo> page = new Page<>(request.getPageNum(), request.getPageSize()); IPage<AdminMallProductSellVo> adminMallProductSellVoIPage = mallProductNftMapper.getSellList(page, mallProductSell); @@ -260,6 +284,7 @@ mallProductBuyRecord.setMemberId(mallProductSell.getMemberId()); mallProductBuyRecord.setSellRecordId(mallProductSellRecord.getId()); mallProductBuyRecord.setPickNftCnt(pickNftCnt); + mallProductBuyRecord.setBuyOrderNo(mallProductBuy.getOrderNo()); mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue()); mallProductBuyRecord.setOrderTime(orderTime); mallProductBuyRecordMapper.insert(mallProductBuyRecord); @@ -273,4 +298,131 @@ mallProductBuyMapper.updateById(mallProductBuy); return new FebsResponse().success(); } + + @Override + public FebsResponse buyRecordPay(AdminBuyRecordPayDto buyRecordPayDto) { + Long buyRecordId = buyRecordPayDto.getId(); + String nftImg = buyRecordPayDto.getNftImg(); + Integer type = buyRecordPayDto.getType(); + /** + * 验证订单是否存在 + * 更新买单状态 + * 更新卖单状态 + * 生成流水信息 + */ + MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(buyRecordId); + if(ObjectUtil.isEmpty(mallProductBuyRecord)){ + throw new FebsException("记录不存在"); + } +// Integer state = mallProductBuyRecord.getState(); +// if(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue() != state){ +// throw new FebsException("记录不是待支付状态"); +// } + + MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(mallProductBuyRecord.getSellRecordId()); + if(ObjectUtil.isEmpty(mallProductSellRecord)){ + throw new FebsException("记录不存在"); + } +// Integer stateSell = mallProductSellRecord.getState(); +// if(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue() != stateSell){ +// throw new FebsException("记录不是待支付状态"); +// } + + DateTime payTime = DateUtil.date(); + mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_PAY.getValue()); + mallProductBuyRecord.setPayTime(payTime); + mallProductBuyRecord.setNftImg(nftImg); + mallProductBuyRecord.setType(type); + mallProductBuyRecordMapper.updateById(mallProductBuyRecord); + + mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_PAY.getValue()); + mallProductSellRecord.setPayTime(payTime); + mallProductSellRecord.setNftImg(nftImg); + mallProductSellRecord.setType(type); + mallProductSellRecordMapper.updateById(mallProductSellRecord); + + String orderNo = MallUtils.getOrderNum("ZF"); + mallMoneyFlowService.addMoneyFlow( + mallProductSellRecord.getMemberId(), + mallProductBuyRecord.getPickNftCnt(), + MoneyFlowTypeNewEnum.PAY.getValue(), + orderNo, + mallProductSellRecord.getMemberId(), + FlowTypeNewEnum.NFT.getValue(), + MoneyFlowTypeNewEnum.PAY.getDescrition()); + return new FebsResponse().success(); + } + + @Override + public FebsResponse buyRecordConfirm(Long id) { + /** + * 验证订单是否存在 + * 更新买单状态 + * 更新卖单状态 + * 生成流水信息 + */ + MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(id); + if(ObjectUtil.isEmpty(mallProductBuyRecord)){ + throw new FebsException("记录不存在"); + } +// Integer state = mallProductBuyRecord.getState(); +// if(ProductEnum.PRODUCT_MATE_STATE_PAY.getValue() != state){ +// throw new FebsException("记录不是已支付状态"); +// } + Long sellRecordId = mallProductBuyRecord.getSellRecordId(); + MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(mallProductBuyRecord.getSellRecordId()); + if(ObjectUtil.isEmpty(mallProductSellRecord)){ + throw new FebsException("记录不存在"); + } +// Integer stateSell = mallProductSellRecord.getState(); +// if(ProductEnum.PRODUCT_MATE_STATE_PAY.getValue() != stateSell){ +// throw new FebsException("记录不是已支付状态"); +// } + + mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_CONFIRM.getValue()); + mallProductBuyRecordMapper.updateById(mallProductBuyRecord); + + mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_CONFIRM.getValue()); + mallProductSellRecordMapper.updateById(mallProductSellRecord); + + agentProducer.sendFcmOrderSellInsureMsg(sellRecordId); + return new FebsResponse().success(); + } + + @Override + public FebsResponse buyRecordCancel(Long id) { + MallProductBuyRecord mallProductBuyRecord = mallProductBuyRecordMapper.selectById(id); + if(ObjectUtil.isEmpty(mallProductBuyRecord)){ + throw new FebsException("记录不存在"); + } +// Integer state = mallProductBuyRecord.getState(); +// if(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue() != state){ +// throw new FebsException("记录不是待支付状态"); +// } + Long sellRecordId = mallProductBuyRecord.getSellRecordId(); + //更新买单子表的数据 + mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue()); + mallProductBuyRecordMapper.updateById(mallProductBuyRecord); + //更新买单主表 + MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(mallProductBuyRecord.getBuyId()); + mallProductBuy.setNftAva(mallProductBuy.getNftAva().add(mallProductBuyRecord.getPickNftCnt())); + mallProductBuyMapper.updateById(mallProductBuy); + //更新卖单子表的数据 + MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(sellRecordId); + mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue()); + mallProductSellRecordMapper.updateById(mallProductSellRecord); + //更新卖单主表 + Long sellId = mallProductSellRecord.getSellId(); + MallProductSell mallProductSell = mallProductSellMapper.selectById(sellId); + mallProductSell.setNftCntAva(mallProductSell.getNftCntAva().add(mallProductSellRecord.getNftCnt())); + mallProductSellMapper.updateById(mallProductSell); + return new FebsResponse().success(); + } + + @Override + public IPage<MallMemberSpeak> getSpeakList(MallMemberSpeak mallMemberSpeak, QueryRequest request) { + Page<MallMemberSpeak> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<MallMemberSpeak> adminMallNewsInfoVoIPage = mallProductSellMapper.getSpeakListInPage(page, mallMemberSpeak); + return adminMallNewsInfoVoIPage; + } } -- Gitblit v1.9.1