|  | @ -17,50 +17,49 @@ import java.util.List;
 | 
	
		
			
				|  |  | @RequestMapping(value = "/common/device", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | @Api(description = "设备管理")
 | 
	
		
			
				|  |  | public class DeviceController extends BaseController {
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private DeviceService deviceService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DeviceService deviceService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	@ApiOperation("获取设备分类")
 | 
	
		
			
				|  |  | 	@RequestMapping(value = "DeviceCategory",method = RequestMethod.POST)
 | 
	
		
			
				|  |  | 	@ResponseBody
 | 
	
		
			
				|  |  | 	public String getDeviceCategory() {
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			List<DeviceCategory> list = deviceService.findAllCategory();
 | 
	
		
			
				|  |  | 			return write(200,"获取设备分类成功!","data",list);
 | 
	
		
			
				|  |  | 		} catch (Exception ex) {
 | 
	
		
			
				|  |  | 			error(ex);
 | 
	
		
			
				|  |  | 			return invalidUserException(ex, -1, "获取设备分类失败!");
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  |     @ApiOperation("获取设备分类")
 | 
	
		
			
				|  |  |     @RequestMapping(value = "DeviceCategory", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public String getDeviceCategory() {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<DeviceCategory> list = deviceService.findAllCategory();
 | 
	
		
			
				|  |  |             return write(200, "获取设备分类成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception ex) {
 | 
	
		
			
				|  |  |             error(ex);
 | 
	
		
			
				|  |  |             return invalidUserException(ex, -1, "获取设备分类失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	@ApiOperation("获取设备列表")
 | 
	
		
			
				|  |  | 	@RequestMapping(value = "DeviceList",method = RequestMethod.POST)
 | 
	
		
			
				|  |  | 	@ResponseBody
 | 
	
		
			
				|  |  | 	public String getDeviceList(@ApiParam(name="category_code",value="设备类型代码",defaultValue = "1")
 | 
	
		
			
				|  |  | 								 @RequestParam(value="category_code",required = true) String categoryCode) {
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			List<Device> list = deviceService.findDeviceByCategory(categoryCode);
 | 
	
		
			
				|  |  | 			return write(200,"获取设备列表成功!","data",list);
 | 
	
		
			
				|  |  | 		} catch (Exception ex) {
 | 
	
		
			
				|  |  | 			error(ex);
 | 
	
		
			
				|  |  | 			return invalidUserException(ex, -1, "获取设备列表失败!");
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  |     @ApiOperation("获取设备列表")
 | 
	
		
			
				|  |  |     @RequestMapping(value = "DeviceList", method = {RequestMethod.POST, RequestMethod.GET})
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public String getDeviceList(@ApiParam(name = "category_code", value = "设备类型代码", defaultValue = "1")
 | 
	
		
			
				|  |  |                                 @RequestParam(value = "category_code", required = true) String categoryCode) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<Device> list = deviceService.findDeviceByCategory(categoryCode);
 | 
	
		
			
				|  |  |             return write(200, "获取设备列表成功!", "data", list);
 | 
	
		
			
				|  |  |         } catch (Exception ex) {
 | 
	
		
			
				|  |  |             error(ex);
 | 
	
		
			
				|  |  |             return invalidUserException(ex, -1, "获取设备列表失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	@ApiOperation("获取设备信息")
 | 
	
		
			
				|  |  | 	@RequestMapping(value = "DeviceInfo",method = RequestMethod.POST)
 | 
	
		
			
				|  |  | 	@ResponseBody
 | 
	
		
			
				|  |  | 	public String getDeviceInfo(@ApiParam(name="id",value="设备ID",defaultValue = "19")
 | 
	
		
			
				|  |  | 									   @RequestParam(value="id",required = true) String id) {
 | 
	
		
			
				|  |  | 		try {
 | 
	
		
			
				|  |  | 			Device device = deviceService.findById(id);
 | 
	
		
			
				|  |  |     @ApiOperation("获取设备信息")
 | 
	
		
			
				|  |  |     @RequestMapping(value = "DeviceInfo", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public String getDeviceInfo(@ApiParam(name = "id", value = "设备ID", defaultValue = "19")
 | 
	
		
			
				|  |  |                                 @RequestParam(value = "id", required = true) String id) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Device device = deviceService.findById(id);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			return write(200, "查询成功", "data", device);
 | 
	
		
			
				|  |  | 		} catch (Exception ex) {
 | 
	
		
			
				|  |  | 			return invalidUserException(ex, -1, ex.getMessage());
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  |             return write(200, "查询成功", "data", device);
 | 
	
		
			
				|  |  |         } catch (Exception ex) {
 | 
	
		
			
				|  |  |             return invalidUserException(ex, -1, ex.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |