| | |
| | | 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()); |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |