Pu Zhibing
7 天以前 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SettlementRecordServiceImpl.java
@@ -77,6 +77,9 @@
    
    @Resource
    private CarModelMapper carModelMapper;
    @Resource
    private IIncomeService incomeService;
@@ -93,10 +96,16 @@
            JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
            Integer type = jsonObject.getInteger("type");
            querySettlementAmount.setType(type);
            List<SettlementRecord> settlementRecords = this.selectList(new EntityWrapper<SettlementRecord>().eq("driverId", driverId).eq("paymentStatus", 1));
            //所有未支付的主表数据
            List<SettlementRecord> settlementRecords = this.selectList(new EntityWrapper<SettlementRecord>().eq("driverId", driverId)
                    .eq("paymentStatus", 1));
            double sum = settlementRecords.stream().mapToDouble(SettlementRecord::getPayMoney).sum();
            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId).isNull("settlementRecordId"));
            //所有未生成主表数据的明细
            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId)
                    .isNull("settlementRecordId"));
            double sum1 = settlementDetailList.stream().mapToDouble(SettlementDetail::getPrice).sum();
            //显示的金额
            querySettlementAmount.setAmount(new BigDecimal(sum).add(new BigDecimal(sum1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
    
            List<Integer> collect = settlementRecords.stream().map(SettlementRecord::getId).collect(Collectors.toList());
@@ -148,7 +157,9 @@
            JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
            Integer type = jsonObject.getInteger("type");
    
            List<SettlementDetail> settlementDetails = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId).isNull("settlementRecordId"));
            //所以未生成主表的明细数据
            List<SettlementDetail> settlementDetails = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driverId)
                    .isNull("settlementRecordId"));
            double sum = settlementDetails.stream().mapToDouble(SettlementDetail::getPrice).sum();
            if(sum > 0){
                SettlementRecord settlementRecord = new SettlementRecord();
@@ -278,6 +289,8 @@
            driver1.setLaveActivityMoney(laveActivityMoney);
            driver1.setBalance(new BigDecimal(laveBusinessMoney).add(new BigDecimal(laveActivityMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            driverService.updateById(driver1);
            //添加司机结算的平台收入记录
            incomeService.saveData(1, 1, 8, driver1.getId(), null, payMoney);
            //添加交易明细
            transactionDetailsService.saveData(driverId, "支付结算费用", payMoney, 2, 1, 2, null, null);