| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | |
| | | query.setLicensePlate(order.getPlate()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ISO_DATE_TIME); |
| | | parse = parse.plusHours(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | |
| | | query.setLicensePlate(order.getPlatenumber()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ISO_DATE_TIME); |
| | | parse = parse.plusHours(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.now()); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getMoney())); |
| | | parkingRecord.setPayment(new BigDecimal(order.getMoney())); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |