puzhibing
2024-02-23 9b3f6f5952d45ceeb0770fe4622721007b8fc79d
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -380,7 +380,7 @@
                    if(d.compareTo(new BigDecimal(0)) > 0){
                        SettlementDetail settlementDetail = new SettlementDetail();
                        settlementDetail.setOrderId(orderId);
                        settlementDetail.setOrderType(1);
                        settlementDetail.setOrderType(4);
                        settlementDetail.setDriverId(orderLogistics.getDriverId());
                        settlementDetail.setOrderMoney(sum);
                        settlementDetail.setPrice(d.doubleValue());
@@ -391,21 +391,29 @@
                        if(null != settlementAllocation){
                            JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
                            Double maxPrice = jsonObject.getDouble("maxPrice");
                            Integer type = jsonObject.getInteger("type");
                            if(type == 1){
                            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", orderLogistics.getDriverId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')"));
                            BigDecimal total = new BigDecimal(0);
                            for (SettlementDetail detail : settlementDetailList) {
                                total = total.add(new BigDecimal(detail.getPrice()));
                            }
                            if(maxPrice.compareTo(total.doubleValue()) <= 0){
                                SettlementRecord settlementRecord = new SettlementRecord();
                                    SettlementRecord settlementRecord = settlementRecordService.selectOne(new EntityWrapper<SettlementRecord>().eq("driverId", orderLogistics.getDriverId())
                                            .eq("type", type).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')"));
                                    if(null == settlementRecord){
                                        settlementRecord = new SettlementRecord();
                                settlementRecord.setDay(new Date());
                                settlementRecord.setDriverId(orderLogistics.getDriverId());
                                settlementRecord.setType(1);
                                        settlementRecord.setType(type);
                                settlementRecord.setPaymentStatus(1);
                                settlementRecord.setPayMoney(d.doubleValue());
                                        settlementRecord.setPayMoney(total.doubleValue());
                                settlementRecord.setInsertTime(new Date());
                                settlementRecordService.insert(settlementRecord);
                                    }else{
                                        settlementRecord.setPayMoney(total.doubleValue());
                                        settlementRecordService.updateById(settlementRecord);
                                    }
                                for (SettlementDetail detail : settlementDetailList) {
                                    detail.setSettlementRecordId(settlementRecord.getId());
                                    settlementDetailService.updateById(detail);
@@ -414,6 +422,7 @@
                        }
                    }
                }
                }
                break;
        }