Forráskód Böngészése

预支付自动缴费逻辑修改

huangpeifeng 2 éve
szülő
commit
4bdd40fe3c

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

@@ -69,7 +69,6 @@ public class AutomaticPay {
     @Lazy
     private TbDeductionBindService tbDeductionBindService;
 
-    private Integer feeType;
 
 
     /**
@@ -80,8 +79,8 @@ public class AutomaticPay {
      * @param feeType    收费类型,1-只收停车费、2-只收业务费,3-停车和业务费
      */
     //TODO 不要在此方法写逻辑
+    @Async
     public void run(String businessId, String plate, Integer feeType) {
-        this.feeType = feeType;
         task(businessId, plate, feeType);
     }
 
@@ -114,10 +113,10 @@ public class AutomaticPay {
         } else if (feeType == 2) {
             List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(businessId);
             for (TbBusinessCar car : cars) {
-                this.doBusinessFee(businessId, car.getCarNo());
+                this.doBusinessFee(businessId, car.getCarNo(), feeType);
             }
         } else if (feeType == 3) {
-            doOutFee(plate);
+            doOutFee(plate, feeType);
         }
         delRedisTask(businessId, plate);
     }
@@ -127,7 +126,7 @@ public class AutomaticPay {
      *
      * @param businessId
      */
-    private void doBusinessFee(String businessId, String plate) {
+    private void doBusinessFee(String businessId, String plate, Integer feeType) {
         if (!NumberUtil.isNumber(businessId) || NbUtil.isNull(plate)) {
             return;
         }
@@ -155,7 +154,7 @@ public class AutomaticPay {
         BigDecimal balance = totalMoneyBig.subtract(tbBusiness.getItemPrice());
         //是否离场支付
         boolean isOut = (TbGoods.DeductionTypeEnum.OUT_KK.getCode().equals(tbBusiness.getAutoDeductionType())) &&
-                this.feeType == 3;
+                feeType == 3;
         if (isOut) {
             parkingMoneyBig = getParkings(cars);
             balance = balance.subtract(parkingMoneyBig);
@@ -215,7 +214,7 @@ public class AutomaticPay {
      *
      * @param plate
      */
-    private void doOutFee(String plate) {
+    private void doOutFee(String plate, Integer feeType) {
         if (NbUtil.isNull(plate)) {
             return;
         }
@@ -231,7 +230,7 @@ public class AutomaticPay {
             List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(business.getId());
             if (cars == null) continue;
             for (TbBusinessCar car : cars) {
-                doBusinessFee(business.getId(), car.getCarNo());
+                doBusinessFee(business.getId(), car.getCarNo(), feeType);
             }
         }