Explorar el Código

查询缴费车辆

qzyReal hace 2 años
padre
commit
79d0db03f9

+ 5 - 0
sp-admin/sa-view/tb-business/tb-car-disincle-edit.html

@@ -561,6 +561,11 @@
                 })
             },
             deleteFn(data) {
+				let confirmJudge=data.confirmJudge;
+				if(confirmJudge==1){
+					sa.error('业务已审核,请先驳回');
+					return;
+				}
                 this.car.list.splice(this.car.list.indexOf(data), 1);
                 this.filterItems();
             },

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

@@ -322,6 +322,7 @@ public class OpenService {
                 desc += " 停车费" + carMoney.toString() + "元";
             }
             log.error("请求返回:{},{}", carNo, desc);
+            RedisUtil.setByMINUTES(channel, carNo, 5);
             return ResultJson.error(desc);
         }
         //离场直接解绑

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

@@ -123,7 +123,11 @@ public class ApiService {
             return Collections.emptyList();
         }
         carNo = carNo.toUpperCase();
-        List<TbBusinessCar> businessCarList = tbBusinessCarService.findNotPayByCarNo(carNo);
+        //有业务的车
+        List<TbBusinessCar> businessCarList = tbBusinessCarService.searchForPayCar(carNo);
+        //无业务车
+        List<TbBusinessCar> noBusinessCarList = tbBusinessCarService.findNotPayByCarNo(carNo);
+        businessCarList.addAll(noBusinessCarList);
         return businessCarList.stream().map(tbBusinessCar -> {
             SearchBO searchBO = new SearchBO();
             searchBO.setId(tbBusinessCar.getId()).setCarNo(tbBusinessCar.getCarNo());

+ 10 - 3
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -571,7 +571,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                     carType = TbItem.ItemTypeEnum.EMPTY_TYPE.getType();
                 }
                 BigDecimal partMoney = calculationPartMoney(inTime, outTime, tbBusinessCar.getCarSize());
-                carMap.put("price", partMoney);
                 if (StrUtil.isNotEmpty(tbBusinessCar.getColor()) && tbBusinessCar.getCarSize() != null) {
                     String freeColor = partConfig.getFreeColor();
                     //4.2米以下蓝色车辆
@@ -588,15 +587,16 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                     partMoney = new BigDecimal("0");
                 }
                 if (TbBusinessCar.PayTypeEnum.FEE_TYPE.getType().equals(tbBusinessCar.getPayType())) {
-                    carMap.put("price", 0);
+                    partMoney = new BigDecimal("0");
                 }
+                carMap.put("price", partMoney);
             }
         }
         carMap.put("id", tbBusinessCar.getId());
         carMap.put("carNo", tbBusinessCar.getCarNo());
         carMap.put("pay", pay);
         carMap.put("no", tbBusinessCar.getNo());
-        result.put("carList",Collections.singleton(carMap));
+        result.put("carList", Collections.singleton(carMap));
         BigDecimal itemsPrice = new BigDecimal("0");
         List<Map<String, Object>> itemList = new ArrayList<>();
         //未支付的
