|
@@ -47,6 +47,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -91,7 +92,7 @@ public class OpenService {
|
|
|
TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
Date now = new Date();
|
|
|
TbCar tbCar = tbCarService.findByCardNo(carNo);
|
|
|
- if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null)||tbBusinessCar.getPay()==1) {
|
|
|
+ if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null) || tbBusinessCar.getPay() == 1) {
|
|
|
tbBusinessCar = new TbBusinessCar();
|
|
|
tbBusinessCar.setCarNo(carNo).setPay(0).setCarSize(0D).setIsLock(0).setCarCompany(tbCar != null ? tbCar.getCustomerName() : "临时")
|
|
|
.setInChannel(channel).setRealInTime(now).setBasePartMoney(new BigDecimal("0")).setTimeUpdate(now)
|
|
@@ -125,7 +126,7 @@ public class OpenService {
|
|
|
private ResultJson handlerOut(String carNo, String channel, String image) {
|
|
|
carNo = carNo.toUpperCase();
|
|
|
TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
- if (tbBusinessCar == null||tbBusinessCar.getRealInTime()==null) {
|
|
|
+ if (tbBusinessCar == null || tbBusinessCar.getRealInTime() == null) {
|
|
|
return ResultJson.error("未查询到入场记录");
|
|
|
}
|
|
|
Date now = new Date();
|
|
@@ -150,22 +151,26 @@ public class OpenService {
|
|
|
return ResultJson.success();
|
|
|
}
|
|
|
if (tbBusinessCar.getIsLock() == 1) {
|
|
|
- RedisUtil.setByMINUTES(channel, carNo,2);
|
|
|
+ RedisUtil.setByMINUTES(channel, carNo, 2);
|
|
|
return ResultJson.error("车辆已锁定");
|
|
|
}
|
|
|
String businessId = tbBusinessCar.getBusinessId();
|
|
|
- BigDecimal price = new BigDecimal("0");
|
|
|
- if (CAR_LIST.contains(carNo.substring(0, 1))) {
|
|
|
- Date inTime=tbBusinessCar.getRealInTime();
|
|
|
- if (tbBusinessCar.getPay()==1){
|
|
|
- inTime=tbBusinessCar.getPayTime();
|
|
|
+ String carNoStr = carNo.substring(0, 1);
|
|
|
+ Date inTime = tbBusinessCar.getRealInTime();
|
|
|
+ if (tbBusinessCar.getPay() == 1) {
|
|
|
+ inTime = tbBusinessCar.getPayTime();
|
|
|
+ }
|
|
|
+ BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now);
|
|
|
+ if (!CAR_LIST.contains(carNoStr)) {
|
|
|
+ TbBusiness tbBusiness = tbBusinessService.getById(businessId);
|
|
|
+ //整车业务免停车费
|
|
|
+ if (tbBusiness != null && Objects.equals(tbBusiness.getBusinessType(), TbBusiness.BusinessType.HOLD_CAR.getCode())) {
|
|
|
+ price = new BigDecimal("0");
|
|
|
}
|
|
|
- price = tbBusinessService.calculationPartMoney(inTime, now);
|
|
|
}
|
|
|
-// double dif = price.subtract(tbBusinessCar.getMoney()).doubleValue();
|
|
|
double dif = price.doubleValue();
|
|
|
if (dif > 0) {
|
|
|
- RedisUtil.setByMINUTES(channel, carNo,1);
|
|
|
+ RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
|
return ResultJson.error("请缴停车费" + dif + "元");
|
|
|
}
|
|
|
if (StrUtil.isEmpty(businessId)) {
|
|
@@ -186,13 +191,13 @@ public class OpenService {
|
|
|
|
|
|
if (!CAR_LIST.contains(StrUtil.sub(carNo, 0, 1))) {
|
|
|
if (!business.getItemPrice().equals(itemPayPrice) && business.getCustomerType() != 2) {
|
|
|
- RedisUtil.setByMINUTES(channel, carNo,2);
|
|
|
+ RedisUtil.setByMINUTES(channel, carNo, 2);
|
|
|
return ResultJson.error("请缴纳业务费用");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType()) && !business.getItemPrice().equals(itemPayPrice)) {
|
|
|
- RedisUtil.setByMINUTES(channel, carNo,1);
|
|
|
+ RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
|
return ResultJson.error("请缴纳业务费用");
|
|
|
}
|
|
|
tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setTimeUpdate(now);
|