|
|
|
@ -47,8 +47,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/device")
|
|
|
|
|
public class HwDeviceController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
public class HwDeviceController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IHwDeviceService hwDeviceService;
|
|
|
|
|
|
|
|
|
@ -66,24 +65,20 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("business:device:list")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public TableDataInfo list(HwDevice hwDevice)
|
|
|
|
|
{
|
|
|
|
|
public TableDataInfo list(HwDevice hwDevice) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<HwDevice> list = hwDeviceService.selectHwDeviceJoinList(hwDevice);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出设备信息列表
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("business:device:export")
|
|
|
|
|
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, HwDevice hwDevice)
|
|
|
|
|
{
|
|
|
|
|
public void export(HttpServletResponse response, HwDevice hwDevice) {
|
|
|
|
|
List<HwDevice> list = hwDeviceService.selectHwDeviceJoinList(hwDevice);
|
|
|
|
|
ExcelUtil<HwDevice> util = new ExcelUtil<HwDevice>(HwDevice.class);
|
|
|
|
|
util.exportExcel(response, list, "设备信息数据");
|
|
|
|
@ -94,8 +89,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("business:device:query")
|
|
|
|
|
@GetMapping(value = "/{deviceId}")
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
|
|
|
|
return success(hwDeviceService.selectHwDeviceByDeviceId(deviceId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -105,8 +99,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
@RequiresPermissions("business:device:add")
|
|
|
|
|
@Log(title = "设备信息", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping
|
|
|
|
|
public AjaxResult add(@RequestBody HwDevice hwDevice)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult add(@RequestBody HwDevice hwDevice) {
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
SysUser user = loginUser.getSysUser();
|
|
|
|
|
hwDevice.setTenantId(user.getTenantId());
|
|
|
|
@ -120,8 +113,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
@RequiresPermissions("business:device:edit")
|
|
|
|
|
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult edit(@RequestBody HwDevice hwDevice)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult edit(@RequestBody HwDevice hwDevice) {
|
|
|
|
|
hwDevice.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
return toAjax(hwDeviceService.updateHwDevice(hwDevice));
|
|
|
|
|
}
|
|
|
|
@ -131,24 +123,26 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("business:device:remove")
|
|
|
|
|
@Log(title = "设备信息", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/{deviceIds}")
|
|
|
|
|
public AjaxResult remove(@PathVariable Long[] deviceIds)
|
|
|
|
|
{
|
|
|
|
|
return toAjax(hwDeviceService.deleteHwDeviceByDeviceIds(deviceIds));
|
|
|
|
|
}
|
|
|
|
|
@DeleteMapping("/{deviceId}/{deviceType}")
|
|
|
|
|
public AjaxResult remove(@PathVariable("deviceId") Long deviceId
|
|
|
|
|
, @PathVariable("deviceType") String deviceType) {
|
|
|
|
|
if (deviceType.equals(HwDictConstants.DEVICE_TYPE_GATEWAY_DEVICE)
|
|
|
|
|
&& hwDeviceService.checkExistSubDevice(deviceId)) {
|
|
|
|
|
return warn("存在子设备,不允许删除");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toAjax(hwDeviceService.deleteHwDeviceByDeviceId(deviceId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("business:device:list")
|
|
|
|
|
@GetMapping("/getScenes")
|
|
|
|
|
public AjaxResult getScenes(HwScene scene)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getScenes(HwScene scene) {
|
|
|
|
|
return success(hwSceneService.selectHwSceneList(scene));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("business:device:list")
|
|
|
|
|
@GetMapping("/getEditedScenes")
|
|
|
|
|
public AjaxResult getEditedScenes(HwScene scene)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getEditedScenes(HwScene scene) {
|
|
|
|
|
return success(hwSceneService.selectHwSceneList4Select(scene));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -157,8 +151,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("business:device:list")
|
|
|
|
|
@GetMapping(value = {"/monitorUnitTree/", "/monitorUnitTree/{sceneId}"})
|
|
|
|
|
public AjaxResult monitorUnitTree(@PathVariable(value = "sceneId", required = false) Long sceneId)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult monitorUnitTree(@PathVariable(value = "sceneId", required = false) Long sceneId) {
|
|
|
|
|
HwMonitorUnit queryMonitorUnit = new HwMonitorUnit();
|
|
|
|
|
queryMonitorUnit.setSceneId(sceneId);
|
|
|
|
|
return success(hwMonitorUnitService.selectMonitorTreeList(queryMonitorUnit));
|
|
|
|
@ -166,8 +159,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("business:device:list")
|
|
|
|
|
@GetMapping(value = {"/getDeviceModes/", "/getDeviceModes/{sceneId}"})
|
|
|
|
|
public AjaxResult getDeviceModes(@PathVariable(value = "sceneId", required = false) Long sceneId)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getDeviceModes(@PathVariable(value = "sceneId", required = false) Long sceneId) {
|
|
|
|
|
HwDeviceMode queryDeviceMode = new HwDeviceMode();
|
|
|
|
|
queryDeviceMode.setSceneId(sceneId);
|
|
|
|
|
return success(hwDeviceModeService.selectHwDeviceModeList(queryDeviceMode));
|
|
|
|
@ -175,8 +167,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("business:device:list")
|
|
|
|
|
@GetMapping(value = {"/getGatewayDevices/", "/getGatewayDevices/{sceneId}"})
|
|
|
|
|
public AjaxResult getGatewayDevices(@PathVariable(value = "sceneId", required = false) Long sceneId)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getGatewayDevices(@PathVariable(value = "sceneId", required = false) Long sceneId) {
|
|
|
|
|
HwDevice queryHwDevice = new HwDevice();
|
|
|
|
|
queryHwDevice.setSceneId(sceneId);
|
|
|
|
|
queryHwDevice.setDeviceType(HwDictConstants.DEVICE_TYPE_GATEWAY_DEVICE);
|
|
|
|
@ -190,8 +181,7 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
@RequiresPermissions("business:device:edit")
|
|
|
|
|
@Log(title = "设备管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping("/changeDeviceStatus")
|
|
|
|
|
public AjaxResult changeDeviceStatus(@RequestBody HwDevice device)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult changeDeviceStatus(@RequestBody HwDevice device) {
|
|
|
|
|
device.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
device.setUpdateTime(new Date());
|
|
|
|
|
return toAjax(hwDeviceService.changeDeviceStatus(device));
|
|
|
|
@ -203,14 +193,13 @@ public class HwDeviceController extends BaseController
|
|
|
|
|
@RequiresPermissions("business:device:edit")
|
|
|
|
|
@Log(title = "下发设备控制指令", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping("/publishControlCommand")
|
|
|
|
|
public AjaxResult publishControlCommand(@RequestBody DeviceControlVo deviceControlVo)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult publishControlCommand(@RequestBody DeviceControlVo deviceControlVo) {
|
|
|
|
|
hwDeviceService.publishControlCommand(deviceControlVo);
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/computeOnlineDevicecCount/{days}")
|
|
|
|
|
public void computeOnlineDevicecCount(@PathVariable("days") int days){
|
|
|
|
|
public void computeOnlineDevicecCount(@PathVariable("days") int days) {
|
|
|
|
|
hwDeviceService.computeOnlineDevicecCount(days);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|