| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_DATA.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<LightReportDataBo> list = lightReportDataService.listReportData(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword, deviceCode); |
| | | return ResponseUtil.success(list); |
| | | CommonPage commonPage = lightReportDataService.listReportData(conditionVO.getPageNo(), conditionVO.getPageSize(), keyword, deviceCode); |
| | | List<LightReportDataBo> lightReportDataBos = ( List<LightReportDataBo>)commonPage.getList(); |
| | | |
| | | CommonPage commonPage1 = CommonPage.restPage(lightReportDataBos); |
| | | commonPage1.setTotal(commonPage.getTotal()); |
| | | commonPage1.setTotalPage(commonPage.getTotalPage()); |
| | | |
| | | return ResponseUtil.success(commonPage1); |
| | | } |
| | | |
| | | /** |
| | |
| | | public ResponseVO<Object> controlEnergySaving() { |
| | | return ResponseUtil.success(lightService.controlEnergySaving()); |
| | | } |
| | | |
| | | /** |
| | | * 获取设备码 |
| | | */ |
| | | @GetMapping("/deviceCode") |
| | | public ResponseVO<Object> getDeviceCode(BaseConditionVO baseConditionVO) { |
| | | return ResponseUtil.success(lightService.listDeviceCode(baseConditionVO.getPageNo() , baseConditionVO.getPageSize())); |
| | | } |
| | | |
| | | /** |
| | | * 设置功率 |
| | | */ |
| | | @PostMapping("/setPower/{power1}/{power2}") |
| | | public ResponseVO<Object> setPower(@RequestBody List<Long> ids, @PathVariable Integer power1,@PathVariable Integer power2) { |
| | | if(ids.isEmpty()||power1==null||power2==null){ |
| | | return ResponseUtil.fail("id为空或者功率为空"); |
| | | } |
| | | boolean resule= lightService.setPower(ids,power1,power2); |
| | | return ResponseUtil.success(resule); |
| | | } |
| | | } |