Pārlūkot izejas kodu

离场记录小于5秒的算无效记录

qzyReal 3 gadi atpakaļ
vecāks
revīzija
49e173b134

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

@@ -36,6 +36,7 @@ import com.pj.project.tb_item_type.TbItemType;
 import com.pj.project4sp.global.BusinessException;
 import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.cache.RedisUtil;
+import com.pj.utils.sg.AjaxJson;
 import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
@@ -84,8 +85,6 @@ public class OpenService {
     private TbGoodsService tbGoodsService;
 
 
-
-
     public ResultJson checkCarNumber(CheckCarNumberBO checkCarNumberBO) {
         String carNo = checkCarNumberBO.getCarNumber();
         int inOrOut = checkCarNumberBO.getInOrOut();
@@ -152,11 +151,16 @@ public class OpenService {
             log.error("请求返回【未查询到入场记录】:{}", carNo);
             return ResultJson.error("未查询到入场记录");
         }
+        Date now = new Date();
+        Date realInTime=tbBusinessCar.getRealInTime();
+        if (now.getTime()/1000-realInTime.getTime()/1000<5){
+            log.error("请求返回【无效离场记录,返回到设备端为:“未查询到入场记录”让其停止轮询】:{}", carNo);
+            return ResultJson.error("无效离场记录");
+        }
         if (StrUtil.isNotEmpty(image)) {
             StaticLog.error("缓存离场图片,{}", carNo);
             IMAGE_CACHE.put(carNo, image);
         }
-        Date now = new Date();
         //判断是否蓝色车牌===免停车费
         if (StrUtil.isNotEmpty(tbBusinessCar.getColor())) {
             List<TbCarNoColor> freeList = tbCarNoColorService.getFreeColor();
@@ -179,7 +183,7 @@ public class OpenService {
         }
         String businessCarId = tbBusinessCar.getId();
         //String carNoPrefix = StrUtil.sub(carNo, 0, 1);
-        String carType=tbBusinessCar.getCarType();
+        String carType = tbBusinessCar.getCarType();
         List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
         if (businessList.isEmpty()) {//无业务车辆===>计算停车费
             //如果已经支付过,则从支付时间算起,重新计算停车费

+ 2 - 2
sp-server/src/main/resources/application-dev.yml

@@ -6,9 +6,9 @@ spring:
     # 数据源配置
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        url: jdbc:mysql://127.0.0.1:3307/pco?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
         username: root
-        password: 1234
+        password: 123456
         # 是否打开sql监控台  (生产环境请务必关闭此选项)
         druid:
             stat-view-servlet: