Browse Source

只要不在4.2~9.6管理里面,全部算9.6以上

qzyReal 2 years ago
parent
commit
a5eb7f6bfe

+ 4 - 4
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -194,7 +194,7 @@ public class OpenService {
         businessList=businessList.stream().filter(tbBusiness -> tbBusiness.getPayStatus()!= PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode()).collect(Collectors.toList());
         if (businessList.isEmpty()) {//无业务车辆===>计算停车费
             //如果已经支付过,则从支付时间算起,重新计算停车费
-            double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarSize()).doubleValue();
+            double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarNo()).doubleValue();
             if (dif > 0&&payPart==0) {
                 RedisUtil.setByMINUTES(channel, carNo, 5);
                 log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
@@ -226,7 +226,7 @@ public class OpenService {
                     return tbGoods.getChinaCarPay() == 1;
                 });
                 if (chinaCarPay&&payPart==0) {
-                    double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarSize()).doubleValue();
+                    double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarNo()).doubleValue();
                     if (dif > 0) {
                         RedisUtil.setByMINUTES(channel, carNo, 5);
                         log.error("中国车停车费:{},{}元", carNo, dif);
@@ -244,7 +244,7 @@ public class OpenService {
                     return tbGoods.getVietnamCarPay() == 1;
                 });
                 if (vietnamCarPay&&payPart==0) {
-                    double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarSize()).doubleValue();
+                    double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarNo()).doubleValue();
                     if (dif > 0) {
                         RedisUtil.setByMINUTES(channel, carNo, 5);
                         log.error("越南车停车费:{},{}元", carNo, dif);
@@ -321,7 +321,7 @@ public class OpenService {
 
     private void freeOut(TbBusinessCar tbBusinessCar, Date now, String outChannel, String base64Image) {
         if (StrUtil.equals(tbBusinessCar.getPayType(), CarEnum.PayTypeEnum.NO_PAY_TYPE.getType())) {
-            BigDecimal partMoney = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now, tbBusinessCar.getCarSize());
+            BigDecimal partMoney = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now, tbBusinessCar.getCarNo());
             if (partMoney.doubleValue() <= 0) {
                 tbBusinessCar.setPayType(CarEnum.PayTypeEnum.FEE_TYPE.getType());
             }

+ 1 - 1
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -158,7 +158,7 @@ public class ApiService {
         if (tbBusinessCar.getPayTime() != null) {
             startTime = tbBusinessCar.getPayTime();
         }
-        BigDecimal price = tbBusinessService.calculationPartMoney(startTime, now, tbBusinessCar.getCarSize());
+        BigDecimal price = tbBusinessService.calculationPartMoney(startTime, now, tbBusinessCar.getCarNo());
         Map<String, Object> car = new HashMap<>();
         car.put("id", tbBusinessCar.getId());
         car.put("carNo", tbBusinessCar.getCarNo());

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_account/AutomaticPay.java

@@ -430,7 +430,7 @@ public class AutomaticPay {
         if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getRealOutTime() == null && tbBusinessCar.getPayTime() != null) {
             inTime = tbBusinessCar.getPayTime();
         }
-        BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now, tbBusinessCar.getCarSize());
+        BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now, tbBusinessCar.getCarNo());
         tbBusinessCar.setMoney(price);
         return price;
     }

+ 17 - 14
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -66,6 +66,8 @@ import com.pj.project.tb_item.TbItem;
 import com.pj.project.tb_item.TbItemService;
 import com.pj.project.tb_item_type.TbItemType;
 import com.pj.project.tb_item_type.TbItemTypeService;
+import com.pj.project.tb_mild_car.TbMildCar;
+import com.pj.project.tb_mild_car.TbMildCarService;
 import com.pj.project.tb_notices.TbNoticesService;
 import com.pj.project.tb_sort_group.TbSortGroup;
 import com.pj.project.tb_sort_group.TbSortGroupService;
@@ -174,12 +176,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     @Resource
     @Lazy
     private TbFeeStatisticsService tbFeeStatisticsService;
