Bladeren bron

Merge branch 'hpf' of http://47.101.143.145:8090/77975466/pco into hpf

qzyReal 2 jaren geleden
bovenliggende
commit
89a6b62005
1 gewijzigde bestanden met toevoegingen van 31 en 1 verwijderingen
  1. 31 1
      sp-server/src/main/java/com/pj/project/tb_account/AutomaticPay.java

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

@@ -443,11 +443,19 @@ public class AutomaticPay {
     }
 
     /**
-     * 根据车牌号判断,解绑
+     * 补录进场解绑逻辑
      * @return
      */
     private void autoUnbindCarByPlate(String plate){
         if(NbUtil.isNull(plate)) return;
+        TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(plate);
+        //离场逻辑
+        if (tbBusinessCar!=null){
+            if(doUnbindCarByPlate(tbBusinessCar)){
+                return;
+            }
+        }
+        //进场逻辑
         TbDeductionBind bind = deductionBindService.getOne(new LambdaQueryWrapper<TbDeductionBind>().eq(
                 TbDeductionBind::getBindCar,plate).isNull(TbDeductionBind::getUnbindTime));
         if(bind != null){
@@ -474,6 +482,28 @@ public class AutomaticPay {
     }
 
     /**
+     * 补录出场解绑逻辑
+     * @param tbBusinessCar
+     */
+    private boolean doUnbindCarByPlate(TbBusinessCar tbBusinessCar){
+        if (tbBusinessCar==null || tbBusinessCar.getRealOutTime()==null){
+            return false;
+        }
+        TbDeductionBind bind = deductionBindService.getOne(new LambdaQueryWrapper<TbDeductionBind>().eq(
+                TbDeductionBind::getBindCar,tbBusinessCar.getCarNo())
+                        .lt(TbDeductionBind::getBindTime,tbBusinessCar.getRealOutTime())
+                        .isNull(TbDeductionBind::getUnbindTime));
+        if(bind==null){
+            return false;
+        }
+        bind.setUpdateBy("预充值自动缴费解绑");
+        bind.setUpdateTime(new Date());
+        bind.setUnbindTime(new Date());
+        bind.updateById();
+        return true;
+    }
+
+    /**
      * 缓存任务,如果存在任务不继续往下执行
      * @param businessId
      * @param plate