| | |
| | | out.close(); |
| | | } |
| | | |
| | | protected void easyOpen2(HttpServletRequest request, HttpServletResponse response) throws IOException { |
| | | response.setContentType("text/json"); |
| | | PrintWriter out = response.getWriter(); |
| | | out.println("{\"Response_AlarmInfoPlate\":{\"ivs_ioctrl\":{\"delay\":1000,\"io\":0,\"value\":2}}}"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | |
| | | protected void easyNoOpen(HttpServletRequest request, HttpServletResponse response) throws IOException { |
| | | response.setContentType("text/json"); |
| | | PrintWriter out = response.getWriter(); |
| | |
| | | inLedFullShow(code, license,barrier.getParkId(),request,response); |
| | | }else { |
| | | //led显示 |
| | | inLedShow(code, license,barrier.getParkId(),request,response); |
| | | enterPark(license,barrier.getId(),barrier.getParkId(),fileInfo); |
| | | inLedShow(code, license,barrier.getParkId(),request,response); |
| | | s+=license+"-保存入场记录\n"; |
| | | } |
| | | } |
| | |
| | | if(one == null){ |
| | | return R.failed("未查询到车辆存在"); |
| | | }else { |
| | | if(one.getCarNo().equals("无牌车")){ |
| | | if(one.getCarNo().equals("_无_")){ |
| | | enterPark.setCreateTime(LocalDateTime.now()); |
| | | QueryWrapper<Ticket> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | writeTxt2(s); |
| | | String jsonValue = JSON.toJSONString(outPark); |
| | | redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue); |
| | | outLedShow(barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,0); |
| | | outLedShow(outPark,barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,0); |
| | | }else { |
| | | //需要缴费或者有违章 |
| | | System.out.println(outPark.getCarNo()+"该车需要缴费"+outPark.getPrice()); |
| | |
| | | outParkLogService.saveOrUpdate(byOutPark); |
| | | String jsonValue = JSON.toJSONString(outPark); |
| | | redisTemplate.opsForValue().set("outPark_dif_"+ barrierId, jsonValue); |
| | | outLedShow(barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,1); |
| | | outLedShow(outPark,barrier.getCode(),barrier.getCarNo(),outPark.getPrice(),toDayHrMinSec,barrier.getParkId(),request,response,1); |
| | | } |
| | | return money; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | if(StringUtils.isBlank(carDay) && !carNo.equals("无车牌")){ |
| | | if(StringUtils.isBlank(carDay) && !carNo.equals("_无_")){ |
| | | carDay = "欢迎光临"; |
| | | }else if(StringUtils.isBlank(carDay) && carNo.equals("无车牌")){ |
| | | }else if(StringUtils.isBlank(carDay) && carNo.equals("_无_")){ |
| | | carDay = "拒绝驶入"; |
| | | } |
| | | |
| | |
| | | String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "="; |
| | | data1 = data1.replaceAll("\r\n", ""); |
| | | |
| | | if(!carNo.equals("无车牌")){ |
| | | if(!carNo.equals("_无_")){ |
| | | open(request,response,data1);//入场开闸 |
| | | }else { |
| | | noOpen(request,response,data1); |
| | |
| | | noOpen(request,response,data1);//入场开闸 |
| | | } |
| | | |
| | | public void outLedShow(String ledId,String carNo,Double price,String timeStamp,Integer parkId,HttpServletRequest request, HttpServletResponse response,int type) throws ServletException, IOException { |
| | | public void outLedShow(OutPark outPark,String ledId,String carNo,Double price,String timeStamp,Integer parkId,HttpServletRequest request, HttpServletResponse response,int type) throws ServletException, IOException { |
| | | String redisnum = redisTemplate.opsForValue().get("car_park_" + parkId); |
| | | Park park = parkService.getById(parkId); |
| | | LedBean ledBean = new LedBean(); |
| | |
| | | String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "="; |
| | | data1 = data1.replaceAll("\r\n", ""); |
| | | if(type == 0){ |
| | | if(carNo.equals("无车牌")){ |
| | | if(carNo.equals("_无_")){ |
| | | noOpen(request,response,data1); |
| | | }else { |
| | | if(timeStamp.contains("记录异常")){ |
| | | noOpen(request,response,data1); |
| | | 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); |
| | | enterParkService.deleteByCarNo(carNo, parkId); |
| | | // open(request,response,data1); |
| | | |
| | | //缓存在redis里,心跳接口去抬杆 |
| | | String jsonValue = JSON.toJSONString(outPark); |
| | | redisTemplate.opsForValue().set("outPark-"+outPark.getBarrierId(), jsonValue); |
| | | |
| | | //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); |
| | | } |
| | | // 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); |
| | | // } |
| | | } |
| | | |
| | | } |