puzhibing
2023-07-30 927afebd4a79f9a78759930bfaff9a5ed6abeb6e
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;
@@ -1488,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) {
@@ -1513,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);
        }
    }
@@ -1961,6 +1972,7 @@
                    }
                    //处理代理商抽佣
                    if(num3 > 0 && null != driver){
                        Double balance = revenueService.queryAgentBalance(driver.getAgentId());
                        Revenue revenue = new Revenue();
                        revenue.setType(1);
                        revenue.setUserType(3);
@@ -1994,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);
                    }
                }
            }
@@ -2079,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) {
@@ -2103,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 折扣优惠由司机承担
@@ -2243,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) {
@@ -2268,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);
        }
    }