| | |
| | | import com.boying.service.*; |
| | | import com.boying.util.DateUtilOther; |
| | | import com.boying.util.FileUtil; |
| | | import com.boying.util.RedisJsonUtil; |
| | | import com.boying.util.StringUtil; |
| | | import com.google.gson.JsonObject; |
| | | import com.google.gson.JsonParser; |
| | |
| | | private final FileInfoService fileInfoService; |
| | | private final TicketBlackService ticketBlackService; |
| | | private final OutParkLogService outParkLogService; |
| | | // private final RedisJsonUtil redisJsonUtil; |
| | | private final String LEDURL = "http://192.168.31.212:9988/LedShow/IGetResultDataAllLine"; |
| | | |
| | | /** |
| | |
| | | @PostMapping("/status") |
| | | public void heart(String serialno,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { |
| | | Barrier barrier = barrierService.findByCode(serialno); |
| | | // Park park = parkService.getOneById(barrier.getParkId()); |
| | | Park park = parkService.getById(barrier.getParkId()); |
| | | String redis = redisTemplate.opsForValue().get("park_up_" + park.getId()); |
| | | String redisnum = redisTemplate.opsForValue().get("car_park_" + park.getId()); |
| | |
| | | barrier.setStatus(0); |
| | | barrier.setUpdateTime(LocalDateTime.now()); |
| | | barrierService.saveOrUpdate(barrier); |
| | | |
| | | // String jsonValue = JSON.toJSONString(barrier); |
| | | // redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue); |
| | | easyOpen(request,response); |
| | | }else { |
| | | //不需开闸 |
| | | barrier.setStatus(0); |
| | | barrier.setUpdateTime(LocalDateTime.now()); |
| | | barrierService.saveOrUpdate(barrier); |
| | | OutPark outPark = outParkService.count4(barrier.getId()); |
| | | if(outPark!=null){ |
| | | if(barrier.getType() == 0){ |
| | | int i = Integer.parseInt(redisnum); |
| | | i--; |
| | | if(i<0){ |
| | | String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n"; |
| | | writeTxt2(s); |
| | | redisTemplate.opsForValue().set("car_park_" + park.getId(),"0",30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS); |
| | | }else { |
| | | String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n"; |
| | | writeTxt2(s); |
| | | redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS); |
| | | |
| | | // String jsonValue = JSON.toJSONString(barrier); |
| | | // redisTemplate.opsForValue().set("barrier-"+barrier.getCode(), jsonValue); |
| | | if(barrier.getType() == 0){ |
| | | OutPark outPark = outParkService.count4(barrier.getId()); |
| | | if(outPark!=null){ |
| | | if(barrier.getType() == 0){ |
| | | int i = Integer.parseInt(redisnum); |
| | | i--; |
| | | if(i<0){ |
| | | String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n"; |
| | | writeTxt2(s); |
| | | redisTemplate.opsForValue().set("car_park_" + park.getId(),"0",30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS); |
| | | }else { |
| | | String s= "2."+outPark.getCarNo()+"缴费完成,场内停车数为"+i+"\n"; |
| | | writeTxt2(s); |
| | | redisTemplate.opsForValue().set("car_park_" + park.getId(),Integer.toString(i),30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("park_up_" + park.getId(),"true",30, TimeUnit.DAYS); |
| | | } |
| | | } |
| | | outPark.setStatus2(1); |
| | | outParkService.saveOrUpdate(outPark); |
| | | easyOpen(request,response); |
| | | 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()); |
| | | } |
| | | outPark.setStatus2(1); |
| | | outParkService.saveOrUpdate(outPark); |
| | | easyOpen(request,response); |
| | | easyOpen(request,response); |
| | | OutParkLog byOutPark = outParkLogService.getByOutPark(outPark.getCarNo(), outPark.getId()); |
| | | byOutPark.setOpenTime(LocalDateTime.now()); |
| | | outParkLogService.saveOrUpdate(byOutPark); |
| | | enterParkService.deleteByCarNo(outPark.getCarNo(), barrier.getParkId()); |
| | | } |
| | | if(barrier.getType() == 1){ |
| | | boolean in = barrierService.getDateDifIn(barrier.getId()); |