| | |
| | | public static final String DEVICE_STATE_MIDDLE ="2"; |
| | | public static final String DEVICE_STATE_SERIOUS ="3"; |
| | | public static final String DEVICE_STATE_OFFLINE ="4"; |
| | | public static final String DEVICE_STATE_MAINTENANCE ="9"; |
| | | } |
| | | |
| | |
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "mac",defaultValue = "p5dnd7a0391956", value = "设备mac码", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<Map<String, Object>> getLimitDataByDevice(HttpServletRequest request) throws Exception {
|
| | | public ResultBean<List<Map<String, Object>>> getLimitDataByDevice(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
|
| | | String density = deviceService.getLimitDataByDevice(parameters);
|
| | | JSONObject parseObject = JSONObject.parseObject(density);
|
| | | return new ResultBean<Map<String, Object>>(parseObject);
|
| | | List<Map<String, Object>> resuList = new ArrayList<Map<String,Object>>();
|
| | | for (Map.Entry entry : parseObject.entrySet()) {
|
| | | resuList.add(new HashMap<String, Object>() {
|
| | | {
|
| | | put("key",entry.getKey());
|
| | | put("limit", entry.getValue());
|
| | | }
|
| | | });
|
| | | }
|
| | | return new ResultBean<List<Map<String, Object>>>(resuList);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | ValidateUtil.notNull(parameters.get("old_state"), "param.is.null");
|
| | | ValidateUtil.notNull(parameters.get("new_state"), "param.is.null");
|
| | | int count = 0;
|
| | | if ("4".equals(parameters.get("old_state")) && "9".equals(parameters.get("new_state"))) {
|
| | | if (Constants.DEVICE_STATE_OFFLINE.equals(parameters.get("old_state")) && Constants.DEVICE_STATE_MAINTENANCE.equals(parameters.get("new_state"))) {
|
| | | Device device = new Device();
|
| | | Example example = new Example(ENTITY_CLASS);
|
| | | example.and().andEqualTo("id", new Integer(parameters.get("id").toString())).andEqualTo("state", "4");
|
| | | device.setState("9");
|
| | | example.and().andEqualTo("id", new Integer(parameters.get("id").toString())).andEqualTo("state", Constants.DEVICE_STATE_OFFLINE);
|
| | | device.setState(Constants.DEVICE_STATE_MAINTENANCE);
|
| | | count = deviceMapper.updateByExampleSelective(device, example);
|
| | | }
|
| | | if (count == 0) {
|