| | |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingSpace; |
| | | import com.ruoyi.integration.barrierGate.model.OfflineParkingOrder; |
| | |
| | | parkingRecord.setOutParkingType(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 1); |
| | | parkingRecord.setTitle("【停车缴费】" + payment + "元"); |
| | | TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(parkingRecord.getLicensePlate()).getData(); |
| | | TChargingOrder chargingOrder = null; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(null != appUserCar){ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | List<TChargingOrder> data = chargingOrderClient.getCarChargingOrder(appUserCar.getId(), parkingRecord.getInParkingTime().format(formatter), LocalDateTime.now().format(formatter)).getData(); |
| | | if(null != data && data.size() > 0){ |
| | | TChargingOrder chargingOrder = data.get(0); |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | chargingOrder = data.get(0); |
| | | } |
| | | }else if(StringUtils.isNotEmpty(parkingRecord.getLicensePlate())){ |
| | | List<TChargingOrder> data = chargingOrderClient.getCarChargingOrderByPlateNum(parkingRecord.getLicensePlate(), parkingRecord.getInParkingTime().format(formatter), LocalDateTime.now().format(formatter)).getData(); |
| | | if(null != data && data.size() > 0){ |
| | | chargingOrder = data.get(0); |
| | | } |
| | | } |
| | | |
| | | |
| | | if(null != chargingOrder){ |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | } |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | |
| | | parkingRecord.setOutParkingType(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 1); |
| | | parkingRecord.setTitle("【停车缴费】" + payment + "元"); |
| | | TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(parkingRecord.getLicensePlate()).getData(); |
| | | TChargingOrder chargingOrder = null; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(null != appUserCar){ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | List<TChargingOrder> data = chargingOrderClient.getCarChargingOrder(appUserCar.getId(), parkingRecord.getInParkingTime().format(formatter), LocalDateTime.now().format(formatter)).getData(); |
| | | if(null != data && data.size() > 0){ |
| | | TChargingOrder chargingOrder = data.get(0); |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | chargingOrder = data.get(0); |
| | | } |
| | | }else if(StringUtils.isNotEmpty(parkingRecord.getLicensePlate())){ |
| | | List<TChargingOrder> data = chargingOrderClient.getCarChargingOrderByPlateNum(parkingRecord.getLicensePlate(), parkingRecord.getInParkingTime().format(formatter), LocalDateTime.now().format(formatter)).getData(); |
| | | if(null != data && data.size() > 0){ |
| | | chargingOrder = data.get(0); |
| | | } |
| | | } |
| | | |
| | | if(null != chargingOrder){ |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | } |
| | | |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |