|
@@ -188,10 +188,10 @@ public class OpenService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//判断是否4.2米以下蓝色车牌===免停车费
|
|
//判断是否4.2米以下蓝色车牌===免停车费
|
|
|
- if (StrUtil.isNotEmpty(tbBusinessCar.getColor())&&tbBusinessCar.getCarSize()!=null) {
|
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(tbBusinessCar.getColor()) && tbBusinessCar.getCarSize() != null) {
|
|
|
String freeColor = partConfig.getFreeColor();
|
|
String freeColor = partConfig.getFreeColor();
|
|
|
//4.2米以下蓝色车辆
|
|
//4.2米以下蓝色车辆
|
|
|
- if (tbBusinessCar.getColor().contains(freeColor)&&tbBusinessCar.getCarSize()<=partConfig.getFreeCarLength()) {
|
|
|
|
|
|
|
+ if (tbBusinessCar.getColor().contains(freeColor) && tbBusinessCar.getCarSize() <= partConfig.getFreeCarLength()) {
|
|
|
log.error("请求返回【蓝牌未备案车辆,放行】:{},{}", carNo, ResultJson.success());
|
|
log.error("请求返回【蓝牌未备案车辆,放行】:{},{}", carNo, ResultJson.success());
|
|
|
freeOut(tbBusinessCar, now, channel, image);
|
|
freeOut(tbBusinessCar, now, channel, image);
|
|
|
return ResultJson.success();
|
|
return ResultJson.success();
|
|
@@ -210,15 +210,24 @@ public class OpenService {
|
|
|
String businessCarId = tbBusinessCar.getId();
|
|
String businessCarId = tbBusinessCar.getId();
|
|
|
//String carNoPrefix = StrUtil.sub(carNo, 0, 1);
|
|
//String carNoPrefix = StrUtil.sub(carNo, 0, 1);
|
|
|
String carType = tbBusinessCar.getCarType();
|
|
String carType = tbBusinessCar.getCarType();
|
|
|
- BigDecimal carMoney = new BigDecimal(0);
|
|
|
|
|
|
|
+ BigDecimal yueCarMoney = new BigDecimal(0);
|
|
|
|
|
+ BigDecimal chinaCarMoney = new BigDecimal(0);
|
|
|
List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
|
|
List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
|
|
|
|
|
+ businessList=businessList.stream().filter(tbBusiness -> tbBusiness.getPayStatus()!=TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()).collect(Collectors.toList());
|
|
|
if (businessList.isEmpty()) {//无业务车辆===>计算停车费
|
|
if (businessList.isEmpty()) {//无业务车辆===>计算停车费
|
|
|
//如果已经支付过,则从支付时间算起,重新计算停车费
|
|
//如果已经支付过,则从支付时间算起,重新计算停车费
|
|
|
double dif = caulatePrice(tbBusinessCar, now);
|
|
double dif = caulatePrice(tbBusinessCar, now);
|
|
|
if (dif > 0) {
|
|
if (dif > 0) {
|
|
|
RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
|
log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
|
|
log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
|
|
|
- automaticPay.run(null, tbBusinessCar.getCarNo(), 1);
|
|
|
|
|
|
|
+ //是否可以预充值缴费 true扣款成功 false否
|
|
|
|
|
+ boolean flag = automaticPay.payPartMoney(tbBusinessCar,dif, now);
|
|
|
|
|
+ if (flag){
|
|
|
|
|
+ tbBusinessCar.setMoney(new BigDecimal(dif));
|
|
|
|
|
+ freeOut(tbBusinessCar, now, channel, image);
|
|
|
|
|
+ automaticPay.unbindRun(carNo);
|
|
|
|
|
+ return ResultJson.success();
|
|
|
|
|
+ }
|
|
|
return ResultJson.error("请缴停车费" + dif + "元");
|
|
return ResultJson.error("请缴停车费" + dif + "元");
|
|
|
} else {
|
|
} else {
|
|
|
//无需交停车费,又没有支付的--->设置成免费车辆
|
|
//无需交停车费,又没有支付的--->设置成免费车辆
|
|
@@ -233,22 +242,6 @@ public class OpenService {
|
|
|
//1、分越重车和空车
|
|
//1、分越重车和空车
|
|
|
//空车是否收费
|
|
//空车是否收费
|
|
|
//该车所有的业务都是到达卡口才进行扣费才会进入自动扣费
|
|
//该车所有的业务都是到达卡口才进行扣费才会进入自动扣费
|
|
|
- int autoPayCount = 0;
|
|
|
|
|
- for (TbBusiness business : businessList) {
|
|
|
|
|
- TbGoods tbGoods = tbGoodsService.getById(business.getGoodsId());
|
|
|
|
|
- if (TbGoods.DeductionTypeEnum.OUT_KK.getCode().equals(tbGoods.getAutoDeductionType())) {
|
|
|
|
|
- autoPayCount++;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (autoPayCount == businessList.size()) {
|
|
|
|
|
- log.info("车辆到达卡口进行扣停车费和业务费:{}", carNo);
|
|
|
|
|
- //自动缴费
|
|
|
|
|
- // automaticPay.run(null, tbBusinessCar.getCarNo(), 3);
|
|
|
|
|
- //tbDeductionBindService.autoUnbindCar(tbBusinessCar.getCarNo());
|
|
|
|
|
- freeOut(tbBusinessCar, now, channel, image);
|
|
|
|
|
- return ResultJson.success();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType)) {
|
|
if (TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType)) {
|
|
|
boolean chinaCarPay = businessList.stream().anyMatch(tbBusiness -> {
|
|
boolean chinaCarPay = businessList.stream().anyMatch(tbBusiness -> {
|
|
|
TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
@@ -259,7 +252,7 @@ public class OpenService {
|
|
|
if (dif > 0) {
|
|
if (dif > 0) {
|
|
|
RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
|
log.error("中国车停车费:{},{}元", carNo, dif);
|
|
log.error("中国车停车费:{},{}元", carNo, dif);
|
|
|
- carMoney = new BigDecimal(dif);
|
|
|
|
|
|
|
+ chinaCarMoney = new BigDecimal(dif);
|
|
|
// return ResultJson.error("请缴停车费" + dif + "元");
|
|
// return ResultJson.error("请缴停车费" + dif + "元");
|
|
|
} else {
|
|
} else {
|
|
|
if (tbBusinessCar.getPayTime() == null) {
|
|
if (tbBusinessCar.getPayTime() == null) {
|
|
@@ -277,7 +270,7 @@ public class OpenService {
|
|
|
if (dif > 0) {
|
|
if (dif > 0) {
|
|
|
RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
RedisUtil.setByMINUTES(channel, carNo, 1);
|
|
|
log.error("越南车停车费:{},{}元", carNo, dif);
|
|
log.error("越南车停车费:{},{}元", carNo, dif);
|
|
|
- carMoney = new BigDecimal(dif);
|
|
|
|
|
|
|
+ yueCarMoney = new BigDecimal(dif);
|
|
|
// return ResultJson.error("请缴停车费" + dif + "元");
|
|
// return ResultJson.error("请缴停车费" + dif + "元");
|
|
|
} else {
|
|
} else {
|
|
|
if (tbBusinessCar.getPayTime() == null) {
|
|
if (tbBusinessCar.getPayTime() == null) {
|
|
@@ -289,8 +282,12 @@ public class OpenService {
|
|
|
}
|
|
}
|
|
|
//============业务费计算是否交完
|
|
//============业务费计算是否交完
|
|
|
BigDecimal businessMoney = new BigDecimal(0);
|
|
BigDecimal businessMoney = new BigDecimal(0);
|
|
|
|
|
+ int autoPayCount=0;
|
|
|
for (TbBusiness tbBusiness : businessList) {
|
|
for (TbBusiness tbBusiness : businessList) {
|
|
|
TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
|
|
+ if (TbGoods.DeductionTypeEnum.OUT_KK.getCode().equals(tbGoods.getAutoDeductionType())) {
|
|
|
|
|
+ autoPayCount++;
|
|
|
|
|
+ }
|
|
|
int vietnamLeave = tbGoods.getVietnamCarLeave();
|
|
int vietnamLeave = tbGoods.getVietnamCarLeave();
|
|
|
int chinaCarLeave = tbGoods.getChinaCarLeave();
|
|
int chinaCarLeave = tbGoods.getChinaCarLeave();
|
|
|
boolean pay = tbBusiness.getPayMoney().doubleValue() >= tbBusiness.getItemPrice().doubleValue();
|
|
boolean pay = tbBusiness.getPayMoney().doubleValue() >= tbBusiness.getItemPrice().doubleValue();
|
|
@@ -313,6 +310,17 @@ public class OpenService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (autoPayCount == businessList.size()&&businessMoney.intValue()>0) {
|
|
|
|
|
+ log.info("车辆到达卡口进行扣停车费和业务费:{}", carNo);
|
|
|
|
|
+ //自动缴费
|
|
|
|
|
+ boolean flag= automaticPay.payBusinessAndPartMoney(businessList,businessMoney,tbBusinessCar,chinaCarMoney,yueCarMoney);
|
|
|
|
|
+ if (flag){
|
|
|
|
|
+ tbDeductionBindService.autoUnbindCar(tbBusinessCar.getCarNo());
|
|
|
|
|
+ freeOut(tbBusinessCar, now, channel, image);
|
|
|
|
|
+ return ResultJson.success();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal carMoney=chinaCarMoney.add(yueCarMoney);
|
|
|
BigDecimal total = businessMoney.add(carMoney);
|
|
BigDecimal total = businessMoney.add(carMoney);
|
|
|
if (total.doubleValue() > 0) {
|
|
if (total.doubleValue() > 0) {
|
|
|
String desc = "请缴";
|
|
String desc = "请缴";
|
|
@@ -325,8 +333,6 @@ public class OpenService {
|
|
|
log.error("请求返回:{},{}", carNo, desc);
|
|
log.error("请求返回:{},{}", carNo, desc);
|
|
|
return ResultJson.error(desc);
|
|
return ResultJson.error(desc);
|
|
|
}
|
|
}
|
|
|
- //离场直接解绑
|
|
|
|
|
- tbDeductionBindService.autoUnbindCar(tbBusinessCar.getCarNo());
|
|
|
|
|
freeOut(tbBusinessCar, now, channel, image);
|
|
freeOut(tbBusinessCar, now, channel, image);
|
|
|
return ResultJson.success();
|
|
return ResultJson.success();
|
|
|
}
|
|
}
|
|
@@ -381,7 +387,7 @@ public class OpenService {
|
|
|
if (tbBusinessCar != null) {
|
|
if (tbBusinessCar != null) {
|
|
|
String color = inRecordBO.getCarColor();
|
|
String color = inRecordBO.getCarColor();
|
|
|
TbMildCar tbMildCar = tbMildCarService.findByCarNo(carNo);
|
|
TbMildCar tbMildCar = tbMildCarService.findByCarNo(carNo);
|
|
|
- if (tbMildCar!=null){//车长
|
|
|
|
|
|
|
+ if (tbMildCar != null) {//车长
|
|
|
tbBusinessCar.setCarSize(tbMildCar.getCarLength());
|
|
tbBusinessCar.setCarSize(tbMildCar.getCarLength());
|
|
|
}
|
|
}
|
|
|
//蓝牌 4.2米以及以下
|
|
//蓝牌 4.2米以及以下
|