kongdeqiang
19 小时以前 973f7a2b420dddb06553489d72d4aa6fdea3c1c0
src/main/java/com/boying/controller/car/PlateServlet3.java
@@ -226,12 +226,19 @@
                        outPark.setStatus2(1);
                        outParkService.saveOrUpdate(outPark);
                        OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId());
                        byOutPark.setOpenTime(LocalDateTime.now());
                        outParkLogService.saveOrUpdate(byOutPark);
                        enterParkService.deleteByCarNo(outPark.getCarNo(), barrier.getParkId());
                        redisTemplate.delete("outPark-"+outPark.getBarrierId());
                        try {
                            OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId());
                            byOutPark.setOpenTime(LocalDateTime.now());
                            outParkLogService.saveOrUpdate(byOutPark);
                            enterParkService.deleteByCarNo(outPark.getCarNo(), barrier.getParkId());
                            redisTemplate.delete("outPark-"+outPark.getBarrierId());
                        }catch (Exception e){
                            String logs = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss").format(new Date())+
                                    " 车牌号为:"+outPark.getCarNo()+
                                    ",修改出场日志报错\n";
                            System.out.println(logs);
                            e.printStackTrace();
                        }
                        easyOpen(request,response);
                    }else {
@@ -890,10 +897,26 @@
                        noOpen(request,response,data1);
                    }
                }else {
                    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);
                    }
                    open(request,response,data1);
                    //缓存在redis里,心跳接口去抬杆
                    String jsonValue = JSON.toJSONString(outPark);
                    redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
                    redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
//                    String jsonValue = JSON.toJSONString(outPark);
//                    redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
//                    redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
                }
            }
        }else {
@@ -924,10 +947,25 @@
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        if(type == 0){
            //缓存在redis里,心跳接口去抬杆
            String jsonValue = JSON.toJSONString(outPark);
            redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
            redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
            int i = Integer.parseInt(redisnum);
            i--;
            if(i<=0){
                String s= "2."+carNo+"缴费完成,场内停车数为"+i+"\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);
            }
            open(request,response,data1);
//            //缓存在redis里,心跳接口去抬杆
//            String jsonValue = JSON.toJSONString(outPark);
//            redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue);
//            redisTemplate.opsForValue().set("park_change_in_"+parkId,"true",1, TimeUnit.DAYS);
        }else {
            noOpen(request,response,data1);
        }