| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.boying.common.R; |
| | | import com.boying.entity.Barrier; |
| | | import com.boying.entity.BarrierOpenLog; |
| | | import com.boying.entity.OutPark; |
| | | import com.boying.service.BarrierOpenLogService; |
| | | import com.boying.service.BarrierService; |
| | | import com.boying.service.OutParkService; |
| | | import com.boying.service.ParkService; |
| | |
| | | public class BarrierController { |
| | | |
| | | private final BarrierService barrierService; |
| | | private final BarrierOpenLogService barrierOpenLogService; |
| | | private final OutParkService outParkService; |
| | | private final ParkService parkService; |
| | | private StringRedisTemplate redisTemplate; |
| | |
| | | |
| | | |
| | | @PostMapping("openBarrier") |
| | | public Object openBarrier(Long barrierId,Integer type) { |
| | | public Object openBarrier(Long barrierId,Integer type,String carNo,String remark) { |
| | | Barrier b= barrierService.getById(barrierId); |
| | | if (b==null) { |
| | | return R.failed("未找到该道闸"); |
| | |
| | | try { |
| | | String jsonValue = JSON.toJSONString(b); |
| | | redisTemplate.opsForValue().set("barrier-"+b.getCode(), jsonValue); |
| | | BarrierOpenLog barrierOpenLog = new BarrierOpenLog(); |
| | | barrierOpenLog.setCarNo(carNo); |
| | | barrierOpenLog.setRemark(remark); |
| | | barrierOpenLog.setParkId(b.getParkId()); |
| | | barrierOpenLog.setType(b.getType()); |
| | | barrierOpenLogService.save(barrierOpenLog); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | try { |
| | | String jsonValue = JSON.toJSONString(b); |
| | | redisTemplate.opsForValue().set("barrier-"+b.getCode(), jsonValue); |
| | | BarrierOpenLog barrierOpenLog = new BarrierOpenLog(); |
| | | barrierOpenLog.setCarNo(carNo); |
| | | barrierOpenLog.setRemark(remark); |
| | | barrierOpenLog.setParkId(b.getParkId()); |
| | | barrierOpenLog.setType(b.getType()); |
| | | barrierOpenLogService.save(barrierOpenLog); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | try { |
| | | String jsonValue = JSON.toJSONString(b); |
| | | redisTemplate.opsForValue().set("barrier-"+b.getCode(), jsonValue); |
| | | BarrierOpenLog barrierOpenLog = new BarrierOpenLog(); |
| | | barrierOpenLog.setCarNo(carNo); |
| | | barrierOpenLog.setRemark(remark); |
| | | barrierOpenLog.setParkId(b.getParkId()); |
| | | barrierOpenLog.setType(b.getType()); |
| | | barrierOpenLogService.save(barrierOpenLog); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |