| | |
| | | import com.boying.service.BarrierService; |
| | | import com.boying.service.LedShowService; |
| | | import com.boying.service.ParkService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | @RestController |
| | | @RequestMapping("ledshow") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ledshow" , name = "led日志(已废弃)" ) |
| | | public class LedShowController { |
| | | |
| | | private final LedShowService ledShowService; |
| | | private final BarrierService barrierService; |
| | | private final ParkService parkService; |
| | | private final StringRedisTemplate redisTemplate; |
| | | |
| | | private Boolean flag = false; |
| | | |
| | | @GetMapping("/getNew") |
| | | public Object getNew(Integer number) { |
| | |
| | | String num = redisTemplate.opsForValue().get("car_park_" + byCode.getParkId()); |
| | | Park byId = parkService.getById(byCode.getParkId()); |
| | | int i = byId.getNum() - Integer.parseInt(num); |
| | | o.setStatus(0); |
| | | ledShowService.saveOrUpdate(o); |
| | | return R.ok(o,i+""); |
| | | }else { |
| | | QueryWrapper<LedShow> wrapper1 = new QueryWrapper<>(); |
| | |
| | | |
| | | @GetMapping("/getNew2") |
| | | public Object getNew2(String code) { |
| | | if(flag){ |
| | | return null; |
| | | } |
| | | flag = true; |
| | | Barrier byCode = barrierService.findByCode(code); |
| | | if(byCode != null){ |
| | | QueryWrapper<LedShow> wrapper = new QueryWrapper<>(); |
| | |
| | | String num = redisTemplate.opsForValue().get("car_park_" + byCode.getParkId()); |
| | | Park byId = parkService.getById(byCode.getParkId()); |
| | | int i = byId.getNum() - Integer.parseInt(num); |
| | | o.setStatus(0); |
| | | ledShowService.saveOrUpdate(o); |
| | | flag = false; |
| | | return R.ok(o,i+""); |
| | | }else { |
| | | String num = redisTemplate.opsForValue().get("car_park_" + byCode.getParkId()); |
| | | Park byId = parkService.getById(byCode.getParkId()); |
| | | int i = byId.getNum() - Integer.parseInt(num); |
| | | flag = false; |
| | | return R.ok(null,i+""); |
| | | } |
| | | }else { |
| | | flag = false; |
| | | return R.failed("未查询到此闸机"); |
| | | } |
| | | } |
| | |
| | | |
| | | @GetMapping("/updateLedShow") |
| | | public Object updateLedShow(Integer id) { |
| | | LedShow byId = ledShowService.getById(id); |
| | | byId.setStatus(0); |
| | | ledShowService.saveOrUpdate(byId); |
| | | return R.ok("查询成功","查询成功"); |
| | | } |
| | | |