@@ -1017,6 +1017,13 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     public void bindOtherBusinessCar(String businessId, List<String> businessCarIdList) {
         TbBusiness tbBusiness = this.getById(businessId);
+        List<TbBusinessCar> list = tbBusinessCarService.findOtherBusinessCar(businessId);
+        long count = list.stream().filter(tbBusinessCar -> tbBusinessCar.getConfirmJudge() == 1).count();
+        if (count > 0) {
+            throw new AjaxError("业务已审核,请先驳回审核");
+        }
+        list.stream().filter(tbBusinessCar -> !businessCarIdList.contains(tbBusinessCar.getId()) && tbBusinessCar.getRealInTime() == null)
+                .forEach(tbBusinessCar -> tbBusinessCarService.removeById(tbBusinessCar.getId()));
         relationBusinessCarService.removeByBusinessId(businessId);
         List<TbBusinessCar> carList = tbBusinessCarService.listByIds(businessCarIdList);
         String chinaCarNo = carList.stream().filter(tbBusinessCar -> {

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

@@ -42,6 +42,7 @@ public interface TbBusinessCarMapper extends BaseMapper<TbBusinessCar> {
 
     List<TbBusinessCar> findOtherBusinessCar(String businessId);
 
+    List<TbBusinessCar> searchForPayCar(@Param("carNo")String carNo);
 
     CarStatics staticsCar(@Param("weightCar") String weightCar, @Param("emptyCar") String emptyCar, @Param("list")List<String> list);
 

+ 13 - 1
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml

@@ -158,7 +158,19 @@
           and c.item_id = #{itemId};
 
     </select>
-
+    <select id="searchForPayCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
+        SELECT
+        distinct
+        a.*
+        FROM
+        tb_business_car a,
+        relation_business_car b,
+        tb_business c
+        WHERE
+        a.id = b.business_car_id
+        AND b.business_id = c.id
+        AND (c.pay_money &lt; c.item_price  or a.pay=0) AND a.car_no LIKE CONCAT('%',#{carNo},'%');
+    </select>
     <select id="findOtherBusinessCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
         select distinct a.*
         from tb_business_car a,

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

@@ -234,8 +234,8 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             throw new Exception("补录离场时间,请填写入场时间");
         }
         String carNo = t.getCarNo();
-        String color=t.getColor();
-        if (StrUtil.isEmpty(color)){
+        String color = t.getColor();
+        if (StrUtil.isEmpty(color)) {
             throw new AjaxError("车牌颜色不能为空");
         }
         if (color.contains(partConfig.getFreeColor())) {
@@ -393,7 +393,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
 
-
     public List<TbBusinessCar> findNotOutCarLike(String carNo) {
         if (StrUtil.isEmpty(carNo) || StrUtil.length(carNo) < 3) {
             return Collections.emptyList();
@@ -408,7 +407,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
 
-
     public List<TbBusinessCar> searchByNo(String carNo) {
         if (StrUtil.length(carNo) < 3) {
             return Collections.emptyList();
@@ -425,6 +423,9 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
 
+    public List<TbBusinessCar> searchForPayCar(String carNo) {
+        return tbBusinessCarMapper.searchForPayCar(carNo);
+    }
 
     public void outCar(String id, String outChannel, Date realOutTime) {
         Date now = new Date();
@@ -475,10 +476,15 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
      * @param judgeContent
      */
     public void callback(String id, String judgeContent) {
+        TbBusinessCar db = this.getById(id);
+        db.setConfirmJudge(TbBusinessCar.ConfirmJudgeEnum.CALL_BACK.getCode())
+                .setConfirmJudgeContent(judgeContent).setConfirmJudgeTime(new Date())
+                .setConfirmJudgeBy(StpUserUtil.getCreateBy());
+        this.updateById(db);
         List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(id);
         businessList.forEach(tbBusiness -> {
             List<TbBusinessCar> tbBusinessCars = this.findOtherBusinessCar(tbBusiness.getId());
-            tbBusinessCars.forEach(tbBusinessCar -> {
+            tbBusinessCars.stream().filter(tbBusinessCar -> !StrUtil.equals(tbBusinessCar.getId(),id)).forEach(tbBusinessCar -> {
                 tbBusinessCar.setConfirmJudge(TbBusinessCar.ConfirmJudgeEnum.CALL_BACK.getCode())
                         .setConfirmJudgeContent(judgeContent).setConfirmJudgeTime(new Date())
                         .setConfirmJudgeBy(StpUserUtil.getCreateBy());
@@ -507,14 +513,15 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
 
     /**
      * 未支付的车
+     *
      * @param carNo
      * @return
      */
     public List<TbBusinessCar> findNotPayByCarNo(String carNo) {
-        QueryWrapper<TbBusinessCar>ew=new QueryWrapper<>();
-        ew.lambda().like(TbBusinessCar::getCarNo,carNo)
-                .eq(TbBusinessCar::getPay,0)
-                .eq(TbBusinessCar::getPayType,TbBusinessCar.PayTypeEnum.NO_PAY_TYPE.getType());
+        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
+        ew.lambda().like(TbBusinessCar::getCarNo, carNo)
+                .eq(TbBusinessCar::getPay, 0)
+                .eq(TbBusinessCar::getPayType, TbBusinessCar.PayTypeEnum.NO_PAY_TYPE.getType());
         return list(ew);
     }
 }