| | |
| | | import com.boying.common.util.DateUtil; |
| | | import com.boying.common.util.HttpUtil; |
| | | import com.boying.common.util.StringUtil; |
| | | import com.boying.entity.Barrier; |
| | | import com.boying.entity.EnterPark; |
| | | import com.boying.entity.Park; |
| | | import com.boying.entity.User; |
| | | import com.boying.entity.*; |
| | | import com.boying.service.BarrierService; |
| | | import com.boying.service.EnterParkService; |
| | | import com.boying.service.OutParkService; |
| | | import com.boying.service.ParkService; |
| | | import io.netty.util.internal.ObjectUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.jpa.domain.Specification; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | private BarrierService barrierService; |
| | | @Autowired |
| | | private SystemConfigProperties systemConfigProperties; |
| | | @Autowired |
| | | private OutParkService outParkService; |
| | | |
| | | @PostMapping("findPage") |
| | | public Object findPage(int page,int pageSize,String parkId) { |
| | |
| | | barrierService.save(b); |
| | | return success("请求成功"); |
| | | } |
| | | |
| | | @PostMapping("openBarrier") |
| | | public Object openBarrier(Long barrierId,Integer type) { |
| | | Barrier b= (Barrier) barrierService.findById(barrierId); |
| | | if (b==null) { |
| | | return error("未找到该道闸"); |
| | | }else { |
| | | if(b.getType() == 1){ |
| | | //入口闸,直接开启 |
| | | b.setType2(1); |
| | | barrierService.save(b); |
| | | return success("请求成功"); |
| | | }else { |
| | | //出口闸,判断状态 |
| | | if(type == null || type == 0){ |
| | | //取消计费 |
| | | OutPark outPark = outParkService.findByCarNoAndBarrierId(b.getCarNo(), b.getId()); |
| | | if(outPark != null){ |
| | | outPark.setPrice(0); |
| | | outParkService.save(outPark); |
| | | } |
| | | b.setType2(1); |
| | | barrierService.save(b); |
| | | return success("请求成功"); |
| | | }else { |
| | | //计费 |
| | | b.setType2(1); |
| | | barrierService.save(b); |
| | | return success("请求成功"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |