From 83b56237a9e0b379b46d31ab77def13226f33548 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 27 Nov 2023 14:15:16 +0800
Subject: [PATCH] 匹配

---
 src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java |   50 +++++++++++++++++++++++++++-----------------------
 1 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
index 8c177c2..69dc437 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
@@ -8,6 +8,7 @@
 import cc.mrbird.febs.mall.service.*;
 import cc.mrbird.febs.mall.vo.AdminMallMoneyFlowVo;
 import cc.mrbird.febs.mall.vo.AdminTeamEqualsPerkVo;
+import cc.mrbird.febs.rabbit.producter.AgentProducer;
 import cc.mrbird.febs.system.mapper.UserMapper;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
@@ -62,6 +63,7 @@
     private final MallProductSellMapper mallProductSellMapper;
     private final MallProductSellRecordMapper mallProductSellRecordMapper;
     private final MallProductNftMapper mallProductNftMapper;
+    private final AgentProducer agentProducer;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -888,29 +890,31 @@
                      * 3、更新买单子表的数据
                      * 3、更新卖单子表的数据
                      */
-                    Long buyId = mallProductBuyRecord.getBuyId();
-                    Long sellRecordId = mallProductBuyRecord.getSellRecordId();
-                    MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(buyId);
-                    Long memberIdBuy = mallProductBuy.getMemberId();
-                    //冻结账户
-                    MallMember mallMemberBuy = memberMapper.selectById(memberIdBuy);
-                    mallMemberBuy.setIsFrozen(ProductEnum.MEMBER_FROZEN.getValue());
-                    memberMapper.updateById(mallMemberBuy);
-                    //更新买单子表的数据
-                    mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue());
-                    mallProductBuyRecordMapper.updateById(mallProductBuyRecord);
-                    //更新买单主表
-                    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);
+                    agentProducer.sendFcmOrderBuyCancelMsg(mallProductBuyRecord.getId());
+
+//                    Long buyId = mallProductBuyRecord.getBuyId();
+//                    Long sellRecordId = mallProductBuyRecord.getSellRecordId();
+//                    MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(buyId);
+//                    Long memberIdBuy = mallProductBuy.getMemberId();
+//                    //冻结账户
+//                    MallMember mallMemberBuy = memberMapper.selectById(memberIdBuy);
+//                    mallMemberBuy.setIsFrozen(ProductEnum.MEMBER_FROZEN.getValue());
+//                    memberMapper.updateById(mallMemberBuy);
+//                    //更新买单子表的数据
+//                    mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue());
+//                    mallProductBuyRecordMapper.updateById(mallProductBuyRecord);
+//                    //更新买单主表
+//                    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);
                 }
             }
         }

--
Gitblit v1.9.1