| | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.boying.common.R; |
| | | import com.boying.entity.EnterPark; |
| | | import com.boying.entity.Park; |
| | | import com.boying.entity.User; |
| | | import com.boying.service.EnterParkService; |
| | | import com.boying.service.ParkService; |
| | | import com.boying.service.UserService; |
| | | import com.boying.util.RedisJsonUtil; |
| | |
| | | private final ParkService parkService; |
| | | private final UserService userService; |
| | | private final RedisJsonUtil redisJsonUtil; |
| | | private final EnterParkService enterParkService; |
| | | |
| | | @PostMapping("/findPage") |
| | | public Object findPage(Page page) { |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/getParkCar") |
| | | public Object getParkCar(Page page, Integer parkId,String carNo) { |
| | | QueryWrapper<EnterPark> enterParkQueryWrapper = new QueryWrapper<>(); |
| | | enterParkQueryWrapper.lambda() |
| | | .eq(parkId != null,EnterPark::getParkId,parkId) |
| | | .like(StringUtils.isNotBlank(carNo),EnterPark::getCarNo,carNo) |
| | | .orderByDesc(EnterPark::getCreateTime); |
| | | Page<EnterPark> page1 = enterParkService.page(page, enterParkQueryWrapper); |
| | | for (EnterPark record : page1.getRecords()) { |
| | | record.setParkName(parkService.getById(record.getParkId()).getName()); |
| | | if(record.getImgId() != null){ |
| | | record.setImgPath("/ffzf/fileinfo/showImgById/"+record.getImgId()); |
| | | } |
| | | } |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | 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(); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | |
| | | }else { |
| | | //开闸 |
| | | 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); |