|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletRequest; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.moral.api.service.DeviceService; | 
|---|
|  |  |  | import com.moral.api.service.SysAreaService; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.constant.ResultMessage; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysAreaService sysAreaService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeviceService deviceService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @param request 请求信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> response = sysAreaService.getMapPath(Integer.parseInt(params.get("organizationId").toString())); | 
|---|
|  |  |  | return ResultMessage.ok(response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @param request 请求信息 | 
|---|
|  |  |  | * @return 返回请求成功后的对象信息 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping("getDevicesByOrganizationId") | 
|---|
|  |  |  | @ApiOperation(value = "获取当前组织下设备列表", notes = "获取当前组织下设备列表") | 
|---|
|  |  |  | @ApiImplicitParams(value = { | 
|---|
|  |  |  | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "organizationId", value = "组织id", required = true, paramType = "query", dataType = "String") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultMessage getDevicesByOrganizationId(HttpServletRequest request) { | 
|---|
|  |  |  | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); | 
|---|
|  |  |  | if (!params.containsKey("organizationId")) { | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Map<String, Object>> response = deviceService.getDevicesByOrganizationId(Integer.parseInt(params.get("organizationId").toString())); | 
|---|
|  |  |  | return ResultMessage.ok(response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|