| | |
| | | package api.controller; |
| | | |
| | | import api.bean.LampEntity; |
| | | import api.bean.ReqParams; |
| | | import api.bean.SinglelampDataEntity; |
| | | import api.result.Msg; |
| | | import api.service.AccessService; |
| | | import api.service.LampService; |
| | | import api.service.SinglelampDataServer; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.google.common.util.concurrent.RateLimiter; |
| | |
| | | |
| | | @RequestMapping(value = "/list",method = RequestMethod.POST) |
| | | public Msg list(@RequestBody ReqParams reqParams){ |
| | | System.out.println(reqParams.toString()); |
| | | rateLimiter.acquire(1); |
| | | if (reqParams.getLimit()>50){ |
| | | if (reqParams.getLimit()>200){ |
| | | return Msg.error("limit exception!!!"); |
| | | } |
| | | Long userId = accessService.getUserId(reqParams.getAccessToken()); |
| | | |
| | | if(userId == null){ |
| | | return Msg.error("server exception!!!"); |
| | | return Msg.error("accessToken exception!!!"); |
| | | } |
| | | reqParams.toString(); |
| | | |
| | |
| | | |
| | | Map data = new HashMap(); |
| | | |
| | | data.put("total",info.getTotal()); |
| | | data.put("dataSize",info.getStartRow()); |
| | | data.put("lampSize",info.getEndRow()); |
| | | data.put("totalPage",Math.ceil(info.getStartRow()*1.0/reqParams.getLimit())); |
| | | data.put("list",info.getList()); |
| | | |
| | | return Msg.ok().put("data",data); |
| | |
| | | Long userId = accessService.getUserId(reqParams.getAccessToken()); |
| | | |
| | | if(userId == null){ |
| | | return Msg.error("server exception!!!"); |
| | | return Msg.error("accessToken exception!!!"); |
| | | } |
| | | |
| | | PageInfo<SinglelampDataEntity> info = singlelampDataServer.selectByStreetlightId(reqParams); |