From 927afebd4a79f9a78759930bfaff9a5ed6abeb6e Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期日, 30 七月 2023 04:50:08 +0800
Subject: [PATCH] 增加企业流水记录

---
 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java
index 3bb9e92..dc24dcc 100644
--- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java
+++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java
@@ -115,6 +115,9 @@
     @Autowired
     private IOrderService orderService;
 
+    @Autowired
+    private ICompanyFundFlowService companyFundFlowService;
+
     @Value("${wx.appletsAppid}")
     private String appletsAppid;
 
@@ -419,18 +422,6 @@
         if(null != order){
             return ResultUtil.error("您还有正在进行的订单");
         }
-
-        String value = redisUtil.getValue("USER" + uid);
-        if(ToolUtil.isEmpty(value)){
-            redisUtil.setStrValue("USER" + uid, System.currentTimeMillis() + "", 60);
-        }else{
-            Long s = System.currentTimeMillis() - Long.valueOf(value);
-            if(s.compareTo(60000L) < 0){//1分钟
-                return ResultUtil.error("数据处理中");
-            }
-            redisUtil.setStrValue("USER" + uid, System.currentTimeMillis() + "", 60);
-        }
-
 
         String startAddress = travelOrder.getStartAddress();
         startAddress = startAddress.replaceAll("& #40;", "(");
@@ -1500,6 +1491,7 @@
             accountChangeDetailService.saveData(accountChangeDetail);
 
             //补贴中分账
+            Double balance = revenueService.queryCompanyBalance();//平台账户余额
             Double discountedPrice = order.getDiscountedPrice();
             List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime"));
             for (RechargeRecord rechargeRecord : rechargeRecords) {
@@ -1525,6 +1517,13 @@
                 }
             }
 
+            CompanyFundFlow companyFundFlow = new CompanyFundFlow();
+            companyFundFlow.setBalance(new BigDecimal(balance));
+            companyFundFlow.setObjectType(1);
+            companyFundFlow.setType(5);
+            companyFundFlow.setMoney(new BigDecimal(order.getDiscountedPrice()));
+            companyFundFlow.setCreateTime(new Date());
+            companyFundFlowService.insert(companyFundFlow);
         }
     }
 
@@ -1973,6 +1972,7 @@
                     }
                     //处理代理商抽佣
                     if(num3 > 0 && null != driver){
+                        Double balance = revenueService.queryAgentBalance(driver.getAgentId());
                         Revenue revenue = new Revenue();
                         revenue.setType(1);
                         revenue.setUserType(3);
@@ -2006,6 +2006,15 @@
                                 }
                             }
                         }
+
+                        CompanyFundFlow companyFundFlow = new CompanyFundFlow();
+                        companyFundFlow.setType(3);
+                        companyFundFlow.setObjectType(2);
+                        companyFundFlow.setObjectId(driver.getAgentId());
+                        companyFundFlow.setBalance(new BigDecimal(balance));
+                        companyFundFlow.setMoney(new BigDecimal(num3));
+                        companyFundFlow.setCreateTime(new Date());
+                        companyFundFlowService.insert(companyFundFlow);
                     }
                 }
             }
@@ -2091,6 +2100,7 @@
             accountChangeDetailService.saveData(accountChangeDetail);
 
             //补贴中分账
+            Double balance = revenueService.queryCompanyBalance();
             Double discountedPrice = order.getDiscountedPrice();
             List<RechargeRecord> rechargeRecords1 = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime"));
             for (RechargeRecord rechargeRecord : rechargeRecords1) {
@@ -2115,6 +2125,13 @@
                     }
                 }
             }
+            CompanyFundFlow companyFundFlow = new CompanyFundFlow();
+            companyFundFlow.setBalance(new BigDecimal(balance));
+            companyFundFlow.setObjectType(1);
+            companyFundFlow.setType(5);
+            companyFundFlow.setMoney(new BigDecimal(order.getDiscountedPrice()));
+            companyFundFlow.setCreateTime(new Date());
+            companyFundFlowService.insert(companyFundFlow);
 
         }
         // TODO: 2023/6/25 折扣优惠由司机承担
@@ -2255,6 +2272,7 @@
             driverService.updateById(driver);
             accountChangeDetailService.saveData(accountChangeDetail);
             //补贴中分账
+            Double balance = revenueService.queryCompanyBalance();
             Double discountedPrice = order.getDiscountedPrice();
             List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime"));
             for (RechargeRecord rechargeRecord : rechargeRecords) {
@@ -2280,6 +2298,14 @@
                 }
             }
 
+            CompanyFundFlow companyFundFlow = new CompanyFundFlow();
+            companyFundFlow.setBalance(new BigDecimal(balance));
+            companyFundFlow.setObjectType(1);
+            companyFundFlow.setType(5);
+            companyFundFlow.setMoney(new BigDecimal(order.getDiscountedPrice()));
+            companyFundFlow.setCreateTime(new Date());
+            companyFundFlowService.insert(companyFundFlow);
+
         }
     }
 

--
Gitblit v1.7.1