Selaa lähdekoodia

越南车除了整车业务外需要收取停车费

qzyReal 2 vuotta sitten
vanhempi
commit
780d77fad4

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+/sp-admin/.idea/

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-22332
+19272

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

@@ -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);

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -220,7 +220,7 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
     private String checkReport;
     private String outReport;
     /**
-     * 业务类型(1=车辆消杀,2=录入业务)
+     * 业务类型(1=其他业务,2=整车业务)
      */
     private Integer businessType=2;
     private String itemTypeId;

+ 19 - 13
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -199,7 +199,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode()).setBusinessType(tbItem.getBusinessType())
                     .setPayType(tbItem.getPayType()).setPayTypeName(tbItem.getPayTypeName())
                     .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
-                    .setTaxRate(NumberUtil.div(tbItem.getTaxRate().doubleValue(),100D,2))
+                    .setTaxRate(NumberUtil.div(tbItem.getTaxRate().doubleValue(), 100D, 2))
                     .setItemTypeId(typeId).setItemTypeName(tbItemType.getName()).setBusinessType(tbItemType.getBusinessType())
                     .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice())).setCreateTime(new Date())
                     .setNo(t.getNo() + "0" + index);
@@ -349,16 +349,16 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 String businessType = item.getBusinessType();
                 if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
                     String remark = "车牌:";
-                   String carNo=business.getCardNo();
-                   String chinaCarNo=business.getChinaCarNo();
-                   if (StrUtil.isNotEmpty(carNo)&&StrUtil.isNotEmpty(chinaCarNo)){
-                       remark +=carNo+ "、" + chinaCarNo;
-                   }
-                    if (StrUtil.isEmpty(carNo)&&StrUtil.isNotEmpty(chinaCarNo)){
-                        remark +=chinaCarNo;
+                    String carNo = business.getCardNo();
+                    String chinaCarNo = business.getChinaCarNo();
+                    if (StrUtil.isNotEmpty(carNo) && StrUtil.isNotEmpty(chinaCarNo)) {
+                        remark += carNo + "、" + chinaCarNo;
                     }
-                    if (StrUtil.isNotEmpty(carNo)&&StrUtil.isEmpty(chinaCarNo)){
-                        remark +=carNo;
+                    if (StrUtil.isEmpty(carNo) && StrUtil.isNotEmpty(chinaCarNo)) {
+                        remark += chinaCarNo;
+                    }
+                    if (StrUtil.isNotEmpty(carNo) && StrUtil.isEmpty(chinaCarNo)) {
+                        remark += carNo;
                     }
                     MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), item.getItemTypeName(), item.getItemName(), business.getGoodsName(), DateUtil.now(), remark);
                     StrUtil.splitTrim(businessType, ",").forEach(type -> {
@@ -508,14 +508,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             Date inTime = tbBusinessCar.getRealInTime();
             BigDecimal partMoney = new BigDecimal("0");
             String carNo = tbBusinessCar.getCarNo().substring(0, 1);
-            if (inTime != null && CAR_LIST.contains(carNo)) {
+            if (inTime != null) {
                 if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getPayTime() != null) {
                     inTime = tbBusinessCar.getPayTime();
                 }
                 partMoney = this.calculationPartMoney(inTime, now);
             }
-//            BigDecimal hasPayMoney = tbBusinessCar.getMoney();
-//            partMoney = partMoney.subtract(hasPayMoney);
             if (StrUtil.isNotEmpty(tbBusinessCar.getColor())) {
                 List<TbCarNoColor> freeList = tbCarNoColorService.getFreeColor();
                 List<String> colorList = freeList.stream().map(f -> f.getCarNoColor().substring(0, 1)).collect(Collectors.toList());
@@ -524,6 +522,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                     partMoney = new BigDecimal("0");
                 }
             }
+            //越南车
+            if (!CAR_LIST.contains(carNo)) {
+                TbBusiness tbBusiness = this.getById(businessId);
+                //整车业务免费
+                if (tbBusiness != null && Objects.equals(tbBusiness.getBusinessType(), TbBusiness.BusinessType.HOLD_CAR.getCode())) {
+                    partMoney = new BigDecimal("0");
+                }
+            }
             Map<String, Object> carMap = new HashMap<>();
             carMap.put("price", partMoney);
             carMap.put("id", tbBusinessCar.getId());

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

@@ -268,7 +268,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         if (db != null) {
             throw new Exception("该车有未完成业务");
         }
-        t.setCarNo(carNo).setPay(0).setCarSize(0D).setIsLock(0).setBasePartMoney(new BigDecimal("0"))
+        t.setCarNo(carNo).setPay(0).setIsLock(0).setBasePartMoney(new BigDecimal("0")).setTimeUpdate(new Date())
                 .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
         this.save(t);
     }