kongdeqiang
2024-03-25 d6aa1029a1c538cd2227f0026ad5adbaa1739726
出场车辆5分钟之内有正常出场记录的抬杆
3个文件已修改
48 ■■■■■ 已修改文件
src/main/java/com/boying/controller/car/PlateServlet3.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/OutParkService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/impl/OutParkServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/car/PlateServlet3.java
@@ -845,7 +845,28 @@
                noOpen(request,response,data1);
            }else {
                if(timeStamp.contains("记录异常")){
                    OutPark by5min = outParkService.findBy5min(carNo, parkId, LocalDateTime.now());
                    if(by5min != null){
                        //开闸
                        open(request,response,data1);
                        enterParkService.deleteByCarNo(carNo, parkId);
                        redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
                        int i = Integer.parseInt(redisnum);
                        i--;
                        if(i<0){
                            String s= "2."+carNo+",场内停车数为0\n";
                            writeTxt2(s);
                            redisTemplate.opsForValue().set("car_park_" + parkId,"0",30, TimeUnit.DAYS);
                            redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
                        }else {
                            String s= "2."+carNo+",场内停车数为"+i+"\n";
                            writeTxt2(s);
                            redisTemplate.opsForValue().set("car_park_" + parkId,Integer.toString(i),30, TimeUnit.DAYS);
                            redisTemplate.opsForValue().set("park_up_" + parkId,"true",30, TimeUnit.DAYS);
                        }
                    }else {
                    noOpen(request,response,data1);
                    }
                }else {
                    //开闸
                    open(request,response,data1);
src/main/java/com/boying/service/OutParkService.java
@@ -4,6 +4,7 @@
import com.boying.entity.OutPark;
import com.boying.entity.Statistic;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -41,5 +42,7 @@
    OutPark findByOrderId(String txnOrderId);
    OutPark findBy5min(String carNo, Integer parkId, LocalDateTime dateTime);
}
src/main/java/com/boying/service/impl/OutParkServiceImpl.java
@@ -19,6 +19,7 @@
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -190,6 +191,29 @@
    }
    @Override
    public OutPark findBy5min(String carNo, Integer parkId,LocalDateTime dateTime) {
        LocalDateTime localDateTime = dateTime.minusMinutes(5);
        QueryWrapper<OutPark> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(OutPark::getCarNo,carNo)
                .eq(OutPark::getParkId,parkId)
                .ge(OutPark::getCreateTime,localDateTime)
                .isNotNull(OutPark::getEnterTime);
        List<OutPark> outParks = outParkMapper.selectList(wrapper);
        if(outParks != null && outParks.size()>0){
            for (OutPark outPark : outParks) {
                if(outPark.getPrice() == 0){
                    return outPark;
                }
                if(outPark.getPrice() != 0 && outPark.getStatus() == 1){
                    return outPark;
                }
            }
        }
        return null;
    }
    @Override
    public List<OutPark> getList(long current, long size, String carNo, Long parkId, String payCode, String date) {
        return outParkMapper.getList((current-1)*size,size,carNo,parkId,payCode,date);
    }