+    @Resource
+    private TbMildCarService tbMildCarService;
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
-
-
     public void storeMsg(String businessCustomerId, String content) {
         String currentCustomerId = StpUserUtil.getCustomerId();
         if (StrUtil.equals(currentCustomerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
@@ -358,7 +360,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
 
-    public BigDecimal calculationPartMoney(Date iTime, Date oTime, double carSize) {
+    public BigDecimal calculationPartMoney(Date iTime, Date oTime, String carNo) {
         BigDecimal zero = new BigDecimal("0");
         if (iTime == null || oTime == null) {
             return zero;
@@ -373,7 +375,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         BigDecimal basePrice = partConfig.getBasePrice();
         BigDecimal uniPrice = basePrice.add(extraPrice);//超过24小时之后每24个小时收费金额
         //4.2~9.6
-        if (carSize <= partConfig.getMildCarLength() && carSize > partConfig.getFreeCarLength()) {
+        TbMildCar tbMildCar = tbMildCarService.findByCarNo(carNo);
+        if (tbMildCar != null) {
             basePrice = partConfig.getMildCarBasePrice();
             uniPrice = basePrice.add(extraPrice);
         }
@@ -454,7 +457,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 if (StrUtil.isEmpty(carType)) {
                     carType = CarEnum.CarTypeEnum.EMPTY_TYPE.getType();
                 }
-                BigDecimal partMoney = calculationPartMoney(inTime, outTime, tbBusinessCar.getCarSize());
+                BigDecimal partMoney = calculationPartMoney(inTime, outTime, tbBusinessCar.getCarNo());
                 if (StrUtil.isNotEmpty(tbBusinessCar.getColor()) && tbBusinessCar.getCarSize() != null) {
                     String freeColor = partConfig.getFreeColor();
                     //4.2米以下蓝色车辆
@@ -609,18 +612,18 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         List<PriceBO> priceBOList = new ArrayList<>();
         TbGoods tbGoods = tbGoodsService.getById(db.getGoodsId());
         //该确认确未确认
-        if (tbGoods.getPayStep().equals(GoodsEnum.PayStep.AFTER_CONFIRM.getCode()) &&db.getAdminConfirmInput()==0) {
+        if (tbGoods.getPayStep().equals(GoodsEnum.PayStep.AFTER_CONFIRM.getCode()) && db.getAdminConfirmInput() == 0) {
             throw new AjaxError("该业务需要确认后才能收费");
         }
         for (TbBusinessCar tbBusinessCar : cars) {
             String carNo = tbBusinessCar.getCarNo().toUpperCase();
-            String prefix=StrUtil.sub(carNo,0,1);
-            if (CAR_LIST.contains(prefix)&&tbGoods.getChinaCarPay()==1
-                    ||!CAR_LIST.contains(prefix)&&tbGoods.getVietnamCarPay()==1) {
+            String prefix = StrUtil.sub(carNo, 0, 1);
+            if (CAR_LIST.contains(prefix) && tbGoods.getChinaCarPay() == 1
+                    || !CAR_LIST.contains(prefix) && tbGoods.getVietnamCarPay() == 1) {
                 Date realInTime = tbBusinessCar.getRealInTime();
                 Date realOutTime = tbBusinessCar.getRealOutTime();
                 if (realInTime != null && realOutTime != null) {
-                    BigDecimal price = calculationPartMoney(realInTime, realOutTime, tbBusinessCar.getCarSize());
+                    BigDecimal price = calculationPartMoney(realInTime, realOutTime, tbBusinessCar.getCarNo());
                     if (price.doubleValue() > 0) {
                         PriceBO priceBO = new PriceBO();
                         priceBO.setId(tbBusinessCar.getId()).setP(price);
@@ -669,9 +672,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             //生成扣费记录
             automaticPay.createTbDeductionRecord(tbFeeDetailsList, tbAccount, plate, bind.getCustomerName(), no);
             automaticPay.unbindRun(plate);
-        }else if (payType == PayEnum.PayType.OFF_LINE_PAY.getCode()){
+        } else if (payType == PayEnum.PayType.OFF_LINE_PAY.getCode()) {
             //车辆的扣费记录
-            if (partMoney.doubleValue() > 0){
+            if (partMoney.doubleValue() > 0) {
                 tbFeeDetailsService.chargeParkFee(
                         priceBOList, null, null, payTime, PayEnum.PayType.OFF_LINE_PAY);
             }
@@ -1126,7 +1129,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             outTime = payTime;
         }
         //计算停车费
-        BigDecimal parkMoney = this.calculationPartMoney(inTime, outTime, tbBusinessCar.getCarSize());
+        BigDecimal parkMoney = this.calculationPartMoney(inTime, outTime, tbBusinessCar.getCarNo());
         tbBusinessCar.setMoney(parkMoney);
     }
 
@@ -1315,7 +1318,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         if (tbCostomer != null) {
             tbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
         }
-        boolean businessIsPay =PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus();
+        boolean businessIsPay = PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus();
         Date businessPayTime = errorBusinessBO.getPayTime();
 
         BigDecimal price = new BigDecimal("0");

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -256,7 +256,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         }
         if (t.getRealInTime() != null && t.getRealOutTime() != null
                 && StrUtil.equals(db.getPayType(), CarEnum.PayTypeEnum.NO_PAY_TYPE.getType())) {
-            BigDecimal money = tbBusinessService.calculationPartMoney(t.getRealInTime(), t.getRealOutTime(), t.getCarSize());
+            BigDecimal money = tbBusinessService.calculationPartMoney(t.getRealInTime(), t.getRealOutTime(), t.getCarNo());
             t.setMoney(money);
             db.setMoney(money);
         }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_business_item/PayTask.java

@@ -410,7 +410,7 @@ public class PayTask extends Task {
         if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getRealOutTime() == null && tbBusinessCar.getPayTime() != null) {
             inTime = tbBusinessCar.getPayTime();
         }
-        BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now,tbBusinessCar.getCarSize());
+        BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now,tbBusinessCar.getCarNo());
         return price;
     }
 

+ 4 - 3
sp-server/src/main/java/com/pj/project/tb_mild_car/TbMildCarService.java

@@ -86,8 +86,8 @@ public class TbMildCarService extends ServiceImpl<TbMildCarMapper, TbMildCar> im
         }
         String carNo = t.getCarNo().toUpperCase();
         t.setCarNo(carNo);
-        TbMildCar db=this.getById(t.getId());
-        if (!t.getCarLength().equals(db.getCarLength())){
+        TbMildCar db = this.getById(t.getId());
+        if (!t.getCarLength().equals(db.getCarLength())) {
             List<TbBusinessCar> businessCars = tbBusinessCarService.findByCarNo(carNo);
             businessCars.parallelStream().forEach(tbBusinessCar -> tbBusinessCar.setCarSize(t.getCarLength()));
             tbBusinessCarService.updateBatchById(businessCars);
@@ -135,6 +135,7 @@ public class TbMildCarService extends ServiceImpl<TbMildCarMapper, TbMildCar> im
     public TbMildCar findByCarNo(String carNo) {
         QueryWrapper<TbMildCar> ew = new QueryWrapper<>();
         ew.lambda().eq(TbMildCar::getCarNo, carNo);
-        return getOne(ew);
+        List<TbMildCar> list = list(ew);
+        return list.isEmpty() ? null : list.get(0);
     }
 }