| 
					
				 | 
			
			
				@ -0,0 +1,84 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.iot.controller.device; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.iot.service.device.IotDeviceTransfersService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.iot.device.IotDeviceTransfersDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.device.IotDeviceVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.iot.IotRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * @author humingfen on 2020.4.29 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RequestMapping(IotRequestMapping.Common.device) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Api(tags = "设备调拨管理相关操作", description = "设备调拨管理相关操作") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class IotDeviceTransfersController extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private IotDeviceTransfersService deviceTransfersService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = IotRequestMapping.Device.getDeviceTransfersList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "获取设备调拨申请列表", notes = "获取设备调拨申请列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotDeviceTransfersDO, IotDeviceTransfersDO> getDeviceTransfersList(@ApiParam(name = "name", value = "设备名称") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @RequestParam(value = "name", required = false) String name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @ApiParam(name = "categoryCode", value = "设备类型标识") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @RequestParam(value = "categoryCode", required = false) String categoryCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @ApiParam(name = "page", value = "第几页", defaultValue = "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @RequestParam(value = "page", required = false) Integer page, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @ApiParam(name = "pageSize", value = "每页记录数") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                         @RequestParam(value = "pageSize", required = false) Integer pageSize) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return deviceTransfersService.getDeviceTransfersList(name, categoryCode, page, pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = IotRequestMapping.Device.createDeviceTransfers) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "新增编辑设备调拨申请记录", notes = "新增编辑设备调拨申请记录") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotDeviceTransfersDO, IotDeviceTransfersDO> createDeviceTransfers(@ApiParam(name = "jsonData", value = "设备调拨申请json", defaultValue = "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                        @RequestParam(value = "jsonData", required = true) String jsonData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            IotDeviceTransfersDO deviceTransfersDO = deviceTransfersService.createDeviceTransfers(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update, deviceTransfersDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = IotRequestMapping.Device.deleteDeviceTransfers) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "删除设备调拨申请记录", notes = "删除编辑设备调拨申请记录") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotDeviceTransfersDO, IotDeviceTransfersDO> deleteDeviceTransfers(@ApiParam(name = "id", value = "设备调拨申请记录id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                        @RequestParam(value = "id", required = true) String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deviceTransfersService.deleteDeviceTransfers(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = IotRequestMapping.Device.updateTransfersStatusById) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "根据id更新设备调拨申请记录状态", notes = "根据id更新设备调拨申请记录状态") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotDeviceTransfersDO, IotDeviceTransfersDO> updateTransfersStatusById(@ApiParam(name = "id", value = "设备调拨申请记录id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                            @RequestParam(value = "id", required = true) String id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                            @ApiParam(name = "status", value = "设备调拨状态(-1已拒绝 0待调拨 1已调拨)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                            @RequestParam(value = "status", required = true) Integer status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            IotDeviceTransfersDO deviceTransfersDO = deviceTransfersService.updateTransfersStatusById(id, status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update, deviceTransfersDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return MixEnvelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |