zhibing.pu
2024-08-22 b77c1869930d044db13a0d4a672bf98da1cab2c2
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -1743,21 +1743,22 @@
                    if(null != settlementAllocation){
                        JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
                        Double maxPrice = jsonObject.getDouble("maxPrice");
                        Integer type1 = jsonObject.getInteger("type");
                        if(1 == type1){
                            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')"));
                        if(null != maxPrice){
                            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", driver.getId())
                                    .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 = settlementRecordService.selectOne(new EntityWrapper<SettlementRecord>().eq("driverId", orderLogistics.getDriverId())
                                        .eq("type", type1).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')"));
                                        .eq("type", 1).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(type1);
                                    settlementRecord.setType(1);
                                    settlementRecord.setPaymentStatus(1);
                                    settlementRecord.setPayMoney(total.doubleValue());
                                    settlementRecord.setInsertTime(new Date());
@@ -2967,17 +2968,20 @@
            }
    
            OrderLogistics orderLogistics = this.selectById(orderId);
            long timeOutCancel = 0L;
            long driverTimeOut = 0L;
            map.put("driverTimeOutTime", 0);
            map.put("driverTimeOut", 0);
            if(null != orderLogistics.getEstimateArriveTime()){
                CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderLogistics.getCompanyId()));
                JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
                int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000;
                timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout;
                driverTimeOut = orderLogistics.getEstimateArriveTime().getTime();
                int driverTimeout1 = jsonObject.getIntValue("driverTimeout");
                long time = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout1 * 60000;
                if(System.currentTimeMillis() > time){
                    Integer driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue();
                    driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime;
                    map.put("driverTimeOutTime", driverTimeOutTime);
                    map.put("driverTimeOut", 1);
                }
            }
            map.put("driverTimeOut", driverTimeOut);
            map.put("timeOutCancel", timeOutCancel);
        }
        return maps;
    }